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 edit_project(name, item_index): """ Adds Session class to the projects that cantains information on the various sessions that happened (ie. Recording session on a date or whatnot) """ os.system("clear") print('\nPlease choose a project to add a session to:\n') print(" Project Name") print(" " + "=" * 50) count = 1 for item in cfg.CLIENT_LIST[item_index].projects: print("[%s] " % count + item.name.ljust(50).title()) count += 1 print("\n") project_choice = fr_functions.check_if_number() - 1 session_date = time.strftime("%d/%m/%Y") print ("How long was the session length?") session_length = fr_functions.check_if_number() while True: service_name, service_exists, service_index = fr_functions.lookup( "service", cfg.SERVICES) if service_exists is True: cost = cfg.SERVICES["%s" % service_name.title()] * session_length cfg.CLIENT_LIST[item_index].projects[ project_choice].sessions.append(fr_classes.Sessions( session_date, service_name, session_length, cost, cfg.SERVICES["%s" % service_name.title()])) break else: fr_functions.alert("Service does not exist.") fr_functions.save_database() menu_main.projects_menu(name, item_index)
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()