-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollection1.java
2501 lines (2160 loc) · 101 KB
/
Collection1.java
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
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.ListCellRenderer;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Dell
*/
public class Collection1 extends javax.swing.JFrame {
/**
* Creates new form Collection1
*
*/
static int user_rights_binary=0;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
public Collection1() {
initComponents();
FillCombo();
FillAgentCombo();
setSize(1366,768);
//User_Rights();
setLocation(screenSize.width/2-getWidth()/2, screenSize.height/2-getHeight()/2);
setVisible(true);
name_combo2.setRenderer(new Collection1.Demo(name_combo2.getRenderer()));
agent_dropbox.setRenderer(new Collection1.Demo(agent_dropbox.getRenderer()));
jScrollPane2.getViewport().setBackground(new Color(116,121,180));
TableCellRenderer alteredColorRenderer = new AlterColor();
col_table2.setDefaultRenderer(Object.class, alteredColorRenderer);
headerColorAndWidth();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
/*public void User_Rights(){
//System.out.println(LoginPage.name);
try{
int a=1;
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://sql452.main-hosting.eu:3306/u159657273_bYz4P","u159657273_9OFDL","Vaishnavi$2801");
String selQuery="SELECT * FROM login_details where username=? and Admin=?";
PreparedStatement pst=con.prepareStatement(selQuery);
pst.setString(1,LoginPage.name);
pst.setInt(2,a);
ResultSet rs=pst.executeQuery();
if(rs.next()){
user_rights_binary=1;
}
else{
user_rights_binary=0;
}
//System.out.println(user_rights_binary);
}
catch (ClassNotFoundException ex) {
System.out.println(ex.getMessage());
} catch (SQLException ex) {
//Logger.getLogger(LoginPage.class.getName()).log(Level.SEVERE, null, ex);
}
}*/
public final void headerColorAndWidth(){
DefaultTableCellRenderer headerClr = new DefaultTableCellRenderer();
headerClr.setBackground(new Color(255, 138, 115));
// headerClr.setForeground(Color.decode("#FCE7FC"));
col_table2.setRowHeight(col_table2.getRowHeight()+20);
col_table2.getTableHeader().getColumnModel().getColumn(0).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(1).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(2).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(3).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(4).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(5).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(6).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(7).setHeaderRenderer(headerClr);
col_table2.getTableHeader().getColumnModel().getColumn(8).setHeaderRenderer(headerClr);
JTableHeader tableHeader = col_table2.getTableHeader();
tableHeader.setVisible(true);
tableHeader.setFont(new Font("Copperplate Gothic Bold",1, 14));
tableHeader.setOpaque(false);
tableHeader.setForeground(new Color(255,255,255));
TableColumn tc1=col_table2.getColumnModel().getColumn(0);
tc1.setPreferredWidth(100);
TableColumn tc2=col_table2.getColumnModel().getColumn(1);
tc2.setPreferredWidth(75);
TableColumn tc3=col_table2.getColumnModel().getColumn(2);
tc3.setPreferredWidth(20);
TableColumn tc4=col_table2.getColumnModel().getColumn(3);
tc4.setPreferredWidth(60);
TableColumn tc5=col_table2.getColumnModel().getColumn(4);
tc5.setPreferredWidth(100);
TableColumn tc6=col_table2.getColumnModel().getColumn(5);
tc6.setPreferredWidth(60);
TableColumn tc7=col_table2.getColumnModel().getColumn(6);
tc7.setPreferredWidth(15);
TableColumn tc8=col_table2.getColumnModel().getColumn(7);
tc8.setPreferredWidth(60);
TableColumn tc9=col_table2.getColumnModel().getColumn(8);
tc9.setPreferredWidth(100);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
party_name = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
date = new com.toedter.calendar.JDateChooser();
name_combobox = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
bill_number = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
days = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
amount = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
recd_date = new com.toedter.calendar.JDateChooser();
jLabel8 = new javax.swing.JLabel();
recd_amount = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
xs_days = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
gr_number = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
gr_date = new com.toedter.calendar.JDateChooser();
jLabel12 = new javax.swing.JLabel();
gr_amount = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
col_table = new javax.swing.JTable();
button_table_name = new javax.swing.JButton();
button_table_data = new javax.swing.JButton();
update_button = new javax.swing.JButton();
delete = new javax.swing.JButton();
amount_tf = new javax.swing.JTextField();
recd_amttf = new javax.swing.JTextField();
gr_amttf = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
update_party = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
outstanding_tf = new javax.swing.JTextField();
days_decided = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
PartyName2 = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
col_table2 = new javax.swing.JTable();
name_combo2 = new javax.swing.JComboBox<>();
jLabel20 = new javax.swing.JLabel();
order_date2 = new com.toedter.calendar.JDateChooser();
jLabel21 = new javax.swing.JLabel();
billNo2 = new javax.swing.JTextField();
jLabel22 = new javax.swing.JLabel();
days2 = new javax.swing.JTextField();
jLabel23 = new javax.swing.JLabel();
amt2 = new javax.swing.JTextField();
jLabel24 = new javax.swing.JLabel();
recd_date2 = new com.toedter.calendar.JDateChooser();
jLabel25 = new javax.swing.JLabel();
recd_amt2 = new javax.swing.JTextField();
xs_days2 = new javax.swing.JTextField();
jLabel26 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
gr_no2 = new javax.swing.JTextField();
jLabel28 = new javax.swing.JLabel();
gr_date2 = new com.toedter.calendar.JDateChooser();
jLabel29 = new javax.swing.JLabel();
gr_amt2 = new javax.swing.JTextField();
jLabel30 = new javax.swing.JLabel();
days_decd2 = new javax.swing.JTextField();
insert_data2 = new javax.swing.JButton();
update_details2 = new javax.swing.JButton();
delete_details2 = new javax.swing.JButton();
reset2 = new javax.swing.JButton();
jLabel31 = new javax.swing.JLabel();
amt_total = new javax.swing.JTextField();
recd_amt_total = new javax.swing.JTextField();
jLabel32 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
gr_amt_total = new javax.swing.JTextField();
jLabel34 = new javax.swing.JLabel();
outstanding = new javax.swing.JTextField();
jLabel35 = new javax.swing.JLabel();
agent_dropbox = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Collection");
setIconImage(new javax.swing.ImageIcon(getClass().getResource("Software_logo.jpeg")).getImage());
getContentPane().setLayout(null);
jPanel1.setBackground(new java.awt.Color(31, 35, 71));
jPanel1.setLayout(null);
jLabel1.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 36)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Collection ");
jPanel1.add(jLabel1);
jLabel1.setBounds(551, 13, 260, 41);
jLabel2.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Party Name:");
jPanel1.add(jLabel2);
jLabel2.setBounds(20, 30, 174, 28);
party_name.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
party_name.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
party_nameMouseClicked(evt);
}
});
party_name.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
party_nameActionPerformed(evt);
}
});
jPanel1.add(party_name);
party_name.setBounds(250, 30, 167, 34);
jLabel3.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Date:");
jPanel1.add(jLabel3);
jLabel3.setBounds(30, 160, 77, 28);
date.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
datePropertyChange(evt);
}
});
jPanel1.add(date);
date.setBounds(250, 160, 167, 20);
name_combobox.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
name_combobox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
name_comboboxActionPerformed(evt);
}
});
jPanel1.add(name_combobox);
name_combobox.setBounds(250, 100, 167, 34);
jLabel4.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Bill Number:");
jPanel1.add(jLabel4);
jLabel4.setBounds(30, 220, 183, 28);
bill_number.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
bill_number.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bill_numberActionPerformed(evt);
}
});
jPanel1.add(bill_number);
bill_number.setBounds(250, 220, 167, 34);
jLabel5.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Days:");
jPanel1.add(jLabel5);
jLabel5.setBounds(30, 280, 78, 28);
days.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(days);
days.setBounds(250, 280, 167, 34);
jLabel6.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Amount:");
jPanel1.add(jLabel6);
jLabel6.setBounds(30, 340, 118, 28);
amount.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(amount);
amount.setBounds(250, 340, 167, 34);
jLabel7.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("Recd Date:");
jPanel1.add(jLabel7);
jLabel7.setBounds(30, 400, 156, 28);
recd_date.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
recd_datePropertyChange(evt);
}
});
jPanel1.add(recd_date);
recd_date.setBounds(250, 400, 167, 20);
jLabel8.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Recd Amount:");
jPanel1.add(jLabel8);
jLabel8.setBounds(30, 450, 197, 28);
recd_amount.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(recd_amount);
recd_amount.setBounds(250, 450, 167, 34);
jLabel9.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("Excess Days:");
jPanel1.add(jLabel9);
jLabel9.setBounds(30, 500, 186, 28);
xs_days.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(xs_days);
xs_days.setBounds(250, 510, 167, 34);
jLabel10.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText("GR Number:");
jPanel1.add(jLabel10);
jLabel10.setBounds(30, 570, 167, 28);
gr_number.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(gr_number);
gr_number.setBounds(250, 570, 167, 34);
jLabel11.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setText("GR Date:");
jPanel1.add(jLabel11);
jLabel11.setBounds(30, 620, 126, 28);
gr_date.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
gr_datePropertyChange(evt);
}
});
jPanel1.add(gr_date);
gr_date.setBounds(250, 630, 167, 20);
jLabel12.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText("GR Amount:");
jPanel1.add(jLabel12);
jLabel12.setBounds(30, 690, 167, 28);
gr_amount.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(gr_amount);
gr_amount.setBounds(250, 680, 167, 34);
jLabel13.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel13.setForeground(new java.awt.Color(255, 255, 255));
jLabel13.setText("Days decided:");
jPanel1.add(jLabel13);
jLabel13.setBounds(28, 751, 197, 28);
col_table.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
col_table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Order date", "Bill Number", "Days", "Amount", "Recd Amt", "XS days", "GR Amount"
}
));
col_table.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
col_tableMouseClicked(evt);
}
});
jScrollPane1.setViewportView(col_table);
jPanel1.add(jScrollPane1);
jScrollPane1.setBounds(480, 70, 1255, 438);
button_table_name.setBackground(new java.awt.Color(255, 138, 115));
button_table_name.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
button_table_name.setText("INSERT PARTY NAME");
button_table_name.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button_table_nameActionPerformed(evt);
}
});
jPanel1.add(button_table_name);
button_table_name.setBounds(510, 540, 333, 37);
button_table_data.setBackground(new java.awt.Color(255, 138, 115));
button_table_data.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
button_table_data.setText("INSERT PARTY DATA ");
button_table_data.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
button_table_dataActionPerformed(evt);
}
});
jPanel1.add(button_table_data);
button_table_data.setBounds(510, 610, 335, 37);
update_button.setBackground(new java.awt.Color(255, 138, 115));
update_button.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
update_button.setText("UPDATE DETAILS");
update_button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
update_buttonActionPerformed(evt);
}
});
jPanel1.add(update_button);
update_button.setBounds(900, 540, 281, 37);
delete.setBackground(new java.awt.Color(255, 138, 115));
delete.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
delete.setText("DELETE DETAILS");
delete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteActionPerformed(evt);
}
});
jPanel1.add(delete);
delete.setBounds(900, 610, 277, 37);
amount_tf.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(amount_tf);
amount_tf.setBounds(1480, 600, 282, 34);
recd_amttf.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(recd_amttf);
recd_amttf.setBounds(1480, 670, 282, 34);
gr_amttf.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
gr_amttf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gr_amttfActionPerformed(evt);
}
});
jPanel1.add(gr_amttf);
gr_amttf.setBounds(1480, 730, 282, 34);
jButton1.setBackground(new java.awt.Color(255, 138, 115));
jButton1.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jButton1.setText("RESET DETAILS");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel1.add(jButton1);
jButton1.setBounds(910, 670, 257, 37);
jButton2.setBackground(new java.awt.Color(255, 138, 115));
jButton2.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jButton2.setText("DELETE PARTY");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel1.add(jButton2);
jButton2.setBounds(510, 670, 249, 37);
update_party.setBackground(new java.awt.Color(255, 138, 115));
update_party.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
update_party.setText("UPDATE PARTY");
update_party.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
update_partyActionPerformed(evt);
}
});
jPanel1.add(update_party);
update_party.setBounds(510, 730, 255, 37);
jLabel14.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel14.setForeground(new java.awt.Color(255, 255, 255));
jLabel14.setText("Outstanding:");
jPanel1.add(jLabel14);
jLabel14.setBounds(1250, 540, 192, 28);
outstanding_tf.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
jPanel1.add(outstanding_tf);
outstanding_tf.setBounds(1480, 540, 282, 34);
days_decided.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 24)); // NOI18N
days_decided.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
days_decidedActionPerformed(evt);
}
});
jPanel1.add(days_decided);
days_decided.setBounds(250, 740, 167, 34);
jLabel15.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel15.setForeground(new java.awt.Color(255, 255, 255));
jLabel15.setText("Amount Total:");
jPanel1.add(jLabel15);
jLabel15.setBounds(1250, 600, 208, 28);
jLabel16.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setText("Recd Amt Total:");
jPanel1.add(jLabel16);
jLabel16.setBounds(1230, 670, 232, 36);
jLabel17.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 24)); // NOI18N
jLabel17.setForeground(new java.awt.Color(255, 255, 255));
jLabel17.setText("GR Amount Total:");
jPanel1.add(jLabel17);
jLabel17.setBounds(1210, 730, 257, 28);
getContentPane().add(jPanel1);
jPanel1.setBounds(1415, 0, 0, 850);
jPanel2.setBackground(new java.awt.Color(31, 35, 71));
jPanel2.setLayout(null);
jLabel18.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 36)); // NOI18N
jLabel18.setForeground(new java.awt.Color(255, 255, 255));
jLabel18.setText("Collection");
jPanel2.add(jLabel18);
jLabel18.setBounds(630, 10, 249, 41);
jLabel19.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel19.setForeground(new java.awt.Color(255, 255, 255));
jLabel19.setText("Party Name:");
jPanel2.add(jLabel19);
jLabel19.setBounds(10, 20, 180, 20);
PartyName2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
PartyName2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
PartyName2ActionPerformed(evt);
}
});
jPanel2.add(PartyName2);
PartyName2.setBounds(220, 20, 210, 30);
col_table2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 14)); // NOI18N
col_table2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Bill Dt", "Bill No", "Days", "Amt", "Rcd Dt", "Rcd Amt", "XS", "GR Amt", "Agent"
}
));
col_table2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
col_table2MouseClicked(evt);
}
});
jScrollPane2.setViewportView(col_table2);
jPanel2.add(jScrollPane2);
jScrollPane2.setBounds(450, 60, 890, 402);
name_combo2.setBackground(new java.awt.Color(249, 173, 129));
name_combo2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
name_combo2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "---select party---" }));
name_combo2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
name_combo2ActionPerformed(evt);
}
});
jPanel2.add(name_combo2);
name_combo2.setBounds(220, 60, 210, 27);
jLabel20.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel20.setForeground(new java.awt.Color(255, 255, 255));
jLabel20.setText("Bill Date:");
jPanel2.add(jLabel20);
jLabel20.setBounds(10, 160, 180, 21);
order_date2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
order_date2PropertyChange(evt);
}
});
jPanel2.add(order_date2);
order_date2.setBounds(220, 160, 210, 30);
jLabel21.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel21.setForeground(new java.awt.Color(255, 255, 255));
jLabel21.setText("Bill Number:");
jPanel2.add(jLabel21);
jLabel21.setBounds(10, 210, 190, 21);
billNo2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(billNo2);
billNo2.setBounds(220, 200, 210, 30);
jLabel22.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel22.setForeground(new java.awt.Color(255, 255, 255));
jLabel22.setText("Days:");
jPanel2.add(jLabel22);
jLabel22.setBounds(10, 250, 160, 21);
days2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(days2);
days2.setBounds(220, 240, 210, 30);
jLabel23.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel23.setForeground(new java.awt.Color(255, 255, 255));
jLabel23.setText("Amount:");
jPanel2.add(jLabel23);
jLabel23.setBounds(10, 300, 140, 21);
amt2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(amt2);
amt2.setBounds(220, 300, 210, 27);
jLabel24.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel24.setForeground(new java.awt.Color(255, 255, 255));
jLabel24.setText("Recieved Date:");
jPanel2.add(jLabel24);
jLabel24.setBounds(10, 350, 220, 21);
recd_date2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
recd_date2PropertyChange(evt);
}
});
jPanel2.add(recd_date2);
recd_date2.setBounds(220, 340, 210, 30);
jLabel25.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel25.setForeground(new java.awt.Color(255, 255, 255));
jLabel25.setText("Recieved Amount:");
jPanel2.add(jLabel25);
jLabel25.setBounds(10, 400, 260, 21);
recd_amt2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(recd_amt2);
recd_amt2.setBounds(220, 390, 210, 27);
xs_days2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(xs_days2);
xs_days2.setBounds(220, 440, 210, 27);
jLabel26.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel26.setForeground(new java.awt.Color(255, 255, 255));
jLabel26.setText("Excess Days:");
jPanel2.add(jLabel26);
jLabel26.setBounds(10, 440, 210, 21);
jLabel27.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel27.setForeground(new java.awt.Color(255, 255, 255));
jLabel27.setText("Gr Number:");
jPanel2.add(jLabel27);
jLabel27.setBounds(10, 490, 190, 21);
gr_no2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(gr_no2);
gr_no2.setBounds(220, 490, 210, 27);
jLabel28.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel28.setForeground(new java.awt.Color(255, 255, 255));
jLabel28.setText("GR Date:");
jPanel2.add(jLabel28);
jLabel28.setBounds(10, 540, 160, 21);
gr_date2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
gr_date2PropertyChange(evt);
}
});
jPanel2.add(gr_date2);
gr_date2.setBounds(220, 540, 210, 30);
jLabel29.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel29.setForeground(new java.awt.Color(255, 255, 255));
jLabel29.setText("GR Amount:");
jPanel2.add(jLabel29);
jLabel29.setBounds(10, 580, 200, 21);
gr_amt2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(gr_amt2);
gr_amt2.setBounds(220, 580, 210, 27);
jLabel30.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel30.setForeground(new java.awt.Color(255, 255, 255));
jLabel30.setText("Days Decided:");
jPanel2.add(jLabel30);
jLabel30.setBounds(10, 640, 210, 21);
days_decd2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(days_decd2);
days_decd2.setBounds(220, 630, 210, 27);
insert_data2.setBackground(new java.awt.Color(255, 138, 115));
insert_data2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
insert_data2.setText("Insert Party Data");
insert_data2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
insert_data2ActionPerformed(evt);
}
});
jPanel2.add(insert_data2);
insert_data2.setBounds(460, 490, 250, 29);
update_details2.setBackground(new java.awt.Color(255, 138, 115));
update_details2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
update_details2.setText("Update Details");
update_details2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
update_details2ActionPerformed(evt);
}
});
jPanel2.add(update_details2);
update_details2.setBounds(460, 530, 250, 29);
delete_details2.setBackground(new java.awt.Color(255, 138, 115));
delete_details2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
delete_details2.setText("Delete Details");
delete_details2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
delete_details2ActionPerformed(evt);
}
});
jPanel2.add(delete_details2);
delete_details2.setBounds(460, 570, 250, 29);
reset2.setBackground(new java.awt.Color(255, 138, 115));
reset2.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
reset2.setText("Reset");
reset2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
reset2ActionPerformed(evt);
}
});
jPanel2.add(reset2);
reset2.setBounds(460, 610, 250, 25);
jLabel31.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel31.setForeground(new java.awt.Color(255, 255, 255));
jLabel31.setText("Amount Total:");
jPanel2.add(jLabel31);
jLabel31.setBounds(870, 480, 170, 21);
amt_total.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(amt_total);
amt_total.setBounds(1040, 480, 180, 27);
recd_amt_total.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(recd_amt_total);
recd_amt_total.setBounds(1040, 520, 180, 27);
jLabel32.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel32.setForeground(new java.awt.Color(255, 255, 255));
jLabel32.setText("Recd Amt Total:");
jPanel2.add(jLabel32);
jLabel32.setBounds(850, 520, 200, 21);
jLabel33.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel33.setForeground(new java.awt.Color(255, 255, 255));
jLabel33.setText("GR Amt Total:");
jPanel2.add(jLabel33);
jLabel33.setBounds(850, 560, 180, 21);
gr_amt_total.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(gr_amt_total);
gr_amt_total.setBounds(1040, 560, 180, 27);
jLabel34.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel34.setForeground(new java.awt.Color(255, 255, 255));
jLabel34.setText("Outstanding:");
jPanel2.add(jLabel34);
jLabel34.setBounds(850, 600, 170, 21);
outstanding.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
jPanel2.add(outstanding);
outstanding.setBounds(1040, 600, 180, 27);
jLabel35.setFont(new java.awt.Font("Copperplate Gothic Bold", 1, 18)); // NOI18N
jLabel35.setForeground(new java.awt.Color(255, 255, 255));
jLabel35.setText("Agent:");
jPanel2.add(jLabel35);
jLabel35.setBounds(10, 110, 100, 21);
agent_dropbox.setBackground(new java.awt.Color(249, 173, 129));
agent_dropbox.setFont(new java.awt.Font("Copperplate Gothic Bold", 0, 18)); // NOI18N
agent_dropbox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "---select agent---" }));
jPanel2.add(agent_dropbox);
agent_dropbox.setBounds(220, 110, 210, 27);
getContentPane().add(jPanel2);
jPanel2.setBounds(0, 0, 1370, 770);
pack();
}// </editor-fold>//GEN-END:initComponents
private void button_table_nameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_table_nameActionPerformed
// TODO add your handling code here:
/*String addValue=PartyName2.getText().toUpperCase();
jComboBox1.addItem(addValue);
PartyName2.setText("");
if(PartyName2.getText().isEmpty()){
new PartyName_FieldEmpty();
}
else{
if(b.signIn.getIsAdmin()){
try{
//Class.forName("com.mysql.cj.jdbc.Driver");
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con;
con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/database","root","Medadmom@123");
String nameOfParty= PartyName2.getText().trim().toUpperCase();
String sql="select PartyName from party_table";
PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
int count=0;
while(rs.next()){
String stringToCompare = rs.getString("PartyName");
if(nameOfParty.equals(stringToCompare)){
count++;
}
}
if(count==0){
String query="insert into party_table(PartyName) values(?)";
PreparedStatement pst1=con.prepareStatement(query);
pst1.setString(1,PartyName2.getText().toUpperCase());
pst1.executeUpdate();
FillCombo();
new InsertedSuccessfully();
}
else{
new PrartyName_Repeat();
}
/*else if(PartyName2.getText().trim().isEmpty())
{
JOptionPane.showMessageDialog(this,"Null values cannot be inserted");
}
//PartyName2.setText("");
}
//PartyName2.setText("");
catch (ClassNotFoundException | SQLException e) {
System.out.println(e.getMessage());
}
}
else{
new Not_Admin();
}
}*/
}//GEN-LAST:event_button_table_nameActionPerformed
public void FillCombo(){
DefaultComboBoxModel model = new DefaultComboBoxModel();
model.setSelectedItem("---select party---");
try{
Connection con=null;
con=ConnectionManager.getConnection();
String sql="select DISTINCT PartyName from party_table";
PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
Set<String> partyNames = new HashSet<>();
while(rs.next()){
String name=rs.getString("PartyName");
partyNames.add(name);
}
ArrayList<String> partyList = new ArrayList<>(partyNames);
java.util.Collections.sort(partyList);
for(String agent: partyList){
model.addElement(agent);
}
name_combo2.setModel(model);
}
catch (ClassNotFoundException | SQLException e) {
System.out.println(e.getMessage());
}
}
public void FillAgentCombo(){
DefaultComboBoxModel model = new DefaultComboBoxModel();
model.setSelectedItem("---select agent---");
try{
Connection con=null;
con=ConnectionManager.getConnection();
String sql="select DISTINCT agent1,agent2,agent3 from party_details";
PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs=pst.executeQuery();
Set<String> agentNames = new HashSet<>();
while(rs.next()){
String name1=rs.getString("agent1");
String name2=rs.getString("agent2");
String name3=rs.getString("agent3");
if(name1 == null ? String.valueOf(0) != null : !name1.equals(String.valueOf(0))){
agentNames.add(name1);
}
if(name2 == null ? String.valueOf(0) != null : !name2.equals(String.valueOf(0))){
agentNames.add(name2);
}
if(name3 == null ? String.valueOf(0) != null : !name3.equals(String.valueOf(0))){
agentNames.add(name3);
}
}
ArrayList<String> agentList = new ArrayList<>(agentNames);
java.util.Collections.sort(agentList);
// for(String agent: agentList)
// System.out.println(agent);
for(String agent: agentList){
model.addElement(agent);
}
agent_dropbox.setModel(model);
//con.close();
//pst.close();
}
catch (ClassNotFoundException | SQLException e) {
System.out.println(e.getMessage());
}
}
private void name_comboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_name_comboboxActionPerformed
// TODO add your handling code here:
//FillCombo();
/*if(name_combo2.getSelectedItem().toString().isEmpty()==false){
String selectedValue=name_combo2.getSelectedItem().toString();
PartyName2.setText(selectedValue);
show_user();
}*/
}//GEN-LAST:event_name_comboboxActionPerformed
private void datePropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_datePropertyChange
/*try{
if(recd_date2.getDate().toString().isEmpty()==false && order_date2.getDate().toString().isEmpty()==false){
SimpleDateFormat format=new SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH);
java.util.Date orderedDate=order_date2.getDate();
java.util.Date recievedDate=recd_date2.getDate();
if(recievedDate.compareTo(orderedDate)!=-1){
Long diffTime=Math.abs(recievedDate.getTime()- orderedDate.getTime());
long diffDays = TimeUnit.DAYS.convert(diffTime, TimeUnit.MILLISECONDS);
days2.setText(diffDays+"");
}
else{
JOptionPane.showMessageDialog(null,"Recieved order_date2 can't be smaller than Date");
}
}
}