Subversion Repository Public Repository

Pharmacy_09_03_18

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

import com.bestray.healthcarecommonutil.exception.HealthCareException;
import com.bestray.healthcarecommonutil.exception.ProcessingException;
import com.bestray.healthcarecommonutil.util.DisabledGlassPane;
import com.bestray.healthcarecommonutil.util.StandardButton;
import com.bestray.healthcarecommonutil.views.StockiestSearchDialog;
import com.bestray.healthcarecommonutil.views.StockiestSearchDialogByBalanceAmount;
import com.bestray.healthcarecommonutil.vo.TPharmacyBilling;
import com.bestray.healthcarecommonutil.vo.TStockiestDetailMaster;
import com.bestray.healthcarepharmacy.controller.PharmacyReportController;
import com.bestray.healthcarepharmacy.util.MessageProperties;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author User1
 */
public class StockistReportPanel extends javax.swing.JPanel {

    /**
     * Creates new form StockistReportPanel
     */
    public StockistReportPanel() {
        populateData();
        initComponents();
        defaultTransactionTable();
    }

    /**
     * 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();
        jPanel2 = new javax.swing.JPanel();
        jToolBar2 = new javax.swing.JToolBar();
        jLabel1 = new javax.swing.JLabel();
        dailyReport_button = new javax.swing.JToggleButton();
        monthlyReport_button = new javax.swing.JToggleButton();
        yearlyReport_button = new javax.swing.JToggleButton();
        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();
        stockist_panel = new javax.swing.JPanel();
        jLabel = new javax.swing.JLabel();
        stockiest_name_textbox = new javax.swing.JTextField();
        stokiest_search_bt = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        address_textbox = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        stockiest_contact_textbox = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        drug_license_textbox = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        tin_number_textbox = new javax.swing.JTextField();
        view_bt = new StandardButton("Receipt");
        duePayment_btn = new javax.swing.JButton();
        jXTitledPanel1 = new org.jdesktop.swingx.JXTitledPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        stockist_transaction_table = new javax.swing.JTable(){

            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;
            }

        };
        jLabel3 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        paid_amount_textbox = new javax.swing.JTextField();
        balance_amount_textbox = new javax.swing.JTextField();
        payforDue_button = new javax.swing.JButton();

        setOpaque(false);

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel2.setOpaque(false);

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

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

        dailyReport_button.setBackground(new java.awt.Color(255, 255, 255));
        buttonGroup1.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.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                dailyReport_buttonItemStateChanged(evt);
            }
        });
        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));
        buttonGroup1.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.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                monthlyReport_buttonItemStateChanged(evt);
            }
        });
        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));
        buttonGroup1.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.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                yearlyReport_buttonItemStateChanged(evt);
            }
        });
        yearlyReport_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                yearlyReport_buttonActionPerformed(evt);
            }
        });
        jToolBar2.add(yearlyReport_button);

        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 :");

        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);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addGap(18, 18, 18)
                .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)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(datechooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 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_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, 26, Short.MAX_VALUE)
                    .addComponent(jLabel4, 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))
                .addGap(5, 5, 5))
        );

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

        stockist_panel.setOpaque(false);
        stockist_panel.setVisible(false);

        jLabel.setFont(new java.awt.Font("SansSerif", 0, 10)); // NOI18N
        jLabel.setText("Name:");
        jLabel.setMaximumSize(new java.awt.Dimension(72, 18));
        jLabel.setMinimumSize(new java.awt.Dimension(72, 18));
        jLabel.setPreferredSize(new java.awt.Dimension(72, 18));

        stockiest_name_textbox.setEditable(false);
        stockiest_name_textbox.setBackground(new java.awt.Color(255, 255, 255));
        stockiest_name_textbox.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        stockiest_name_textbox.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        stockiest_name_textbox.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        stokiest_search_bt.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        stokiest_search_bt.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search-icon16X16.png"))); // NOI18N
        stokiest_search_bt.setContentAreaFilled(false);
        stokiest_search_bt.setFocusable(false);
        stokiest_search_bt.setMargin(new java.awt.Insets(2, 16, 2, 16));
        stokiest_search_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stokiest_search_btActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("SansSerif", 0, 10)); // NOI18N
        jLabel2.setText("Address:");
        jLabel2.setMaximumSize(new java.awt.Dimension(72, 18));
        jLabel2.setMinimumSize(new java.awt.Dimension(72, 18));
        jLabel2.setPreferredSize(new java.awt.Dimension(72, 18));

        address_textbox.setEditable(false);
        address_textbox.setBackground(new java.awt.Color(255, 255, 255));
        address_textbox.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        address_textbox.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        address_textbox.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLabel5.setFont(new java.awt.Font("SansSerif", 0, 10)); // NOI18N
        jLabel5.setText("Contact:");
        jLabel5.setMaximumSize(new java.awt.Dimension(72, 18));
        jLabel5.setMinimumSize(new java.awt.Dimension(72, 18));
        jLabel5.setPreferredSize(new java.awt.Dimension(72, 18));

        stockiest_contact_textbox.setEditable(false);
        stockiest_contact_textbox.setBackground(new java.awt.Color(255, 255, 255));
        stockiest_contact_textbox.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        stockiest_contact_textbox.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        stockiest_contact_textbox.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLabel6.setFont(new java.awt.Font("SansSerif", 0, 10)); // NOI18N
        jLabel6.setText("Drug License:");
        jLabel6.setMaximumSize(new java.awt.Dimension(72, 18));
        jLabel6.setMinimumSize(new java.awt.Dimension(72, 18));
        jLabel6.setPreferredSize(new java.awt.Dimension(72, 18));

        drug_license_textbox.setEditable(false);
        drug_license_textbox.setBackground(new java.awt.Color(255, 255, 255));
        drug_license_textbox.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        drug_license_textbox.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        drug_license_textbox.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        jLabel7.setFont(new java.awt.Font("SansSerif", 0, 10)); // NOI18N
        jLabel7.setText("T.I.N:");
        jLabel7.setMaximumSize(new java.awt.Dimension(72, 18));
        jLabel7.setMinimumSize(new java.awt.Dimension(72, 18));
        jLabel7.setPreferredSize(new java.awt.Dimension(72, 18));

        tin_number_textbox.setEditable(false);
        tin_number_textbox.setBackground(new java.awt.Color(255, 255, 255));
        tin_number_textbox.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        tin_number_textbox.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        tin_number_textbox.setDisabledTextColor(new java.awt.Color(0, 0, 0));

        view_bt.setFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N
        view_bt.setText("View");
        view_bt.setOpaque(false);
        view_bt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                view_btActionPerformed(evt);
            }
        });

        duePayment_btn.setFont(new java.awt.Font("SansSerif", 1, 12)); // NOI18N
        duePayment_btn.setText("Due Payment");
        duePayment_btn.setOpaque(false);
        duePayment_btn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                duePayment_btnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout stockist_panelLayout = new javax.swing.GroupLayout(stockist_panel);
        stockist_panel.setLayout(stockist_panelLayout);
        stockist_panelLayout.setHorizontalGroup(
            stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stockist_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(stockist_panelLayout.createSequentialGroup()
                        .addComponent(stockiest_name_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(stokiest_search_bt, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(82, 82, 82)
                        .addComponent(duePayment_btn))
                    .addComponent(address_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(stockiest_contact_textbox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(drug_license_textbox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, stockist_panelLayout.createSequentialGroup()
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tin_number_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(view_bt, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );

        stockist_panelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {address_textbox, drug_license_textbox, stockiest_contact_textbox, stockiest_name_textbox, tin_number_textbox});

        stockist_panelLayout.setVerticalGroup(
            stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(stockist_panelLayout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(stockist_panelLayout.createSequentialGroup()
                        .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(stockiest_name_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(stokiest_search_bt, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(address_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(stockist_panelLayout.createSequentialGroup()
                        .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(duePayment_btn, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(stockiest_contact_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tin_number_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(stockist_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(drug_license_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(view_bt))))
                .addGap(5, 5, 5))
        );

        stockist_panelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {address_textbox, drug_license_textbox, stockiest_contact_textbox, stockiest_name_textbox, tin_number_textbox});

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(stockist_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(stockist_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(5, 5, 5))
        );

        jXTitledPanel1.setTitle("Stockist Transactions");
        jXTitledPanel1.setTitleFont(new java.awt.Font("SansSerif", 1, 10)); // NOI18N

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

            },
            new String [] {
                "Obj", "Date", "Billing Number", "Total Product MRP", "Total Product PTR", "Paid Price", "Balance Amount"
            }
        ));
        stockist_transaction_table.getColumnModel().getColumn(0).setMinWidth(0);
        stockist_transaction_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        stockist_transaction_table.getColumnModel().getColumn(0).setMaxWidth(0);
        stockist_transaction_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        stockist_transaction_table.setRowHeight(20);
        stockist_transaction_table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(stockist_transaction_table);

        javax.swing.GroupLayout jXTitledPanel1Layout = new javax.swing.GroupLayout(jXTitledPanel1.getContentContainer());
        jXTitledPanel1.getContentContainer().setLayout(jXTitledPanel1Layout);
        jXTitledPanel1Layout.setHorizontalGroup(
            jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1117, Short.MAX_VALUE)
        );
        jXTitledPanel1Layout.setVerticalGroup(
            jXTitledPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)
        );

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

        jLabel8.setFont(new java.awt.Font("SansSerif", 1, 14)); // NOI18N
        jLabel8.setText("Total Balance Amount (Rs.): ");

        paid_amount_textbox.setEditable(false);
        paid_amount_textbox.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        paid_amount_textbox.setOpaque(false);

        balance_amount_textbox.setEditable(false);
        balance_amount_textbox.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        balance_amount_textbox.setOpaque(false);

        payforDue_button.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        payforDue_button.setText("Pay");
        payforDue_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                payforDue_buttonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jXTitledPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(205, 205, 205)
                                .addComponent(paid_amount_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(35, 35, 35)
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(balance_amount_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(payforDue_button)
                        .addGap(210, 210, 210))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jXTitledPanel1, 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.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(17, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(paid_amount_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(balance_amount_textbox, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(payforDue_button))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel3, paid_amount_textbox});

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {balance_amount_textbox, jLabel8});

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

    private void stokiest_search_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stokiest_search_btActionPerformed
        DisabledGlassPane glassPane = new DisabledGlassPane();
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        StockiestSearchDialog lookUpDialoge = new StockiestSearchDialog(MainAPP, true);
        lookUpDialoge.setResizable(false);
        lookUpDialoge.setLocationRelativeTo(null);
        glassPane.activate("");
        lookUpDialoge.setVisible(true);
        lookUpDialoge.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        glassPane.deactivate();
        selectedStockiest = lookUpDialoge.getStockiest();
        if(selectedStockiest!= null)
        {
            showAllStockiest(selectedStockiest);
        }        
    }//GEN-LAST:event_stokiest_search_btActionPerformed

    private void view_btActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_view_btActionPerformed
        if(selectedStockiest!=null){
            showPurchaseTrancsactions();
        }else{
            JOptionPane.showMessageDialog(null, "select stockiest");
        }
    }//GEN-LAST:event_view_btActionPerformed

    private void dailyReport_buttonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_dailyReport_buttonItemStateChanged
        // TODO add your handling code here:
//        if(DAR_button.isSelected()){
//            jButton1.setVisible(true);
//        }
    }//GEN-LAST:event_dailyReport_buttonItemStateChanged

    private void dailyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dailyReport_buttonActionPerformed
        /*if(DAR_button.isSelected()){
            jButton1.setVisible(true);
        }*/
        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);
        jPanel1.setVisible(true);
        stockist_panel.setVisible(true);
        dailyReport_button.setEnabled(false);
        monthlyReport_button.setEnabled(true);
        yearlyReport_button.setEnabled(true);
