-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbill.java
More file actions
103 lines (100 loc) · 2.75 KB
/
Copy pathbill.java
File metadata and controls
103 lines (100 loc) · 2.75 KB
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
package chemist_shop;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public class bill extends JFrame implements ActionListener
{
JLabel j1, j2, j3, j4, l1, l2, l3, l4;
Float a;
Integer i1;
JPanel p1;
Font f1 = new Font("Courier New", Font.ITALIC,20);
JTextField t1, t2, t3, a1, a2, a3, a4;
Choice ch1;
JButton b1;
public bill(int cus_id, float total)
{
super("Chemist Shop Bill");
a = total;
i1 = cus_id;
p1 = new JPanel();
p1.setSize(1000, 1000);
p1.setLocation(100,100);
p1.setLayout(new GridLayout(8,2));
j1 = new JLabel("Customer Name");
j2 = new JLabel("Date and Time");
j3 = new JLabel("Amount to be Paid");
j4 = new JLabel("Mode of Payment");
l1 = new JLabel("Amount Paid");
b1 = new JButton("Pay");
t1 = new JTextField(30);
t2 = new JTextField(30);
t3 = new JTextField(30);
a1 = new JTextField(30);
t1.setFont(f1);
a1.setFont(f1);
l1.setFont(f1);
t2.setFont(f1);
t3.setFont(f1);
j1.setFont(f1);
j2.setFont(f1);
j3.setFont(f1);
j4.setFont(f1);
b1.setFont(f1);
ch1 = new Choice();
ch1.setFont(f1);
p1.add(j1);
p1.add(t1);
p1.add(j2);
p1.add(t2);
p1.add(j3);
p1.add(t3);
p1.add(j4);
p1.add(ch1);
p1.add(l1);
p1.add(a1);
p1.add(b1, "South");
try
{
conn c1 = new conn();
String q = "SELECT NAME, DATE FROM CUSTOMER, BILL WHERE BILL.CUSTOMER_ID=CUSTOMER.CUSTOMER_ID AND BILL.CUSTOMER_ID="+cus_id;
ResultSet rs = c1.s.executeQuery(q);
String a = total+"";
if(rs.next())
{
t1.setText(rs.getString("NAME"));
t2.setText(rs.getString("DATE"));
t3.setText(a);
}
}
catch(Exception e)
{
e.printStackTrace();
}
ch1.add("PayTM");
ch1.add("Debit Card");
ch1.add("Credit Card");
ch1.add("Cash");
ch1.add("Net Banking");
add(p1, "North");
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String msg = ae.getActionCommand();
if(msg.equals("Pay"))
{
new bill_pay(a1.getText(), a, i1).setVisible(true);
}
else
{
System.out.println("ERROR");
}
}
public static void main(String s[])
{
int x = 0;
new bill(x, x).setVisible(true);
}
}