From 2af4b866862d5308f9384292a348aadc384ffdb9 Mon Sep 17 00:00:00 2001 From: Ben-Sicat Date: Wed, 20 Dec 2023 20:00:16 +0800 Subject: [PATCH] sales ledger union with completed reservation table --- backend/app/app.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/app/app.py b/backend/app/app.py index 962b117e..48b6cd6a 100644 --- a/backend/app/app.py +++ b/backend/app/app.py @@ -172,11 +172,16 @@ def get_all_reservations(): if connection: try: cursor = connection.cursor(dictionary=True) - cursor.execute(""" - SELECT Reservations.ReservationID, Users.Username, Reservations.StartTime, Reservations.EndTime, Reservations.Seat, Reservations.TableFee, Reservations.ResDate - FROM Reservations - JOIN Users ON Reservations.UserID = Users.UserID - """) + query = """ + SELECT Reservations.ReservationID, Users.Username, Reservations.StartTime, Reservations.EndTime, Reservations.Seat, Reservations.TableFee, Reservations.ResDate + FROM Reservations + JOIN Users ON Reservations.UserID = Users.UserID + UNION + SELECT Completed_Reservations.ReservationID, Users.Username, Completed_Reservations.StartTime, Completed_Reservations.EndTime, Completed_Reservations.Seat, Completed_Reservations.TableFee, Completed_Reservations.ResDate + FROM Completed_Reservations + JOIN Users ON Completed_Reservations.UserID = Users.UserID + """ + cursor.execute(query) results = cursor.fetchall() cursor.close() connection.close() @@ -184,6 +189,7 @@ def get_all_reservations(): except mysql.connector.Error as err: print(f"Error Fetching Reservations: {err}") + def perform_warehouse_process(): operational_connection = get_db_connection(db_config) warehouse_connection = get_db_connection(warehouse_db_config)