Subversion Repository Public Repository

Satyam

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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.healthcareinpatient.view;

import com.bestray.healthcarecommonutil.util.ButtonType;
import com.bestray.healthcarecommonutil.util.Initcap;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.util.StandardButton;
import com.bestray.healthcarecommonutil.util.Theme;
import com.bestray.healthcarecommonutil.vo.TCCodeValues;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcarecommonutil.vo.TInpatientCharges;
import com.bestray.healthcareinpatient.controller.InPatientChargeController;
import com.bestray.healthcareinpatient.controller.InPatientCodeValuesController;
import com.bestray.healthcareinpatient.reports.IPBillingDetail;
import com.bestray.healthcareinpatient.reports.IPBillingSummary;
import com.toedter.calendar.JDateChooserCellEditor;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.SimpleDateFormat;
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.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

/**
 *
 * @author user3
 */
public class InpatientChargesDialog extends javax.swing.JDialog {

    /**
     * Creates new form InpatientChargesDialog
     */
    public InpatientChargesDialog(java.awt.Frame parent, boolean modal,TInpatentAdmission inPatAdmission) {
        super(parent, modal);
        this.inpatientinfo = inPatAdmission;
        populate();
        initComponents();
        combobox.setModel(new javax.swing.DefaultComboBoxModel(inpatientchargevalues));
        showInformation(inpatientinfo);
        showChargesTable();
        totalcharges();
        jLabel7.setVisible(false);
        jLabel12.setVisible(false);
    }