//        pdf_button.setVisible(true);

        if(datechooser.getDate()!=null){
//            viewbutton.doClick();
        }
    }//GEN-LAST:event_dailyReport_buttonActionPerformed

    private void monthlyReport_buttonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_monthlyReport_buttonItemStateChanged
        // TODO add your handling code here:
//        if(DAR_button.isSelected()){
//            jButton1.setVisible(true);
//        }
    }//GEN-LAST:event_monthlyReport_buttonItemStateChanged

    private void monthlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthlyReport_buttonActionPerformed

        /*if(DAR_button.isSelected()){
            jButton1.setVisible(true);
        }*/
        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);
        stockist_panel.setVisible(true);
        dailyReport_button.setEnabled(true);
        monthlyReport_button.setEnabled(false);
        yearlyReport_button.setEnabled(true);
//        pdf_button.setVisible(true);

        if(detail_monthchooser.getMonth()!=0){
//            viewbutton.doClick();
        }
    }//GEN-LAST:event_monthlyReport_buttonActionPerformed

    private void yearlyReport_buttonItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_yearlyReport_buttonItemStateChanged
        // TODO add your handling code here:
//        if(DAR_button.isSelected()){
//            jButton1.setVisible(true);
//        }
    }//GEN-LAST:event_yearlyReport_buttonItemStateChanged

    private void yearlyReport_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yearlyReport_buttonActionPerformed

        /*if(DAR_button.isSelected()){
            jButton1.setVisible(true);
        }*/
        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);
        stockist_panel.setVisible(true);
        dailyReport_button.setEnabled(true);
        monthlyReport_button.setEnabled(true);
        yearlyReport_button.setEnabled(false);
