Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
88 kB
1
Indexable
Never
# ________Breakdown of Dictionaries and list that are to be stored with________
Staff_Tasks = {}
Patient_records = {}
Bill_of_Patients = {}
Bill_prices = {}
Staff_list = {}
Admin_Password = []
System_builtin_code = []
Default_Admin = []
maximum_attempt = 5
tries = 0
task_no = 0
# _________Starting from here are the DEFINITIONS to be called out on the main code__________
def start():
    print("_____________In-Patient Only________________")
    print("You are about to create a new patient record")
    Name_Add = input("Enter Name of Patient (Format = Surname First name): ").title()
    Age_Add = input("Enter Age of Patient: ")
    Address_Add = input("Enter Address of Patient: ")
    Diagnosis_Add = input("Enter Diagnosis of Patient: ")
    Prescription_Add = input("Enter Prescription of Patient: ")
    EmergencyContact_Add = input("Enter EmergencyContact of Patient: ")
    Patient_Date = input("Enter date of admission (day/month/year): ")
    New_Record = { Name_Add : {
        "Name": Name_Add,
        "Age": Age_Add,
        "Address": Address_Add,
        "Diagnosis": Diagnosis_Add,
        "Prescription": Prescription_Add,
        "EmergencyContact": EmergencyContact_Add,
        "Date of Admission": Patient_Date
    }}
    Patient_records.update(New_Record)
    print(New_Record)
    Bill_Record = { Name_Add : {
    }}
    Bill_of_Patients.update(Bill_Record)
    price_bill =  { Name_Add : {
    }}
    Bill_prices.update(price_bill)
    end = input("Enter 1 - Return to Menu, Enter 2 - Add more Record: ")
    if end == "1":
        print("__Returned to Menu__")
    elif end == "2":
        start()
    else:
        print("Enter only numbers 1 or 2")
