1
+ import time
2
+ import datetime
3
+ from tkinter import *
4
+
5
+ root = Tk ()
6
+ root .title ("Payment System" )
7
+
8
+
9
+ Tops = Frame (root , width = 1350 , height = 50 , bd = 8 , relief = "raise" )
10
+ Tops .pack (side = TOP )
11
+
12
+ f1 = Frame (root , width = 600 , height = 600 , bd = 8 , relief = "raise" )
13
+ f1 .pack (side = LEFT )
14
+
15
+ f2 = Frame (root , width = 300 , height = 700 , bd = 8 , relief = "raise" )
16
+ f2 .pack (side = RIGHT )
17
+
18
+ f1a = Frame (f1 , width = 600 , height = 200 , bd = 20 , relief = "raise" )
19
+ f1a .pack (side = TOP )
20
+
21
+ f1b = Frame (f1 , width = 600 , height = 600 , bd = 20 , relief = "raise" )
22
+ f1b .pack (side = TOP )
23
+
24
+ lblinfo = Label (Tops , font = ("arial" , 60 , 'bold' ), text = " Payment Management " )
25
+ lblinfo .grid (row = 0 , column = 0 )
26
+
27
+
28
+ def iExit ():
29
+ qExit = messagebox .askyesno ("Payment System" , "Do you want to exit" )
30
+ if qExit > 0 :
31
+ root .destroy ()
32
+ return
33
+
34
+
35
+ def Reset ():
36
+ Name .set ("" )
37
+ Address .set ("" )
38
+ HoursWorked .set ("" )
39
+ wageshour .set ("" )
40
+ Payable .set ("" )
41
+ Taxable .set ("" )
42
+ NetPayable .set ("" )
43
+ GrossPayable .set ("" )
44
+ OvertimeHours .set ("" )
45
+ Employer .set ("" )
46
+ NINumber .set ("" )
47
+ txtPlaySlip .delete ("1.0" , END )
48
+
49
+
50
+ def EnterInfo ():
51
+ txtPlaySlip .insert (END , "\t \t PaySlip\n \n " )
52
+ txtPlaySlip .insert (END , "Name: \t \t " + Name .get () + "\n \n " )
53
+ txtPlaySlip .insert (END , "Address: \t \t " + Address .get () + "\n \n " )
54
+ txtPlaySlip .insert (END , "Employer: \t \t " + Employer .get () + "\n \n " )
55
+ txtPlaySlip .insert (END , "NINumber: \t \t " + NINumber .get () + "\n \n " )
56
+ txtPlaySlip .insert (END , "Hours Worked: \t \t " + HoursWorked .get () + "\n \n " )
57
+ txtPlaySlip .insert (END , "NetPayable: \t \t " + NetPayable .get () + "\n \n " )
58
+ txtPlaySlip .insert (END , "wages per hour: \t \t " + wageshour .get () + "\n \n " )
59
+ txtPlaySlip .insert (END , "Tax Paid: \t \t " + Taxable .get () + "\n \n " )
60
+ txtPlaySlip .insert (END , "Payable: \t \t " + Payable .get () + "\n \n " )
61
+
62
+ def WeeklyWages ():
63
+ HoursWorkedPerWeek = float (HoursWorked .get ())
64
+ WagesPerHours = float (wageshour .get ())
65
+
66
+ paydue = WagesPerHours * HoursWorkedPerWeek
67
+ paymentDue = "$" , str ("%.2f" % (paydue ))
68
+ Payable .set (paymentDue )
69
+
70
+ tax = paydue * 0.2
71
+ Taxables = "$" , str ("%.2f" % (tax ))
72
+ Taxable .set (Taxables )
73
+
74
+ netpay = paydue - tax
75
+ NetPays = "$" , str ("%.2f" % (netpay ))
76
+ NetPayable .set (NetPays )
77
+
78
+ if HoursWorkedPerWeek > 40 :
79
+ overTimeHours = (HoursWorkedPerWeek - 40 ) + WagesPerHours * 1.5
80
+ Overtimehrs = "$" , str ("%.2f" % (overTimeHours ))
81
+ OvertimeHours .set (Overtimehrs )
82
+
83
+ elif HoursWorkedPerWeek <= 40 :
84
+ overTimePay = (HoursWorkedPerWeek - 40 ) + WagesPerHours * 1.5
85
+ Overtimehrs = "$" , str ("%.2f" % (overTimePay ))
86
+ OvertimeHours .set (Overtimehrs )
87
+
88
+ return
89
+
90
+ # =============================================Variables=========================================================
91
+
92
+ Name = StringVar ()
93
+ Address = StringVar ()
94
+ HoursWorked = StringVar ()
95
+ wageshour = StringVar ()
96
+ Payable = StringVar ()
97
+ Taxable = StringVar ()
98
+ NetPayable = StringVar ()
99
+ GrossPayable = StringVar ()
100
+ OvertimeHours = StringVar ()
101
+ Employer = StringVar ()
102
+ NINumber = StringVar ()
103
+ TimeOfOrder = StringVar ()
104
+ DateOfOrder = StringVar ()
105
+
106
+ DateOfOrder .set (time .asctime (time .localtime (time .time ())))
107
+
108
+ # ========================================Label Widget==========================================================
109
+
110
+ lblName = Label (f1a , text = "Name" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 0 , column = 0 )
111
+ lblAddress = Label (f1a , text = "Address" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 0 , column = 2 )
112
+ lblEmployer = Label (f1a , text = "Employer" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 1 , column = 0 )
113
+ lblNINumber = Label (f1a , text = "NINumber" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 1 , column = 2 )
114
+ lblHoursWorked = Label (f1a , text = "Hours Worked" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 2 , column = 0 )
115
+ lblHourlyRate = Label (f1a , text = "Hourly Rate" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 2 , column = 2 )
116
+ lblTax = Label (f1a , text = "Tax" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 3 , column = 0 )
117
+ lblOvertime = Label (f1a , text = "Overtime" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 3 , column = 2 )
118
+ lblGrossPay = Label (f1a , text = "GrossPay" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 4 , column = 0 )
119
+ lblNetPay = Label (f1a , text = "NetPay" , font = ("arial" , 16 , 'bold' ), bd = 20 ).grid (row = 4 , column = 2 )
120
+
121
+
122
+ # =========================================Entry Widget===========================================================
123
+
124
+ etxtName = Entry (f1a , textvariable = Name , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
125
+ etxtName .grid (row = 0 , column = 1 )
126
+ etxtAddress = Entry (f1a , textvariable = Address , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
127
+ etxtAddress .grid (row = 0 , column = 3 )
128
+ etxtEmployer = Entry (f1a , textvariable = Employer , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
129
+ etxtEmployer .grid (row = 1 , column = 1 )
130
+ etxtHoursWorked = Entry (f1a , textvariable = HoursWorked , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
131
+ etxtHoursWorked .grid (row = 2 , column = 1 )
132
+ etxtWagesPerHours = Entry (f1a , textvariable = wageshour , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
133
+ etxtWagesPerHours .grid (row = 2 , column = 3 )
134
+ etxtninoW = Entry (f1a , textvariable = NINumber , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
135
+ etxtninoW .grid (row = 1 , column = 3 )
136
+ etxtGrossPay = Entry (f1a , textvariable = Payable , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
137
+ etxtGrossPay .grid (row = 4 , column = 1 )
138
+ etxtNetPay = Entry (f1a , textvariable = NetPayable , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
139
+ etxtNetPay .grid (row = 4 , column = 3 )
140
+ etxtTax = Entry (f1a , textvariable = Taxable , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
141
+ etxtTax .grid (row = 3 , column = 1 )
142
+ etxtOvertime = Entry (f1a , textvariable = OvertimeHours , font = ("arial" , 16 , 'bold' ), bd = 16 , width = 22 , justify = "left" )
143
+ etxtOvertime .grid (row = 3 , column = 3 )
144
+
145
+
146
+ # ==========================================Text Widget============================================================
147
+
148
+ lblPaySlip = Label (f2 , font = ("arial" , 16 , 'bold' ), textvariable = DateOfOrder ).grid (row = 0 , column = 0 )
149
+ txtPlaySlip = Text (f2 , height = 22 , width = 34 , bd = 16 , font = ("arial" , 16 , 'bold' ))
150
+ txtPlaySlip .grid (row = 1 , column = 0 )
151
+
152
+
153
+ # ===========================================Buttons=============================================================
154
+
155
+ btnSalary = Button (f1b , text = "Weekly Salary" , padx = 16 , pady = 16 , bd = 8 , fg = "black" , font = ("arial" , 16 , 'bold' ),
156
+ width = 14 , height = 1 , command = WeeklyWages ).grid (row = 0 , column = 0 )
157
+
158
+ btnReset = Button (f1b , text = "Reset" , padx = 16 , pady = 16 , bd = 8 , fg = "black" , font = ("arial" , 16 , 'bold' ),
159
+ width = 14 , height = 1 , command = Reset ).grid (row = 0 , column = 1 )
160
+
161
+ btnPaySlip = Button (f1b , text = "View Payslip" , padx = 16 , pady = 16 , bd = 8 , fg = "black" , font = ("arial" , 16 , 'bold' ),
162
+ width = 14 , height = 1 , command = EnterInfo ).grid (row = 0 , column = 2 )
163
+
164
+ btnExit = Button (f1b , text = "Exit System" , padx = 16 , pady = 16 , bd = 8 , fg = "black" , font = ("arial" , 16 , 'bold' ),
165
+ width = 14 , height = 1 , command = iExit ).grid (row = 0 , column = 3 )
166
+
167
+ root .mainloop ()
0 commit comments