//        pdf_button.setVisible(true);

        if(detail_yearchooser.getYear()!=0){
//            viewbutton.doClick();
        }
    }//GEN-LAST:event_yearlyReport_buttonActionPerformed

    private void duePayment_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_duePayment_btnActionPerformed
        List<TPharmacyBilling> StockistByBalanceamount = pharmacyReportController.getavailableTransactionsByStockistByBalanceamount();
        int i = 0;    
            for (TPharmacyBilling Tbill : StockistByBalanceamount) {                
                System.out.println(i+"] Tbill: "+Tbill.getBalanceAmount());
                i++;
            }
        DisabledGlassPane glassPane = new DisabledGlassPane();
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);
        StockiestSearchDialogByBalanceAmount lookUpDialoge = new StockiestSearchDialogByBalanceAmount(MainAPP, true, StockistByBalanceamount);
        lookUpDialoge.setResizable(false);
        lookUpDialoge.setLocationRelativeTo(null);
        glassPane.activate("");
        lookUpDialoge.setVisible(true);
        lookUpDialoge.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        glassPane.deactivate();
        selectedStockiest = lookUpDialoge.getStockiest();
        if(selectedStockiest!= null){
            showAllStockiest(selectedStockiest);
        }
    }//GEN-LAST:event_duePayment_btnActionPerformed

    private void payforDue_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_payforDue_buttonActionPerformed
        int row = stockist_transaction_table.getSelectedRow();
        if(row>=0){
            Double paid_amt = Double.parseDouble(stockist_transaction_table.getValueAt(row, 5).toString());
            Double bal_amt = Double.parseDouble(stockist_transaction_table.getValueAt(row, 7).toString()) ;
            Double duepaid_amt = Double.parseDouble(stockist_transaction_table.getValueAt(row, 8).toString()) ;
            System.out.println("due_paid_amt:::::>>>"+duepaid_amt);                           
            Double paid_due_amt = bal_amt- duepaid_amt;
            Double new_paid_amt = paid_amt+duepaid_amt;
            System.out.println("paid_due_amount: >>>> "+paid_due_amt);
            System.out.println("paid_amount: >>>> "+new_paid_amt);
            TPharmacyBilling billingToUpdate = null;
            
            List<TPharmacyBilling> allStockist = pharmacyReportController.getavailableTransactionsByStockistByBalanceamount();        
            System.out.println("allStockist### "+allStockist.size());
            Long st_id = selectedStockiest.getId();
            String main_billing_no = stockist_transaction_table.getValueAt(row, 2).toString();
            for(TPharmacyBilling billing: allStockist){
                Long stk_Id = billing.getStockistDetail().getId();
                String billing_no = billing.getBillingNumber();
                System.out.println("stk_Id### "+stk_Id+"    st_id: "+st_id);
                System.out.println("main_billing_no### "+main_billing_no+"    billing_no: "+billing_no);
                if(main_billing_no.trim().equalsIgnoreCase(billing_no.trim())) 
                    billingToUpdate = billing;                
            }
            if(billingToUpdate != null){                
                billingToUpdate.setBalanceAmount(paid_due_amt);
                billingToUpdate.setPaidPrice(new_paid_amt);
                System.out.println("billing_Id### "+billingToUpdate.getId());
                System.out.println("billingbalamt### "+billingToUpdate.getBalanceAmount());
                System.out.println("billingpaidprc### "+billingToUpdate.getPaidPrice());
                
                
                boolean isUpdated = pharmacyReportController.updateDuePayment(billingToUpdate);
                System.out.println("isUpdated: "+isUpdated);
                if(isUpdated) 
                    JOptionPane.showMessageDialog(null, "Data updated");
                //defaultTableModel.getDataVector().removeAllElements();
                defaultTransactionTable();
                clearAllFields();
                paid_amount_textbox.setText(String.valueOf(new_paid_amt));
                balance_amount_textbox.setText(String.valueOf(paid_due_amt));
                
                }                      
        }else{
         JOptionPane.showMessageDialog(null, "Select a Record for Payment");   
        }                                        
    }//GEN-LAST:event_payforDue_buttonActionPerformed

    public void clearAllFields(){
        datechooser.setDate(null);
        stockiest_name_textbox.setText("");
        address_textbox.setText("");
        stockiest_contact_textbox.setText("");
        drug_license_textbox.setText("");
        tin_number_textbox.setText("");
    }
    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField address_textbox;
    private javax.swing.JTextField balance_amount_textbox;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JToggleButton dailyReport_button;
    private com.toedter.calendar.JDateChooser datechooser;
    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.JTextField drug_license_textbox;
    private javax.swing.JButton duePayment_btn;
    private javax.swing.JLabel jLabel;
    private javax.swing.JLabel jLabel1;
    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.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar jToolBar2;
    private org.jdesktop.swingx.JXTitledPanel jXTitledPanel1;
    private javax.swing.JToggleButton monthlyReport_button;
    private javax.swing.JTextField paid_amount_textbox;
    private javax.swing.JButton payforDue_button;
    private javax.swing.JTextField stockiest_contact_textbox;
    private javax.swing.JTextField stockiest_name_textbox;
    private javax.swing.JPanel stockist_panel;
    private javax.swing.JTable stockist_transaction_table;
    private javax.swing.JButton stokiest_search_bt;
    private javax.swing.JTextField tin_number_textbox;
    private javax.swing.JButton view_bt;
    private javax.swing.JToggleButton yearlyReport_button;
    // End of variables declaration//GEN-END:variables
    private TStockiestDetailMaster selectedStockiest;
    private javax.swing.JFrame MainAPP;
    private DefaultTableModel model;
    private Vector<Object> addObject;
    private PharmacyReportController pharmacyReportController;
    private SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
    private TPharmacyBilling billing;

    
    private void populateData() {        
        pharmacyReportController = (PharmacyReportController)PharmacyHomeFrame.context.getBean("pharmacyReportController");
        
        
    }
    
    private void showAllStockiest(TStockiestDetailMaster selectedStockiest) {
           if(selectedStockiest.getStockiestName()!=null){
              stockiest_name_textbox.setText(selectedStockiest.getStockiestName().toString());
           }
           if(selectedStockiest.getStockiestAddress()!=null){
           address_textbox.setText(selectedStockiest.getStockiestAddress().toString());
           }
           if(selectedStockiest.getStockiestContactNumber()!=null){
           stockiest_contact_textbox.setText(selectedStockiest.getStockiestContactNumber().toString());
           }
           if(selectedStockiest.getStockiestDLNumber()!=null){
           drug_license_textbox.setText(selectedStockiest.getStockiestDLNumber().toString());
           }
           if(selectedStockiest.getStockiestTINnumber()!=null){
           tin_number_textbox.setText(selectedStockiest.getStockiestTINnumber().toString());
           }
    }
    
    private void defaultTransactionTable(){
        stockist_transaction_table.setModel(new javax.swing.table.DefaultTableModel(new Object [][] {},new String [] {
                "Obj", "Date", "Billing Number", "Total Product MRP", "Total Product PTR", "Paid Price","Discount", "Balance Amount","Pay For Due"}));
        stockist_transaction_table.getColumnModel().getColumn(0).setMinWidth(0);
        stockist_transaction_table.getColumnModel().getColumn(0).setPreferredWidth(0);
        stockist_transaction_table.getColumnModel().getColumn(0).setMaxWidth(0);
        stockist_transaction_table.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 11));
        stockist_transaction_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
    }

    private void showPurchaseTrancsactions() {
        Double paidAmount = 0d;
        Double balanceAmount = 0d;
        
        defaultTransactionTable();
        
        List<TPharmacyBilling> availableTransactions = new ArrayList<TPharmacyBilling>();
        try{
            if(!dailyReport_button.isEnabled()){
                Date date=datechooser.getDate();
                availableTransactions = pharmacyReportController.getavailableTransactionsByStockistByDate(selectedStockiest,date);
         }else if(!monthlyReport_button.isEnabled()){
                    String month=getMonthFullName(detail_monthchooser.getMonth());
                    int year = detail_month_year_chosser.getYear();
                    availableTransactions = pharmacyReportController.getavailableTransactionsByStockistByMonth(selectedStockiest,month,year);
         }else if(!yearlyReport_button.isEnabled()){
                    int year = detail_yearchooser.getYear();
                    availableTransactions = pharmacyReportController.getavailableTransactionsByStockistByYear(selectedStockiest,year);
         }
           
        }catch(ProcessingException e){
            e.printStackTrace();
             JOptionPane.showMessageDialog(null,MessageProperties.getMessage("error.fetch",new Object[]{"Billing details"}));
             throw new HealthCareException(MessageProperties.getMessage("error.dao"));
        }
        if(availableTransactions.size()==0){
            JOptionPane.showMessageDialog(null,"No Data present");
        }
        model = (DefaultTableModel)stockist_transaction_table.getModel();
                for(TPharmacyBilling billing: availableTransactions){
                    addObject = new Vector<Object>();
                    addObject.add(billing);
                    addObject.add(sdf.format(billing.getBillingDate()));
                    addObject.add(billing.getBillingNumber());
                    addObject.add(billing.getTotalProductPrice());
                    addObject.add(billing.getTotalPriceToBePaid());
                    addObject.add(billing.getPaidPrice());
                    addObject.add(billing.getDiscountPrice());
                    addObject.add(billing.getBalanceAmount());
                    model.addRow(addObject);
                 }
                for(int row=0;row<stockist_transaction_table.getRowCount();row++){
                                if(!stockist_transaction_table.getValueAt(row, 5).toString().equalsIgnoreCase("")){
                                    paidAmount+=Double.parseDouble(stockist_transaction_table.getValueAt(row, 5).toString());
                                }
                                if(!stockist_transaction_table.getValueAt(row, 7).toString().equalsIgnoreCase("")){
                                    balanceAmount+=Double.parseDouble(stockist_transaction_table.getValueAt(row, 7).toString());
                                }
                            }
                paid_amount_textbox.setText(String.valueOf(paidAmount));
                balance_amount_textbox.setText(String.valueOf(balanceAmount));
    }
    
    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;
       }

    
}

Commits for Pharmacy_09_03_18/Dr Gyana ProjectSpace/DrGyanaPharmacy/src/main/java/com/bestray/healthcarepharmacy/view/StockistReportPanel.java

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