def add_client(): os.system("clear") first_name = input("\n\nEnter client's first name:\n >> ").title() last_name = input("\nEnter client's last name:\n >> ").title() kind = input("\nEnter customer type (band, company, artist, etc):\n >> ") email = input("\nEnter client e-mail:\n >> ").lower() phone = input("\nEnter client phone (###-###-####):\n >> ") street = input("\nEnter client's street address:\n >>") city = input("\nEnter client's city and province:\n >>").title() country = input("\nEnter client's country:\n >>") zipcode = input("\nEnter client's postal code:\n >>") survey = input("\nHow did client hear about us?\n >>").lower() os.system('clear') print("\n\nPlease review the information entered:") print("\n%s %s" % (first_name, last_name)) print("Type: " + kind.title()) print("Contact info: %s %s" % (email, phone)) print("\nAddress:") print(street) print(city, country) print(zipcode) print("Found studio through %s" % survey) if fr_functions.verification(False) == 'y': cfg.CLIENT_LIST.append(fr_classes.Client(first_name, last_name, kind, email, phone, street, city, country, zipcode, survey)) fr_functions.save_database() menu_main.execute_menu('c')
def edit_client_info(): os.system('clear') client_name, cilent_exists, client_index = fr_functions.lookup( "client's", cfg.CLIENT_LIST) print("\tCurrent client information:") print("\t" + item.first_name + " " + item.last_name) print("\t" + item.street) print("\t" + item.city) print("\t" + item.country) print("\t" + item.zipcode) print("\t" + item.email) print("\t" + item.phone) new_email = input("\n\tEnter client e-mail:\n >> ").lower() new_phone = input("\n\tEnter client phone (###-###-####):\n >> ") new_street = input("\n\tEnter client's street address:\n >>") new_city = input("\n\tEnter client's city and province:\n >>").title() new_country = input("\n\tEnter client's country:\n >>") new_zipcode = input("\n\tEnter client's postal code:\n >>") fr_functions.alert("Warning: you cannot undo this change.") if fr_functions.verification() == 'y': cfg.CLIENT_LIST[client_index].email = new_email cfg.CLIENT_LIST[client_index].phone = new_phone cfg.CLIENT_LIST[client_index].street = new_street cfg.CLIENT_LIST[client_index].city = new_city cfg.CLIENT_LIST[client_index].country = new_country cfg.CLIENT_LIST[client_index].zip_code = new_zipcode menu_main.execute_menu('c')
def new_invoice(): os.system('clear') client_name, client_exists, client_index = fr_functions.lookup( "client's", cfg.CLIENT_LIST) customer_info = [(cfg.CLIENT_LIST[client_index].first_name + " " + cfg.CLIENT_LIST[client_index].last_name), cfg.CLIENT_LIST[client_index].phone, cfg.CLIENT_LIST[client_index].street, cfg.CLIENT_LIST[client_index].city, cfg.CLIENT_LIST[client_index].country, cfg.CLIENT_LIST[client_index].zip_code] invoice_date = time.strftime("%d/%m/%Y") invoice_number = fr_functions.find_invoice_number() os.system("clear") print("\n\nWhich project are you invoicing:\n") print(" Project Name") print(" " + "=" * 50) count = 1 for item in cfg.CLIENT_LIST[client_index].projects: print("[%s] " % count + item.name.ljust(50).title()) count += 1 print("\n") project_choice = fr_functions.check_if_number() - 1 services_rendered = [] invoice_cost = 0 while True: control_date = cfg.CLIENT_LIST[client_index].projects[ project_choice].sessions[-1].date for item in cfg.CLIENT_LIST[client_index].projects[ project_choice].sessions: if item.date == control_date: services_rendered.append(item) invoice_cost = invoice_cost + item.cost break print("Total invoice cost will be $%s." % invoice_cost) print("Current discount for invoice is: $0") if fr_functions.verification(False) == 'n': print("What discount would you like to offer (in CAD dollars)?") discount = fr_functions.check_if_number() else: discount = 0 final_invoice_total = invoice_cost - discount cfg.INVOICES.append(fr_classes.Invoice(invoice_number, invoice_date, invoice_cost, discount, final_invoice_total, customer_info, services_rendered)) current_invoice = cfg.INVOICES[-1] fr_functions.save_database() fr_functions.write_to_csv(fr_functions.unpack_invoice_information( current_invoice)) fr_generate_invoice.make_invoice()