Subversion Repository Public Repository

Pharmacy_09_03_18

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareemr.Views;

import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.vo.TCCodeValues;
import com.bestray.healthcarecommonutil.vo.TEncounterProcedure;
import com.bestray.healthcarecommonutil.vo.TEncounterTreatmentSession;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcareemr.Controller.CodeValuesController;
import com.bestray.healthcareemr.Controller.PatientTreatmentSessionController;
import com.bestray.healthcareemr.Util.CollectionUtil;
import com.bestray.healthcareemr.Util.MessageProperties;
import com.bestray.healthcareemr.reports.TreatmentSessionReport;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;

/**
 *
 * @author User1
 */
public class PatientTreatmentSessionPanel extends SimpleGradientPanel {

    /**
     * Creates new form PatientTreatmentSessionPanel
     */
    public PatientTreatmentSessionPanel() {
        initComponents();
    }

    PatientTreatmentSessionPanel(TPatientEncounter encEncounter) {//passed patient encounter parameter
        this.patientEncounter = encEncounter;
        populate();
        initComponents();
        showencounteredProcedure();//show the procedure list in table
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jSplitPane1 = new javax.swing.JSplitPane();
        jPanel1 = new SimpleGradientPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        procedure_table = new javax.swing.JTable(){

            public boolean isCellEditable(int row, int column){
                return false;
            }
            public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
                if (rowIndex % 2 == 0 && !isCellSelected(rowIndex, vColIndex)) {
                    c.setForeground(Color.BLACK);
                    c.setBackground(new Color(200, 225, 225));
                }
                else if(rowIndex % 2 == 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else if(rowIndex % 2 != 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else {
                    c.setForeground(Color.BLACK);
                    c.setBackground(new Color(200, 225, 225));
                }
                return c;
            }

        };
        jPanel2 = new SimpleGradientPanel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        treatment_session_table = new javax.swing.JTable(){

            public boolean isCellEditable(int row, int column){
                return false;
            }
            public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
                if (rowIndex % 2 == 0 && !isCellSelected(rowIndex, vColIndex)) {
                    c.setForeground(Color.BLACK);
                    c.setBackground(new Color(200, 225, 250));
                }
                else if(rowIndex % 2 == 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else if(rowIndex % 2 != 0 && isCellSelected(rowIndex, vColIndex)){
                    c.setForeground(Color.WHITE);
                    c.setBackground(Color.BLUE);
                }
                else {
                    c.setForeground(Color.BLACK);
                    c.setBackground(getBackground());
                }
                return c;
            }

        };
        jToolBar1 = new javax.swing.JToolBar();
        save_Button = new javax.swing.JButton();
        edit_Button = new javax.swing.JButton();
        reset_Button = new javax.swing.JButton();
        delete_Button = new javax.swing.JButton();
        report_Button = new javax.swing.JButton();
        session_date = new com.toedter.calendar.JDateChooser();
        session_name = new javax.swing.JTextField();
        session_price = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        session_details = new javax.swing.JTextArea();
        payment_no_radio = new javax.swing.JRadioButton();
        payment_yes_radio = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        session_pending_radio = new javax.swing.JRadioButton();
        session_completed_radio = new javax.swing.JRadioButton();
        jLabel7 = new javax.swing.JLabel();
        laser_Panel = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        lasertype_ComboBox = new javax.swing.JComboBox();
        energy_ComboBox = new javax.swing.JComboBox();
        pulse_ComboBox = new javax.swing.JComboBox();
        tipsize_ComboBox = new javax.swing.JComboBox();
        jLabel13 = new javax.swing.JLabel();
        session_area_ComboBox = new javax.swing.JComboBox();

        setLayout(new java.awt.BorderLayout());

        jSplitPane1.setDividerLocation(300);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

        procedure_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        procedure_table.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
        procedure_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Obj", "Treatment"
            }
        ));
        procedure_table.getColumnModel().getColumn(0).setMinWidth(0);
        procedure_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        procedure_table.getColumnModel().getColumn(0).setMaxWidth(0);
        procedure_table.setRowHeight(25);
        procedure_table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        procedure_table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                procedure_tableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(procedure_table);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
                .addContainerGap())
        );

        jSplitPane1.setLeftComponent(jPanel1);

        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel3.setOpaque(false);

        treatment_session_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        treatment_session_table.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
        treatment_session_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Obj", "Date", "Session Name", "Details", "Paid", "Session Area"
            }
        ));
        treatment_session_table.getColumnModel().getColumn(0).setMinWidth(0);
        treatment_session_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        treatment_session_table.getColumnModel().getColumn(0).setMaxWidth(0);
        treatment_session_table.setRowHeight(20);
        treatment_session_table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane2.setViewportView(treatment_session_table);

        jToolBar1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setOpaque(false);

        save_Button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        save_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Save-icon 16X16.png"))); // NOI18N
        save_Button.setText("Save");
        save_Button.setFocusable(false);
        save_Button.setMargin(new java.awt.Insets(2, 16, 2, 16));
        save_Button.setNextFocusableComponent(edit_Button);
        save_Button.setOpaque(false);
        save_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                save_ButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(save_Button);

        edit_Button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        edit_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Edit-icon 16X16.png"))); // NOI18N
        edit_Button.setText("Edit");
        edit_Button.setFocusable(false);
        edit_Button.setMargin(new java.awt.Insets(2, 16, 2, 16));
        edit_Button.setNextFocusableComponent(reset_Button);
        edit_Button.setOpaque(false);
        edit_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edit_ButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(edit_Button);

        reset_Button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        reset_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/refresh 16x16.png"))); // NOI18N
        reset_Button.setText("Reset");
        reset_Button.setFocusable(false);
        reset_Button.setMargin(new java.awt.Insets(2, 16, 2, 16));
        reset_Button.setNextFocusableComponent(delete_Button);
        reset_Button.setOpaque(false);
        reset_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_ButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(reset_Button);

        delete_Button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        delete_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/delete 16x16.png"))); // NOI18N
        delete_Button.setText("Delete");
        delete_Button.setFocusable(false);
        delete_Button.setMargin(new java.awt.Insets(2, 16, 2, 16));
        delete_Button.setNextFocusableComponent(report_Button);
        delete_Button.setOpaque(false);
        delete_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                delete_ButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(delete_Button);

        report_Button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        report_Button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/pdf-icon.png"))); // NOI18N
        report_Button.setText("Report");
        report_Button.setFocusable(false);
        report_Button.setMargin(new java.awt.Insets(2, 16, 2, 16));
        report_Button.setOpaque(false);
        report_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                report_ButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(report_Button);

        session_date.setDate(new Date());
        session_date.setDateFormatString("dd/MM/yyyy");
        session_date.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        session_date.setNextFocusableComponent(session_name);

        session_name.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        session_name.setToolTipText("");
        session_name.setNextFocusableComponent(session_price);

        session_price.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        session_price.setToolTipText("");
        session_price.setNextFocusableComponent(session_details);
        session_price.setVisible(false);

        session_details.setColumns(20);
        session_details.setLineWrap(true);
        session_details.setRows(5);
        session_details.setWrapStyleWord(true);
        jScrollPane3.setViewportView(session_details);

        buttonGroup1.add(payment_no_radio);
        payment_no_radio.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        payment_no_radio.setSelected(true);
        payment_no_radio.setText("No");
        payment_no_radio.setNextFocusableComponent(payment_yes_radio);
        payment_no_radio.setOpaque(false);

        buttonGroup1.add(payment_yes_radio);
        payment_yes_radio.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        payment_yes_radio.setText("Yes");
        payment_yes_radio.setNextFocusableComponent(session_pending_radio);
        payment_yes_radio.setOpaque(false);

        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel1.setText("Date :");

        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel2.setText("Session Name :");

        jLabel3.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel3.setText("Price :");
        jLabel3.setVisible(false);

        jLabel4.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel4.setText("Details :");

        jLabel5.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel5.setText("Paid :");

        jLabel6.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel6.setText("Completed :");

        buttonGroup2.add(session_pending_radio);
        session_pending_radio.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        session_pending_radio.setSelected(true);
        session_pending_radio.setText("Pending");
        session_pending_radio.setNextFocusableComponent(session_completed_radio);
        session_pending_radio.setOpaque(false);

        buttonGroup2.add(session_completed_radio);
        session_completed_radio.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        session_completed_radio.setText("Completed");
        session_completed_radio.setOpaque(false);

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(255, 51, 0));
        jLabel7.setText("*");

        laser_Panel.setVisible(false);
        laser_Panel.setOpaque(false);

        jLabel8.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel8.setText("Energy :");
        jLabel3.setVisible(false);

        jLabel9.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel9.setText("Pulse:");
        jLabel3.setVisible(false);

        jLabel11.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel11.setText("Laser Type :");
        jLabel3.setVisible(false);

        jLabel12.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel12.setText("Tip Size :");
        jLabel3.setVisible(false);

        lasertype_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(laserName));
        lasertype_ComboBox.setSelectedIndex(-1);

        energy_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(energy));
        lasertype_ComboBox.setSelectedIndex(-1);

        pulse_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(pulse));
        lasertype_ComboBox.setSelectedIndex(-1);

        tipsize_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(tipsize));
        lasertype_ComboBox.setSelectedIndex(-1);

        javax.swing.GroupLayout laser_PanelLayout = new javax.swing.GroupLayout(laser_Panel);
        laser_Panel.setLayout(laser_PanelLayout);
        laser_PanelLayout.setHorizontalGroup(
            laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(laser_PanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lasertype_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(energy_ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pulse_ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tipsize_ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        laser_PanelLayout.setVerticalGroup(
            laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(laser_PanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lasertype_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(energy_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pulse_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(laser_PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tipsize_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        laser_PanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel11, jLabel12, jLabel8, jLabel9});

        jLabel13.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        jLabel13.setText("Session Area :");
        jLabel3.setVisible(false);

        session_area_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(area));
        lasertype_ComboBox.setSelectedIndex(-1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel7)
                .addGap(0, 0, 0)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(session_pending_radio)
                            .addComponent(payment_no_radio))
                        .addGap(2, 2, 2)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(payment_yes_radio)
                            .addComponent(session_completed_radio)))
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(session_date, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                        .addComponent(session_price)
                        .addComponent(session_name, javax.swing.GroupLayout.Alignment.LEADING))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(session_area_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(laser_Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6});

        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(session_date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(session_name, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7))
                        .addGap(7, 7, 7)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(session_price, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(session_area_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(7, 7, 7)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(payment_no_radio)
                            .addComponent(payment_yes_radio)
                            .addComponent(jLabel5))
                        .addGap(7, 7, 7)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(session_pending_radio)
                            .addComponent(session_completed_radio)))
                    .addComponent(laser_Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {session_name, session_price});

        jPanel2.add(jPanel3, java.awt.BorderLayout.CENTER);

        jSplitPane1.setRightComponent(jPanel2);

        add(jSplitPane1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void save_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_ButtonActionPerformed
        if (validateTreatementSession()) {
            encounterTreatmentSession.setEncounterProcedure(encProcedure);
            encounterTreatmentSession.setSessionDate(session_date.getDate());
            encounterTreatmentSession.setSessionName(session_name.getText());
            encounterTreatmentSession.setSessionDetails(session_details.getText());
            if (encounterTreatmentSession.getId()!=null && encounterTreatmentSession.getId()>0) {
                encounterTreatmentSession.setSessionPrice(encounterTreatmentSession.getSessionPrice());
            } else {
                //encProcedure.getOrderSpecimenCollectionStatus() is used as number of sessions per treatement
                encounterTreatmentSession.setSessionPrice(encProcedure.getProcedure().getProcedurePrice()/Double.parseDouble(encProcedure.getOrderSpecimenCollectionStatus()));
            }
            if (payment_no_radio.isSelected()) {
                encounterTreatmentSession.setSessionPaymentStatus("NO");
            } else {
                encounterTreatmentSession.setSessionPaymentStatus("YES");
            }
            if (session_pending_radio.isSelected()) {
                encounterTreatmentSession.setSessionCompletionStatus("NO");
            } else {
                encounterTreatmentSession.setSessionCompletionStatus("YES");
            }
             if(session_area_ComboBox.getSelectedItem()!=null){
                   encounterTreatmentSession.setSessionArea(session_area_ComboBox.getSelectedItem().toString()); 
                }
            if (encProcedure.getProcedure().getProcedureCatagory().equalsIgnoreCase("LASER")) {
                 if(lasertype_ComboBox.getSelectedItem()!=null){
                   encounterTreatmentSession.setLaserType(lasertype_ComboBox.getSelectedItem().toString()); 
                }
                if(energy_ComboBox.getSelectedItem()!=null){
                   encounterTreatmentSession.setEnergy(energy_ComboBox.getSelectedItem().toString()); 
                }
                if(pulse_ComboBox.getSelectedItem()!=null){
                   encounterTreatmentSession.setPulse(pulse_ComboBox.getSelectedItem().toString()); 
                }
                if(tipsize_ComboBox.getSelectedItem()!=null){
                   encounterTreatmentSession.setTipSize(tipsize_ComboBox.getSelectedItem().toString()); 
                }
                
            } else {
                encounterTreatmentSession.setLaserType("");
                encounterTreatmentSession.setEnergy("");
                encounterTreatmentSession.setPulse("");
                encounterTreatmentSession.setTipSize("");
            }          
            
            try {
                patientTreatmentSessionController.saveTreatmentSession(encounterTreatmentSession);
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("success.save",new Object[]{"Treatment session"}));
                clearField();
                clearTable();
                showAvailableSessionDetails();
            }catch(HibernateOptimisticLockingFailureException e){
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.update",new Object[]{"Treatment session"}));
              }catch(ProcessingException e){
                    JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Treatment session"}));
                    throw new HealthCareException(MessageProperties.getMessage("error.dao"));
               }catch(Exception e){
                    JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Treatment session"}));
               }
            
        }
    }//GEN-LAST:event_save_ButtonActionPerformed

    private void edit_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edit_ButtonActionPerformed
        int row = treatment_session_table.getSelectedRow();
        if (!(row<0)) {
            encounterTreatmentSession = (TEncounterTreatmentSession)treatment_session_table.getValueAt(row, 0);
            displayRowValue(encounterTreatmentSession);
        }else{
            JOptionPane.showMessageDialog(null, "Selete a record to update");
        }
    }//GEN-LAST:event_edit_ButtonActionPerformed

    private void reset_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_ButtonActionPerformed
        clearField();
    }//GEN-LAST:event_reset_ButtonActionPerformed

    private void procedure_tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_procedure_tableMouseClicked
        int row = procedure_table.getSelectedRow();
        encProcedure = (TEncounterProcedure)procedure_table.getValueAt(row, 0);
        clearField();
        clearTable();
        showAvailableSessionDetails();
        if(encProcedure.getProcedure().getProcedureCatagory().equalsIgnoreCase("LASER")){
           laser_Panel.setVisible(true);
        }else if(encProcedure.getProcedure().getProcedureCatagory().equalsIgnoreCase("NON LASER")){
           laser_Panel.setVisible(false);
        }
    }//GEN-LAST:event_procedure_tableMouseClicked

    private void delete_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delete_ButtonActionPerformed
        int row = treatment_session_table.getSelectedRow();
        if (!(row<0)) {
            TEncounterTreatmentSession encounterTreatmentSession = (TEncounterTreatmentSession)treatment_session_table.getValueAt(row, 0);
            try {
                patientTreatmentSessionController.deleteTreatmentSession(encounterTreatmentSession);
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("success.delete",new Object[]{"Treatment session"}));
                clearField();
                clearTable();
                showAvailableSessionDetails();
            }catch(IllegalArgumentException e){
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.aleardydeleted",new Object[]{"Treatment session"}));
            }catch(ProcessingException e){
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.delete",new Object[]{"Treatment session"}));
                throw new HealthCareException(MessageProperties.getMessage("error.dao"));
            }catch(Exception e){
                JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.delete",new Object[]{"Treatment session"}));
            }
        }else{
            JOptionPane.showMessageDialog(null, "Selete a record to Delete");
        }
    }//GEN-LAST:event_delete_ButtonActionPerformed

    private void report_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_report_ButtonActionPerformed
        int row = procedure_table.getSelectedRow();
         if (!(row<0)) {
        encProcedure = (TEncounterProcedure)procedure_table.getValueAt(row, 0);
        treatmentSessionReport = new TreatmentSessionReport();
        String patientName = patientEncounter.getPatient().getPatientFName();
        Long procedureId = encProcedure.getProcedure().getId();
                try {
                    treatmentSessionReport.getPdfReport(patientEncounter.getEncId(),patientName,procedureId);
                } catch (Exception ex) {
                    Logger.getLogger(PatientTreatmentSessionPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
                treatmentSessionReport.openPdfReport();
         }else{
            JOptionPane.showMessageDialog(null, "Selete a treatment");
        }
    }//GEN-LAST:event_report_ButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton delete_Button;
    private javax.swing.JButton edit_Button;
    private javax.swing.JComboBox energy_ComboBox;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JPanel laser_Panel;
    private javax.swing.JComboBox lasertype_ComboBox;
    private javax.swing.JRadioButton payment_no_radio;
    private javax.swing.JRadioButton payment_yes_radio;
    private javax.swing.JTable procedure_table;
    private javax.swing.JComboBox pulse_ComboBox;
    private javax.swing.JButton report_Button;
    private javax.swing.JButton reset_Button;
    private javax.swing.JButton save_Button;
    private javax.swing.JComboBox session_area_ComboBox;
    private javax.swing.JRadioButton session_completed_radio;
    private com.toedter.calendar.JDateChooser session_date;
    private javax.swing.JTextArea session_details;
    private javax.swing.JTextField session_name;
    private javax.swing.JRadioButton session_pending_radio;
    private javax.swing.JTextField session_price;
    private javax.swing.JComboBox tipsize_ComboBox;
    private javax.swing.JTable treatment_session_table;
    // End of variables declaration//GEN-END:variables
    private Vector<Object> addObject;
    private DefaultTableModel model;
    private TPatientEncounter patientEncounter;
    private PatientTreatmentSessionController patientTreatmentSessionController;
    private List<TEncounterProcedure> encprocedureList = new ArrayList<TEncounterProcedure>();
    private TEncounterTreatmentSession encounterTreatmentSession ;
    private TEncounterProcedure encProcedure;
    private TreatmentSessionReport treatmentSessionReport;
     /** The code values controller. */
    private CodeValuesController codeValuesController;
     /** The laser name list. */
    private Vector<TCCodeValues> laserName = new Vector<TCCodeValues>();
    private Vector<TCCodeValues> energy = new Vector<TCCodeValues>();
    private Vector<TCCodeValues> pulse = new Vector<TCCodeValues>();
    private Vector<TCCodeValues> tipsize = new Vector<TCCodeValues>();
    private Vector<TCCodeValues> area = new Vector<TCCodeValues>();
    
    private void populate() {
        patientTreatmentSessionController = (PatientTreatmentSessionController)HealthcareLogin.context.getBean("patientTreatmentSessionController");
        codeValuesController=(CodeValuesController)HealthcareLogin.context.getBean("codeValuesController");
        try{
           encprocedureList = patientTreatmentSessionController.getEncounterLabsProcedure(patientEncounter);
           laserName=codeValuesController.getCodeValues("LASER NAME");
           area=codeValuesController.getCodeValues("AREA");
           energy=codeValuesController.getCodeValues("ENERGY");
           pulse=codeValuesController.getCodeValues("PULSE");
           tipsize=codeValuesController.getCodeValues("TIP SIZE");
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Visit details"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
      
    }

    private void showencounteredProcedure() {
        model = (DefaultTableModel) procedure_table.getModel();
        for(TEncounterProcedure enc:encprocedureList){
            addObject = new Vector<Object>();
            addObject.add(enc);
            addObject.add(enc.getProcedure().getProcedureName());
            model.addRow(addObject);
        }
    }

    private void clearTable() {
        treatment_session_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {
                "Obj", "Date", "Session Name","Session Area","Treatment Type","Details"}));
        treatment_session_table.getColumnModel().getColumn(0).setMinWidth(0);
        treatment_session_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        treatment_session_table.getColumnModel().getColumn(0).setMaxWidth(0);
        
    }
    
    private void showAvailableSessionDetails() {
        List<TEncounterTreatmentSession> sessionList = new ArrayList<TEncounterTreatmentSession>();
        try{
           sessionList = patientTreatmentSessionController.getTreatmentSessionsByTreatment(encProcedure);
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Treatment Sessions"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
        model = (DefaultTableModel) treatment_session_table.getModel();
        for(TEncounterTreatmentSession enc:sessionList){
            addObject = new Vector<Object>();
            addObject.add(enc);
            addObject.add(enc.getSessionDate());
            addObject.add(enc.getSessionName());
            addObject.add(enc.getSessionArea());
            addObject.add(enc.getEncounterProcedure().getProcedure().getProcedureCatagory());
            addObject.add(enc.getSessionDetails());
            model.addRow(addObject);
        }
    }

    private void clearField() {
        encounterTreatmentSession = new TEncounterTreatmentSession();
        session_date.setDate(new Date());
        session_name.setText("");
        session_price.setText("");
        session_details.setText("");
        payment_yes_radio.setSelected(false);
        payment_no_radio.setSelected(true);
        session_area_ComboBox.setSelectedIndex(-1);
        lasertype_ComboBox.setSelectedIndex(-1);
        energy_ComboBox.setSelectedIndex(-1);
        pulse_ComboBox.setSelectedIndex(-1);
        tipsize_ComboBox.setSelectedIndex(-1);      
    }    

    private boolean validateTreatementSession() {
        boolean valid = true;
        List<TEncounterTreatmentSession> sessionList = new ArrayList<TEncounterTreatmentSession>();
        try{
           sessionList = patientTreatmentSessionController.getTreatmentSessionsByTreatment(encProcedure);
        }catch(ProcessingException e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Treatment Sessions"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
        if ((Integer.parseInt(encProcedure.getOrderSpecimenCollectionStatus())==0)&&encounterTreatmentSession.getId()==null) {
            JOptionPane.showMessageDialog(null, "User Cannot create sessions for this treatment as number of treatment is 0.");
            valid = false;
        }else if (sessionList.size()>=Integer.parseInt(encProcedure.getOrderSpecimenCollectionStatus())&&encounterTreatmentSession.getId()==null) {
            JOptionPane.showMessageDialog(null, "User Cannot create more than "+encProcedure.getOrderSpecimenCollectionStatus()+" "+"session for this treatment.");
            session_name.requestFocus();
            valid = false;
        }else if (this.session_name.getText().trim().length() == 0) {
            JOptionPane.showMessageDialog(null, "Enter Session name.");
            session_name.requestFocus();
            valid = false;
        }
//        else if (this.session_price.getText().trim().length() == 0) {
//            JOptionPane.showMessageDialog(null, "Enter Session price.");
//            session_price.requestFocus();
//            session_price.selectAll();
//            valid = false;
//        } 
//        else if(!(session_price.getText().matches("^\\d*[\\.]?\\d*$"))){
//             JOptionPane.showMessageDialog(null, "Price should be Numerical", "Error", JOptionPane.ERROR_MESSAGE);
//             session_price.requestFocus();
//             session_price.selectAll();
//             valid = false;
//        } 
        return valid;
    }

    private void displayRowValue(TEncounterTreatmentSession encounterTreatmentSession) {
        session_date.setDate(encounterTreatmentSession.getSessionDate());
        session_name.setText(encounterTreatmentSession.getSessionName());
        session_details.setText(encounterTreatmentSession.getSessionDetails());
        session_price.setText(String.valueOf(encounterTreatmentSession.getSessionPrice()));
        if (encounterTreatmentSession.getSessionPaymentStatus().equalsIgnoreCase("YES")) {
            payment_yes_radio.setSelected(true);
        } else {
            payment_no_radio.setSelected(true);
        }
        if (encounterTreatmentSession.getSessionCompletionStatus().equalsIgnoreCase("YES")) {
            session_completed_radio.setSelected(true);
        } else {
            session_pending_radio.setSelected(true);
        }
        
        session_area_ComboBox.setSelectedIndex(CollectionUtil.getCodeValueIndex(area,encounterTreatmentSession.getSessionArea()));
        lasertype_ComboBox.setSelectedIndex(CollectionUtil.getCodeValueIndex(laserName,encounterTreatmentSession.getLaserType()));
        energy_ComboBox.setSelectedIndex(CollectionUtil.getCodeValueIndex(energy,encounterTreatmentSession.getEnergy()));
        pulse_ComboBox.setSelectedIndex(CollectionUtil.getCodeValueIndex(pulse,encounterTreatmentSession.getPulse()));
        tipsize_ComboBox.setSelectedIndex(CollectionUtil.getCodeValueIndex(tipsize,encounterTreatmentSession.getTipSize()));
       
    }
    
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaEMR/src/main/java/com/bestray/healthcareemr/Views/PatientTreatmentSessionPanel.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 27 Jul, 2018 07:30:57 +0000