def start2():
    print("______Medical Staff Scheduled task for Patients_______")
    print("Enter 1 : View Scheduled task per patients")
    print("Enter 2 : Assign and Create Tasks to Staff (Admin)")
    print("Enter 3 : Deleted/Edit an assigned task (Admin)")
    choice = input("Enter number of desired function: ")
    if choice == "1":
        view_task = input("Enter your ID number to see your task: ")
        if view_task in Staff_Tasks:
            get_task = Staff_Tasks.get(view_task)
            if get_task == {}:
                print("__No existing task/s__")
            else:
                print("Accomplish this tasks and mark them as done = ",view_task,":",get_task)
                print("________________________________________________________")
                print("Enter 1: Mark a Task Done, Enter 2: Mark all as done")
                print("Enter 3: Return to Menu")
                print("Enter 4: To Task Section")
                mod_task = input("Enter number choice: ")
                if mod_task == "1":
                    print(get_task)
                    patient_task = input("Enter which patient is the task to be marked as DONE: ").title()
                    if patient_task in Staff_Tasks[view_task]:
                        mark = input("Enter subject of the task to mark as DONE: ").title()
                        if mark in Staff_Tasks[view_task][patient]:
                            Staff_Tasks[view_task][patient][mark] = "*TASK CONCLUDED*"
                            get_new = Staff_Tasks[view_task].get(patient)
                            print("UPDATED TASK:",view_task,get_new)
                            print("Enter 1: Return to Menu, Enter 2: View another staff's task")
                            print("Enter 3: Mark done another (same patient), Enter 4: Mark done another (other patient)")
                            end = input("Enter choice: ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                start2()
                            elif end == "3":
                                viewandmark_same()
                            elif end == "4":
                                viewandmaek_other()
                            else:
                                print("Error: Enter only numbers from 1 to 4")
                        else:
                            print("Error: Patient not found in staffs assigned task")
                    else:
                        print("Error: Patient does not exist in staff's current task")
                elif mod_task == "2":
                    print(get_task)
                    patient_task = input("Enter which patient is the all tasks to be marked as DONE: ").title()
                    if patient_task in Staff_Tasks[view_task]:
                        Staff_Tasks[view_task][patient_task] = "*TASK CONCLUDED*"
                        get_new2 = Staff_Tasks[view_task].get(patient_task)
                        print("UPDATED TASK:",view_task,get_new2)
                        print("Enter 1: Return to Menu, Enter 2: View/mark another staff's task , Enter 3: Mark done all (same staff)")
                        end = input("Enter choice: ")
                        if end == "1":
                            print("_Returned to Menu_")
                        elif end == "2":
                            start2()
                        elif end == "3":
                            doneall()
                        else:
                            print("Error: Not in option, Enter only numbers from 1 to 3")
                    else:
                        print("Error: Patient not found in this staffs assigned task")
                elif mod_task == "3":
                    print("_Returned to Menu_")
                elif mod_task == "4":
                    start2()
                else:
                    print("Error: Enter only numbers from 1 to 4")
        else:
            print("Error: ID number not found")
    elif choice == "2":
        verify_admin = input("Enter admin password to assign and create tasks for staffs: ").title()
        if verify_admin in Admin_Password:
            staff = input("Enter staff number to assign a task: ").title()
            if staff in Staff_list:
                staff_value = Staff_list.get(staff)
                print("You are assigning task to:", staff_value)
                patient = input("Enter Patient name to be assigned to this staff: ").title()
                if patient in Patient_records:
                    task = input("Enter task to be done by this staff to the patient:")
                    if patient in Staff_Tasks[staff]:
                        subject = input("Enter subject of task (Ex. Medications): ").title()
                        if subject in Staff_Tasks[staff][patient]:
                            get_task = Staff_Tasks[staff][patient].get(subject)
                            fvalue = get_task, task
                            Staff_Tasks[staff][patient][subject] = fvalue
                            view1 = Staff_Tasks.get(staff)
                            print(view1)
                            end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                assign()
                            else:
                                print("Error: Enter only numbers from 1 or 2")
                        else:
                            Staff_Tasks[staff][patient][subject] = task
                            view2 = Staff_Tasks.get(staff)
                            print(view2)
                            end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                assign()
                            else:
                                print("Error: Enter only numbers from 1 or 2")
                    else:
                        subject = input("Enter subject of task (Ex. Medications): ").title()
                        update = {
                            staff : {
                                patient : {
                                    subject : task
                                }
                            }
                        }
                        Staff_Tasks.update(update)
                        view = Staff_Tasks.get(staff)
                        print("Task assignment added:",staff,":",view)
                        end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                        if end == "1":
                            print("_Returned to Menu_")
                        elif end == "2":
                            assign()
                        else:
                            print("Error: Enter only numbers from 1 or 2")
                else:
                    print("__Error : Patient not found__")
            else:
                print("__Error: Staff not found__")
        else:
            print("__Error: Incorrect password__")
    elif choice == "3":
        verify_admin = input("Enter admin password to edit and delete task: ")
        if verify_admin in Admin_Password:
            print("Enter 1: Edit a task assigned to staff, Enter 2: Delete assigned task")
            edit = input("Enter number of function: ")
            if edit == "1":
                who = input("Who's task are you going to edit?, Enter ID number: ").title()
                if who in Staff_Tasks:
                    get = Staff_Tasks.get(who)
                    print(get)
                    which = input("Which patient are you going to edit: ").title()
                    if which in Staff_Tasks[staff]:
                        select = input("Are you going to change the subject as well, Yes or No: ").title()
                        if select == "Yes":
                            enter = input("Enter subject you're about to change").title()
                            if enter in Staff[who][which]:
                                Staff_Tasks[who][which].pop(enter)
                                newsub = input("Enter subject of task: ").title()
                                if newsub in Staff_Tasks[who][which]:
                                    newtask = input("Enter new task: ")
                                    Staff_Tasks[who][which][newsub] = newtask
                                else:
                                    newtask = input("Enter new task: ")
                                    get2 = Staff_Task[who].get(which)
                                    final = get2, newtask
                                    Staff_Tasks[who][which][newsub] = final
                                    get3 = Staff_Tasks[who].get(which)
                                    print("UPDATED TASKS:", get3)
                            else:
                                print("Error: Subject not found in task record")
                        elif select == "No":
                            get4 = Staff_Tasks.get(who)
                            print(get4)
                            enter2 = input("Enter which subject is the task under: ").title()
                            if enter2 in Staff_Tasks[who][which]:
                                new_task = input("Enter the new task: ").title()
                                Staff_Tasks[who][which][enter2] = new_task
                                get5 = Staff_Tasks[who].get(which)
                                print("UPDATED TASKS:", get5)
                            else:
                                print("Error: Subject not foun in task record")
                        else:
                                print("Error: Enter only Yes or No")
                    else:
                        print("Error: Patient does not exist in task record")
            elif edit == "2":
                choice = input("Enter Staff number where you want to delete a task: ")
                if choice in Staff_Task:
                    get = Staff_Task.get(choice)
                    print(get)
                    patient = input("Enter which Patient does the task belong: ").title()
                    if patient in Staff_Tasks[choice]:
                        delete = input("Enter subject of the task in order to delete: ").title()
                        if delete in Staff_Tasks[choice][patient]:
                            Staff_Tasks[choice][patient].pop(delete)
                            get2 = Staff_Tasks[choice].get(patient)
                            print(get2)
                        else:
                            print("Error: Subject not foun in task")
                    else:
                        print("Error: Patient does not exist in task record")
                else:
                    print("Error: Staff number not found in task record")
            else:
                print("Error: Enter numbers only 1 and 2")
        else:
            print("Error: Input password incorrect")
    else:
        print("Error : Enter only numbers from 1 to 3")
def start3():
    Patient_View = input("Enter Name of Patient: ").title()
    if Patient_View in Patient_records:
        Patient_get = Patient_records.get(Patient_View)
        print("Here is the record you're looking for\n",Patient_get)
        end = input("Enter 1 - Return to Menu, Enter 2 - View another: ")
        if end == "1":
            print("__Returned to Menu__")
        elif end == "2":
            start3()
        else:
            print("Error: Enter 1 and 2 only")
    else:
        print("Patient does not exist in existing records")
def start4():
    Delete_record = input("Enter name of the patient to delete its record: ")
    if Delete_record in Patient_records:
        Get_record = Patient_records.get(Delete_record)
        print(Get_record)
        Ask = input("Are you sure you want delete this patient's record?, Enter Yes/No: ").title()
        if Ask == "Yes":
            del Patient_records[Delete_record]
            final_record = Patient_records.get(Delete_record)
            print("Record has been cleared, New Value:", final_record)
        elif Ask == "No":
            print("Record retained:",Get_record)
        else:
            print("Invalid, Enter only Yes or No")
        end = input("Enter 1 - Return to Menu, Enter 2 - Delete another: ")
        if end == "1":
            print("_Returned to Menu_")
        elif end == "2":
            start4()
        else:
            print("Error: Enter only 1 or 2")
    else:
        print("Patient does not exist, cannot proceed to records")
def start5():
    Patient_edit = input("Please enter patient name to edit his/her record: ").title()
    if Patient_edit in Patient_records:
        Patientbump = Patient_records.get(Patient_edit)
        print(Patientbump)
        To_edit = input("Please enter what you want to edit in the record (Ex. name): ").title()
        if To_edit in Patient_records[Patient_edit]:
            edit = input("Enter new value for the area of edit: ")
            New_value = Patient_records[Patient_edit][To_edit] = edit
            Patient_update = Patient_records.get(Patient_edit)
            print("Record Updated:",Patient_update)
        else:
            print("Area of edit mispelled or does not exist")
            end = input("Enter 1 - Return to Menu, Enter 2 - Edit another: ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start5()
            else:
                print("Error: Enter only numbers 1 or 2")
    else:
        print("Patient does not exist in current records")
def start8():
    ID_Access = input("Enter Admin password to Add Staff ID: ")
    if ID_Access in Admin_Password:
        Add_ID = input("Enter new staff Indentification Number to add: ")
        Add_name = input("Enter name for this ID: ")
        Staff_list[Add_ID] = Add_name
        print("New ID number:",Add_ID,"successfully added to records")
        end = input("Enter 1 - Return to Menu, Enter 2 - Add another ID: ")
        if end == "1":
            print("_Returned to Menu_")
        elif end == "2":
            start8()
        else:
            print("Error: Enter only numbers 1 or 2")
    else:
        print("Incorrect Admin Password")
def view6():
    patient_bill = input("Enter the name of Patient you want to see the bill: ").title()
    if patient_bill in Bill_of_Patients:
        Get_Bill = Bill_of_Patients.get(patient_bill)
        if Bill_of_Patients[patient_bill] == {}:
            print("This bill record is empty:",patient_bill,":",Get_Bill)
        else:
            print(Get_Bill)
            Bill_total = sum(value for value in Bill_prices[patient_bill].values())
            print("Total bill:",Bill_total)
            end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-View another bill: ")
            if end == "1":
                print("_Returned to Menu")
            elif end == "2":
                start6()
            elif end == "3":
                view6()
            else:
                print("Error: Enter only numbers 1 to 3")
    else:
        print("Bill record not found!")
def start6():
    print("______________Welcome to Billing_____________")
    print("Enter 1 : View Patient bill")
    print("Enter 2 : Add items to a Patient's bill")
    print("Enter 3 : Delete/Edit items in a Patient's bill")
    print("Enter 4 : Pay per item")
    print("Enter 5 : Pay Total")
    choice = input("Enter desired function for Billing: ")
    if choice == "1":
        patient_bill = input("Enter the name of Patient you want to see the bill: ").title()
        if patient_bill in Bill_of_Patients:
            Get_Bill = Bill_of_Patients.get(patient_bill)
            if Bill_of_Patients[patient_bill] == {}:
                print("This bill record is empty:",patient_bill,":",Get_Bill)
            else:
                print(Get_Bill)
                Bill_total = sum(value for value in Bill_prices[patient_bill].values())
                print("Total bill:",Bill_total)
                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-View another bill: ")
                if end == "1":
                    print("_Returned to Menu")
                elif end == "2":
                    start6()
                elif end == "3":
                    view6()
                else:
                    print("Error: Enter only 1 or 2")
        else:
            print("Bill record not found!")
    elif choice == "2":
        print("___Adding items to a patient's bill____")
        patientbill_add  = input("Enter name of Patient you want to add an item in bill with: ").title()
        if patientbill_add in Bill_of_Patients:
            Get_Bill = Bill_of_Patients.get(patientbill_add)
            print("Current Bill:", Get_Bill)
            add_bill = input("Enter name of medical item: ").title()
            if add_bill in Bill_of_Patients[patientbill_add]:
                print("__Item already exist in bill, Edit it instead__")
                end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Edit: ")
                if end == "1":
                    print("__Returned to Menu__")
                elif end == "2":
                    start6()
                elif end == "3":
                    addedit()
                else:
                    print("Error: Enter only numbers from 1 to 3")
            else:
                add_iprice = int(input("Enter price of item: "))
                add_quantity = int(input("Enter quantity of item: "))
                add_oprice = add_quantity * add_iprice
                Bill_prices[patientbill_add][add_bill] = add_oprice
                Bill_total = sum(value for value in Bill_prices[patientbill_add].values())
                Bill_of_Patients[patientbill_add][add_bill] = "qty",add_quantity,"PHP",add_oprice
                New_Bill = Bill_of_Patients.get(patientbill_add)
                print(patientbill_add,"current bill:",New_Bill)
                print("Total Bill:",Bill_total)
                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Add another: ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    start6()
                elif end == "3":
                    add()
                else:
                    print("Error: Please enter only numbers 1 to 3")
        else:
            print("Error: Patient not found")
    elif choice == "3":
        print("_________________________________")
        print("Enter 1 : Edit a Patient's bill")
        print("Enter 2 : Delete items in Patient's bill")
        mode = input("Enter number of desired function: ")
        if mode == "1":
            edit = input("Enter name of Patient to edit its bill:").title()
            if edit in Bill_of_Patients:
                Get = Bill_of_Patients.get(edit)
                print("Current Bill:",Get)
                to_edit = input("Enter what item to edit: ").title()
                if to_edit in Bill_of_Patients[edit]:
                    Qty_new = float(input("Enter new/retain Quantity: "))
                    Price = float(input("Enter new/retain Price: "))
                    oprice = Qty_new * Price
                    Bill_prices[edit][to_edit] = oprice
                    Bill_of_Patients[edit][to_edit] = "Qty:",Qty_new,"*",Price,"Php:",oprice
                    New_total = sum(value for value in Bill_prices[edit].values())
                    update_bill = Bill_of_Patients.get(edit)
                    print(update_bill)
                    print("New bill total:", New_total)
                    end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Edit another: ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        start6()
                    elif end == "3":
                        edit()
                    else:
                        print("Error: Enter only numbers from 1 to 3")
                else:
                    print("Error: Input item not in bill")
            else:
                print("Error: Patient not found!")
        elif mode == "2":
            patient = input("Enter name of Patient to delete items in its bill: ").title()
            get_past = Bill_of_Patients.get(patient)
            print(get_past)
            if patient in Bill_of_Patients:
                delete = input("Enter the item you would want to delete").title()
                if delete in Bill_of_Patients[patient]:
                    pop = Bill_of_Patients[patient].pop(delete)
                    Bill_prices[patient].pop(delete)
                    get = Bill_of_Patients.get(patient)
                    total = sum(value for value in Bill_prices[patient].values())
                    print("Item deleted:",pop)
                    print("New bill copy:",get)
                    print("New bill Total:",total)
                    end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Delete another(same patient): ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        start6()
                    elif end == "3":
                        delete()
                    else:
                        print("Error: Enter only numbers from 1 to 3")
                else:
                    print("Error: item not found in the bill")
            else:
                print("Error: Patient bill not found")
        else:
            print("Error: Enter only numbers from 1 to 2")
    elif choice == "4":
        patient = input("Enter name of Patient to proceed to payment: ").title()
        if patient in Bill_of_Patients:
            get = Bill_of_Patients.get(patient)
            print("Current bill:",get)
            pay_select = input("Enter specific item you are going to pay: ").title()
            if pay_select in Bill_of_Patients[patient]:
                Bill_of_Patients[patient][pay_select] = "Paid"
                Bill_prices[patient][pay_select] = 0
                get2 = Bill_of_Patients.get(patient)
                new_total = sum(value for value in Bill_prices[patient].values())
                print("Payment concluded:",get2)
                print("New bill totall:",new_total)
                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Pay another item(Same patient): ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    start6()
                elif end == "3":
                    payselect()
                else:
                    print("Error: Enter only numbers from 1 to 3")
            else:
                print("Error: Input item not found in bill")
        else:
            print("Error: Patient not found!")
    elif choice == "5":
        patient = input("Enter name of Patient for total payment: ").title()
        if patient in Bill_of_Patients:
            verify = input("Are you sure you want to proceed to total payment Yes/No: ").title()
            if verify == "Yes":
                get1 = sum(value for value in Bill_prices[patient].values())
                Bill_of_Patients[patient] = "Paid: Bill cleared"
                Bill_prices[patient] = 0
                get2 = Bill_of_Patients.get(patient)
                get3 = Bill_prices.get(patient)
                print("Current bill:",get2)
                print("Total bill:",get3)
                print("Amount Paid:",get1)
            elif verify == "No":
                print("__Returned to Billing Page__")
                start6()
            else:
                print("Error: Enter only Yes or No")
        else:
            print("Error: Patient not found!")
    else:
        print("Error: Enter only numbers from 1 to 5")
def add():
    if patientbill_add in Bill_of_Patients:
        Get_Bill = Bill_of_Patients.get(patientbill_add)
        print("Current Bill:", Get_Bill)
        add_bill = input("Enter name of medical item: ").title()
        if add_bill in Bill_of_Patients[patientbill_add]:
            print("__Item already exist in bill, Edit it instead__")
            end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Edit: ")
            if end == "1":
                print("__Returned to Menu__")
            elif end == "2":
                start6()
            elif end == "3":
                Getbill = Bill_of_Patients.get(patientbill_add)
                print(Getbill)
                addedit()
            else:
                print("Error: Enter only numbers from 1 to 3")
        else:
            add_iprice = float(input("Enter price of item: "))
            add_quantity = float(input("Enter quantity of item: "))
            add_oprice = add_quantity * add_iprice
            Bill_prices[patientbill_add][add_bill] = add_oprice
            Bill_total = sum(value for value in Bill_prices[patientbill_add].values())
            Bill_of_Patients[patientbill_add][add_bill] = "qty",add_quantity,"PHP",add_oprice
            New_Bill = Bill_of_Patients.get(patientbill_add)
            print(patientbill_add,"current bill:",New_Bill)
            print("Total Bill:",Bill_total)
            end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Add another: ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start6()
            elif end == "3":
                add()
            else:
                print("Error: Please enter only from numbers 1 to 3")
    else:
        print("Error: Patient not found")
def edit():
    edit = input("Enter name of Patient to edit its bill:").title()
    if edit in Bill_of_Patients:
        Get = Bill_of_Patients.get(edit)
        Old_total = sum(value for value in Bill_prices[edit].values())
        print("Current Bill:",Get)
        print("Current total:",Old_total)
        to_edit = input("Enter what item to edit: ").title()
        if to_edit in Bill_of_Patients[edit]:
            Qty_new = float(input("Enter new/retain Quantity: "))
            Price = float(input("Enter new/retain Price: "))
            oprice = Qty_new * Price
            Bill_prices[edit][to_edit] = oprice
            Bill_of_Patients[edit][to_edit] = "Qty:",Qty_new,"*",Price,"Php:",oprice
            New_total = sum(value for value in Bill_prices[edit].values())
            update_bill = Bill_of_Patients.get(edit)
            print(update_bill)
            print("New bill total:", New_total)
            end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Edit another: ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start6()
            elif end == "3":
                edit()
            else:
                print("Error: Enter only numbers from 1 to 3")
        else:
            print("Error: Input item not in bill")
    else:
        print("Error: Patient not found!")
def delete():
    if patient in Bill_of_Patients:
        get_past = Bill_of_Patients.get(patient)
        print(get_past)
        delete = input("Enter the item you would want to delete: ").title()
        if delete in Bill_of_Patients[patient]:
            pop = Bill_of_Patients[patient].pop(delete)
            Bill_prices[patient].pop(delete)
            get = Bill_of_Patients.get(patient)
            total = sum(value for value in Bill_prices[patient].values())
            print("Item deleted:",pop)
            print("New bill copy:",get)
            print("New bill Total:",total)
            end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Delete another(same patient): ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start6()
            elif end == "3":
                delete()
            else:
                print("Error: Enter only numbers from 1 to 3")
        else:
            print("Error: item not found in the bill")
    else:
        print("Error: Patient bill not found")
def payselect():
    if patient in Bill_of_Patients:
        get = Bill_of_Patients.get(patient)
        print("Current bill:",get)
        pay_select = input("Enter specific item you are going to pay: ").title()
        if pay_select in Bill_of_Patients[patient]:
            Bill_of_Patients[patient][pay_select] = "Paid"
            Bill_prices[patient][pay_select] = 0
            get2 = Bill_of_Patients.get(patient)
            new_total = sum(value for value in Bill_prices[patient].values())
            print("Payment concluded:",get2)
            print("New bill totall:",new_total)
            end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Pay another item(Same patient): ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start6()
            elif end == "3":
                payselect()
            else:
                print("Error: Enter only numbers from 1 to 3")
        else:
            print("Error: Input item not found in bill")
    else:
        print("Error: Patient not found!")
def addedit():
    to_edit = input("Enter what item to edit: ").title()
    if to_edit in Bill_of_Patients[patientbill_add]:
        Qty_new = float(input("Enter new/retain Quantity: "))
        Price = float(input("Enter new/retain Price: "))
        oprice = Qty_new * Price
        Bill_prices[patientbill_add][to_edit] = oprice
        Bill_of_Patients[patientbill_add][to_edit] = "Qty:",Qty_new,"*",Price,"Php:",oprice
        New_total = sum(value for value in Bill_prices[patientbill_add].values())
        update_bill = Bill_of_Patients.get(patientbill_add)
        print(update_bill)
        print("New bill total:", New_total)
        end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Edit another: ")
        if end == "1":
            print("_Returned to Menu_")
        elif end == "2":
            start6()
        elif end == "3":
            edit()
        else:
            print("Error: Enter only numbers from 1 to 3")
    else:
        print("Error: Input item not in bill")
def edit_delete():
    print("Enter 1: Edit a task assigned to staff, Enter 2: Delete assigned task")
    edit = input("Enter number of function: ")
    if edit == "1":
        who = input("Who's task are you going to edit?, Enter ID number: ")
        if who in Staff_Tasks:
            get = Staff_Tasks.get(who)
            print(get)
            which = input("Which patient are you going to edit: ").title()
            if which in Staff_Tasks[staff]:
                select = input("Are you going to change the subject as well, Yes or No: ").title()
                if select == "Yes":
                    enter = input("Enter subject you're about to change: ").title()
                    if enter in Staff_Tasks[who][which]:
                        Staff_Tasks[who][which].pop(enter)
                        newsub = input("Enter subject of task: ").title()
                        if newsub in Staff_Tasks[who][which]:
                            newtask = input("Enter new task: ")
                            Staff_Tasks[who][which][newsub] = newtask
                            end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section: ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                edit_delete()
                            else:
                                print("Error: Enter only numbers 1 or 2")
                        else:
                            newtask = input("Enter new task: ")
                            get2 = Staff_Tasks[who].get(which)
                            final = get2, newtask
                            Staff_Tasks[who][which][newsub] = final
                            get3 = Staff_Tasks[who].get(which)
                            print("UPDATED TASKS:", get3)
                            end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section; ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                edit_delete()
                            else:
                                print("Error: Enter only numbers 1 or 2")
                    else:
                        print("Error: Subject not found in tasks record")
                elif select == "No":
                    get4 = Staff_Tasks.get(who)
                    print(get4)
                    enter2 = input("Enter which subject is the task under: ").title()
                    if enter2 in Staff_Tasks[who][which]:
                        new_task = input("Enter the new task: ")
                        Staff_Tasks[who][which][enter2] = new_task
                        get5 = Staff_Tasks[who].get(which)
                        print("UPDATED TASKS:", get5)
                        end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section: ")
                        if end == "1":
                            print("_Returned to Menu_")
                        elif end == "2":
                            edit_delete()
                        else:
                            print("Error: Enter only numbers 1 or 2")
                    else:
                        print("Error: Subject not found in Tasks Record")
                else:
                    print("Error: Enter only Yes or No")
            else:
                print("Error: Patient does not exist in task record")
    elif edit == "2":
        choice = input("Enter Staff number where you want to delete a task: ")
        if choice in Staff_Task:
            get = Staff_Task.get(choice)
            print(get)
            patient = input("Enter which Patient does the task belong: ").title()
            if patient in Staff_Tasks[choice]:
                delete = input("Enter subject of the task in order to delete: ").title()
                if delete in Staff_Tasks[choice][patient]:
                    Staff_Tasks[choice][patient].pop(delete)
                    get2 = Staff_Tasks[choice].get(patient)
                    print(get2)
                else:
                    print("Error: Subject not foun in task")
            else:
                print("Error: Patient does not exist in task record")
        else:
            print("Error: Staff number not found in task record")
    else:
        print("Error: Enter numbers only 1 and 2")
def assign():
    staff = input("Enter staff number to assign a task: ")
    if staff in Staff_list:
        staff_value = Staff_list.get(staff)
        print("You are assigning task to:", staff_value)
        patient = input("Enter Patient name to be assigned with this staff: ").title()
        if patient in Patient_records:
            task = input("Enter task to be done by this staff to the patient: ")
            if patient in Staff_Tasks[staff]:
                subject = input("Enter subject of task (Ex. Medications)").title()
                if subject in Staff_Tasks[staff][patient]:
                    get_task = Staff_Tasks[staff][patient].get(subject)
                    fvalue = get_task, task
                    Staff_Tasks[staff][patient][subject] = fvalue
                    view1 = Staff_Tasks.get(staff)
                    print(view1)
                    end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        assign()
                    else:
                        print("Error: Enter only numbers from 1 or 2")
                else:
                    Staff_Tasks[staff][patient][subject] = task
                    view2 = Staff_Tasks.get(staff)
                    print(view2)
                    end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        assign()
                    else:
                        print("Error: Enter only numbers from 1 or 2")
            else:
                subject = input("Enter subject of task (Ex. Medications): ").title()
                update = {
                    staff : {
                        patient : {
                            subject : task
                        }
                    }
                }
                Staff_Tasks.update(update)
                view = Staff_Tasks.get(staff)
                print("Task assignment added:",staff,":",view)
                end = input("Enter 1: Back to Menu, Enter 2: Back to Assign and Create section: ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    assign()
                else:
                    print("Error: Enter only numbers from 1 or 2")
        else:
            print("__Error : Patient not found__")
    else:
        print("__Error: Staff not found__")
def viewandmark_same():
    print(get_task)
    mark = input("Enter subject of the task to mark as DONE: ").title()
    if mark in Staff_Tasks[view_task][patient_task]:
        Staff_Tasks[view_task][patient_task][mark] = "*TASK CONCLUDED*"
        get_new = Staff_Tasks[view_task].get(patient_task)
        print("UPDATED TASK of:",view_task, get_new)
        print("Enter 1: Return to Menu, Enter 2: View another staff's task")
        print("Enter 3: Mark done another (same patient), Enter 4: Mark done another (other patient)")
        end = input("Enter choice: ")
        if end == "1":
            print("_Returned to Menu_")
        elif end == "2":
            start2()
        elif end == "3":
            viewandmark_same()
        elif end == "4":
            viewandmark_other()
        else:
            print("Error: Enter only numbers from 1 to 4")
    else:
        print("Error: subject not found in tasks")
def viewandmark_other():
    print(get_task)
    patient_task = input("Enter which patient is the task to be marked as DONE: ").title()
    if patient_task in Staff_Tasks[view_task]:
        mark = input("Enter subject of the task to mark as DONE: ").title()
        if mark in Staff_Tasks[view_task][patient_task]:
            Staff_Tasks[view_task][patient_task][mark] = "*TASK CONCLUDED*"
            get_new = Staff_Tasks[view_task].get(patient_task)
            print("UPDATED TASK of:",view_task, get_new)
            print("Enter 1: Return to Menu, Enter 2: View another staff's task")
            print("Enter 3: Mark done another (same patient), Enter 4: Mark done another (other patient)")
            end = input("Enter choice: ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start2()
            elif end == "3":
                viewandmark_same()
            elif end == "4":
                viewandmark_other()
            else:
                print("Error: Enter only numbers from 1 to 4")
        else:
            print("Error: subject not found in tasks")
def doneall():
    print(get_task)
    patient_task = input("Enter which patient is the task to be marked as DONE: ").title()
    if patient_task in Staff_Tasks[view_task]:
        Staff_Tasks[view_task][patient_task] = "*TASK CONCLUDED*"
        get_new2 = Staff_Tasks[view_task].get(patient_task)
        print("UPDATED TASK:",get_new2)
        print("Enter 1: Return to Menu, Enter 2: View another staff's task , Enter 3: Another, Mark done all task in one patient")
        end = input("Enter choice: ")
        if end == "1":
            print("_Returned to Menu_")
        elif end == "2":
            start2()
        elif end == "3":
            doneall()
        else:
            print("Error: Not in option, Enter only numbers from 1 to 3")
    else:
        print("Error: Patient not found in this staff assigned tasks")
def assign_same():
    patient = input("Enter Patient name to be assigned with this staff: ").title()
    if patient in Patient_records:
        task = input("Enter task to be done by this staff to the patient:")
        if patient in Staff_Tasks[staff]:
            subject = input("Enter subject of task (Ex. Medications): ").title()
            if subject in Staff_Tasks[staff][patient]:
                get_task = Staff_Tasks[staff][patient].get(subject)
                fvalue = get_task, task
                Staff_Tasks[staff][patient][subject] = fvalue
                view1 = Staff_Tasks.get(staff)
                print(view1)
                print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                end = input("Enter choice: ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    start2()
                elif end == "3":
                    assign_same()
                elif end == "4":
                    assign_other()
                else:
                    print("Error: Enter only numbers from 1 to 4")
            else:
                Staff_Tasks[staff][patient][subject] = task
                view2 = Staff_Tasks.get(staff)
                print(view2)
                print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                end = input("Enter choice: ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    start2()
                elif end == "3":
                    assign_same()
                elif end == "4":
                    assign_other()
                else:
                    print("Error: Enter only numbers from 1 to 4")
        else:
            subject = input("Enter subject of task (Ex. Medications)").title()
            task_update = {patient: {
                subject: task
            }}
            Staff_Tasks[staff].update(task_update)
            view = Staff_Tasks.get(staff)
            print("Task assignment added:",staff,":",view)
            print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
            print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
            end = input("Enter choice: ")
            if end == "1":
                print("_Returned to Menu_")
            elif end == "2":
                start2()
            elif end == "3":
                assign_same()
            elif end == "4":
                assign_other()
            else:
                print("Error: Enter only numbers from 1 to 4")
    else:
        print("__Error : Patient not found__")
def assign_other():
    print("Current staff listing:",Staff_list)
    staff = input("Enter staff number to assign a task: ")
    if staff in Staff_list:
        staff_value = Staff_list.get(staff)
        print("You are assigning task to:", staff_value)
        patient = input("Enter Patient name to be assigned with this staff: ").title()
        if patient in Patient_records:
            task = input("Enter task to be done by this staff to the patient:")
            if patient in Staff_Tasks[staff]:
                subject = input("Enter subject of task (Ex. Medications): ").title()
                if subject in Staff_Tasks[staff][patient]:
                    get_task = Staff_Tasks[staff][patient].get(subject)
                    fvalue = get_task, task
                    Staff_Tasks[staff][patient][subject] = fvalue
                    view1 = Staff_Tasks.get(staff)
                    print(view1)
                    print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                    print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                    end = input("Enter choice: ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        start2()
                    elif end == "3":
                        assign_same()
                    elif end == "4":
                        assign_other()
                    else:
                        print("Error: Enter only numbers from 1 to 4")
                else:
                    Staff_Tasks[staff][patient][subject] = task
                    view2 = Staff_Tasks.get(staff)
                    print(view2)
                    print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                    print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                    end = input("Enter choice: ")
                    if end == "1":
                        print("_Returned to Menu_")
                    elif end == "2":
                        start2()
                    elif end == "3":
                        assign_same()
                    elif end == "4":
                        assign_other()
                    else:
                        print("Error: Enter only numbers from 1 to 4")
            else:
                subject = input("Enter subject of task (Ex. Medications)").title()
                task_update = {patient: {
                    subject: task
                }}
                Staff_Tasks[staff].update(task_update)
                view = Staff_Tasks.get(staff)
                print("Task assignment added:",staff,":",view)
                print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                end = input("Enter choice: ")
                if end == "1":
                    print("_Returned to Menu_")
                elif end == "2":
                    start2()
                elif end == "3":
                    assign_same()
                elif end == "4":
                    assign_other()
                else:
                    print("Error: Enter only numbers from 1 to 4")
        else:
            print("__Error : Patient not found__")
    else:
        print("__Error: Staff not found__")
# _____________________________________Starting from here is the MAIN CODE____________________________________
while True:
    if Admin_Password == []:
        print("Welcome, System needs to be set upon first usage")
        new_apass = input("Create an Admin Password: ")
        Admin_Password.append(new_apass)
        print("Admin Password has been set:", Admin_Password)
        new_sbc = input("Create a system built-in password that will allow you to change Admin Password: ")
        System_builtin_code.append(new_sbc)
        print("Built-in password has been set:", System_builtin_code)
        print("To enable staffs to access this Hospital Record System, you must creat an ID numbers of staffs.")
        new_StaffID = input("Add one ID number now and you can add more later after set up: ")
        new_nameID = input("Enter name for this ID: ")
        profession = input("Enter staff's profession (Ex. Nurse): ").title()
        finalID = profession + " " + new_nameID
        task_update = { new_StaffID : {
        }}
        Staff_list[new_StaffID] = finalID
        Staff_Tasks.update(task_update)
        print("This is the updated list of staff ID upon your input:",Staff_list,",use it on yourfirst sign in")
    else:
        Log_in = input("Enter Staff ID to enter Menu: ")
        if Log_in in Staff_list:
            print("____________Welcome to Medical Records_____________")
            print("Enter 1 : Create New Record (Format: Surname Firstname)")
            print("Enter 2 : Scheduled task for patients")
            print("Enter 3 : View Patient Record")
            print("Enter 4 : Delete Patient Record")
            print("Enter 5 : Edit Record")
            print("Enter 6 : Patient Hospital Billing")
            print("Enter 7 : (Settings) Change Admin Password")
            print("Enter 8 : (Settings) Add Staff ID")
            print("Enter 9 : (Settings) Delete a Staff ID")
            if Log_in in Staff_list:
                Option = input("Enter Number of Desired Function: ")
                if Option == "1":
                    print("______________In-Patient Only_______________")
                    print("You are about to create a new patient record")
                    Name_Add = input("Enter Name of Patient: ").title()
                    Age_Add = input("Enter Age of Patient: ")
                    Address_Add = input("Enter Address of Patient: ").title()
                    Diagnosis_Add = input("Enter Diagnosis of Patient: ")
                    Prescription_Add = input("Enter Prescription of Patient: ")
                    EmergencyContact_Add = input("Enter EmergencyContact of Patient: ")
                    Patient_Date = input("Enter date of admission (day/month/year): ")
                    Room_no = input("Enter Room number: ")
                    New_Record = { Name_Add : {
                        "Name": Name_Add,
                        "Age": Age_Add,
                        "Address": Address_Add,
                        "Diagnosis": Diagnosis_Add,
                        "Prescription": Prescription_Add,
                        "EmergencyContact": EmergencyContact_Add,
                        "Date of Admission": Patient_Date,
                        "Room Number": Room_no
                    }}
                    Patient_records.update(New_Record)
                    print(New_Record)
                    Bill_Record = { Name_Add : {
                    }}
                    Bill_of_Patients.update(Bill_Record)
                    price_bill =  { Name_Add : {
                    }}
                    Bill_prices.update(price_bill)
                    end = input("Enter 1 - Return to Menu, Enter 2 - Add more Record:")
                    if end == "1":
                        print("__Returned to Menu__")
                    elif end == "2":
                        start()
                    else:
                        print("Enter only 1 or 2")
                elif Option == "2":
                    print("______Staff assigned tasks_______")
                    print("Enter 1 : View Scheduled task for staffs")
                    print("Enter 2 : Assign and Create Tasks to Staff (Admin)")
                    print("Enter 3 : Edit/Delete an Existing Task (Admin)")
                    choice = input("Enter number of desired function: ")
                    if choice == "1":
                        view_task = input("Enter your ID number to see your task: ")
                        if view_task in Staff_Tasks:
                            get_task = Staff_Tasks.get(view_task)
                            if get_task == {}:
                                print("__No existing tasks__")
                            else:
                                print("Accomplish this tasks and mark them as done = ",view_task,":",get_task)
                                print("________________________________________________________")
                                print("Enter 1: Mark a Task Done, Enter 2: Mark all as done")
                                print("Enter 3: Return to Menu")
                                print("Enter 4: To Task Section")
                                mod_task = input("Enter number choice: ")
                                if mod_task == "1":
                                    print(get_task)
                                    patient_task = input("Enter which patient is the task to be marked as DONE: ").title()
                                    if patient_task in Staff_Tasks[view_task]:
                                        mark = input("Enter subject of the task to mark as DONE: ").title()
                                        if mark in Staff_Tasks[view_task][patient_task]:
                                            Staff_Tasks[view_task][patient_task][mark] = "*TASK CONCLUDED*"
                                            get_new = Staff_Tasks[view_task].get(patient_task)
                                            print("UPDATED TASK of:",view_task,get_new)
                                            print("Enter 1: Return to Menu, Enter 2: View another staff's task")
                                            print("Enter 3: Mark done another (same patient), Enter 4: Mark done another (other patient)")
                                            end = input("Enter choice: ")
                                            if end == "1":
                                                print("_Returned to Menu_")
                                            elif end == "2":
                                                start2()
                                            elif end == "3":
                                                viewandmark_same()
                                            elif end == "4":
                                                viewandmark_other()
                                            else:
                                                print("Error: Enter only numbers from 1 to 4")
                                        else:
                                            print("Error: subject not found in tasks")
                                    else:
                                        print("Error: Patient does not exist in staff's current task")
                                elif mod_task == "2":
                                    print(get_task)
                                    patient_task = input("Enter which patient is the all tasks to be marked as DONE: ").title()
                                    if patient_task in Staff_Tasks[view_task]:
                                        Staff_Tasks[view_task][patient_task] = "*TASK CONCLUDED*"
                                        get_new2 = Staff_Tasks[view_task].get(patient_task)
                                        print("UPDATED TASK:",view_task,get_new2)
                                        print("Enter 1: Return to Menu, Enter 2: View/mark another staff's task , Enter 3: Mark done all (same staff)")
                                        end = input("Enter choice: ")
                                        if end == "1":
                                            print("_Returned to Menu_")
                                        elif end == "2":
                                            start2()
                                        elif end == "3":
                                            doneall()
                                        else:
                                            print("Error: Not in option, Enter only numbers from 1 to 3")
                                    else:
                                        print("Error: Patient not found in this staffs assigned task")
                                elif mod_task == "3":
                                    print("_Returned to Menu_")
                                elif mod_task == "4":
                                    start2()
                                else:
                                    print("Error: Enter only numbers from 1 to 4")
                        else:
                            print("Error: ID number not found")
                    elif choice == "2":
                        verify_admin = input("Enter admin password to assign and create tasks for staffs: ")
                        if verify_admin in Admin_Password:
                            print("Current staff listing:",Staff_list)
                            staff = input("Enter staff number to assign a task: ")
                            if staff in Staff_list:
                                staff_value = Staff_list.get(staff)
                                print("You are assigning task to:", staff_value)
                                patient = input("Enter Patient name to be assigned with this staff: ").title()
                                if patient in Patient_records:
                                    task = input("Enter task to be done by this staff to the patient:")
                                    if patient in Staff_Tasks[staff]:
                                        subject = input("Enter subject of task (Ex. Medications): ").title()
                                        if subject in Staff_Tasks[staff][patient]:
                                            get_task = Staff_Tasks[staff][patient].get(subject)
                                            fvalue = get_task, task
                                            Staff_Tasks[staff][patient][subject] = fvalue
                                            view1 = Staff_Tasks.get(staff)
                                            print(view1)
                                            print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                                            print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                                            end = input("Enter choice: ")
                                            if end == "1":
                                                print("_Returned to Menu_")
                                            elif end == "2":
                                                start2()
                                            elif end == "3":
                                                assign_same()
                                            elif end == "4":
                                                assign_other()
                                            else:
                                                print("Error: Enter only numbers from 1 to 4")
                                        else:
                                            Staff_Tasks[staff][patient][subject] = task
                                            view2 = Staff_Tasks.get(staff)
                                            print(view2)
                                            print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                                            print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                                            end = input("Enter choice: ")
                                            if end == "1":
                                                print("_Returned to Menu_")
                                            elif end == "2":
                                                start2()
                                            elif end == "3":
                                                assign_same()
                                            elif end == "4":
                                                assign_other()
                                            else:
                                                print("Error: Enter only numbers from 1 to 4")
                                    else:
                                        subject = input("Enter subject of task (Ex. Medications)").title()
                                        task_update = { patient : {
                                            subject : task
                                        }}
                                        Staff_Tasks[staff].update(task_update)
                                        view = Staff_Tasks.get(staff)
                                        print("Task assignment added:",staff,":",view)
                                        print("Enter 1: Return to Menu, Enter 2: To Staff Assigned Tasks")
                                        print("Enter 3: Assign again(same staff), Enter 4: Assign again(new staff)")
                                        end = input("Enter choice: ")
                                        if end == "1":
                                            print("_Returned to Menu_")
                                        elif end == "2":
                                            start2()
                                        elif end == "3":
                                            assign_same()
                                        elif end == "4":
                                            assign_other()
                                        else:
                                            print("Error: Enter only numbers from 1 to 4")
                                else:
                                    print("__Error : Patient not found__")
                            else:
                                print("__Error: Staff not found__")
                        else:
                            print("__Error: Incorrect password__")
                    elif choice == "3":
                        verify_admin = input("Enter admin password to edit and delete task: ")
                        if verify_admin in Admin_Password:
                            print("Enter 1: Edit a task assigned to staff, Enter 2: Delete assigned task")
                            edit = input("Enter number of function: ")
                            if edit == "1":
                                who = input("Who's task are you going to edit?, Enter ID number: ")
                                if who in Staff_Tasks:
                                    get = Staff_Tasks.get(who)
                                    print(get)
                                    which = input("Which patient are you going to edit: ").title()
                                    if which in Staff_Tasks[staff]:
                                        select = input("Are you going to change the subject as well, Yes or No: ").title()
                                        if select == "Yes":
                                            enter = input("Enter subject you're about to change: ").title()
                                            if enter in Staff_Tasks[who][which]:
                                                Staff_Tasks[who][which].pop(enter)
                                                newsub = input("Enter subject of task: ").title()
                                                if newsub in Staff_Tasks[who][which]:
                                                    newtask = input("Enter new task: ")
                                                    Staff_Tasks[who][which][newsub] = newtask
                                                    end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section")
                                                    if end == "1":
                                                        print("_Returned to Menu_")
                                                    elif end == "2":
                                                        edit_delete()
                                                    else:
                                                        print("Error: Enter only numbers 1 or 2")
                                                else:
                                                    newtask = input("Enter new task: ")
                                                    get2 = Staff_Tasks[who].get(which)
                                                    final = get2, newtask
                                                    Staff_Tasks[who][which][newsub] = final
                                                    get3 = Staff_Tasks[who].get(which)
                                                    print("UPDATED TASKS:", get3)
                                                    end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section: ")
                                                    if end == "1":
                                                        print("_Returned to Menu_")
                                                    elif end == "2":
                                                        edit_delete()
                                                    else:
                                                        print("Error: Enter only numbers 1 or 2")
                                            else:
                                                print("Error: Subject not found in tasks record")
                                        elif select == "No":
                                            get4 = Staff_Tasks.get(who)
                                            print(get4)
                                            enter2 = input("Enter which subject is the task under: ").title()
                                            if enter2 in Staff_Tasks[who][which]:
                                                new_task = input("Enter the new task: ")
                                                Staff_Tasks[who][which][enter2] = new_task
                                                get5 = Staff_Tasks[who].get(which)
                                                print("UPDATED TASKS:", get5)
                                                end = input("Enter 1: Back to Menu, Enter2: Back to Edit/Delete section: ")
                                                if end == "1":
                                                    print("_Returned to Menu_")
                                                elif end == "2":
                                                    edit_delete()
                                                else:
                                                    print("Error: Enter only numbers 1 or 2")
                                            else:
                                                print("Error: Subject not found in Tasks Record")
                                        else:
                                            print("Error: Enter only Yes or No")
                                    else:
                                        print("Error: Patient does not exist in task record")
                            elif edit == "2":
                                choice = input("Enter Staff number where you want to delete a task: ")
                                if choice in Staff_Task:
                                    get = Staff_Task.get(choice)
                                    print(get)
                                    patient = input("Enter which Patient does the task belong: ").title()
                                    if patient in Staff_Tasks[choice]:
                                        delete = input("Enter subject of the task in order to delete: ").title()
                                        if delete in Staff_Tasks[choice][patient]:
                                            Staff_Tasks[choice][patient].pop(delete)
                                            get2 = Staff_Tasks[choice].get(patient)
                                            print(get2)
                                        else:
                                            print("Error: Subject not found in task")
                                    else:
                                        print("Error: Patient does not exist in task record")
                                else:
                                    print("Error: Staff number not found in task record")
                            else:
                                print("Error: Enter numbers only 1 and 2")
                    else:
                        print("Error : Enter only numbers from 1 to 3")
                elif Option == "3":
                    Patient_View = input("Enter Name of Patient: ").title()
                    if Patient_View in Patient_records:
                        Patient_get = Patient_records.get(Patient_View)
                        print("Here is the record you're looking for\n",Patient_get)
                        end = input("Enter 1 - Return to Menu, Enter 2 - View another: ")
                        if end == "1":
                            print("__Returned to Menu__")
                        elif end == "2":
                            start3()
                        else:
                            print("Error: Enter 1 and 2 only")
                    else:
                        print("Patient does not exist in existing records")
                elif Option == "4":
                    Delete_record = input("Enter name of the patient to delete its record: ").title()
                    if Delete_record in Patient_records:
                        Get_record = Patient_records.get(Delete_record)
                        print(Get_record)
                        Ask = input("Are you sure you want delete this patient's record?, Enter Yes/No: ").title()
                        if Ask == "Yes":
                            del Patient_records[Delete_record]
                            final_record = Patient_records.get(Delete_record)
                            print("Record has been cleared, New Value:", final_record)
                        elif Ask == "No":
                            print("Record retained:",Get_record)
                        else:
                            print("Invalid, Enter only Yes or No")
                        end = input("Enter 1 - Return to Menu, Enter 2 - Delete another: ")
                        if end == "1":
                            print("_Returned to Menu_")
                        elif end == "2":
                            start4()
                        else:
                            print("Error: Enter only 1 or 2")
                    else:
                        print("Patient does not exist, cannot proceed to records")
                elif Option == "5":
                    Patient_edit = input("Please enter patient name to edit his/her record: ").title()
                    if Patient_edit in Patient_records:
                        Patientbump = Patient_records.get(Patient_edit)
                        print(Patientbump)
                        To_edit = input("Please enter what you want to edit in the record (Ex. name): ").title()
                        if To_edit in Patient_records[Patient_edit]:
                            edit = input("Enter new value for the area of edit: ")
                            New_value = Patient_records[Patient_edit][To_edit] = edit
                            Patient_update = Patient_records.get(Patient_edit)
                            print("Record Updated:",Patient_update)
                        else:
                            print("Area of edit mispelled or does not exist")
                        end = input("Enter 1 - Return to Menu, Enter 2 - Edit another: ")
                        if end == "1":
                            print("_Returned to Menu_")
                        elif end == "2":
                            start5()
                        else:
                            print("Error: Enter only numbers 1 or 2")
                    else:
                        print("Patient does not exist in current records")
                elif Option == "6":
                    print("______________Welcome to Billing_____________")
                    print("Enter 1 : View Patient bill")
                    print("Enter 2 : Add items to a Patient's bill")
                    print("Enter 3 : Delete/Edit items in a Patient's bill")
                    print("Enter 4 : Pay per item")
                    print("Enter 5 : Pay Total")
                    choice = input("Enter desired function for Billing: ")
                    if choice == "1":
                        patient_bill = input("Enter the name of Patient you want to see the bill: ").title()
                        if patient_bill in Bill_of_Patients:
                            Get_Bill = Bill_of_Patients.get(patient_bill)
                            if Bill_of_Patients[patient_bill] == {}:
                                print("This bill record is empty:",patient_bill,":",Get_Bill)
                            else:
                                print(Get_Bill)
                                Bill_total = sum(value for value in Bill_prices[patientbill_add].values())
                                print("Total bill:",Bill_total)
                                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-View another bill: ")
                                if end == "1":
                                    print("_Returned to Menu")
                                elif end == "2":
                                    start6()
                                elif end == "3":
                                    view6()
                                else:
                                    print("Error: Enter only 1 or 2")
                        else:
                            print("Bill record not found!")
                    elif choice == "2":
                        print("___Adding items to a patient's bill____")
                        patientbill_add  = input("Enter name of Patient you want to add an item in bill with: ").title()
                        if patientbill_add in Bill_of_Patients:
                            Get_Bill = Bill_of_Patients.get(patientbill_add)
                            print("Current Bill:", Get_Bill)
                            add_bill = input("Enter name of medical item: ").title()
                            if add_bill in Bill_of_Patients[patientbill_add]:
                                print("__Item already exist in bill, Edit it instead__")
                                end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Edit: ")
                                if end == "1":
                                    print("__Returned to Menu__")
                                elif end == "2":
                                    start6()
                                elif end == "3":
                                    Getbill = Bill_of_Patients.get(patientbill_add)
                                    print(Getbill)
                                    addedit()
                                else:
                                    print("Error: Enter only numbers from 1 to 3")
                            else:
                                add_iprice = float(input("Enter price of item: "))
                                add_quantity = float(input("Enter quantity of item: "))
                                add_oprice = add_quantity * add_iprice
                                Bill_prices[patientbill_add][add_bill] = add_oprice
                                Bill_total = sum(value for value in Bill_prices[patientbill_add].values())
                                Bill_of_Patients[patientbill_add][add_bill] = "Qty:",add_quantity,"*",add_iprice,"Php:",add_oprice
                                New_Bill = Bill_of_Patients.get(patientbill_add)
                                print(patientbill_add,"current bill:",New_Bill)
                                print("Total Bill:",Bill_total)
                                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Add another: ")
                                if end == "1":
                                    print("_Returned to Menu_")
                                elif end == "2":
                                    start6()
                                elif end == "3":
                                    add()
                                else:
                                    print("Error: Please enter only numbers 1 to 3")
                        else:
                            print("Error: Patient not found")
                    elif choice == "3":
                        print("_________________________________")
                        print("Enter 1 : Edit a Patient's bill")
                        print("Enter 2 : Delete items in Patient's bill")
                        mode = input("Enter number of desired function: ")
                        if mode == "1":
                            edit = input("Enter name of Patient to edit its bill: ").title()
                            if edit in Bill_of_Patients:
                                Get = Bill_of_Patients.get(edit)
                                print("Current Bill:",Get)
                                to_edit = input("Enter what item to edit: ").title()
                                if to_edit in Bill_of_Patients[edit]:
                                    Qty_new = float(input("Enter new/retain Quantity: "))
                                    Price = float(input("Enter new/retain Price: "))
                                    oprice = Qty_new * Price
                                    Bill_prices[edit][to_edit] = oprice
                                    Bill_of_Patients[edit][to_edit] = "Qty:",Qty_new,"*",Price,"Php:",oprice
                                    New_total = sum(value for value in Bill_prices[edit].values())
                                    update_bill = Bill_of_Patients.get(edit)
                                    print(update_bill)
                                    print("New bill total:", New_total)
                                    end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Edit another: ")
                                    if end == "1":
                                        print("_Returned to Menu_")
                                    elif end == "2":
                                        start6()
                                    elif end == "3":
                                        edit()
                                    else:
                                        print("Error: Enter only numbers from 1 to 3")
                                else:
                                    print("Error: Input item not in bill")
                            else:
                                print("Error: Patient not found!")
                        elif mode == "2":
                            patient = input("Enter name of Patient to delete items in its bill: ").title()
                            if patient in Bill_of_Patients:
                                get_past = Bill_of_Patients.get(patient)
                                print(get_past)
                                delete = input("Enter the item you would want to delete: ").title
                                if delete in Bill_of_Patients[patient]:
                                    pop = Bill_of_Patients[patient].pop(delete)
                                    Bill_prices[patient].pop(delete)
                                    get = Bill_of_Patients.get(patient)
                                    total = sum(value for value in Bill_prices[patient].values())
                                    print("Item deleted:",pop)
                                    print("New bill copy:",get)
                                    print("New bill Total:",total)
                                    end = input("Enter 1-Return to Menu, Enter 2-Billing page, Enter 3-Delete another: ")
                                    if end == "1":
                                        print("_Returned to Menu_")
                                    elif end == "2":
                                        start6()
                                    elif end == "3":
                                        delete()
                                    else:
                                        print("Error: Enter only numbers from 1 to 3")
                                else:
                                    print("Error: item not found in the bill")
                            else:
                                print("Error: Patient bill not found")
                        else:
                            print("Error: Enter only numbers from 1 to 2")
                    elif choice == "4":
                        patient = input("Enter name of Patient to proceed to payment: ").title()
                        if patient in Bill_of_Patients:
                            get = Bill_of_Patients.get(patient)
                            print("Current bill:",get)
                            pay_select = input("Enter specific item you are going to pay: ").title()
                            if pay_select in Bill_of_Patients[patient]:
                                Bill_of_Patients[patient][pay_select] = "Paid"
                                Bill_prices[patient][pay_select] = 0
                                get2 = Bill_of_Patients.get(patient)
                                new_total = sum(value for value in Bill_prices[patient].values())
                                print("Payment concluded:",get2)
                                print("New bill totall:",new_total)
                                end = input("Enter 1-Return to Menu, Enter 2-Billing Page, Enter 3-Pay another item(Same patient): ")
                                if end == "1":
                                    print("_Returned to Menu_")
                                elif end == "2":
                                    start6()
                                elif end == "3":
                                    payselect()
                                else:
                                    print("Error: Enter only numbers from 1 to 3")
                            else:
                                print("Error: Input item not found in bill")
                        else:
                            print("Error: Patient not found!")
                    elif choice == "5":
                        patient = input("Enter name of Patient for total payment: ").title()
                        if patient in Bill_of_Patients:
                            verify = input("Are you sure you want to proceed to total payment Yes/No: ").title()
                            if verify == "Yes":
                                get1 = sum(value for value in Bill_prices[patient].values())
                                Bill_of_Patients[patient] = "Paid: Bill cleared"
                                Bill_prices[patient] = 0
                                get2 = Bill_of_Patients.get(patient)
                                get3 = Bill_prices.get(prices)
                                print("Current bill:",get2)
                                print("Total bill:",get3)
                                print("Amount Paid:",get1)
                            elif verify == "No":
                                print("__Returned to Billing Page__")
                                start6()
                            else:
                                print("Error: Enter only Yes or No")
                        else:
                            print("Error: Patient not found!")
                    else:
                        print("Error: Enter only numbers from 1 to 5")
                elif Option == "7":
                    access = input("Enter System built-in passcode to change Admin password: ")
                    if access in System_builtin_code:
                        print("Access granted")
                        Admin_Password.clear()
                        New_Admin = input("Enter new Admin_Password: ")
                        Admin_Password.append(New_Admin)
                        print("Admin password has been updated: ", Admin_Password)
                    else:
                        print("Access Denied: Incorrect System built-in passcode")
                elif Option == "8":
                    ID_Access = input("Enter Admin password to Add Staff ID: ")
                    if ID_Access in Admin_Password:
                        Add_ID = input("Enter new staff Indentification Number to add: ")
                        if Add_ID in Staff_list:
                            print("__Error: ID number already exist__")
                            start8()
                        else:
                            Add_name = input("Enter name for this ID: ")
                            profession = input("Enter staff's profession (Ex. Nurse): ").title()
                            finalID = profession + " " + Add_name
                            Staff_list[Add_ID] = finalID
                            task_update = { Add_ID : {
                            }}
                            Staff_Tasks.update(task_update)
                            print("New ID number:",Add_ID,"successfully added to records")
                            end = input("Enter 1 - Return to Menu, Enter 2 - Add another ID: ")
                            if end == "1":
                                print("_Returned to Menu_")
                            elif end == "2":
                                start8()
                            else:
                                print("Error: Enter only numbers 1 or 2")
                    else:
                        print("Incorrect Admin Password")
                elif Option == "9":
                    print("Current Staff listing:", Staff_list)
                    deleteID = input("Enter ID number to delete staff on staff list")
                    if delete in Staff_list:
                        Staff_list.pop(deleteID)
                        print("Update Staff Listing:",Staff_list)
                    else:
                        print("ID number not found in Staff list")
                else:
                    print("Enter given number options only")
        else:
            tries += 1
            if tries > maximum_attempt:
                print("Access Denied, Maximum attempts of five reached")
                break
            else:
                print("ID Number not found")
Leave a Comment