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
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, 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.PreferenceUtil;
import com.bestray.healthcarecommonutil.vo.TCCodeValues;
import com.bestray.healthcarecommonutil.vo.TDoctorInformation;
import com.bestray.healthcarecommonutil.vo.TEncounterHistoryVisit;
import com.bestray.healthcarecommonutil.vo.TInpatentAdmission;
import com.bestray.healthcarecommonutil.vo.TInpatientCharges;
import com.bestray.healthcarecommonutil.vo.TOutDoorBilling;
import com.bestray.healthcarecommonutil.vo.TPatient;
import com.bestray.healthcarecommonutil.vo.TPatientEncounter;
import com.bestray.healthcarecommonutil.vo.TRole;
import com.bestray.healthcareemr.Controller.LoginController;
import com.bestray.healthcareemr.Controller.OutDoorBillingController;
import static com.bestray.healthcareemr.Views.VisitInfoPanel.allergy_table;
import com.bestray.healthcareemr.Vo.OutPatientDTO;
import com.bestray.healthcareemr.reports.DeptAppointmentReport;
import com.bestray.healthcareemr.reports.outDoorBillingReport;
//import com.bestray.healthcareinpatient.controller.InPatientChargeController;
import com.bestray.healthcareinpatient.controller.InPatientCodeValuesController;
//import com.bestray.healthcareinpatient.controller.InPatientPaymentController;
import com.bestray.healthcareinpatient.controller.InPatientRoundingController;
import com.bestray.healthcareinpatient.util.CollectionUtill;
import com.bestray.healthcareinpatient.util.MessageProperties;
import com.bestray.healthcareinpatient.view.HealthCareInpatientHome;
import com.bestray.healthcareinpatient.view.InpatientChargesDialog;
//import static com.bestray.healthcareinpatient.view.Inpatient_ChargeEntry_Panel.edit_bt;
import java.text.DecimalFormat;
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 org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
/**
*
* @author dell
*/
public class OutDoorBillingPanel extends javax.swing.JPanel {
/**
* Creates new form OutDoorBillingPanel
*/
public OutDoorBillingPanel() {
initComponents();
populate();
showinfo();
}
public OutDoorBillingPanel( TPatientEncounter encounter) {
this.encounter = encounter;
populate();
initComponents();
defaulttablemodel();
showinfo();
}
/**
* 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() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
outDoorBilling_btn = new javax.swing.JButton();
outDoorBilling_combobox = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
billingAmount_btn = new javax.swing.JTextField();
billingPdf_Btn = new javax.swing.JButton();
edit_Btn = new javax.swing.JButton();
billingDate_chooser = new com.toedter.calendar.JDateChooser();
billingDate_lbl = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
outDoorBilling_Table = new javax.swing.JTable();
billingTotalAmount_label = new javax.swing.JLabel();
billingTotalAmount_textBox = new javax.swing.JTextField();
setBackground(new java.awt.Color(153, 204, 255));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("Billing Details");
outDoorBilling_btn.setBackground(new java.awt.Color(102, 102, 255));
outDoorBilling_btn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
outDoorBilling_btn.setForeground(new java.awt.Color(102, 102, 255));
outDoorBilling_btn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Save-icon 16X16.png"))); // NOI18N
outDoorBilling_btn.setText("Save");
outDoorBilling_btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
outDoorBilling_btnActionPerformed(evt);
}
});
outDoorBilling_combobox.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
outDoorBilling_combobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Consultation Fees", "Stich", "Medicine", "Plaster", "injection", "Others" }));
outDoorBilling_combobox.setSelectedIndex(-1);
outDoorBilling_combobox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
outDoorBilling_comboboxItemStateChanged(evt);
}
});
outDoorBilling_combobox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
outDoorBilling_comboboxActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("Amount:");
billingAmount_btn.setCaretColor(new java.awt.Color(255, 255, 255));
billingPdf_Btn.setBackground(new java.awt.Color(102, 102, 255));
billingPdf_Btn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
billingPdf_Btn.setForeground(new java.awt.Color(102, 102, 255));
billingPdf_Btn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/pdf-icon.png"))); // NOI18N
billingPdf_Btn.setText("Print Receipt");
billingPdf_Btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
billingPdf_BtnActionPerformed(evt);
}
});
edit_Btn.setBackground(new java.awt.Color(102, 102, 255));
edit_Btn.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
edit_Btn.setForeground(new java.awt.Color(102, 102, 255));
edit_Btn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Edit-icon 16X16.png"))); // NOI18N
edit_Btn.setText("Edit");
edit_Btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
edit_BtnActionPerformed(evt);
}
});
billingDate_chooser.setDateFormatString("dd/MM/yyyy");
billingDate_chooser.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
billingDate_lbl.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
billingDate_lbl.setText("Billing Date:");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(74, 74, 74)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(billingDate_lbl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(billingDate_chooser, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(outDoorBilling_combobox, 0, 145, Short.MAX_VALUE)
.addComponent(billingAmount_btn))
.addGap(18, 18, 18)
.addComponent(outDoorBilling_btn, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(edit_Btn, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addComponent(billingPdf_Btn, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(26, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(billingDate_chooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(billingDate_lbl, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(outDoorBilling_combobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(outDoorBilling_btn)
.addComponent(billingPdf_Btn)
.addComponent(edit_Btn))
.addComponent(billingAmount_btn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(41, Short.MAX_VALUE))
);
outDoorBilling_Table.setBackground(javax.swing.UIManager.getDefaults().getColor("tab_mouse_over_fill_dark_lower"));
outDoorBilling_Table.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
outDoorBilling_Table.setForeground(new java.awt.Color(51, 51, 51));
outDoorBilling_Table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
}
));
outDoorBilling_Table.setGridColor(new java.awt.Color(0, 153, 102));
outDoorBilling_Table.setSelectionForeground(new java.awt.Color(255, 204, 204));
jScrollPane1.setViewportView(outDoorBilling_Table);
billingTotalAmount_label.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
billingTotalAmount_label.setText("Total Amount:");
billingTotalAmount_textBox.setEditable(false);
billingTotalAmount_textBox.setBackground(new java.awt.Color(255, 255, 255));
billingTotalAmount_textBox.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
billingTotalAmount_textBox.setForeground(new java.awt.Color(204, 51, 0));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 742, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(billingTotalAmount_label, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(billingTotalAmount_textBox, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(billingTotalAmount_label, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(billingTotalAmount_textBox, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(51, 51, 51))
);
}// </editor-fold>//GEN-END:initComponents
private void outDoorBilling_comboboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outDoorBilling_comboboxItemStateChanged
}//GEN-LAST:event_outDoorBilling_comboboxItemStateChanged
private void outDoorBilling_comboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outDoorBilling_comboboxActionPerformed
}//GEN-LAST:event_outDoorBilling_comboboxActionPerformed
private void outDoorBilling_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outDoorBilling_btnActionPerformed
if(edit_flag){
if(validateSave()){
try{
int row = outDoorBilling_Table.getSelectedRow();
try{
outDoorBilling = outDoorBillingController.getChargeDetailById(Long.parseLong(String.valueOf(outDoorBilling_Table.getValueAt(row, 0))));
}catch(ProcessingException e){
JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Billing Detail"}));
throw new HealthCareException(MessageProperties.getMessage("error.dao"));
}catch(Exception e){
JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Billing Detail"}));
}
//TPatient patient = new TPatient();
// patId= outDoorBilling.setInpatientBillingId(outDoorBillingController.findPatientDetailsById(patient.getId()));
System.out.println("+++++++++++++++inside edit++++++++++++++");
outDoorBilling.setInpatientOutDoorBillingEnc(encounter);
if(outDoorBilling.getInvoiceNo()==null){
invoiceId = outDoorBillingController.getInvoiceNo();
}
outDoorBilling.setInvoiceNo(invoiceId);
// outDoorBilling.setInpatientBillingId(patient);
outDoorBilling.setBillingDetailsName(outDoorBilling_combobox.getSelectedItem().toString());
outDoorBilling.setOutDoorBillingamount(Double.parseDouble(billingAmount_btn.getText()));
outDoorBillingController.saveOutDoorBilling(outDoorBilling);
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("success.save",new Object[]{"Outdoor Billing Entry"}));
// chargeDetail = new TInpatientCharges();
}catch(HibernateOptimisticLockingFailureException e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.update",new Object[]{"Outdoor Billing Entry"}));
}catch(ProcessingException e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Outdoor Billing Entry"}));
throw new HealthCareException(MessageProperties.getMessage("error.dao"));
}catch(Exception e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Outdoor Billing Entry"}));
}
clearFields();
showinfo();
}
}else{
if(validateSave()){
try{
//TPatient patient = new TPatient();
// outDoorBilling.setInpatientBillingId(outDoorBillingController.findPatientDetailsById(patient.getId()));
System.out.println("+++++++++++++++++inside save+++++++++++++++++");
if(outDoorBilling.getInvoiceNo()==null){
invoiceId = outDoorBillingController.getInvoiceNo();
}
//outDoorBilling.setInvoiceNo(invoiceId);
outDoorBilling.setInvoiceNo(getCurrentInvoiceNumber());
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+outDoorBilling.getInvoiceNo());
outDoorBilling.setInpatientOutDoorBillingEnc(encounter);
outDoorBilling.setItemDate(billingDate_chooser.getDate());
billingDate_chooser.setDate(outDoorBilling.getItemDate());
outDoorBilling.setBillingDetailsName(outDoorBilling_combobox.getSelectedItem().toString());
outDoorBilling.setOutDoorBillingamount(Double.parseDouble(billingAmount_btn.getText()));
outDoorBillingController.saveOutDoorBillingElse(outDoorBilling);
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("success.save",new Object[]{"Outdoor Billing Entry"}));
}catch(HibernateOptimisticLockingFailureException e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.update",new Object[]{"Outdoor Billing Entry"}));
}catch(ProcessingException e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Outdoor Billing Entry"}));
throw new HealthCareException(MessageProperties.getMessage("error.dao"));
}catch(Exception e){
JOptionPane.showMessageDialog(null, MessageProperties.getMessage("error.save",new Object[]{"Outdoor Billing Entry"}));
}
showinfo();
clearFields();
}
}
edit_flag=false;
/* int TRow=outDoorBilling_Table.getRowCount();
System.out.println("----------->"+TRow);
for (int i = TRow - 1; i >= 0; i--) {
System.out.println("-----------"+i);
((DefaultTableModel)outDoorBilling_Table.getModel()).removeRow(i);
}*/
//((DefaultTableModel)outDoorBilling_Table.getModel()).;
}//GEN-LAST:event_outDoorBilling_btnActionPerformed
private String getCurrentInvoiceNumber() {
try {
String userStatus="newUser";
String currInvNo="";
//String currEncId=""+outDoorBilling.getInpatientOutDoorBillingEnc().getEncId();
if(outDoorBilling.getInpatientOutDoorBillingEnc()!=null){
userStatus="existingUser";
currInvNo=""+outDoorBilling.getInvoiceNo();
invoiceId = currInvNo;
}else{
userStatus="newUser";
invoiceId = ""+((Long.parseLong(outDoorBillingController.getInvoiceNo()))+1);
}
System.out.println(userStatus+" <<<<<<<<<<<<<<currInvNo: "+currInvNo);
} catch (Exception e) {
e.printStackTrace();
}
return invoiceId;
}
private void billingPdf_BtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_billingPdf_BtnActionPerformed
// String displayFormat = "";
int encId = Integer.parseInt(encounter.getEncId().toString());
System.out.println("--------------->>>>"+encounter.getEncId().toString());
outDoorBillingReport billingReport=new outDoorBillingReport();
try {
billingReport.getPdfReport(encId);
} catch (Exception ex) {
Logger.getLogger(OutDoorBillingPanel.class.getName()).log(Level.SEVERE, null, ex);
}
int reply = JOptionPane.showConfirmDialog(null, "Do you want to open this file ?", "OutDoorBillingDetail", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION){
billingReport.openPdfReport();
}
}//GEN-LAST:event_billingPdf_BtnActionPerformed
static boolean edit_flag;
private void edit_BtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edit_BtnActionPerformed
edit_flag=true;
int row = outDoorBilling_Table.getSelectedRow();
try{
outDoorBillingEdit = outDoorBillingController.getChargeDetailById(Long.parseLong(String.valueOf(outDoorBilling_Table.getValueAt(row, 0))));
}catch(ProcessingException e){
JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Billing Detail"}));
throw new HealthCareException(MessageProperties.getMessage("error.dao"));
}catch(Exception e){
JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Billing Detail"}));
}
outDoorBilling_combobox.setSelectedIndex(CollectionUtill.getCodeValueIndex(inpatientOutDoorBillingList,outDoorBillingEdit.getBillingDetailsName()));
billingAmount_btn.setText(outDoorBillingEdit.getOutDoorBillingamount().toString());
}//GEN-LAST:event_edit_BtnActionPerformed
private void clearFields() {
outDoorBilling_combobox.setSelectedIndex(-1);
// taskName_tb.setText("");
billingAmount_btn.setText("");
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField billingAmount_btn;
private com.toedter.calendar.JDateChooser billingDate_chooser;
private javax.swing.JLabel billingDate_lbl;
private javax.swing.JButton billingPdf_Btn;
private javax.swing.JLabel billingTotalAmount_label;
private javax.swing.JTextField billingTotalAmount_textBox;
private javax.swing.JButton edit_Btn;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable outDoorBilling_Table;
private javax.swing.JButton outDoorBilling_btn;
private javax.swing.JComboBox outDoorBilling_combobox;
// End of variables declaration//GEN-END:variables
private Vector<TCCodeValues> inpatientOutDoorBillingList;
private InPatientCodeValuesController inPatientCodeValuesController;
List<TInpatientCharges> charges;
private TInpatientCharges chargeDetail;
private LoginController loginController;
private DefaultTableModel model;
private Vector<Object> addObject;
private TOutDoorBilling outDoorBilling;
private OutDoorBillingController outDoorBillingController;
private List<TOutDoorBilling> billingList;
private TOutDoorBilling tBilling;
private TPatientEncounter encounter;
private TPatient patient;
private TOutDoorBilling outDoorBillingEdit;
private OutPatientDTO outdto;
String patId;
private TPatientEncounter enc;
String selected_val;
String selected_val_id;
String selected_pat_id;
private TOutDoorBilling inpatadmission;
private String invoiceId;
private void populate(){
try{
outDoorBilling=new TOutDoorBilling();
// patient=new TPatient();
outDoorBillingController = (OutDoorBillingController)HealthcareLogin.context.getBean("outDoorBillingController");
inPatientCodeValuesController = (InPatientCodeValuesController)HealthcareLogin.context.getBean("inPatientCodeValuesController");
inpatientOutDoorBillingList = inPatientCodeValuesController.getCodeValues("OUTDOOR BILLING");
for(int i=0;i<inpatientOutDoorBillingList.size();i++){
System.out.println("size is--------------------------->"+inpatientOutDoorBillingList.elementAt(i));
}
outDoorBilling_combobox.setModel(new javax.swing.DefaultComboBoxModel(inpatientOutDoorBillingList));
charges = new ArrayList<TInpatientCharges>();
chargeDetail = new TInpatientCharges();
// patient=new TPatient();
}catch(Exception ex){
//Logger.getLogger(OutDoorBillingPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void defaulttablemodel(){
outDoorBilling_Table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {},new String [] {"Id", "Billing Name", "Amount"}));
outDoorBilling_Table.getColumnModel().getColumn(0).setMinWidth(0);
outDoorBilling_Table.getColumnModel().getColumn(0).setPreferredWidth(0);
outDoorBilling_Table.getColumnModel().getColumn(0).setMaxWidth(0);
}
private void showinfo() {
//--------------
if(outDoorBilling_combobox.getSelectedItem()==null){
selected_val="";
}else{
selected_val=outDoorBilling_combobox.getSelectedItem().toString();
}
selected_pat_id=""+encounter.getEncId();
//--------------
try{
defaulttablemodel();
model = (DefaultTableModel)outDoorBilling_Table.getModel();
// String val= outDoorBilling_combobox.getSelectedItem().toString();
billingList = outDoorBillingController.getBillingDetails();
for(TOutDoorBilling billing:billingList){
if((""+billing.getInpatientOutDoorBillingEnc().getEncId()).trim().equalsIgnoreCase(selected_pat_id)){
System.out.println(billing.getInpatientOutDoorBillingEnc()+">>>...............Patient found: "+selected_pat_id);
addObject = new Vector<Object>();
addObject.add(billing.getId());
addObject.add(billing.getBillingDetailsName());
addObject.add(billing.getOutDoorBillingamount());
model.addRow(addObject);
}
}
Double fee = 0d;
for(int row=0;row<outDoorBilling_Table.getRowCount();row++){
if(!outDoorBilling_Table.getValueAt(row, 2).toString().equalsIgnoreCase("")){
fee+=Double.parseDouble(outDoorBilling_Table.getValueAt(row, 2).toString());
}
}
billingTotalAmount_textBox.setText(String.valueOf(fee));
}
/* catch(ProcessingException e){
JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Charge Information"}));
throw new HealthCareException(MessageProperties.getMessage("error.dao"));
}*/
catch(Exception e){
// JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Charge Information"}));
}
}
private boolean validateSave() {
boolean flag = true;
if(outDoorBilling_combobox.getSelectedItem()==null){
flag = false;
outDoorBilling_combobox.requestFocus();
JOptionPane.showMessageDialog(null,"Billing Items should be selected");
}
else if(billingAmount_btn.getText().trim().length()==0){
flag = false;
billingAmount_btn.requestFocus();
JOptionPane.showMessageDialog(null,"Amount Can't be empty");
}
return flag;
}
}
|