-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMENDOZA_ELGA.java
2124 lines (1663 loc) · 67 KB
/
MENDOZA_ELGA.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 javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.stream.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.applet.*;
import java.io.*;
public class MENDOZA_ELGA extends JFrame implements ActionListener
{
//////////////////////////////////////*****LOG IN PANEL******////////////////////////////////////////
JPanel logIn = new JPanel();
JLabel JL1,JL2, logo,logo2;
JTextField JT1;
JPasswordField JP1;
JButton JB1, JB2;
JLabel copy = new JLabel("Copyright © 2018 Ayush Srivastava - Chandigarh University");
JLabel right = new JLabel("Copyright © 2018 Ayush Srivastava - Chandigarh University");
JLabel copyright = new JLabel("Copyright © 2018 Ayush Srivastava - Chandigarh University");
//////////////////////////////////////*****LOG IN PANEL******////////////////////////////////////////
//////////////////////////////////////*****MENU PANEL******////////////////////////////////////////
JPanel menus = new JPanel();
JLabel banner = new JLabel(new ImageIcon(getClass().getResource("banner.jpg")));
JPanel forButtons = new JPanel();
JButton buttons[] = {new JButton("PURCHASE"),
new JButton("INVENTORY"),
new JButton("SALES REPORT"),
new JButton("ADMIN")};
JButton logOut = new JButton("LOG OUT");
//////////////////////////////////////*****MENU PANEL******////////////////////////////////////////
//////////////////////////////////////*****PURCHASE PANEL******////////////////////////////////////////
JPanel cashRegister = new JPanel();
JPanel categoriesPanel = new JPanel();
JPanel numericPanel = new JPanel();
JPanel menuPanel = new JPanel();
JScrollPane scrollPane;
JTextArea summaryField;
JLabel orderLabel,totalLabel,paymentLabel,changeLabel,neymLabel,stakLabel;
JTextField orderField,totalField,paymentField,changeField,neymField,stakField;
JButton categoriesButton[] = {new JButton("RICE MEALS"),
new JButton("SIZZLING RICE MEALS"),
new JButton("PASTA & SANDWICHES"),
new JButton("CRAVINGS"),
new JButton("MUST TRY!"),
new JButton("FRENCH FRIES"),
new JButton("DRINKS"),
new JButton("ICE BLENDED DRINKS"),
new JButton("NEW PRODUCT")};
JButton numericButton[] = {new JButton("1"),
new JButton("2"),
new JButton("3"),
new JButton("4"),
new JButton("5"),
new JButton("6"),
new JButton("7"),
new JButton("8"),
new JButton("9"),
new JButton("0"),
new JButton("."),
new JButton("CLEAR"),
new JButton("ENTER"),
new JButton("CANCEL"),
new JButton("PAY")};
JButton menuButton[] = {new JButton("NEXT TRANSACTION"),//menuButton[0]
new JButton("VOID"), //menuButton[1]
new JButton("CONTACT US"), //menuButton[2]
new JButton("BACK")};//menuButton[3]
JPanel p[] = {new JPanel(),new JPanel(),new JPanel(),new JPanel(),new JPanel(),new JPanel(),new JPanel(),new JPanel(),new JPanel()};
//////////////////////////////////////*****PRODUCTS PANEL 1******////////////////////////////////////////
JButton prodButton1[] = {new JButton("PHILLY CHEESE STEAK - PHP 79"),
new JButton("BEEF JERKY - PHP 79"),
new JButton("BUFFALO CHICKEN - PHP 79"),
new JButton("CHICKEN TEREYAKI - PHP 79")};
//////////////////////////////////////*****PRODUCTS PANEL 1******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 2******////////////////////////////////////////
JButton prodButton2[] = {new JButton("BEEF SALPICAO - PHP 89"),
new JButton("CRISPY CHICKEN - PHP 89"),
new JButton("PORK SISIG W/ EGG - PHP 89"),
new JButton("PORK LIEMPO - PHP 89")};
//////////////////////////////////////*****PRODUCTS PANEL 2******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 3******////////////////////////////////////////
JButton prodButton3[] = {new JButton("PASTA BOLOGNESE - PHP 69"),
new JButton("CREAMY PESTO - PHP 69"),
new JButton("PASTA ALFREDO - PHP 69"),
new JButton("BACON & EGG SANDWICH - PHP 49"),
new JButton("SPAM & EGG SANDWICH - PHP 55")};
//////////////////////////////////////*****PRODUCTS PANEL 3******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 4******////////////////////////////////////////
JButton prodButton4[] = {new JButton("MOZZARELLA POTATO BALLS - PHP 59"),
new JButton("MOZZARELLA POCKETS - PHP 59"),
new JButton("CHEESY FRIES - PHP 59"),
new JButton("CHICKEN NUGGETS - PHP 59")};
//////////////////////////////////////*****PRODUCTS PANEL 4******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 5******////////////////////////////////////////
JButton prodButton5[] = {new JButton("HASHBROWN - PHP 29"),
new JButton("TWISTER FRIES - PHP 49")};
//////////////////////////////////////*****PRODUCTS PANEL 5******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 6******////////////////////////////////////////
JButton prodButton6[] = {new JButton("SOLO - PHP 35"),
new JButton("UPSIZE - PHP 59")};
//////////////////////////////////////*****PRODUCTS PANEL 6******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 7******////////////////////////////////////////
JButton prodButton7[] = {new JButton("22OZ ICED TEA - PHP 25"),
new JButton("ICED COFFEE - PHP 49"),
new JButton("ICED COFFEE VANILLA - PHP 49"),
new JButton("ICED MOCHA - PHP 49"),
new JButton("BOTTLED WATER - PHP 20")};
//////////////////////////////////////*****PRODUCTS PANEL 7******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 8******////////////////////////////////////////
JButton prodButton8[] = {new JButton("PINK PERFECTION - PHP 69"),
new JButton("CHUNKY MONKEY - PHP 59"),
new JButton("MOCHA LOCA - PHP 59")};
//////////////////////////////////////*****PRODUCTS PANEL 8******////////////////////////////////////////
//////////////////////////////////////*****PRODUCTS PANEL 9******////////////////////////////////////////
JButton prodButton9[] = {new JButton("POTPOTS SOLO - PHP 35"),
new JButton("POTPOTS UPSIZE - PHP 59"),
new JButton("Biryani - PHP 150"),
new JButton("NEW PRODUCT 1"),
new JButton("NEW PRODUCT 2"),
new JButton("NEW PRODUCT 3")};
//////////////////////////////////////*****PRODUCTS PANEL 9******////////////////////////////////////////
String num[] = {"1","2","3","4","5","6","7","8","9","0","."};
//////////////////////////////////////*****PURCHASE PANEL******////////////////////////////////////////
//////////////////////////////////////*****SALES REPORT PANEL******////////////////////////////////////////
JPanel salesPanel8 = new JPanel();
JLabel salesLabel8,grossLabel8,transactLabel8; JTextField grossField8,transactField8; JTextArea summaryField8; JScrollPane scrollPane8; JButton backButton8;
//////////////////////////////////////*****SALES REPORT PANEL PANEL******////////////////////////////////////////
//////////////////////////////////////*****INVENTORY PANEL******////////////////////////////////////////
JPanel inventoryPanel = new JPanel();
//JPanel menuPanel2 = new JPanel();
JLabel inventoryLabel; JTextArea summaryField3; JScrollPane scrollPane3; JButton backButton2;
//JButton menuButton2[] = {new JButton("ADD STOCKS"), new JButton("EDIT PRICE")};
Scanner i,i2;
PrintWriter wrfile,wrfile2;
String prodId[] = new String[200];
String prodName[] = new String[200];
double prodSales[] = new double[200];
String prodSaless[] = new String[200];
int prodPrice[] = new int[200];
int prodStocks[] = new int[200];
String prodStockss[] = new String[200];
double totalSales;
String prodPrices[] = new String[200];
String newStocks2s[] = new String[200];
int beks=0;
String truelaloo;
int itemSold[] = new int[200];
String itemSolds[] = new String[200];
int newStocks2[] = new int[200];
int newStocks[] = new int[200];
int Norder[] = new int[200];
int b=-1;
int c=-1;
String id;
int order =0; int transaction=0;
double total;
double newtimes[] = new double[200];
double payment;
double gross;
String[] itemline = new String[1000];
String[] itemlines = new String[100];
String itemline2[] = new String[10000];
String itemline3;
int t[] = new int[9000];
int tr;
String d1[] = new String[9000];
String d2[] = new String[9000];
double s[] = new double[9000];
double sum;
int jadine=30;
public void openFile()
{
try{
i = new Scanner(new FileReader("inventory1.txt"));
}
catch(IOException e){
System.out.println("could not find file");
}
}
public void writeFile()
{
try{
wrfile = new PrintWriter(new FileWriter("inventory1.txt"));
}
catch(IOException e){
System.out.println("could not find file");
}
}
public void readFile()
{
while(i.hasNext())
{
++b;
prodId[b] = i.next();
prodName[b] = i.next();
beks = Integer.parseInt(prodId[b]);
prodPrices[b] = i.next();
prodPrice[b] = Integer.parseInt(prodPrices[b]);
prodStockss[b] = i.next();
prodStocks[b] = Integer.parseInt(prodStockss[b]);
itemSolds[b] = i.next();
itemSold[b] = Integer.parseInt(itemSolds[b]);
newStocks2s[b] = i.next();
newStocks2[b] = Integer.parseInt(newStocks2s[b]);
prodSaless[b] = i.next();
prodSales[b] = Double.parseDouble(prodSaless[b]);
}
}
public void printInventory()
{
summaryField3.setText("=====================================================================================================================================================\nPROD. ID\t \t\t\tPROD. NAME\t\t\tINITIAL STOCKS\tITEM SOLD\t STOCKS LEFT\n=====================================================================================================================================================\n");
for(int x =0; x<=(beks-1); x++)
{
itemline[x] = prodId[x] + "\t" + prodName[x] + "\t" + prodPrices[x] + "\t" + prodStockss[x] + "\t" + itemSolds[x]+ "\t" + newStocks2s[x]+ "\t" + prodSaless[x];
wrfile.println(itemline[x]);
summaryField3.append(""+prodId[x]+"\t \t\t\t"+prodName[x]+"\t\t"+prodStockss[x]+"\t\t"+itemSolds[x]+"\t\t"+newStocks2s[x]+"\n");
}
}
public void printAdmin()
{
productList.setText("====================================================================\nID\tNAME\t\tSTOCKS\tPRICE\n====================================================================\n");
for(int x =0; x<=(beks-1); x++)
{
itemline[x] = prodId[x] + "\t" + prodName[x] + "\t" + prodPrices[x] + "\t" + prodStockss[x] + "\t" + itemSolds[x]+ "\t" + newStocks2s[x]+ "\t" + prodSaless[x];
wrfile.println(itemline[x]);
itemlines[x]=""+prodId[x]+"\t"+prodName[x]+"\t"+newStocks2s[x]+"\t"+prodPrices[x]+"\n";
productList.append(""+itemlines[x]);
}
}
public void printSalesReport()
{
summaryField8.setText("=====================================================================================================================================================\nPROD. ID\t \t\t\tPROD. NAME\t\t\tPRICE\t ITEM SOLD\t SALES\n=====================================================================================================================================================\n");
for(int x =0; x<=(beks-1); x++)
{
summaryField8.append(""+prodId[x]+"\t \t\t\t"+prodName[x]+"\t\t"+prodPrices[x]+"\t\t"+itemSolds[x]+"\t\t"+prodSaless[x]+"\n");
}
}
public void closeFile1()
{
i.close();
}
public void closeFile2()
{
wrfile.close();
}
public void totalSales()
{
totalSales = prodSales[0]+prodSales[1]+prodSales[2]+prodSales[3]+prodSales[4]+prodSales[5]+prodSales[6]+prodSales[7]+prodSales[7]+prodSales[9]+prodSales[10]+prodSales[11]+prodSales[12]+prodSales[13]+prodSales[14]+prodSales[15]+prodSales[16]+prodSales[17]+prodSales[18]+prodSales[19]+prodSales[20]+prodSales[21]+prodSales[22]+prodSales[23]+prodSales[24]+prodSales[25]+prodSales[26]+prodSales[27]+prodSales[28]+prodSales[29]+prodSales[30]+prodSales[31]+prodSales[32]+prodSales[33]+prodSales[34];
grossField8.setText(""+totalSales);
}
//////////////////////////////////////*****INVENTORY PANEL******////////////////////////////////////////
//////////////////////////////////////////////ADMIN PANEL//////////////////////////////////////////////////////////
JPanel adminPanel = new JPanel();
JTextArea productList;
JScrollPane productScroll;
JPanel optionsPanel = new JPanel();
JButton options[] = {new JButton("ADD"),
new JButton("EDIT"),
new JButton("DELETE"),
new JButton("CANCEL")};
JLabel nameLabel,stockLabel,priceLabel;
JTextField nameField,stockField,priceField;
JButton okButton,beckButton;
String pidmo;
//////////////////////////////////////////////ADMIN PANEL//////////////////////////////////////////////////////////
AudioClip error = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("error.wav"));
AudioClip numeric = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("numeric.wav"));
AudioClip intro = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("intro.wav"));
AudioClip welcome = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("welcome.wav"));
AudioClip chaching = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("chaching.wav"));
AudioClip m1 = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("m1.wav"));
AudioClip m2 = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("m2.wav"));
AudioClip m3 = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("m3.wav"));
AudioClip m4 = JApplet.newAudioClip(MENDOZA_ELGA.class.getResource("admin.wav"));
Font font1 = new Font ("Trebuchet MS", Font.BOLD, 15);
Font font2 = new Font ("Trebuchet MS", Font.BOLD, 30);
Font font3 = new Font ("Trebuchet MS", Font.BOLD, 15);
Color Red = new Color (136, 0, 21);
Color Blue = new Color (0, 64, 64);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd/ HH:mm:ss");
Date date = new Date();
Container C = getContentPane();
public MENDOZA_ELGA()
{
C.setLayout(null);
C.setBackground(Red);
setIconImage(Toolkit.getDefaultToolkit().getImage("logo.png"));
//////////////////////////////////////*****LOG IN PANEL******////////////////////////////////////////
logIn.setLayout(null);
C.add(logIn);
logIn.setBackground(Red);
logo = new JLabel();
logIn.add(logo);
logo.setIcon(new ImageIcon(getClass().getResource("logo.png")));
JL1 = new JLabel("USERNAME:");
logIn.add(JL1);
JT1 = new JTextField(8);
logIn.add(JT1);
JL2 = new JLabel("PASSWORD:");
logIn.add(JL2);
JP1 = new JPasswordField(8);
logIn.add(JP1);
JB1 = new JButton("LOG-IN");
logIn.add(JB1);
logIn.add(right);
JP1.addActionListener(this);
JB1.addActionListener(this);
logo.setBounds(543,120,225,225);
JL1.setBounds(495,375,200,30);
JT1.setBounds(685,375,140,25);
JL2.setBounds(495,410,200,30);
JP1.setBounds(685,410,140,25);
JB1.setBounds(610,460,100,25);
logIn.setBounds(0,0,1364,727);
right.setBounds(5,670,500,30);
JL1.setFont(font1);
JT1.setFont(font1);
JL2.setFont(font1);
JP1.setFont(font1);
JB1.setFont(font1);
right.setFont(font1);
JL1.setForeground(Color.ORANGE);
JL2.setForeground(Color.ORANGE);
JB1.setBackground(Blue);
JB1.setForeground(Color.ORANGE);
right.setForeground(Color.ORANGE);
logIn.setVisible(true);
//////////////////////////////////////*****LOG IN PANEL******////////////////////////////////////////
//////////////////////////////////////*****MENU PANEL******////////////////////////////////////////
menus.setLayout(null);
menus.setBackground(Red);
forButtons.setLayout(new GridLayout(1,3));
C.add(menus);
menus.add(forButtons);
menus.add(banner);
for(int x = 0; x < buttons.length; x++)
{
forButtons.add(buttons[x]);
buttons[x].addActionListener(this);
buttons[x].setBackground(Blue);
buttons[x].setForeground(Color.ORANGE);
buttons[x].setFont(font3);
}
menus.add(logOut);
menus.add(copy);
logOut.addActionListener(this);
logOut.setBackground(Blue);
logOut.setForeground(Color.ORANGE);
copy.setForeground(Color.ORANGE);
logOut.setFont(font3);
copy.setFont(font1);
banner.setBounds(430,150,500,230);
forButtons.setBounds(330,400,690,50);
menus.setBounds(0,0,1364,727);
logOut.setBounds(1120,610,230,80);
copy.setBounds(5,670,500,30);
menus.setVisible(false);
//////////////////////////////////////*****MENU PANEL******////////////////////////////////////////
//////////////////////////////////////*****PURCHASE PANEL******////////////////////////////////////////
cashRegister.setLayout(null);
categoriesPanel.setLayout(new GridLayout(3,3));
numericPanel.setLayout(new GridLayout(5,3));
menuPanel.setLayout(new GridLayout(2,3));
C.add(cashRegister);
cashRegister.setBackground(Red);
categoriesPanel.setBackground(Red);
numericPanel.setBackground(Red);
menuPanel.setBackground(Red);
/////////****CATEGORIES****//////////
for(int x = 0; x < categoriesButton.length; x++)
{
categoriesPanel.add(categoriesButton[x]);
categoriesButton[x].addActionListener(this);
categoriesButton[x].setBackground(Red);
categoriesButton[x].setForeground(Color.ORANGE);
categoriesButton[x].setFont(font3);
}
/////////****CATEGORIES****//////////
/////////****PRODUCTS****//////////
p[0].setLayout(new GridLayout(2,2));
p[1].setLayout(new GridLayout(2,2));
p[2].setLayout(new GridLayout(3,2));
p[3].setLayout(new GridLayout(2,2));
p[4].setLayout(new GridLayout(1,2));
p[5].setLayout(new GridLayout(2,2));
p[6].setLayout(new GridLayout(3,2));
p[7].setLayout(new GridLayout(1,3));
p[8].setLayout(new GridLayout(2,2));
for(int x = 0; x < p.length; x++)
{
p[x].setBackground(Red);
}
for(int x = 0; x < prodButton1.length; x++)
{
p[0].add(prodButton1[x]);
prodButton1[x].addActionListener(this);
prodButton1[x].setBackground(Red);
prodButton1[x].setForeground(Color.ORANGE);
prodButton1[x].setFont(font3);
}
for(int x = 0; x < prodButton2.length; x++)
{
p[1].add(prodButton2[x]);
prodButton2[x].addActionListener(this);
prodButton2[x].setBackground(Red);
prodButton2[x].setForeground(Color.ORANGE);
prodButton2[x].setFont(font3);
}
for(int x = 0; x < prodButton3.length; x++)
{
p[2].add(prodButton3[x]);
prodButton3[x].addActionListener(this);
prodButton3[x].setBackground(Red);
prodButton3[x].setForeground(Color.ORANGE);
prodButton3[x].setFont(font3);
}
for(int x = 0; x < prodButton4.length; x++)
{
p[3].add(prodButton4[x]);
prodButton4[x].addActionListener(this);
prodButton4[x].setBackground(Red);
prodButton4[x].setForeground(Color.ORANGE);
prodButton4[x].setFont(font3);
}
for(int x = 0; x < prodButton5.length; x++)
{
p[4].add(prodButton5[x]);
prodButton5[x].addActionListener(this);
prodButton5[x].setBackground(Red);
prodButton5[x].setForeground(Color.ORANGE);
prodButton5[x].setFont(font3);
}
for(int x = 0; x < prodButton6.length; x++)
{
p[5].add(prodButton6[x]);
prodButton6[x].addActionListener(this);
prodButton6[x].setBackground(Red);
prodButton6[x].setForeground(Color.ORANGE);
prodButton6[x].setFont(font3);
}
for(int x = 0; x < prodButton7.length; x++)
{
p[6].add(prodButton7[x]);
prodButton7[x].addActionListener(this);
prodButton7[x].setBackground(Red);
prodButton7[x].setForeground(Color.ORANGE);
prodButton7[x].setFont(font3);
}
for(int x = 0; x < prodButton8.length; x++)
{
p[7].add(prodButton8[x]);
prodButton8[x].addActionListener(this);
prodButton8[x].setBackground(Red);
prodButton8[x].setForeground(Color.ORANGE);
prodButton8[x].setFont(font3);
}
for(int x = 0; x < prodButton9.length; x++)
{
p[8].add(prodButton9[x]);
prodButton9[x].addActionListener(this);
prodButton9[x].setBackground(Red);
prodButton9[x].setForeground(Color.ORANGE);
prodButton9[x].setFont(font3);
}
for(int x = 0; x < p.length; x++)
{
cashRegister.add(p[x]);
}
for(int x = 0; x < p.length; x++)
{
p[x].setVisible(false);
}
for(int x = 0; x < p.length; x++)
{
p[x].setBounds(0,0,690,321);
}
/////////****PRODUCTS****//////////
for(int x = 0; x < numericButton.length; x++)
{
numericPanel.add(numericButton[x]);
numericButton[x].addActionListener(this);
numericButton[x].setBackground(Blue);
numericButton[x].setForeground(Color.ORANGE);
numericButton[x].setFont(font2);
numericButton[x].setEnabled(false);
}
for(int x = 0; x < menuButton.length; x++)
{
menuPanel.add(menuButton[x]);
menuButton[x].addActionListener(this);
menuButton[x].setBackground(Blue);
menuButton[x].setForeground(Color.ORANGE);
menuButton[x].setFont(font3);
}
cashRegister.add(categoriesPanel);
cashRegister.add(numericPanel);
cashRegister.add(menuPanel);
scrollPane = new JScrollPane();
cashRegister.add(scrollPane);
summaryField = new JTextArea(20,20);
cashRegister.add(summaryField);
scrollPane.setViewportView(summaryField);
summaryField.setEditable(false);
summaryField.append("============================================================================================\n");
summaryField.append("\t\t\t FOOD CORT\n");
summaryField.append("\t\t\t"+dateFormat.format(date));
summaryField.append("\n\t\t\tOFFICIAL RECEIPT");
summaryField.append("\n============================================================================================\n");
summaryField.append("PROD ID.\t QTY.\t\t PRODUCT \t\tPRICE\t AMOUNT\n");
summaryField.setForeground(Color.ORANGE);
summaryField.setBackground(Color.BLACK);
neymLabel = new JLabel("NAME:");
cashRegister.add(neymLabel);
neymField = new JTextField(10);
cashRegister.add(neymField);
neymField.setEditable(false);
stakLabel = new JLabel("STOCKS:");
cashRegister.add(stakLabel);
stakField = new JTextField(10);
cashRegister.add(stakField);
stakField.setEditable(false);
orderLabel = new JLabel("ORDER:");
cashRegister.add(orderLabel);
orderField = new JTextField(10);
cashRegister.add(orderField);
orderField.setEnabled(false);
orderField.setEditable(false);
totalLabel = new JLabel("TOTAL AMOUNT:");
cashRegister.add(totalLabel);
totalField = new JTextField(10);
cashRegister.add(totalField);
totalField.setEditable(false);
paymentLabel = new JLabel("PAYMENT:");
cashRegister.add(paymentLabel);
paymentField = new JTextField(10);
cashRegister.add(paymentField);
paymentField.setEnabled(false);
paymentField.setEditable(false);
changeLabel = new JLabel("CHANGE:");
cashRegister.add(changeLabel);
changeField = new JTextField(10);
cashRegister.add(changeField);
changeField.setEditable(false);
orderLabel.setFont(font2);
orderField.setFont(font2);
totalLabel.setFont(font2);
totalField.setFont(font2);
paymentLabel.setFont(font2);
paymentField.setFont(font2);
changeLabel.setFont(font2);
changeField.setFont(font2);
neymLabel.setFont(font1);
stakLabel.setFont(font1);
neymField.setFont(font1);
stakField.setFont(font1);
orderField.setForeground(Color.GREEN);
totalField.setForeground(Color.GREEN);
paymentField.setForeground(Color.GREEN);
changeField.setForeground(Color.GREEN);
orderLabel.setForeground(Color.ORANGE);
totalLabel.setForeground(Color.ORANGE);
paymentLabel.setForeground(Color.ORANGE);
changeLabel.setForeground(Color.ORANGE);
neymLabel.setForeground(Color.ORANGE);
stakLabel.setForeground(Color.ORANGE);
neymField.setForeground(Color.ORANGE);
stakField.setForeground(Color.ORANGE);
orderField.setBackground(Color.BLACK);
totalField.setBackground(Color.BLACK);
paymentField.setBackground(Color.BLACK);
changeField.setBackground(Color.BLACK);
neymField.setBackground(Color.BLACK);
stakField.setBackground(Color.BLACK);
categoriesPanel.setBounds(0,0,690,321);
numericPanel.setBounds(0,320,690,380);
menuPanel.setBounds(690,585,690,120);
cashRegister.setBounds(0,0,1364,727);
scrollPane.setBounds(691,0,665,270);
summaryField.setBounds(691,0,665,270);
neymLabel.setBounds(720,280,100,30);
neymField.setBounds(780,280,212,30);
stakLabel.setBounds(1040,280,100,30);
stakField.setBounds(1110,280,212,30);
orderLabel.setBounds(695,335,400,30);
orderField.setBounds(945,322,412,55);
totalLabel.setBounds(695,400,400,30);
totalField.setBounds(945,387,412,55);
paymentLabel.setBounds(695,465,400,30);
paymentField.setBounds(945,452,412,55);
changeLabel.setBounds(695,530,400,30);
changeField.setBounds(945,517,412,55);
menuButton[0].setEnabled(false);
menuButton[1].setEnabled(false);
cashRegister.setVisible(false);
//////////////////////////////////////*****PURCHASE PANEL******////////////////////////////////////////
//////////////////////////////////////*****INVENTORY PANEL******////////////////////////////////////////
openFile();
readFile();
closeFile1();
inventoryPanel.setLayout(null);
inventoryPanel.setBackground(Red);
C.add(inventoryPanel);
inventoryLabel = new JLabel("INVENTORY");
inventoryPanel.add(inventoryLabel);
scrollPane3 = new JScrollPane();
inventoryPanel.add(scrollPane3);
summaryField3 = new JTextArea(20,20);
inventoryPanel.add(summaryField3);
scrollPane3.setViewportView(summaryField3);
summaryField3.setEditable(false);
summaryField3.append("============================================================================================\n");
summaryField3.append("PROD. ID\t \t\t\tPROD. NAME\t\tBEGINNING BALANCEt\tITEM SOLD\t\tENDING BALANCE\n");
summaryField3.append("============================================================================================\n");
writeFile();
printInventory();
closeFile2();
backButton2 = new JButton("BACK");
inventoryPanel.add(backButton2);
backButton2.addActionListener(this);
summaryField3.setForeground(Color.ORANGE);
summaryField3.setBackground(Color.BLACK);
inventoryLabel.setForeground(Color.ORANGE);
backButton2.setForeground(Color.ORANGE);
backButton2.setBackground(Blue);
inventoryLabel.setFont(font2);
backButton2.setFont(font3);
inventoryPanel.setBounds(0,0,1364,727);
inventoryLabel.setBounds(580,15,400,30);
scrollPane3.setBounds(165,50,1065,550);
summaryField3.setBounds(165,50,1065,550);
backButton2.setBounds(1120,610,230,80);
inventoryPanel.setVisible(false);
//////////////////////////////////////*****INVENTORY PANEL******////////////////////////////////////////
//////////////////////////////////////*****SALES REPORT PANEL******////////////////////////////////////////
salesPanel8.setLayout(null);
salesPanel8.setBackground(Red);
C.add(salesPanel8);
salesLabel8 = new JLabel("SALES REPORT");
salesPanel8.add(salesLabel8);
scrollPane8 = new JScrollPane();
salesPanel8.add(scrollPane8);
summaryField8 = new JTextArea(20,20);
salesPanel8.add(summaryField8);
scrollPane8.setViewportView(summaryField8);
summaryField8.setEditable(false);
summaryField8.setText("=====================================================================================================================================================\nPROD. ID\t \t\t\tPROD. NAME\t\t\tPRICE\t ITEM SOLD\t SALES\n=====================================================================================================================================================\n");
printSalesReport();
grossLabel8 = new JLabel("TOTAL SALES:");
salesPanel8.add(grossLabel8);
grossField8 = new JTextField(""+String.valueOf(totalSales));
salesPanel8.add(grossField8);
grossField8.setEditable(false);
totalSales();
backButton8 = new JButton("BACK");
salesPanel8.add(backButton8);
backButton8.addActionListener(this);
summaryField8.setForeground(Color.ORANGE);
summaryField8.setBackground(Color.BLACK);
salesLabel8.setForeground(Color.ORANGE);
grossLabel8.setForeground(Color.ORANGE);;
grossField8.setBackground(Color.BLACK);
grossField8.setForeground(Color.GREEN);
backButton8.setForeground(Color.ORANGE);
backButton8.setBackground(Blue);
salesLabel8.setFont(font2);
backButton8.setFont(font3);
grossLabel8.setFont(font2);
grossField8.setFont(font2);
salesPanel8.setBounds(0,0,1364,727);
salesLabel8.setBounds(580,15,400,30);
scrollPane8.setBounds(165,50,1065,550);
summaryField8.setBounds(165,50,1065,550);
backButton8.setBounds(1120,610,230,80);
grossLabel8.setBounds(165,637,400,30);
grossField8.setBounds(415,620,155,55);
backButton2.setBounds(1120,610,230,80);
salesPanel8.setVisible(false);
//////////////////////////////////////*****SALES REPORT PANEL******////////////////////////////////////////
//////////////////////////////////////*****ADMIN PANEL******////////////////////////////////////////
C.add(adminPanel);
adminPanel.setLayout(null);
adminPanel.setBackground(Red);
productScroll = new JScrollPane();
adminPanel.add(productScroll);
productList = new JTextArea();
adminPanel.add(productList);
productScroll.setViewportView(productList);
productList.setEditable(false);
printAdmin();
optionsPanel.setLayout(new GridLayout (1,3));
adminPanel.add(optionsPanel);
productList.setBackground(Color.BLACK);
productList.setForeground(Color.ORANGE);
beckButton = new JButton("BACK");
adminPanel.add(beckButton);
beckButton.addActionListener(this);
beckButton.setForeground(Color.ORANGE);
beckButton.setBackground(Blue);
beckButton.setFont(font3);
for(int x=0; x<options.length; x++)
{
optionsPanel.add(options[x]);
options[x].setBackground(Blue);
options[x].setForeground(Color.ORANGE);
options[x].addActionListener(this);
options[x].setFont(font1);
}
logo2 = new JLabel();
adminPanel.add(logo2);
logo2.setIcon(new ImageIcon(getClass().getResource("logo.png")));
nameLabel = new JLabel("NAME:");
adminPanel.add(nameLabel);
stockLabel = new JLabel("STOCK:");
adminPanel.add(stockLabel);
priceLabel = new JLabel("PRICE:");
adminPanel.add(priceLabel);
nameField = new JTextField();
adminPanel.add(nameField);
stockField = new JTextField();
adminPanel.add(stockField);
priceField = new JTextField();
adminPanel.add(priceField);
okButton = new JButton("OK");
adminPanel.add(okButton);
okButton.addActionListener(this);
adminPanel.add(copyright);
nameLabel.setFont(font2);
stockLabel.setFont(font2);
priceLabel.setFont(font2);
nameField.setFont(font2);
stockField.setFont(font2);
priceField.setFont(font2);
okButton.setFont(font2);
copyright.setFont(font1);
nameLabel.setForeground(Color.orange);
stockLabel.setForeground(Color.orange);
priceLabel.setForeground(Color.orange);
nameField.setForeground(Color.orange);
stockField.setForeground(Color.orange);
priceField.setForeground(Color.orange);
okButton.setForeground(Color.orange);
copyright.setForeground(Color.orange);
nameField.setBackground(Color.black);
stockField.setBackground(Color.black);
priceField.setBackground(Color.black);
okButton.setBackground(Blue);
productScroll.setBounds(35,35,500,500);
productList.setBounds(35,35,500,500);
optionsPanel.setBounds(35,550,500,100);
nameLabel.setBounds(695,335,400,30);
beckButton.setBounds(1120,610,230,80);
nameField.setBounds(845,322,412,55);
stockLabel.setBounds(695,400,400,30);
stockField.setBounds(845,387,412,55);
priceLabel.setBounds(695,465,400,30);
priceField.setBounds(845,452,412,55);
okButton.setBounds(845,530,412,55);
copyright.setBounds(5,670,500,30);
logo2.setBounds(880,60,225,225);
adminPanel.setBounds(0,0,1364,727);
options[3].setEnabled(false);
adminPanel.setVisible(false);
//////////////////////////////////////*****ADMIN PANEL******////////////////////////////////////////
setButtons();
setTitle("FOOD CORT - SALES AND INVENTORY SYSYTEM");
setSize(1364,727);
setResizable(false);
setLocationRelativeTo(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
///////////////////////////////////////ADMIN PANEL///////////////////////////////////////