    /**
     * 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() {

        jPanel1 = new SimpleGradientPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        chargestable = new javax.swing.JTable(){
            public boolean isCellEditable(int row,int column){
                if(getValueAt(row, 0)!=null){
                    return false;
                }
                else{
                    return true;
                }
            }

        };
        save_button = new StandardButton("Save", Theme.STANDARD_NAVYBLUE_THEME,ButtonType.BUTTON_RECTANGULAR);
        addrowbutton = new StandardButton("Add Row", Theme.STANDARD_NAVYBLUE_THEME,ButtonType.BUTTON_RECTANGULAR);
        jLabel5 = new javax.swing.JLabel();
        departmentlabel = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        total = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        paidamount = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        generatePDF = new StandardButton("Detail", Theme.STANDARD_NAVYBLUE_THEME,ButtonType.BUTTON_RECTANGULAR);
        jButton1 = new StandardButton("Summary", Theme.STANDARD_NAVYBLUE_THEME,ButtonType.BUTTON_RECTANGULAR);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Patient Charge Details");

        jLabel2.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel2.setText("MRN #");

        jLabel3.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel3.setText("In-Patient Id #");

        jLabel4.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel4.setText("Patient Name :");

        jLabel8.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 0, 0));
        jLabel8.setText("jLabel8");

        jLabel9.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel9.setForeground(new java.awt.Color(0, 0, 204));
        jLabel9.setText("jLabel9");

        jLabel10.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        jLabel10.setForeground(new java.awt.Color(0, 0, 204));
        jLabel10.setText("jLabel10");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel11.setForeground(new java.awt.Color(67, 45, 247));
        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Patients-icon 24X24.png"))); // NOI18N
        jLabel11.setText("Patient Details");

        chargestable.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        chargestable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "Id", "Date", "Charge Type", "Task Name", "Amount", "Servicing Provider", "Notes"
            }
        ));
        chargestable.setColumnSelectionAllowed(true);
        chargestable.setRowHeight(21);
        chargestable.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(chargestable);
        chargestable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        save_button.setText("Save");
        save_button.setOpaque(false);
        save_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                save_buttonActionPerformed(evt);
            }
        });

        addrowbutton.setText("Add Row");
        addrowbutton.setOpaque(false);
        addrowbutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addrowbuttonActionPerformed(evt);
            }
        });

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

        departmentlabel.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        departmentlabel.setForeground(new java.awt.Color(0, 0, 204));
        departmentlabel.setText("jLabel6");

        jLabel6.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel6.setText("Total Amount :");

        total.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        total.setText("jLabel1");

        jLabel1.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel1.setText("Paid Amount :");

        paidamount.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                paidamountKeyTyped(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel7.setText("Adjustment Amount :");

        jLabel12.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        jLabel12.setText("jLabel12");

        generatePDF.setText("Detail");
        generatePDF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generatePDFActionPerformed(evt);
            }
        });

        jButton1.setText("Summary");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        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()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(total)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(paidamount, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel12)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(generatePDF)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(addrowbutton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(save_button))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel3)
                                .addGap(6, 6, 6)
                                .addComponent(jLabel9)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel5)
                                .addGap(6, 6, 6)
                                .addComponent(departmentlabel))
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel8)
                    .addComponent(jLabel3)
                    .addComponent(jLabel9)
                    .addComponent(jLabel4)
                    .addComponent(jLabel10)
                    .addComponent(jLabel5)
                    .addComponent(departmentlabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(save_button)
                    .addComponent(addrowbutton)
                    .addComponent(jLabel6)
                    .addComponent(total)
                    .addComponent(jLabel1)
                    .addComponent(paidamount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel12)
                    .addComponent(generatePDF)
                    .addComponent(jButton1))
                .addContainerGap())
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addrowbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addrowbuttonActionPerformed
        addObject = new Vector<Object>();
        model = (DefaultTableModel) chargestable.getModel();
        model.addRow(addObject);
    }//GEN-LAST:event_addrowbuttonActionPerformed

    private void save_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_buttonActionPerformed
        chargestable.clearSelection();
        if(chargestable.getCellEditor()!=null){
            chargestable.getCellEditor().stopCellEditing(); 
        }
        for(int i=0;i<chargestable.getModel().getRowCount();i++){
            if(chargestable.getValueAt(i, 0)!=null){
            }else{
                try {
                    charge = new TInpatientCharges();
                    String itemname=null;
                    String chargetype=null;
                    Date d=null;
                    String service=null;
                    Double amount = 0D;
                    String notes=null;
                   /** charge.setInpatientAdmission(inpatientinfo);
                    * this file not in Use
                    */
                    if(chargestable.getValueAt(i, 1)!=null){
                        d = (Date)chargestable.getValueAt(i, 1);
                    }
                    if(chargestable.getValueAt(i, 2)!=null){
                        chargetype = chargestable.getValueAt(i, 2).toString();
                    }
                    if(chargestable.getValueAt(i, 3)!=null){
                        itemname = chargestable.getValueAt(i, 3).toString();
                    }
                    if(chargestable.getValueAt(i, 4)!=null){
                        amount = Double.valueOf(chargestable.getValueAt(i, 4).toString());
                    }
                    if(chargestable.getValueAt(i, 5)!=null){
                        service = chargestable.getValueAt(i, 5).toString();
                    }
                    if(chargestable.getValueAt(i, 6)!=null){
                        notes = chargestable.getValueAt(i, 6).toString();
                    }
                    if(itemname==null&&amount<=0D&&notes==null&&service==null){
                    }else{
                        charge.setItemDate(d);
                        charge.setChargeType(chargetype);
                        charge.setItemChargeFor(itemname);
                        charge.setAmountCharge(amount);
                        charge.setServiceProvider(service);
                        charge.setNotes(notes);
                        inPatientChargeController.saveCharge(charge);
                    }
                } catch (Exception ex) {
                    Logger.getLogger(InpatientChargesDialog.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        //showChargesTable();
        dispose();
    }//GEN-LAST:event_save_buttonActionPerformed

    private void paidamountKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_paidamountKeyTyped
        ea=evt;
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                if((ea.getKeyChar() >= '0' && ea.getKeyChar() <= '9') || ea.getKeyChar()=='.'|| ea.getKeyChar()=='\b'){
                    if(paidamount.getText().length()>0){
                        Double pamt = Double.parseDouble(paidamount.getText());
                        Double tamt = Double.parseDouble(total.getText());
                        Double adj = tamt-pamt;
                        jLabel12.setText(adj.toString());
                        jLabel7.setVisible(true);
                        jLabel12.setVisible(true);
                    }else{
                        jLabel7.setVisible(false);
                        jLabel12.setVisible(false);
                    }
                }else{
                    JOptionPane.showMessageDialog(null,"String type entry not allowed");
                    paidamount.setText("");
                    jLabel7.setVisible(false);
                    jLabel12.setVisible(false);
                }
            }
            
        });
    }//GEN-LAST:event_paidamountKeyTyped

    private void generatePDFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generatePDFActionPerformed
        
      
        int id = Integer.parseInt(inpatientinfo.getId().toString());
       String patientName = inpatientinfo.getPatientId().getPatientFName()+" "+inpatientinfo.getPatientId().getPatientMName()+" "+inpatientinfo.getPatientId().getPatientLName();
         try{
              IPBillingDetail inpatientCharges=new IPBillingDetail();
              
              //inpatientCharges.getPdfReport(id,patientName);
              int reply = JOptionPane.showConfirmDialog(null, "Do you want to open this file ?", "In Patient Charges Report", JOptionPane.YES_NO_OPTION);
              if (reply == JOptionPane.YES_OPTION)
               {
                   inpatientCharges.openPdfReport();
               }
            }//try
             catch(Exception e){

            String error=e.getMessage();
            JOptionPane.showMessageDialog(null, error+"\n So, Document can't be generated");
            }
   
    }//GEN-LAST:event_generatePDFActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        
        int id = Integer.parseInt(inpatientinfo.getId().toString());
        String patientName = inpatientinfo.getPatientId().getPatientFName()+" "+inpatientinfo.getPatientId().getPatientMName()+" "+inpatientinfo.getPatientId().getPatientLName();
         try{
              IPBillingSummary inpatientChargeSummary=new IPBillingSummary();
              
              //inpatientChargeSummary.getPdfReport(id,patientName);
              int reply = JOptionPane.showConfirmDialog(null, "Do you want to open this file ?", "In Patient Charges Summary Report", JOptionPane.YES_NO_OPTION);
              if (reply == JOptionPane.YES_OPTION)
               {
                   inpatientChargeSummary.openPdfReport();
               }
            }//try
             catch(Exception e){

            String error=e.getMessage();
            JOptionPane.showMessageDialog(null, error+"\n So, Document can't be generated");
            }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     
    public static void main(String args[]) {
        /* Set the Nimbus look and feel 
       //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(InpatientChargesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(InpatientChargesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(InpatientChargesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(InpatientChargesDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog 
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                InpatientChargesDialog dialog = new InpatientChargesDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }*/
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addrowbutton;
    private javax.swing.JTable chargestable;
    private javax.swing.JLabel departmentlabel;
    private javax.swing.JButton generatePDF;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    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.JScrollPane jScrollPane1;
    private javax.swing.JTextField paidamount;
    private javax.swing.JButton save_button;
    private javax.swing.JLabel total;
    // End of variables declaration//GEN-END:variables
    
    private TInpatientCharges charge;

    private TInpatentAdmission inpatientinfo;
    
    private InPatientChargeController inPatientChargeController;
    
    private List<TInpatientCharges> chargesList;
    
    private DefaultTableModel model;
    
    private Vector<Object> addObject;
    
    private KeyEvent ea;
    
    private JTextField textbox = new JTextField();
    
    private JComboBox combobox = new JComboBox();
    
    private SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    
    private Double totalcharge = 0D;
    
    private Vector<TCCodeValues> inpatientchargevalues;
    
    private InPatientCodeValuesController inPatientCodeValuesController;
    
    //private TextAreaRenderer r;
    
    private void reset(){
        charge = new TInpatientCharges();
    }
    
    private void populate(){
        try{
            charge = new TInpatientCharges();
            inPatientChargeController = (InPatientChargeController)HealthCareInpatientHome.context.getBean("inPatientChargeController");
            inPatientCodeValuesController = (InPatientCodeValuesController)HealthCareInpatientHome.context.getBean("inPatientCodeValuesController");
            inpatientchargevalues = inPatientCodeValuesController.getCodeValues("INPATIENT CHARGE");
        }catch(Exception ex){
            Logger.getLogger(InpatientChargesDialog.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    private void showInformation(TInpatentAdmission inPatAdmission) {
        jLabel8.setText(inPatAdmission.getPatientId().getPatientId());
        jLabel9.setText(inPatAdmission.getInpatientId());
        departmentlabel.setText(inpatientinfo.getBedId().getRoom().getDepartment().getDepartmentName());
        String patientFullName = null;
        if(inPatAdmission.getPatientId().getPatientMName()!=null){
            patientFullName = Initcap.toInitCap(inPatAdmission.getPatientId().getPatientFName())+" "+Initcap.toInitCap(inPatAdmission.getPatientId().getPatientMName())+" "+Initcap.toInitCap(inPatAdmission.getPatientId().getPatientLName());
        }else if(inPatAdmission.getPatientId().getPatientMName()==null){
            patientFullName = Initcap.toInitCap(inPatAdmission.getPatientId().getPatientFName())+" "+Initcap.toInitCap(inPatAdmission.getPatientId().getPatientLName());
        }
        
        jLabel10.setText(patientFullName);
    }
    
    private void showChargesTable() {
        //r = new TextAreaRenderer();
        try{
            //chargesList = inPatientChargeController.getAllChargesForPatient(inpatientinfo);
            textbox.addKeyListener(new KeyAdapter() {
                @Override
                public void keyTyped(KeyEvent EVT) {
                    super.keyTyped(EVT);
                    ea=EVT;
                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            if((ea.getKeyChar() >= '0' && ea.getKeyChar() <= '9') || ea.getKeyChar()=='.'|| ea.getKeyChar()=='\b' ){
                            }else{
                                JOptionPane.showMessageDialog(null,"String type entry not allowed");
                                textbox.setText(null);
                            }
                        }
                    });
                }
            });
            chargestable.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {"Id","Date","Charge Type","Task Name", "Amount","Service Provider", "Notes"}));
            
            chargestable.getColumnModel().getColumn(0).setMinWidth(0);
            chargestable.getColumnModel().getColumn(0).setPreferredWidth(0);
            chargestable.getColumnModel().getColumn(0).setMaxWidth(0);
            chargestable.getColumnModel().getColumn(1).setMinWidth(100);
            chargestable.getColumnModel().getColumn(1).setPreferredWidth(100);
            chargestable.getColumnModel().getColumn(1).setMaxWidth(100);
            chargestable.getColumnModel().getColumn(3).setMinWidth(250);
            chargestable.getColumnModel().getColumn(3).setPreferredWidth(250);
            chargestable.getColumnModel().getColumn(3).setMaxWidth(250);
            chargestable.getColumnModel().getColumn(4).setMinWidth(90);
            chargestable.getColumnModel().getColumn(4).setPreferredWidth(90);
            chargestable.getColumnModel().getColumn(4).setMaxWidth(90);
            chargestable.getColumnModel().getColumn(5).setMinWidth(150);
            chargestable.getColumnModel().getColumn(5).setPreferredWidth(150);
            chargestable.getColumnModel().getColumn(5).setMaxWidth(150);
            
            TableColumn dateColumn = chargestable.getColumnModel().getColumn(1);
            TableColumn chargeColumn = chargestable.getColumnModel().getColumn(2);
            TableColumn amountColumn = chargestable.getColumnModel().getColumn(4);
            //TableColumn notescolumn = chargestable.getColumnModel().getColumn(5);
            dateColumn.setCellEditor(new JDateChooserCellEditor());
            chargeColumn.setCellEditor(new DefaultCellEditor(combobox));
            amountColumn.setCellEditor(new DefaultCellEditor(textbox));
            //notescolumn.setCellRenderer(r);
            
            chargestable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
            chargestable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            model = (DefaultTableModel) chargestable.getModel();
            for(TInpatientCharges charge:chargesList){
                addObject = new Vector<Object>();
                addObject.add(charge.getId());
                addObject.add(sdf.format(charge.getItemDate()));
                addObject.add(charge.getChargeType());
                addObject.add(charge.getItemChargeFor());
                addObject.add(charge.getAmountCharge());
                addObject.add(charge.getServiceProvider());
                addObject.add(charge.getNotes());
                model.addRow(addObject);
            }
        }catch(Exception e){
            Logger.getLogger(InpatientChargesDialog.class.getName()).log(Level.SEVERE, null, e);
        }
    }

    private void totalcharges() {
        totalcharge = 0D;
        for(int row=0;row<chargestable.getRowCount();row++){
          if(!chargestable.getValueAt(row, 4).toString().equalsIgnoreCase("")){
               totalcharge+=Double.parseDouble(chargestable.getValueAt(row, 4).toString());
          }
        }
        total.setText(totalcharge.toString());
    }
}

Commits for Satyam/AuroCareHealthCareInPatient/src/main/java/com/bestray/healthcareinpatient/view/InpatientChargesDialog.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Fri 20 Jul, 2018 05:59:17 +0000