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 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 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()
def add_project(name, item_index): os.system('clear') proj_name = input("\n\nEnter new project name:\n >> ").lower() date = time.strftime("%d/%m/%Y") cfg.CLIENT_LIST[item_index].projects.append(fr_classes.Project( proj_name, date, sessions=[])) fr_functions.save_database() menu_main.projects_menu(name, item_index)