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
/*
 * 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.DisabledGlassPane;
import com.bestray.healthcarecommonutil.util.SimpleGradientPanel;
import com.bestray.healthcarecommonutil.vo.TDepartmentMaster;
import com.bestray.healthcareemr.Controller.AmbulatoryFeeController;
import com.bestray.healthcareemr.reports.AmbulatoryFeeReport;
import com.bestray.healthcareinpatient.controller.IpBillingFeeCollectionController;
import com.bestray.healthcareinpatient.reports.IpBillingFeeReport;
import com.bestray.healthcareinpatient.util.MessageProperties;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.table.TableCellRenderer;

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

    /**
     * Creates new form PatientSchedulingReportPanel
     */
    public AmbulatoryFeecollectionReport() {
        populate();
        initComponents();
        
        //jToolBar2.setVisible(false);
        //jScrollPane1.setVisible(false);
        //jPanel1.setVisible(false);
        //pdf_button.setVisible(false);
        //viewbutton.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() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        detail_Datelb = new javax.swing.JLabel();
        datechooser = new com.toedter.calendar.JDateChooser();
        detail_monthlb = new javax.swing.JLabel();
        detail_monthchooser = new com.toedter.calendar.JMonthChooser();
        detail_month_year_chosser = new com.toedter.calendar.JYearChooser();
        detail_yearchooser = new com.toedter.calendar.JYearChooser();
        detail_yearlb = new javax.swing.JLabel();
        viewbutton = new javax.swing.JButton();
        deptlb = new javax.swing.JLabel();
        dept_comboBox = new javax.swing.JComboBox();
        jToolBar2 = new javax.swing.JToolBar();
        dailyReport_button = new javax.swing.JToggleButton();
        monthlyReport_button = new javax.swing.JToggleButton();
        yearlyReport_button = new javax.swing.JToggleButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        ipBillingFeeTable = 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;
            }

        };
        pdf_button = new javax.swing.JButton();
        total_ipBilling_fee_label = new javax.swing.JLabel();
        total_IpBilling_fee_tb = new javax.swing.JTextField();
        total_amount_label = new javax.swing.JLabel();
        total_amount_tb = new javax.swing.JTextField();
        total_paid_label = new javax.swing.JLabel();
        total_paid_tb = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setOpaque(false);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setOpaque(false);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(102, 102, 102));
        jLabel4.setText("Parameters :");
        jLabel4.setVisible(false);

        detail_Datelb.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        detail_Datelb.setText("Date :");
        detail_Datelb.setVisible(false);

        datechooser.setDate(new Date());
        datechooser.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        datechooser.setOpaque(false);
        datechooser.setVisible(false);

        detail_monthlb.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        detail_monthlb.setText("Month :");
        detail_monthlb.setVisible(false);

        detail_monthchooser.setFont(new java.awt.Font("SansSerif", 1, 11)); // NOI18N
        detail_monthchooser.setOpaque(false);
        detail_monthchooser.setVisible(false);

        detail_month_year_chosser.setVisible(false);
        detail_month_year_chosser.setOpaque(false);

        detail_yearchooser.setOpaque(false);
        detail_yearchooser.setVisible(false);

        detail_yearlb.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        detail_yearlb.setText("Year :");
        detail_yearlb.setVisible(false);

        viewbutton.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        viewbutton.setText("View");
        viewbutton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                viewbuttonActionPerformed(evt);
            }
        });
        viewbutton.setVisible(false);

        deptlb.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        deptlb.setText("Department :");
        deptlb.setVisible(false);

        dept_comboBox.setFont(new java.awt.Font("SansSerif", 0, 12)); // NOI18N
        dept_comboBox.setModel(new javax.swing.DefaultComboBoxModel(departmentList));
        dept_comboBox.setOpaque(false);
        dept_comboBox.setSelectedIndex(-1);
        dept_comboBox.setVisible(false);

        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(jLabel4)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(detail_Datelb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(datechooser, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(detail_monthlb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(detail_monthchooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(detail_month_year_chosser, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(detail_yearlb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(detail_yearchooser, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(deptlb)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dept_comboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 242, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(viewbutton)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(viewbutton)
                        .addComponent(deptlb)
                        .addComponent(dept_comboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(datechooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
                            .addComponent(detail_monthchooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_month_year_chosser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_yearlb, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_Datelb, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_monthlb, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(detail_yearchooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {datechooser, dept_comboBox, detail_month_year_chosser, detail_monthchooser, detail_yearchooser});

        jToolBar2.setBackground(new java.awt.Color(255, 255, 255));
        jToolBar2.setFloatable(false);
        jToolBar2.setRollover(true);
        jToolBar2.setOpaque(false);

        dailyReport_button.setBackground(new java.awt.Color(255, 255, 255));
        buttonGroup2.add(dailyReport_button);
        dailyReport_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        dailyReport_button.setText("Daily Report");
        dailyReport_button.setFocusable(false);
        dailyReport_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        dailyReport_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        dailyReport_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        dailyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dailyReport_buttonActionPerformed(evt);
            }
        });
        jToolBar2.add(dailyReport_button);

        monthlyReport_button.setBackground(new java.awt.Color(255, 255, 255));
        buttonGroup2.add(monthlyReport_button);
        monthlyReport_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        monthlyReport_button.setText("Monthly Report");
        monthlyReport_button.setFocusable(false);
        monthlyReport_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        monthlyReport_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        monthlyReport_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        monthlyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthlyReport_buttonActionPerformed(evt);
            }
        });
        jToolBar2.add(monthlyReport_button);

        yearlyReport_button.setBackground(new java.awt.Color(255, 255, 255));
        buttonGroup2.add(yearlyReport_button);
        yearlyReport_button.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        yearlyReport_button.setText("Yearly Report");
        yearlyReport_button.setFocusable(false);
        yearlyReport_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        yearlyReport_button.setMargin(new java.awt.Insets(2, 20, 2, 20));
        yearlyReport_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        yearlyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yearlyReport_buttonActionPerformed(evt);
            }
        });
        jToolBar2.add(yearlyReport_button);

        jScrollPane1.setOpaque(false);
        jScrollPane1.setVisible(false);

        ipBillingFeeTable.setModel(new javax.swing.table.DefaultTableModel(data,Header));
        ipBillingFeeTable.setOpaque(false);
        ipBillingFeeTable.setRowHeight(21);
        ipBillingFeeTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        ipBillingFeeTable.setBackground(new java.awt.Color(253, 251, 251));
        ipBillingFeeTable.setFont(new java.awt.Font("Tahoma", 0, 12));
        ipBillingFeeTable.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jScrollPane1.setViewportView(ipBillingFeeTable);

        pdf_button.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        pdf_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/pdf-icon.png"))); // NOI18N
        pdf_button.setText("Save as PDF");
        pdf_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pdf_buttonActionPerformed(evt);
            }
        });
        pdf_button.setVisible(false);

        total_ipBilling_fee_label.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
        total_ipBilling_fee_label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        total_ipBilling_fee_label.setText("Total IP Billing Fee (Rs.): ");
        total_ipBilling_fee_label.setVisible(false);

        total_IpBilling_fee_tb.setEditable(false);
        total_IpBilling_fee_tb.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        total_IpBilling_fee_tb.setOpaque(false);
        total_IpBilling_fee_tb.setVisible(false);

        total_amount_label.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
        total_amount_label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        total_amount_label.setText("Total Amount (Rs.): ");
        total_amount_label.setVisible(false);

        total_amount_tb.setVisible(false);
        total_amount_tb.setEditable(false);
        total_amount_tb.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        total_amount_tb.setOpaque(false);

        total_paid_label.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
        total_paid_label.setText("Total Paid Amount (Rs.): ");
        total_paid_label.setVisible(false);

        total_paid_tb.setVisible(false);
        total_paid_tb.setEditable(false);
        total_paid_tb.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        total_paid_tb.setOpaque(false);

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

        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(jScrollPane1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pdf_button))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(total_ipBilling_fee_label, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(total_amount_label, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, 0)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(total_IpBilling_fee_tb, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(total_amount_tb, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(total_paid_label)
                                .addGap(0, 0, 0)
                                .addComponent(total_paid_tb, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {total_IpBilling_fee_tb, total_amount_tb, total_paid_tb});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pdf_button))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(total_amount_tb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(total_amount_label, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(total_paid_label)
                    .addComponent(total_paid_tb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(total_IpBilling_fee_tb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(total_ipBilling_fee_label, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {total_IpBilling_fee_tb, total_amount_label, total_amount_tb, total_ipBilling_fee_label, total_paid_label, total_paid_tb});

    }// </editor-fold>//GEN-END:initComponents

    private void dailyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dailyReport_buttonActionPerformed
        detail_Datelb.setVisible(true);
        datechooser.setVisible(true);
        detail_monthlb.setVisible(false);
        detail_monthchooser.setVisible(false);
        detail_yearlb.setVisible(false);
        detail_yearchooser.setVisible(false);
        detail_month_year_chosser.setVisible(false);
        deptlb.setVisible(true);
        dept_comboBox.setVisible(true);
        viewbutton.setVisible(true);
        jPanel1.setVisible(true);
        pdf_button.setVisible(true);
        jScrollPane1.setVisible(true);
        total_amount_label.setVisible(true);
        total_amount_tb.setVisible(true);
        jLabel4.setVisible(true);
        if(datechooser.getDate()!=null){
            viewbutton.doClick();
        }
    }//GEN-LAST:event_dailyReport_buttonActionPerformed

    private void monthlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReport_buttonActionPerformed
        detail_monthlb.setVisible(true);
        detail_monthchooser.setVisible(true);
        detail_month_year_chosser.setVisible(true);
        detail_Datelb.setVisible(false);
        datechooser.setVisible(false);
        detail_yearlb.setVisible(false);
        detail_yearchooser.setVisible(false);
        jPanel1.setVisible(true);
        pdf_button.setVisible(true);
        jLabel4.setVisible(true);
        deptlb.setVisible(true);
        dept_comboBox.setVisible(true);
        viewbutton.setVisible(true);
        
        if(detail_monthchooser.getMonth()!=0){
            viewbutton.doClick();
        }
    }//GEN-LAST:event_monthlyReport_buttonActionPerformed

    private void yearlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearlyReport_buttonActionPerformed
        detail_yearlb.setVisible(true);
        detail_yearchooser.setVisible(true);
        detail_Datelb.setVisible(false);
        datechooser.setVisible(false);
        detail_monthlb.setVisible(false);
        detail_monthchooser.setVisible(false);
        detail_month_year_chosser.setVisible(false);
        jPanel1.setVisible(true);
        pdf_button.setVisible(true);
        jLabel4.setVisible(true);
        deptlb.setVisible(true);
        dept_comboBox.setVisible(true);
        viewbutton.setVisible(true);
        if(detail_yearchooser.getYear()!=0){
            viewbutton.doClick();
        }
    }//GEN-LAST:event_yearlyReport_buttonActionPerformed

    private String getMonthFullName(int monthNumber){
        String monthName="";
        if(monthNumber>=0 && monthNumber<12){
            try{
                Calendar calendar = Calendar.getInstance();
                calendar.set(Calendar.MONTH, monthNumber);

                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMM");
                simpleDateFormat.setCalendar(calendar);
                monthName = simpleDateFormat.format(calendar.getTime());
            }catch (Exception e){}
        }
            return monthName;
    }
    
    private void pdf_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pdf_buttonActionPerformed
        
        String date = "null";
        String month = "null";
        String year = "null";
        String displayFormat = "";
        TDepartmentMaster dept=null;
        String departmentIds = "";
        if(dept_comboBox.getSelectedIndex()==-1){
        }else{
            dept = (TDepartmentMaster)dept_comboBox.getSelectedItem();
        }
        try{
            
                if(dailyReport_button.isSelected()){
                    if(datechooser.getDate()!=null){
                        date = sdf.format(datechooser.getDate());
                        displayFormat = "Date : "+sdf1.format(datechooser.getDate());
                    }else{
                        JOptionPane.showMessageDialog(null,"Choose The Date");
                    }
                }else if(monthlyReport_button.isSelected()){
                    if(detail_monthchooser.getMonth()!=0){
                        //month = getMonthFullName(detail_monthchooser.getMonth());
                        int monthnum = detail_monthchooser.getMonth()+1;
                        int yearnum = detail_month_year_chosser.getYear();
                        if(monthnum < 10){
                            month = String.valueOf(yearnum)+"0"+monthnum;
                        }else{
                            month = String.valueOf(yearnum)+monthnum;
                        }
                        displayFormat = "Month : "+getMonthFullName(detail_monthchooser.getMonth())+" Of "+String.valueOf(yearnum);
                    }else{
                        JOptionPane.showMessageDialog(null,"Choose The Month");
                    }
                }else if(yearlyReport_button.isSelected()){
                    if(detail_yearchooser.getYear()!=0){
                        year = String.valueOf(detail_yearchooser.getYear());
                        displayFormat = "Year : "+year;
                    }else{
                        JOptionPane.showMessageDialog(null,"Choose The Year");
                    }
                }
                if(ipBillingFeeTable.getRowCount()>0){
                   AmbulatoryFeeReport ambfeeReport=new AmbulatoryFeeReport();
                    ambfeeReport.getPdfReport(date,month,year,displayFormat,dept);
                    System.out.println("Date :"+date);
                    System.out.println("Month :"+month);
                    System.out.println("Year :"+year);
                    System.out.println("Dept Id :"+dept);
                    int reply = JOptionPane.showConfirmDialog(null, "Do you want to open this file ?", " Ambulatory fee report", JOptionPane.YES_NO_OPTION);
                    if (reply == JOptionPane.YES_OPTION){
                        ambfeeReport.openPdfReport();
                    }
                }else{
                    JOptionPane.showMessageDialog(null,"No Data Available");
                }
           

        }//try
        catch(Exception e){
            String error=e.getMessage();
            JOptionPane.showMessageDialog(null, error+"\n So, Document can't be generated");
        }
    }//GEN-LAST:event_pdf_buttonActionPerformed
    
    private void viewbuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewbuttonActionPerformed
        
         JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        glassPane.activateLoadingImage();
        
        SwingWorker s = new SwingWorker() {

            @Override
            protected Object doInBackground() throws Exception {
                Double fee = 0d;
                try {
                        Date date = null;
                        String month = "null";
                        int year = 0;
                        int monthyear = 0;
                        TDepartmentMaster dept = null;
                       /* if(dept_comboBox.getSelectedItem()!=null){
                            dept = ambulatoryFeeController.getDepartmentValues(((TDepartmentMaster)dept_comboBox.getSelectedItem()).getId());
                        }*/
                        if(dailyReport_button.isSelected()){
                            if(datechooser.getDate()!=null){
                                date = datechooser.getDate();
                            }else{
                                JOptionPane.showMessageDialog(null,"Choose The Date");
                            }
                        }else if(monthlyReport_button.isSelected()){
                            if(detail_monthchooser.getMonth()!=0){
                                 month = getMonthFullName(detail_monthchooser.getMonth());
                                 monthyear = detail_month_year_chosser.getYear();
                            }else{
                                 JOptionPane.showMessageDialog(null,"Choose The Month");
                            }
                        }else if(yearlyReport_button.isSelected()){
                            if(detail_yearchooser.getYear()!=0){
                                 year = detail_yearchooser.getYear();
                            }else{
                                 JOptionPane.showMessageDialog(null,"Choose The Year");
                            }
                        }
                        jScrollPane1.setVisible(true);

                            data = ambulatoryFeeController.showReport(date, month,monthyear, year,dept);
                            ipBillingFeeTable.setModel(new javax.swing.table.DefaultTableModel(data,Header));
                            for(int row=0;row<ipBillingFeeTable.getRowCount();row++){
                                if(!ipBillingFeeTable.getValueAt(row, 3).toString().equalsIgnoreCase("")){
                                    fee+=Double.parseDouble(ipBillingFeeTable.getValueAt(row, 3).toString());
                                }
                            }
                            total_IpBilling_fee_tb.setText(String.valueOf(fee));
                            total_paid_label.setVisible(false);
                            total_paid_tb.setVisible(false);
                            total_amount_tb.setVisible(false);
                            total_amount_label.setVisible(false);
                            total_ipBilling_fee_label.setVisible(true);
                            total_IpBilling_fee_tb.setVisible(true);
                            if(data.isEmpty()){
                                JOptionPane.showMessageDialog(null,"No Data Available");
                            }
                        
                    

                }catch (ProcessingException ex) {
                    Logger.getLogger(AmbulatoryFeecollectionReport.class.getName()).log(Level.SEVERE, null, ex);
                }catch (Exception ex) {
                    Logger.getLogger(AmbulatoryFeecollectionReport.class.getName()).log(Level.SEVERE, null, ex);
                }
                return null;
            }

            @Override
            protected void done() {
                super.done();
                glassPane.deactivate();
            }
            
        };
        s.execute();
           
    }//GEN-LAST:event_viewbuttonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JToggleButton dailyReport_button;
    private com.toedter.calendar.JDateChooser datechooser;
    private javax.swing.JComboBox dept_comboBox;
    private javax.swing.JLabel deptlb;
    private javax.swing.JLabel detail_Datelb;
    private com.toedter.calendar.JYearChooser detail_month_year_chosser;
    private com.toedter.calendar.JMonthChooser detail_monthchooser;
    private javax.swing.JLabel detail_monthlb;
    private com.toedter.calendar.JYearChooser detail_yearchooser;
    private javax.swing.JLabel detail_yearlb;
    private javax.swing.JTable ipBillingFeeTable;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToggleButton monthlyReport_button;
    private javax.swing.JButton pdf_button;
    private javax.swing.JTextField total_IpBilling_fee_tb;
    private javax.swing.JLabel total_amount_label;
    private javax.swing.JTextField total_amount_tb;
    private javax.swing.JLabel total_ipBilling_fee_label;
    private javax.swing.JLabel total_paid_label;
    private javax.swing.JTextField total_paid_tb;
    private javax.swing.JButton viewbutton;
    private javax.swing.JToggleButton yearlyReport_button;
    // End of variables declaration//GEN-END:variables

    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    private SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy");
    private Vector<String> Header = new Vector<String>();
    private Vector<Vector<String>> data = new Vector<Vector<String>>();
    private DisabledGlassPane glassPane = new DisabledGlassPane();
    /** The department list. */
    private Vector<TDepartmentMaster> departmentList = new Vector<TDepartmentMaster>();
    private AmbulatoryFeeController ambulatoryFeeController;
    
    private void populate(){
        ambulatoryFeeController=(AmbulatoryFeeController)HealthcareLogin.context.getBean("ambulatoryFeeController");
       
        Header.add("Date");
        Header.add("Patient Name");
        Header.add("Billing Details Name");
        Header.add("Paid Amount");
        try{
           
           // departmentList = ambulatoryFeeController.getDepartmentList();
            
        }catch(Exception e){
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"department"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
         }
    }

   
}

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

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