def view_invoice(): os.system('clear') print("\n\nTo find specific invoices, please enter client's full name:") name = input(" >> ").title() temp_list = [] for item in cfg.INVOICES: if name == item.customer_info[0]: temp_list.append(item) elif name != item.customer_info[0] and item is cfg.INVOICES[-1] and ( not temp_list): fr_functions.alert("No such customer exists.") menu_main.invoice_menu() os.system("clear") print("\n\n\tShowing past invoices for:") print("\t" + temp_list[1].customer_info[0]) print("\t" + temp_list[1].customer_info[2]) print("\t" + temp_list[1].customer_info[3]) print("\t" + temp_list[1].customer_info[4]) print("\t" + temp_list[1].customer_info[5]) print("\n\n" + "Invoice No.".rjust(15) + " Invoice Date") print("=" * 40) count = 1 for item in temp_list: print(str(count).ljust(4) + str( item.invoice_number).rjust(11).zfill(5) + " " + item.invoice_date) count += 1 print("\nWhich invoice would you like to view:") view_invoice = fr_functions.check_if_number() - 1 current_invoice = temp_list[view_invoice] fr_functions.write_to_csv(fr_functions.unpack_invoice_information( current_invoice)) fr_generate_invoice.make_invoice() menu_main.main_menu()
def make_invoice(data_file="fr_csv_data.csv"): import_data(data_file) menu_main.invoice_menu()