@@ -478,6 +478,37 @@ def show_employee_list_page(parent, title):
478
478
main_layout .addWidget (content_frame )
479
479
480
480
return page
481
+ def show_total_money (parent , title ):
482
+ page , main_layout = create_page_with_header (parent , title )
483
+
484
+ content_frame = create_styled_frame (page , style = "background-color: #f9f9f9; border-radius: 10px; padding: 15px;" )
485
+ content_layout = QtWidgets .QVBoxLayout (content_frame )
486
+ content_layout .setProperty ("spacing" , 10 )
487
+ all = backend .all_money ()
488
+
489
+ # Total money label
490
+ total_money_label = QtWidgets .QLabel (f"Total Money: ${ all } " , content_frame )
491
+ total_money_label .setStyleSheet ("font-size: 24px; font-weight: bold; color: #333333;" )
492
+ content_layout .addWidget (total_money_label , alignment = QtCore .Qt .AlignCenter )
493
+ # Back button
494
+ back_button = QtWidgets .QPushButton ("Back" , content_frame )
495
+ back_button .setStyleSheet ("""
496
+ QPushButton {
497
+ background-color: #6c757d;
498
+ color: white;
499
+ border: none;
500
+ border-radius: 4px;
501
+ padding: 8px 16px;
502
+ font-size: 14px;
503
+ }
504
+ QPushButton:hover {
505
+ background-color: #5a6268;
506
+ }
507
+ """ )
508
+ back_button .clicked .connect (lambda : parent .setCurrentIndex (3 ))
509
+ content_layout .addWidget (back_button , alignment = QtCore .Qt .AlignCenter )
510
+ main_layout .addWidget (content_frame )
511
+ return page
481
512
482
513
def setup_main_window (main_window ):
483
514
"""Set up the main window with a stacked widget containing home, admin, and employee pages."""
@@ -578,6 +609,8 @@ def update_employee_data(name, password, salary, position, name_to_update):
578
609
add_button .clicked .connect (lambda : stacked_widget .setCurrentIndex (4 ))
579
610
update_button .clicked .connect (lambda : stacked_widget .setCurrentIndex (5 ))
580
611
list_button .clicked .connect (lambda : stacked_widget .setCurrentIndex (7 ))
612
+ back_button .clicked .connect (lambda : stacked_widget .setCurrentIndex (0 ))
613
+ money_button .clicked .connect (lambda : stacked_widget .setCurrentIndex (8 ))
581
614
# Create Add Employee Page
582
615
add_employee_page , emp_name , emp_password , emp_salary , emp_position , emp_submit = create_add_employee_page (
583
616
stacked_widget ,
@@ -645,7 +678,6 @@ def update_employee_data(name, password, salary, position, name_to_update):
645
678
)
646
679
)
647
680
648
-
649
681
650
682
emp_submit .clicked .connect (
651
683
lambda : add_employee_form_submit (
@@ -663,7 +695,7 @@ def update_employee_data(name, password, salary, position, name_to_update):
663
695
stacked_widget ,
664
696
title = "Employee Login"
665
697
)
666
-
698
+ admin_total_money = show_total_money ( stacked_widget , "Total Money" )
667
699
668
700
# Add pages to stacked widget
669
701
stacked_widget .addWidget (home_page )#0
@@ -674,6 +706,8 @@ def update_employee_data(name, password, salary, position, name_to_update):
674
706
stacked_widget .addWidget (update_employee_page1 )#5
675
707
stacked_widget .addWidget (update_employee_page2 )#6
676
708
stacked_widget .addWidget (employee_list_page )#7
709
+ stacked_widget .addWidget (admin_total_money )#8
710
+
677
711
678
712
679
713
main_layout .addWidget (stacked_widget )
0 commit comments