#include /* What goes where, listed as: Function [Menu Option] Cashier: list of available products [1] list of available services [2] invoices [3] (includes adding new customers) modify customer information [4] Supervisor: insert products/services/suppliers [5] update tech w/service capabilities [7] update service time [5] inventory rpt [0] supplier rpt [0] customer rpt [0] inventory turnover report [0] Manager: hire/fire technicians [7] change service rate [5] financial report (from transactions) [0] */ void main() { do_main_menu(); } char get_choice(char *choices) { char c=1, x; while(!index(choices, c)) { c = toupper(getchar()); if(c=='\n') continue; x = getchar(); while(x!='\n') x = getchar(); } return c } void do_main_menu() { char choice=0; while(1) { printf("+------------------------------------------+\n"); printf("| 1] List products available |\n"); printf("| 2] List services available |\n"); printf("| 3] Build an invoice |\n"); printf("| 4] Modify customer information |\n"); printf("| 5] Add/Remove/Update a product/service |\n"); printf("| 6] Add/Remove/Update a supplier |\n"); printf("| 7] Add/Remove/Update employees |\n"); printf("| |\n"); printf("| Q] Exit |\n"); printf("+------------------------------------------+\n"); printf("\nChoice: "); choice = get_choice("12345670Q"); switch (choice) { case '1': /* list_products();*/ break; case '2': /* list_services();*/ break; case '3': /* build_invoice();*/ break; case '4': /* do_customer_menu();*/ break; case '5': do_product_menu(); break; case '6': /* do_supplier_menu();*/ break; case '7': do_employee_menu(); break; case '0': do_reports_menu(); case 'Q': return; } } } void do_reports_menu() { char choice=0; while(1) { printf("+------------------------+\n"); printf("| 1] Inventory report |\n"); printf("| 2] Supplier report |\n"); printf("| 3] Customer report |\n"); printf("| 4] Financial summary |\n"); printf("| |\n"); printf("| 0] Return to previous |\n"); printf("+------------------------+\n"); printf("\nChoice: "); choice = get_choice("12340"); switch (choice) { case '1': /* do_inventory_report();*/ break; case '2': /* do_supplier_report();*/ break; case '3': /* do_customer_report();*/ break; case '4': do_financial_summary(); break; case '0': return; } } } void do_employee_menu() { char choice=0; while(1) { printf("+-------------------------------------+\n"); printf("| 1] Add a new technician |\n"); printf("| 2] Remove a technician |\n"); printf("| 3] Update a technician's skill set |\n"); printf("| |\n"); printf("| 0] Return to previous |\n"); printf("+-------------------------------------+\n"); printf("\nChoice: "); choice = get_choice("1230"); switch (choice) { case '1': do_add_employee(); break; case '2': do_remove_employee(); break; case '3': /* Call Cristi's employee-update function */ break; case '0': return; } } } void do_product_menu() { char choice=0; while(1) { printf("+------------------------+\n"); printf("| 1] Add a product |\n"); printf("| 2] Remove a product |\n"); printf("| 3] Update a product |\n"); printf("| 4] Add a service |\n"); printf("| 5] Remove a service |\n"); printf("| 6] Update a service |\n"); printf("| |\n"); printf("| 0] Return to previous |\n"); printf("+------------------------+\n"); printf("\nChoice: "); choice = get_choice("1230"); switch (choice) { case '1': /* do_add_product();*/ break; case '2': /* do_remove_product();*/ break; case '3': /* do_update_product();*/ break; case '4': /* do_add_service();*/ break; case '5': /* do_remove_service();*/ break; case '6': do_update_service(); break; case '0': return; } } }