├── .DS_Store ├── C Files ├── Customer_Menu_Function.c ├── INVENTORY_MANAGEMENT.C ├── medical_menu.c ├── medicine.txt ├── supplier.txt └── supplier_menu.c ├── LICENSE ├── README.md ├── RUN_THIS_FIRST(INDEX).py ├── __pycache__ ├── customer_functions.cpython-36.pyc ├── invoicing_functions.cpython-36.pyc ├── medicine_functions.cpython-36.pyc ├── menu_functions.cpython-36.pyc ├── report_functions.cpython-36.pyc └── supplier_functions.cpython-36.pyc ├── cus_men.csv ├── customer_functions.py ├── gui.py ├── invoicing_functions.py ├── medicine.csv ├── medicine_functions.py ├── menu_functions.py ├── purchase.csv ├── report_functions.py ├── sales.csv ├── supplier.csv └── supplier_functions.py /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/.DS_Store -------------------------------------------------------------------------------- /C Files/Customer_Menu_Function.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct cusmen 4 | { 5 | char name[50]; 6 | int id; 7 | long phone; 8 | char med[50]; 9 | }; 10 | 11 | void cusmen(); 12 | 13 | int main() 14 | { 15 | cusmen(); 16 | } 17 | 18 | void cusmen() 19 | { 20 | char ch='y'; 21 | do 22 | { 23 | printf("1. To add a new customer\n2. To view details of existing customer\n3. To update an existing record\n"); 24 | int c; 25 | scanf("%d",&c); 26 | switch(c) 27 | { 28 | case 1: 29 | { 30 | struct cusmen a; 31 | printf("---------------------Customer Details------------------------\n"); 32 | FILE *fp=fopen("cusmen.txt","a+"); 33 | printf("Enter the name of the customer\n"); 34 | scanf("%s",&a.name); 35 | printf("Enter the ID of the customer\n"); 36 | scanf("%d",&a.id); 37 | printf("Enter the phone number of the customer\n"); 38 | scanf("%ld",&a.phone); 39 | printf("Enter the name of the drug the customer needs\n"); 40 | scanf("%s",&a.med); 41 | fprintf(fp,"%s \n%d \n%ld \n %s\n",a.name,a.id,a.phone,a.med); 42 | fclose(fp); 43 | break; 44 | } 45 | case 2: 46 | { 47 | printf("Enter the customer ID to find details\n"); 48 | int n; 49 | struct cusmen b; 50 | scanf("%d",&n); 51 | FILE *fp1=fopen("cusmen.txt","a+"); 52 | rewind(fp1); 53 | while(fscanf(fp1,"%s %d %ld %s",&b.name,&b.id,&b.phone,&b.med)!=EOF) 54 | { 55 | if(n==b.id) 56 | printf("Customer Name:%s\n Customer ID: %d\n Customer Phone: %ld\n Customer Medicine: %s\n",b.name,b.id,b.phone,b.med); 57 | } 58 | 59 | fclose(fp1); 60 | break; 61 | } 62 | case 3: 63 | { 64 | printf("Enter the customer ID to update that particular record\n"); 65 | int n1; 66 | struct cusmen c; 67 | scanf("%d",&n1); 68 | FILE *fp2=fopen("cusmen.txt","a+"); 69 | FILE *fp2_1=fopen("temp.txt","a+"); 70 | rewind(fp2); 71 | while(fscanf(fp2,"%s %d %ld %s",&c.name,&c.id,&c.phone,&c.med)!=EOF) 72 | { 73 | if(n1!=c.id) 74 | fprintf(fp2_1,"%s \n%d \n%ld \n %s\n",c.name,c.id,c.phone,c.med); 75 | else 76 | { 77 | printf("1. To update customer name\n2. To update customer ID\n3. To update customer phone number\n4. To update customer medicine\n"); 78 | int choice; 79 | scanf("%d",&choice); 80 | switch(choice) 81 | { 82 | case 1: 83 | { 84 | printf("Enter the name\n"); 85 | scanf("%s",&c.name); 86 | break; 87 | } 88 | case 2: 89 | { 90 | printf("Enter the ID\n"); 91 | scanf("%d",&c.id); 92 | break; 93 | } 94 | case 3: 95 | { 96 | printf("Enter the phone number\n"); 97 | scanf("%ld",&c.phone); 98 | break; 99 | } 100 | case 4: 101 | { 102 | printf("Enter the medicine name\n"); 103 | scanf("%s",&c.med); 104 | break; 105 | } 106 | } 107 | fprintf(fp2_1,"%s \n%d \n%ld \n %s\n",c.name,c.id,c.phone,c.med); 108 | 109 | } 110 | fclose(fp2_1); 111 | fclose(fp2); 112 | fp2=fopen("cusmen.txt","w"); 113 | fp2_1=fopen("temp.txt","r"); 114 | while(fscanf(fp2_1,"%s %d %ld %s",&c.name,&c.id,&c.phone,&c.med)!=EOF) 115 | fprintf(fp2,"%s \n%d \n%ld \n %s\n",c.name,c.id,c.phone,c.med); 116 | fclose(fp2); 117 | fclose(fp2_1); 118 | } 119 | 120 | } 121 | printf("Do you want to go again(y/n)?"); 122 | scanf("%c",&ch); 123 | } 124 | <<<<<<< HEAD:CusMen.c 125 | }while(ch=='Y' || ch=='y'); 126 | } 127 | ======= 128 | } 129 | >>>>>>> 5a82015c330405c43d4beb1aae785155053e189a:Customer_Menu_Function.c 130 | -------------------------------------------------------------------------------- /C Files/INVENTORY_MANAGEMENT.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // For medicines 6 | void medicine_menu(); 7 | void add_medicine(); 8 | void search_medicine(); 9 | void medicine_to_be_purchased(); 10 | void update_inventory(); 11 | 12 | // For customer 13 | void customer_menu(); 14 | void search_customer(); 15 | void create_customer(); 16 | void update_customer_info(); 17 | 18 | // For supplier 19 | void supplier_menu(); 20 | void search_supplier(); 21 | void create_supplier(); 22 | void update_supplier_info(); 23 | 24 | //For billing 25 | void invoicing_menu(); 26 | 27 | //For reports 28 | void report_menu(); 29 | void day_sale(); 30 | void month_sale(); 31 | void day_purchase(); 32 | void month_purchase(); 33 | void profit_report(); 34 | 35 | int main(void){ 36 | int menu_choice; 37 | do{ 38 | printf("Enter 1 for medicine menu. \n Enter 2 for customer menu. \n Enter 3 for supplier menu. \n Enter 4 for report menu. \n Enter 5 for Invoicing. \n Enter 6 to quit program.\n"); 39 | scanf("%d",&menu_choice); 40 | 41 | switch(menu_choice) 42 | { 43 | case 1: medicine_menu(); 44 | break; 45 | 46 | case 2: customer_menu(); 47 | break; 48 | 49 | case 3: supplier_menu(); 50 | break; 51 | 52 | case 4: report_menu(); 53 | break; 54 | 55 | case 5: invoicing_menu(); 56 | break; 57 | 58 | case 6: printf("Exit Successful \n"); 59 | break; 60 | 61 | default: printf("Invalid Input! Try Again! \n"); 62 | 63 | } 64 | 65 | }while(menu_choice!= 6); 66 | 67 | } 68 | 69 | void medicine_menu(){ 70 | int medicine_menu_choice; 71 | do{ 72 | printf("Enter 1 to search medicine. \nEnter 2 to add medicine. \nEnter 3 to update inventory . \nEnter 4 for Medicines to be purchased list. \nEnter 5 to to go back to Main Menu.\n"); 73 | scanf("%d",&medicine_menu_choice); 74 | 75 | switch(medicine_menu_choice) 76 | { 77 | case 1: search_medicine(); 78 | break; 79 | 80 | case 2: add_medicine(); 81 | break; 82 | 83 | case 3: update_inventory(); 84 | break; 85 | 86 | case 4: medicine_to_be_purchased(); 87 | break; 88 | 89 | case 5: printf("Returning to main menu \n"); 90 | break; 91 | 92 | default: printf("Invalid Input! Try Again! \n"); 93 | 94 | } 95 | }while(medicine_menu_choice!= 5); 96 | } 97 | 98 | void customer_menu(){ 99 | int customer_menu_choice; 100 | do{ 101 | printf("Enter 1 to search customer. \nEnter 2 to create new customer. \nEnter 3 to update customer information. \nEnter 4 to go back to Main Menu.\n"); 102 | scanf("%d",&customer_menu_choice); 103 | 104 | switch(customer_menu_choice) 105 | { 106 | case 1: search_customer(); 107 | break; 108 | 109 | case 2: create_customer(); 110 | break; 111 | 112 | case 3: update_customer_info(); 113 | break; 114 | 115 | case 4: printf("Returning to main menu!"); 116 | break; 117 | 118 | default: printf("Invalid Input! Try Again! \n"); 119 | 120 | } 121 | 122 | }while(customer_menu_choice!= 4); 123 | 124 | } 125 | 126 | void supplier_menu(){ 127 | int supplier_menu_choice; 128 | do{ 129 | printf("Enter 1 to search supplier. \nEnter 2 to create new supplier. \nEnter 3 to update supplier information. \nEnter 4 to go back to Main Menu."); 130 | scanf("%d",&supplier_menu_choice); 131 | 132 | switch(supplier_menu_choice) 133 | { 134 | case 1: search_supplier(); 135 | break; 136 | 137 | case 2: create_supplier(); 138 | break; 139 | 140 | case 3: update_supplier_info(); 141 | break; 142 | 143 | case 4: printf("Returning to main menu \n"); 144 | break; 145 | 146 | default: printf("Invalid Input! Try Again! \n"); 147 | 148 | } 149 | 150 | }while(supplier_menu_choice!= 4); 151 | 152 | } 153 | 154 | void report_menu(){ 155 | int report_menu_choice; 156 | do{ 157 | printf("Enter 1 for Todays sales. \n Enter 2 for this months sales. \n Enter 3 for todays purchases. \n Enter 4 for this months purchases. \n Enter 5 for profit report. \n Enter 6 to go back to main menu."); 158 | scanf("%d",&report_menu_choice); 159 | 160 | switch(report_menu_choice) 161 | { 162 | case 1: day_sale(); 163 | break; 164 | 165 | case 2: month_sale(); 166 | break; 167 | 168 | case 3: day_purchase(); 169 | break; 170 | 171 | case 4: month_purchase(); 172 | break; 173 | 174 | case 5: profit_report(); 175 | break; 176 | 177 | case 6: printf("Returning to main menu \n"); 178 | break; 179 | 180 | default: printf("Invalid Input! Try Again! \n"); 181 | 182 | } 183 | 184 | }while(report_menu_choice != 6); 185 | 186 | } 187 | 188 | void invoicing_menu(){ 189 | 190 | } 191 | 192 | -------------------------------------------------------------------------------- /C Files/medical_menu.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | struct medicine 6 | { 7 | char id[6]; 8 | char medi_name[20]; 9 | int quantity; 10 | float sale; 11 | float total; 12 | float unit; 13 | float cost; 14 | int min_quantity; 15 | char pur_date[15]; 16 | char exp_date[15]; 17 | char comp_name[20]; 18 | char supp_name[30]; 19 | }; 20 | 21 | struct medicine *temp; 22 | 23 | 24 | void add_medicine(){ 25 | FILE *fm1; 26 | struct medicine medical; 27 | 28 | fm1 = fopen("medicine.txt", "a+"); 29 | 30 | printf("Enter the name of the medicine\n"); 31 | scanf("%s",medical.medi_name); 32 | printf("Enter the medicine ID\n"); 33 | scanf("%s",medical.id); 34 | printf("Enter quantity purchased\n"); 35 | scanf("%d",&medical.quantity); 36 | printf("Enter minimum quantity to be kept in stock\n"); 37 | scanf("%d",&medical.min_quantity); 38 | printf("Enter sale price\n"); 39 | scanf("%f",&medical.sale); 40 | printf("Enter cost price\n"); 41 | scanf("%f",&medical.unit); 42 | printf("Enter company name\n"); 43 | scanf("%s",medical.comp_name); 44 | printf("Enter supplier name\n"); 45 | scanf("%s",medical.supp_name); 46 | printf("Enter Expiery date\n"); 47 | scanf("%s",medical.exp_date); 48 | printf("Enter purchase date\n"); 49 | scanf("%s",medical.pur_date); 50 | rewind(fm1); 51 | fwrite(&medical,sizeof(struct medicine),1,fm1); 52 | //fprintf(fm1,"%s %s %d %d %f %f %s %s %s %s \r\n",medical.medi_name,medical.id,medical.quantity,medical.min_quantity,medical.sale,medical.unit,medical.comp_name,medical.supp_name,medical.exp_date,medical.pur_date); 53 | fclose(fm1); 54 | 55 | } 56 | 57 | void search_medicine(){ 58 | printf("Enter the name of the medicine\n"); 59 | char med_name[20]; 60 | struct medicine medical; 61 | scanf("%s",med_name); 62 | FILE *fm2=fopen("medicine.txt","r"); 63 | rewind(fm2); 64 | while(fread(&medical,sizeof(struct medicine),1,fm2)==1) 65 | { 66 | fread(&medical,sizeof(struct medicine),1,fm2); 67 | printf("here1"); 68 | printf("%s\n",medical.medi_name); 69 | if(strcmp(medical.medi_name,med_name)==0){ 70 | printf("here2"); 71 | printf("Medicine Name:%s\n Medicine quantity:%d\nMedicine company:%s\nMedicine Price:%f\n",medical.medi_name,medical.quantity,medical.comp_name,medical.sale); 72 | }} 73 | 74 | fclose(fm2); 75 | } 76 | 77 | void main(){ 78 | int medicine_menu_choice; 79 | do{ 80 | printf("Enter 1 to search medicine. \nEnter 2 to add medicine. \nEnter 3 to update inventory . \nEnter 4 for Medicines to be purchased list. \nEnter 5 to to go back to Main Menu."); 81 | scanf("%d",&medicine_menu_choice); 82 | 83 | switch(medicine_menu_choice) 84 | { 85 | case 1: search_medicine(); 86 | break; 87 | 88 | case 2: add_medicine(); 89 | break; 90 | /* 91 | case 3: update_inventory(); 92 | break; 93 | 94 | case 4: medicine_to_be_purchased(); 95 | break;*/ 96 | 97 | default: break; 98 | } 99 | 100 | }while(medicine_menu_choice != 5); 101 | 102 | } -------------------------------------------------------------------------------- /C Files/medicine.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/C Files/medicine.txt -------------------------------------------------------------------------------- /C Files/supplier.txt: -------------------------------------------------------------------------------- 1 | 1 2 | hsv 3 | mum 4 | 809 5 | aba@j.com 6 | 1 7 | 1 8 | 1 9 | 1 10 | 1 11 | 2 12 | 2 13 | 2 14 | 2 15 | 2 16 | -------------------------------------------------------------------------------- /C Files/supplier_menu.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | struct supplier{ 5 | int supplier_id; 6 | char supplier_name[30]; 7 | char supplier_city[20]; 8 | int supplier_contact; 9 | char supplier_email[50]; 10 | }; 11 | void sup_search_byid(){ 12 | printf("Enter the supplier ID to find details!\n"); 13 | int temp_id; 14 | struct supplier temp; 15 | scanf("%d", &temp_id); 16 | FILE *f=fopen("supplier.txt", "a+"); 17 | rewind(f); 18 | while(fscanf(f,"%d \n %s\n %s\n %d\n %s\n", &temp.supplier_id, temp.supplier_name, temp.supplier_city, &temp.supplier_contact, temp.supplier_email)!=EOF){ 19 | if(temp_id==temp.supplier_id){ 20 | printf("Supplier Found!\n"); 21 | printf("Supplier id: %d\n", temp.supplier_id); 22 | printf("Supplier name: %s\n", temp.supplier_name); 23 | printf("Supplier city: %s\n", temp.supplier_city); 24 | printf("Supplier contact: %d\n", temp.supplier_contact); 25 | printf("Supplier email: %s\n", temp.supplier_email); 26 | } 27 | else{ 28 | printf("Supplier does not exist!\n"); 29 | } 30 | } 31 | fclose(f); 32 | return; 33 | } 34 | void sup_search_byname(){ 35 | printf("Enter the supplier name to find details!\n"); 36 | char *temp_name=malloc(sizeof(char*)); 37 | struct supplier temp; 38 | scanf("%s", temp_name); 39 | FILE *f=fopen("supplier.txt", "a+"); 40 | rewind(f); 41 | while(fscanf(f,"%d \n %s\n %s\n %d\n %s\n", &temp.supplier_id, temp.supplier_name, temp.supplier_city, &temp.supplier_contact, temp.supplier_email)!=EOF){ 42 | if(strcmp(temp_name, temp.supplier_name)==0){ 43 | printf("Supplier Found!\n"); 44 | printf("Supplier id: %d\n", temp.supplier_id); 45 | printf("Supplier name: %s\n", temp.supplier_name); 46 | printf("Supplier city: %s\n", temp.supplier_city); 47 | printf("Supplier contact: %d\n", temp.supplier_contact); 48 | printf("Supplier email: %s\n", temp.supplier_email); 49 | } 50 | } 51 | fclose(f); 52 | return; 53 | } 54 | void search_supplier(){ 55 | int sup_search_choice; 56 | do{ 57 | printf("Enter 1 to search supplier by id!\nEnter 2 to search supplier by name!\nEnter 3 to Exit!\n"); 58 | scanf("%d", &sup_search_choice); 59 | switch(sup_search_choice){ 60 | case 1: sup_search_byid(); 61 | break; 62 | case 2: sup_search_byname(); 63 | break; 64 | case 3: printf("Exit Successful!\n"); 65 | break; 66 | default:printf("Invalid Input!\n"); 67 | } 68 | }while(sup_search_choice!=3); 69 | } 70 | void create_supplier(){ 71 | struct supplier temp; 72 | FILE *fp=fopen("supplier.txt", "a+"); 73 | printf("Enter the ID for the new supplier! \n"); 74 | scanf("%d", &temp.supplier_id); 75 | printf("Enter the name of the supplier! \n"); 76 | scanf("%s", temp.supplier_name); 77 | printf("Enter the city of the supplier! \n"); 78 | scanf("%s", temp.supplier_city); 79 | printf("Enter the contact number of the supplier! \n"); 80 | scanf("%d", &temp.supplier_contact); 81 | printf("Enter the email id of the supplier! \n"); 82 | scanf("%s", temp.supplier_email); 83 | fprintf(fp, "%d \n %s\n %s\n %d\n %s\n", temp.supplier_id, temp.supplier_name, temp.supplier_city, temp.supplier_contact, temp.supplier_email); 84 | fclose(fp); 85 | return; 86 | } 87 | void update_supplier_info(){ 88 | 89 | } 90 | 91 | int main(void){ 92 | int supplier_menu_choice; 93 | 94 | do{ 95 | printf("Enter 1 to search supplier. \nEnter 2 to create new supplier. \nEnter 3 to update supplier information. \nEnter 4 to go back to Main Menu.\n"); 96 | scanf("%d",&supplier_menu_choice); 97 | 98 | switch(supplier_menu_choice) 99 | { 100 | case 1: search_supplier(); 101 | break; 102 | 103 | case 2: create_supplier(); 104 | break; 105 | 106 | case 3: update_supplier_info(); 107 | break; 108 | 109 | case 4: printf("Returning to main menu \n"); 110 | break; 111 | 112 | default: printf("Invalid Input! Try Again! \n"); 113 | 114 | } 115 | }while(supplier_menu_choice!= 4); 116 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CS207-AP 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pharmacy Management Software 2 | 3 | ## GitHub Repository 4 | * https://github.com/CS207-AP/Inventory-Management 5 | 6 | ## Table of Contents 7 | 8 | * [Aim](#aim) 9 | * [Our Approach to the Solution](#our-approach-to-the-solution) 10 | * [Technology Utilised](#technology-utilised) 11 | * [Issues Faced](#issues-faced) 12 | * [Scope of improvement](#scope-of-improvement) 13 | * [Contributors](#contributors) 14 | * [License](#license) 15 | 16 | ## Aim 17 | To create an inventory management software that deals with the day-to-day workings of a pharmacy store, thereby improving its efficiency and productivity. 18 | 19 | ## Our Approach to the Solution 20 | Once the aim was established, we ideated to develop a program by which a pharmacy can deal with the following tasks: 21 | * Customer Database Management 22 | * Supplier Database Management 23 | * Inventory Database Management 24 | * Invoicing (To manage bill generation.) 25 | * Reports (To maintain the record of medicines sold and bought on a daily/monthly/yearly basis.) 26 | 27 | We worked upon a basic structure of what we wanted to achieve, and we started working on it in C language. However, once we were almost halfway done, we realised that managing multiple databses in the said language was neither easy, nor efficient. Additionally, working on a GUI in C was challenging as most of its GUI libraries like 'graphics.h' were outdated and out of active support. 28 | 29 | Due to the continued problems that the C language posed us with, we decided to move our whole code to the Python language - a language that none of us group members were earlier familiar with - by learning it from scratch. We decided on this switch given Python's extensive support of libraries, efficient database management, and active support availability. 30 | 31 | We read the python documentation, and began our work. We used '.csv' files to maintain our databse records, which helped us manage our data in a relatively efficient manner as compared to the '.txt' files that we had been using in the C langauge. 32 | 33 | ## Technology Utilised 34 | * Python - https://docs.python.org/3/ 35 | * CSV files for Database Management - https://docs.python.org/3/library/csv.html 36 | * Git & GitHub for Version Control- https://www.github.com 37 | 38 | ## Issues Faced 39 | 40 | * Lack of modern libraries and complexity of C langauge for database management made us transistion to a programming language that we had never worked upon before. 41 | * Implementation of a GUI was challenging as the C language's 'graphics.h' and 'windows.h' libraries were very outdated and most other libraries lacked enough documentation for beginners to understand. 42 | * Switching to Python, an entirely new language, posed a set of different problems. 43 | * While selecting a database, we tried the following: 44 | * .txt files 45 | * MySql & MongoDB 46 | * .csv files 47 | * After writing our code for all the features of our program, we went on to make the GUI. While researching about the same we came across the following modules to make the GUI, and we worked with all of them - 48 | * Tkinter 49 | * EasyGUI 50 | * PyQT5 51 | * One might say that we got a little too ambitious as we weren't aware about the challenges learning a completely new programming language would pose. After spending 2 days working with above mentioned modules to implement and make the GUI work, we had to leave it incomplete given our limited time. 52 | 53 | ## Scope of improvement 54 | * GUI 55 | * A more efficient database management 56 | * Login Page 57 | 58 | ## Contributors 59 | 60 | ### Shivam Sharda 61 | * Github 62 | * Customer Menu & Functions: 63 | * Add Customer 64 | * Update Customer 65 | * Search Customer 66 | * Debugging 67 | * Report 68 | * Designing 69 | * GUI attempt 70 | ### Vir Jhangiani 71 | * Github 72 | * Medicine Menu & Functions: 73 | * Add Medicine 74 | * Search Medicine 75 | * Update Medicine 76 | * Medicine to be purchased 77 | * Invoicing Menu & Functions: 78 | * Supplier Invoice 79 | * Customer Invoice 80 | * Designing 81 | * Debugging 82 | * Compilation 83 | ### Harpreet Virk 84 | * Github 85 | * Supplier Menu & Functions: 86 | * Add Supplier 87 | * Update Supplier 88 | * Search Supplier 89 | * Report Menu & Functions: 90 | * Day Sale 91 | * Month Sale 92 | * Day Purchase 93 | * Month Purchase 94 | * Profit Report 95 | * Designing 96 | * GUI attempt 97 | * Report 98 | * Compilation 99 | * Debugging 100 | 101 | ## License 102 | 103 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details 104 | -------------------------------------------------------------------------------- /RUN_THIS_FIRST(INDEX).py: -------------------------------------------------------------------------------- 1 | import menu_functions 2 | import sys 3 | menu_choice=0 4 | while menu_choice != 6: 5 | print('-----------------------------') 6 | print("|Enter 1 for medicine menu |") 7 | print('----------------------------') 8 | print('|Enter 2 for customer menu |') 9 | print('----------------------------') 10 | print('|Enter 3 for supplier menu |') 11 | print('----------------------------') 12 | print('|Enter 4 for report menu |') 13 | print('----------------------------') 14 | print('|Enter 5 for invoicing |') 15 | print('----------------------------') 16 | print('|Enter 6 to quit the program|') 17 | print('-----------------------------') 18 | menu_choice=int(input("Enter Your Choice\n")) 19 | if menu_choice==1: 20 | menu_functions.medicine_menu() 21 | elif menu_choice==2: 22 | menu_functions.customer_menu() 23 | elif menu_choice==3: 24 | menu_functions.supplier_menu() 25 | elif menu_choice==4: 26 | menu_functions.report_menu() 27 | elif menu_choice==5: 28 | menu_functions.invoicing_menu() 29 | elif menu_choice==6: 30 | break 31 | else: 32 | print("Invalid Input! Try Again! \n") 33 | sys.exit() 34 | -------------------------------------------------------------------------------- /__pycache__/customer_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/customer_functions.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/invoicing_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/invoicing_functions.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/medicine_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/medicine_functions.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/menu_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/menu_functions.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/report_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/report_functions.cpython-36.pyc -------------------------------------------------------------------------------- /__pycache__/supplier_functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CS207-AP/Inventory-Management/92ffddedf21d6de6a7f37a7aceb6064673b0f2b1/__pycache__/supplier_functions.cpython-36.pyc -------------------------------------------------------------------------------- /cus_men.csv: -------------------------------------------------------------------------------- 1 | customer_name,customer_id,customer_phone,customer_address 2 | Vir,1,7506433098,"A-302, Amrit Society, Carter Road, Mumbai - 52" 3 | -------------------------------------------------------------------------------- /customer_functions.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from tempfile import NamedTemporaryFile 3 | import shutil 4 | 5 | def customer_id_generator(): 6 | with open('cus_men.csv','r') as csvfile: 7 | reader=csv.DictReader(csvfile) 8 | i=1 9 | for row in reader: 10 | if int(row['customer_id'])==i: 11 | i=i+1 12 | return i 13 | 14 | def new_customer(): 15 | with open('cus_men.csv','a+') as csvfile: 16 | names=['customer_name','customer_id','customer_phone','customer_address'] 17 | writer=csv.DictWriter(csvfile,fieldnames=names) 18 | writer.writeheader() 19 | customer_name=input('Enter the name of the customer : ') 20 | customer_id=customer_id_generator() 21 | print('Unique customer ID generated : ',customer_id) 22 | customer_phone=input('Enter the phone number of the customer : ') 23 | customer_address=input('Enter the address : ') 24 | writer.writerow({'customer_name':customer_name,'customer_id':customer_id,'customer_phone':customer_phone,"customer_address":customer_address}) 25 | 26 | def search_customer(): 27 | with open('cus_men.csv','r') as csvfile: 28 | name=input('Enter the name of customer:\n') 29 | reader=csv.DictReader(csvfile) 30 | for row in reader: 31 | if row['customer_name']==name: 32 | print("------------------------------------------") 33 | print(" Name : ",row['customer_name'],'\n',"ID : ",row['customer_id'],'\n',"Phone : ",row['customer_phone'],'\n',"Address : ",row['customer_address']) 34 | print("------------------------------------------") 35 | def update_customer_info(): 36 | tempfile = NamedTemporaryFile(mode='w', delete=False) 37 | names=['customer_name','customer_id','customer_phone','customer_address'] 38 | with open('cus_men.csv', 'r') as csvfile, tempfile: 39 | reader = csv.DictReader(csvfile) 40 | writer = csv.DictWriter(tempfile, fieldnames=names) 41 | writer.writeheader() 42 | idno =input('Enter the id of the customer you want to modify!\n') 43 | for row in reader: 44 | if row['customer_id'] == idno: 45 | print('---------------------------------------------') 46 | print("|Enter 1 to change name |") 47 | print('---------------------------------------------') 48 | print('|Enter 2 to change phone number |') 49 | print('---------------------------------------------') 50 | print('|Enter 3 to change address |') 51 | print('---------------------------------------------') 52 | choice=int(input("Enter Your Choice!\n")) 53 | 54 | if(choice==1): 55 | row['customer_name']=input("Enter the new name : ") 56 | 57 | elif(choice==2): 58 | row['customer_phone']=input("Enter the new phone number : ") 59 | 60 | elif(choice==3): 61 | 62 | row['customer_address']=input("Enter the new address : ") 63 | 64 | row = {'customer_name':row['customer_name'],'customer_id':row['customer_id'],'customer_phone':row['customer_phone'],"customer_address":row['customer_address']} 65 | writer.writerow(row) 66 | 67 | shutil.move(tempfile.name, 'cus_men.csv') -------------------------------------------------------------------------------- /gui.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import sys 3 | #Medicine Menu 4 | def mclickedbtn1(): 5 | print("Hello") 6 | def mclickedbtn2(): 7 | print("Hello") 8 | def mclickedbtn3(): 9 | print("Hello") 10 | def mclickedbtn4(): 11 | print("Hello") 12 | def clickedbtn1(): 13 | medicine_menu_window = Tk() 14 | medicine_menu_window.geometry('350x200') 15 | medicine_menu_window.title("Pharmacy Management Software") 16 | lbl = Label(medicine_menu_window, text="Medicine Menu!") 17 | lbl.grid(column=0, row=0) 18 | lbl2 = Label(medicine_menu_window, text="What would you like to do!") 19 | lbl2.grid(column=0, row=1) 20 | btn1 = Button(medicine_menu_window, text="Add New Medicine",fg="red", command=mclickedbtn1) 21 | btn1.grid(column=0, row=2) 22 | btn2 = Button(medicine_menu_window, text="Search Medicine",fg="red", command=mclickedbtn2) 23 | btn2.grid(column=0, row=3) 24 | btn3 = Button(medicine_menu_window, text="Update Medicine",fg="red", command=mclickedbtn3) 25 | btn3.grid(column=0, row=4) 26 | btn4 = Button(medicine_menu_window, text="Medicines to be purchased",fg="red", command=mclickedbtn4) 27 | btn4.grid(column=0, row=5) 28 | btn4 = Button(medicine_menu_window, text="Return to main menu",fg="red", command=mclickedbtn4) 29 | btn4.grid(column=0, row=6) 30 | medicine_menu_window.mainloop() 31 | #Customer Menu 32 | def clickedbtn2(): 33 | c_menu_window = Tk() 34 | c_menu_window.geometry('350x200') 35 | c_menu_window.title("Pharmacy Management Software") 36 | lbl = Label(c_menu_window, text="Customer Menu!") 37 | lbl.grid(column=0, row=0) 38 | lbl2 = Label(c_menu_window, text="What would you like to do!") 39 | lbl2.grid(column=0, row=1) 40 | btn1 = Button(c_menu_window, text="Search Customer",fg="red", command=mclickedbtn1) 41 | btn1.grid(column=0, row=2) 42 | btn2 = Button(c_menu_window, text="New Customer",fg="red", command=mclickedbtn2) 43 | btn2.grid(column=0, row=3) 44 | btn3 = Button(c_menu_window, text="Update Customer Info",fg="red", command=mclickedbtn3) 45 | btn3.grid(column=0, row=4) 46 | btn4 = Button(c_menu_window, text="Return to main menu",fg="red", command=mclickedbtn4) 47 | btn4.grid(column=0, row=5) 48 | c_menu_window.mainloop() 49 | #Supplier Menu 50 | def clickedbtn3(): 51 | s_menu_window = Tk() 52 | s_menu_window.geometry('350x200') 53 | s_menu_window.title("Pharmacy Management Software") 54 | lbl = Label(s_menu_window, text="Supplier Menu!") 55 | lbl.grid(column=0, row=0) 56 | lbl2 = Label(s_menu_window, text="What would you like to do!") 57 | lbl2.grid(column=0, row=1) 58 | btn1 = Button(s_menu_window, text="Search Supplier",fg="red", command=mclickedbtn1) 59 | btn1.grid(column=0, row=2) 60 | btn2 = Button(s_menu_window, text="New Supplier",fg="red", command=mclickedbtn2) 61 | btn2.grid(column=0, row=3) 62 | btn3 = Button(s_menu_window, text="Update Supplier Info",fg="red", command=mclickedbtn3) 63 | btn3.grid(column=0, row=4) 64 | btn4 = Button(s_menu_window, text="Return to main menu",fg="red", command=mclickedbtn4) 65 | btn4.grid(column=0, row=5) 66 | s_menu_window.mainloop() 67 | #Report Menu 68 | def clickedbtn4(): 69 | r_menu_window = Tk() 70 | r_menu_window.geometry('350x200') 71 | r_menu_window.title("Pharmacy Management Software") 72 | lbl = Label(r_menu_window, text="Supplier Menu!") 73 | lbl.grid(column=0, row=0) 74 | lbl2 = Label(r_menu_window, text="What would you like to do!") 75 | lbl2.grid(column=0, row=1) 76 | btn1 = Button(r_menu_window, text="Day Sales",fg="red", command=mclickedbtn1) 77 | btn1.grid(column=0, row=2) 78 | btn2 = Button(r_menu_window, text="Month Sales",fg="red", command=mclickedbtn2) 79 | btn2.grid(column=0, row=3) 80 | btn3 = Button(r_menu_window, text="Day Purchase",fg="red", command=mclickedbtn3) 81 | btn3.grid(column=0, row=4) 82 | btn3 = Button(r_menu_window, text="Month Purchase",fg="red", command=mclickedbtn3) 83 | btn3.grid(column=0, row=5) 84 | btn3 = Button(r_menu_window, text="Profit Report",fg="red", command=mclickedbtn3) 85 | btn3.grid(column=0, row=6) 86 | btn4 = Button(r_menu_window, text="Return to main menu",fg="red", command=mclickedbtn4) 87 | btn4.grid(column=0, row=7) 88 | r_menu_window.mainloop() 89 | #Invoicing Menu 90 | def clickedbtn5(): 91 | r_menu_window = Tk() 92 | r_menu_window.geometry('350x200') 93 | r_menu_window.title("Pharmacy Management Software") 94 | lbl = Label(r_menu_window, text="Invoice Menu!") 95 | lbl.grid(column=0, row=0) 96 | lbl2 = Label(r_menu_window, text="What would you like to do!") 97 | lbl2.grid(column=0, row=1) 98 | btn1 = Button(r_menu_window, text="Supplier Invoice",fg="red", command=mclickedbtn1) 99 | btn1.grid(column=0, row=2) 100 | btn2 = Button(r_menu_window, text="Customer Invoice",fg="red", command=mclickedbtn2) 101 | btn2.grid(column=0, row=3) 102 | btn4 = Button(r_menu_window, text="Return to main menu",fg="red", command=mclickedbtn4) 103 | btn4.grid(column=0, row=4) 104 | r_menu_window.mainloop() 105 | 106 | #Main Menu 107 | window = Tk() 108 | window.geometry('350x200') 109 | window.title("Pharmacy Management Software") 110 | lbl = Label(window, text="Welcome to Pharmacy Management Software!") 111 | lbl.grid(column=0, row=0) 112 | lbl2 = Label(window, text="What would you like to do!") 113 | lbl2.grid(column=0, row=1) 114 | btn1 = Button(window, text="Medicine Menu",fg="red", command=clickedbtn1) 115 | btn1.grid(column=0, row=2) 116 | btn2 = Button(window, text="Customer Menu",fg="red", command=clickedbtn2) 117 | btn2.grid(column=0, row=3) 118 | btn3 = Button(window, text="Supplier Menu",fg="red", command=clickedbtn3) 119 | btn3.grid(column=0, row=4) 120 | btn4 = Button(window, text="Report Menu",fg="red", command=clickedbtn4) 121 | btn4.grid(column=0, row=5) 122 | btn5 = Button(window, text="Invoicing Menu",fg="red", command=clickedbtn5) 123 | btn5.grid(column=0, row=6) 124 | window.mainloop() 125 | -------------------------------------------------------------------------------- /invoicing_functions.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from tempfile import NamedTemporaryFile 3 | import shutil 4 | import datetime 5 | d = datetime.datetime.now() 6 | date= d.strftime("%d") 7 | month= d.strftime("%m") 8 | year = d.strftime("%Y") 9 | def sup_invoice(): 10 | medi_name = input("Enter medicine name : ") 11 | 12 | quantity = int(input("Enter quantity : ")) 13 | sup_id = input("Enter supplier id : ") 14 | cost = quantity * unit 15 | 16 | with open('purchase.csv','a+') as csvfile: 17 | columns = ['medi_name','med_id','unit','quantity','pur_date', 'pur_month','pur_year', 'sup_id','cost'] 18 | writer = csv.DictWriter(csvfile,fieldnames = columns) 19 | writer.writerow({'medi_name':medi_name,'med_id':med_id,'unit':unit,'quantity':quantity,'pur_date':date,'pur_month':month,'pur_year':year,'sup_id':sup_id,'cost':cost}) 20 | 21 | tempfile = NamedTemporaryFile(mode='w', delete=False) 22 | with open('medicine.csv','r') as csvfile,tempfile: 23 | 24 | columns = ['medi_name','med_id','sale','unit','quantity','min_quantity','comp_name', 'sup_id','to_pur'] 25 | reader = csv.DictReader(csvfile) 26 | writer = csv.DictWriter(tempfile, fieldnames=columns) 27 | writer.writeheader() 28 | 29 | for row in reader: 30 | if row['medi_name'] == medi_name: 31 | med_id = row['med_id'] 32 | unit = float(row['unit']) 33 | row['quantity'] = int(row['quantity']) + quantity 34 | if int(row['quantity'])min_quantity: 30 | to_pur = 0 31 | writer.writerow({'medi_name':medi_name,'med_id':med_id,'sale':sale,'unit':unit,'quantity':quantity,\ 32 | 'min_quantity':min_quantity,'comp_name':comp_name,'sup_id':sup_id,'to_pur':to_pur}) 33 | 34 | 35 | with open('purchase.csv','a+') as csvfile: 36 | pur_date= d.strftime("%d") 37 | pur_month= d.strftime("%m") 38 | pur_year = d.strftime("%Y") 39 | columns = ['medi_name','med_id','unit','quantity','pur_date', 'pur_month','pur_year','sup_id','cost'] 40 | writer = csv.DictWriter(csvfile,fieldnames = columns) 41 | 42 | writer.writerow({'medi_name':medi_name,'med_id':med_id,'unit':unit,'quantity':quantity,'pur_date':pur_date,'pur_month':pur_month,'pur_year':pur_year,'sup_id':sup_id,'cost':cost}) 43 | 44 | 45 | def search_medicine(): 46 | with open('medicine.csv','r') as csvfile: 47 | name=input('Enter the medicine to search : ') 48 | reader=csv.DictReader(csvfile) 49 | for row in reader: 50 | if row['medi_name'] == name: 51 | print(' Name :', row['medi_name'],'\n','Quantity : ',row['quantity'],'\n','Price : ',row['sale']) 52 | 53 | def update_medicine(): 54 | tempfile = NamedTemporaryFile(mode='w', delete=False) 55 | columns = ['medi_name','med_id','sale','unit','quantity','min_quantity','comp_name', 'sup_id','to_pur'] 56 | with open('medicine.csv', 'r+') as csvfile, tempfile: 57 | reader = csv.DictReader(csvfile) 58 | writer = csv.DictWriter(tempfile, fieldnames=columns) 59 | writer.writeheader() 60 | med_name =input('Enter the name of the medicine you want to modify : ') 61 | for row in reader: 62 | if row['medi_name'] == med_name: 63 | print('---------------------------------------------') 64 | print('|1.To update Name |') 65 | print('---------------------------------------------') 66 | print('|2.To update Cost price |') 67 | print('---------------------------------------------') 68 | print('|3.To update Sale price |') 69 | print('---------------------------------------------') 70 | print('|4.To update supplier ID |') 71 | print('---------------------------------------------') 72 | choice=int(input()) 73 | if(choice==1): 74 | row['medi_name']=input("Enter the new name : ") 75 | 76 | elif(choice==2): 77 | row['cost']=input("Enter the new cost price : ") 78 | 79 | elif(choice==3): 80 | row['sale']=input("Enter the new sale price : ") 81 | 82 | elif(choice==4): 83 | row['sup_id']=input("Enter the new supplier ID : ") 84 | row = {'medi_name':row['medi_name'],'med_id':row['med_id'],'sale':row['sale'],'unit':row['unit'],'quantity':row['quantity'],\ 85 | 'min_quantity':row['min_quantity'],'comp_name':row['comp_name'],'sup_id':row['sup_id'],'to_pur':row['to_pur']} 86 | writer.writerow(row) 87 | shutil.move(tempfile.name, 'medicine.csv') 88 | def medicine_to_be_purchased(): 89 | count = 0 90 | with open('medicine.csv','r') as csvfile: 91 | reader=csv.DictReader(csvfile) 92 | for row in reader: 93 | if int(row['to_pur']) >0: 94 | count+=1 95 | print(' Name : ', row['medi_name'],'\n','Quantity : ',row['quantity'],'\n','Minimum Quantity : ',row['min_quantity']\ 96 | ,'\n','To be purchased : ',row['to_pur'],'\n','Supplier ID : ',row['sup_id']) 97 | if count == 0: 98 | print("No medicine to be purchased.\n") -------------------------------------------------------------------------------- /menu_functions.py: -------------------------------------------------------------------------------- 1 | import medicine_functions 2 | import customer_functions 3 | import supplier_functions 4 | import report_functions 5 | import invoicing_functions 6 | def medicine_menu(): 7 | m_menu_choice=0 8 | while(m_menu_choice!=5): 9 | print('---------------------------------------------') 10 | print("|Enter 1 to add medicine |") 11 | print('---------------------------------------------') 12 | print('|Enter 2 to search medicine |') 13 | print('---------------------------------------------') 14 | print('|Enter 3 to update medicine info |') 15 | print('---------------------------------------------') 16 | print('|Enter 4 for medicines to be purchased list |') 17 | print('---------------------------------------------') 18 | print('|Enter 5 to go back to Main Menu |') 19 | print('---------------------------------------------') 20 | m_menu_choice=int(input("Enter Your Choice!\n")) 21 | if(m_menu_choice==1): 22 | medicine_functions.add_medicine() 23 | elif(m_menu_choice==2): 24 | medicine_functions.search_medicine() 25 | elif(m_menu_choice==3): 26 | medicine_functions.update_medicine() 27 | elif(m_menu_choice==4): 28 | medicine_functions.medicine_to_be_purchased() 29 | elif m_menu_choice==5: 30 | break 31 | else: 32 | print("Invalid Input! Try Again!\n") 33 | def customer_menu(): 34 | c_menu_choice=0 35 | while(c_menu_choice!=4): 36 | print('----------------------------------') 37 | print("|Enter 1 to search customer |") 38 | print('----------------------------------') 39 | print('|Enter 2 to create new customer |') 40 | print('----------------------------------') 41 | print('|Enter 3 to update customer info |') 42 | print('----------------------------------') 43 | print('|Enter 4 to go back to main menu |') 44 | print('----------------------------------') 45 | c_menu_choice=int(input("Enter Your Choice!\n")) 46 | if(c_menu_choice==1): 47 | customer_functions.search_customer() 48 | elif(c_menu_choice==2): 49 | customer_functions.new_customer() 50 | elif(c_menu_choice==3): 51 | customer_functions.update_customer_info() 52 | elif c_menu_choice==4: 53 | break 54 | else: 55 | print("Invalid Input! Try Again!\n") 56 | def supplier_menu(): 57 | s_menu_choice=0 58 | while(s_menu_choice!=4): 59 | print('----------------------------------') 60 | print("|Enter 1 to search supplier |") 61 | print('----------------------------------') 62 | print('|Enter 2 to create new supplier |') 63 | print('----------------------------------') 64 | print('|Enter 3 to update supplier info |') 65 | print('----------------------------------') 66 | print('|Enter 4 to go back to main menu |') 67 | print('----------------------------------') 68 | print("Enter 1 to search supplier. \nEnter 2 to create new supplier. \nEnter 3 to update supplier information. \nEnter 4 to go back to Main Menu.") 69 | s_menu_choice=int(input("Enter Your Choice!\n")) 70 | if(s_menu_choice==1): 71 | supplier_functions.search_supplier() 72 | elif(s_menu_choice==2): 73 | supplier_functions.create_supplier() 74 | elif(s_menu_choice==3): 75 | supplier_functions.update_supplier_info() 76 | elif s_menu_choice==4: 77 | break 78 | else: 79 | print("Invalid Input! Try Again!\n") 80 | def report_menu(): 81 | r_menu_choice=0 82 | while(r_menu_choice!=6): 83 | print('--------------------------------') 84 | print("|Enter 1 for today's sale |") 85 | print('--------------------------------') 86 | print('|Enter 2 for monthly sale |') 87 | print('--------------------------------') 88 | print("|Enter 3 for today's purchases |") 89 | print('--------------------------------') 90 | print("|Enter 4 for monthly purchases |") 91 | print('--------------------------------') 92 | print('|Enter 5 for profit report |') 93 | print('--------------------------------') 94 | print('|Enter 6 to go to main menu |') 95 | print('--------------------------------') 96 | 97 | r_menu_choice=int(input("Enter Your Choice!\n")) 98 | if(r_menu_choice==1): 99 | report_functions.day_sale() 100 | elif(r_menu_choice==2): 101 | report_functions.month_sale() 102 | elif(r_menu_choice==3): 103 | report_functions.day_purchase() 104 | elif(r_menu_choice==4): 105 | report_functions.month_purchase() 106 | elif(r_menu_choice==5): 107 | report_functions.profit_report() 108 | elif r_menu_choice==6: 109 | break 110 | else: 111 | print("Invalid Input! Try Again!\n") 112 | def invoicing_menu(): 113 | i_menu_choice=0 114 | while(i_menu_choice!=3): 115 | print('---------------------------------') 116 | print("|Enter 1 for supplier invoice |") 117 | print('---------------------------------') 118 | print('|Enter 2 for customer invoice |') 119 | print('---------------------------------') 120 | print("|Enter 3 to return to main menu |") 121 | print('---------------------------------') 122 | i_menu_choice=int(input("Enter Your Choice!\n")) 123 | if(i_menu_choice==1): 124 | invoicing_functions.sup_invoice() 125 | elif(i_menu_choice==2): 126 | invoicing_functions.cust_invoice() 127 | elif i_menu_choice==3: 128 | break 129 | else: 130 | print("Invalid Input! Try Again!\n") -------------------------------------------------------------------------------- /purchase.csv: -------------------------------------------------------------------------------- 1 | medi_name,med_id,unit,quantity,pur_date,pur_month,pur_year,sup_id,cost 2 | Allegra,1,50.0,20,07,12,2018,1,1000.0 3 | Crocin,2,8.0,100,07,12,2018,1,800.0 4 | Uprise,3,100.0,20,07,12,2018,1,2000.0 5 | Calpol,4,70.0,20,07,12,2018,1,1400.0 6 | Beudamate200,5,110.0,15,07,12,2018,1,1650.0 7 | -------------------------------------------------------------------------------- /report_functions.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from tempfile import NamedTemporaryFile 3 | import shutil 4 | import datetime 5 | d = datetime.datetime.now() 6 | date= d.strftime("%d") 7 | month= d.strftime("%m") 8 | year = d.strftime("%Y") 9 | 10 | def day_sale(): 11 | print('Enter Date : ') 12 | date = input() 13 | print('Enter Month : ') 14 | month = input() 15 | print('Enter Year : ') 16 | year = input() 17 | count=0.0 18 | with open('sales.csv','r+') as csvfile: 19 | reader = csv.DictReader(csvfile) 20 | print('-----------------Day\'s Sales-----------------') 21 | for r in reader: 22 | if r['sale_date']==date and r['sale_month']==month and r['sale_year']==year : 23 | count=count+float(r['total']) 24 | print('Medicine Name : ', r['medi_name']) 25 | print('Medicine Id : ', r['med_id']) 26 | print('Sale : ', r['sale']) 27 | print('Quantity : ', r['quantity']) 28 | print('Total : ', r['total']) 29 | print('\n') 30 | print('-----------------------------------------------') 31 | print('Total sales for the day : ', count) 32 | print('-----------------------------------------------') 33 | def month_sale(): 34 | print('Enter Month : ') 35 | month = input() 36 | print('Enter Year : ') 37 | year = input() 38 | count=0.0 39 | with open('sales.csv','r+') as csvfile: 40 | reader = csv.DictReader(csvfile) 41 | print('-----------------Day\'s Sales-----------------') 42 | for r in reader: 43 | if r['sale_month']==month and r['sale_year']==year : 44 | count=count+float(r['total']) 45 | print('Medicine Name : ', r['medi_name']) 46 | print('Medicine Id : ', r['med_id']) 47 | print('Sale : ', r['sale']) 48 | print('Quantity : ', r['quantity']) 49 | print('Total : ', r['total']) 50 | print('\n') 51 | print('-----------------------------------------------') 52 | print('Total sales for the month : ', count) 53 | print('-----------------------------------------------') 54 | def day_purchase(): 55 | print('Enter Date : ') 56 | date = input() 57 | print('Enter Month : ') 58 | month = input() 59 | print('Enter Year : ') 60 | year = input() 61 | count=0.0 62 | with open('purchase.csv','r+') as csvfile: 63 | reader = csv.DictReader(csvfile) 64 | print('-----------------Day\'s Purchase-----------------') 65 | for r in reader: 66 | if r['pur_date']==date and r['pur_month']==month and r['pur_year']==year : 67 | count=count+float(r['total']) 68 | print('Medicine Name : ', r['medi_name']) 69 | print('Medicine Id : ', r['med_id']) 70 | print('Purchase cost per item : ', r['unit']) 71 | print('Quantity : ', r['quantity']) 72 | print('Total : ', r['cost']) 73 | print('\n') 74 | print('-----------------------------------------------') 75 | print('Total Purchase cost for the day : ', count) 76 | print('-----------------------------------------------') 77 | def month_purchase(): 78 | print('Enter Month : ') 79 | month = input() 80 | print('Enter Year : ') 81 | year = input() 82 | count=0.0 83 | with open('purchase.csv','r+') as csvfile: 84 | reader = csv.DictReader(csvfile) 85 | print('-----------------Day\'s Purchase-----------------') 86 | for r in reader: 87 | if r['pur_month']==month and r['pur_year']==year : 88 | count=count+float(r['total']) 89 | print('Medicine Name : ', r['medi_name']) 90 | print('Medicine Id : ', r['med_id']) 91 | print('Purchase cost per item : ', r['unit']) 92 | print('Quantity : ', r['quantity']) 93 | print('Total : ', r['cost']) 94 | print('\n') 95 | print('-----------------------------------------------') 96 | print('Total Purchase cost for the month : ', count) 97 | print('-----------------------------------------------') 98 | def profit_report(): 99 | 100 | print('Enter Month : ') 101 | month = input() 102 | print('Enter Year : ') 103 | year = input() 104 | count1=0.0 105 | count2=0.0 106 | with open('sales.csv','r+') as csvfile : 107 | reader = csv.DictReader(csvfile) 108 | for r in reader: 109 | if r['sale_month']==month and r['sale_year']==year : 110 | count1=count1+float(r['total']) 111 | with open('purchase.csv', 'r+') as csvfile : 112 | reader = csv.DictReader(csvfile) 113 | for r in reader: 114 | if r['pur_month']==month and r['pur_year']==year : 115 | count2=count2+float(r['cost']) 116 | profit = count1-count2 117 | print("Profit for ", month, " - ", year, " is ", profit, "!\n") 118 | 119 | 120 | -------------------------------------------------------------------------------- /sales.csv: -------------------------------------------------------------------------------- 1 | medi_name,med_id,sale,quantity,sale_date,sale_month,sale_year,customer_name,customer_id,total 2 | Allegra,1,110.0,1,07,12,2018,Vir,1,110.0 3 | Allegra,1,110.0,16,07,12,2018,Vir,1,1760.0 4 | Crocin,2,20.0,1,07,12,2018,Vir,1,20.0 5 | Crocin,2,20.0,5,07,12,2018,Vir,1,100.0 6 | Crocin,2,20.0,90,07,12,2018,Vir,1,1800.0 7 | -------------------------------------------------------------------------------- /supplier.csv: -------------------------------------------------------------------------------- 1 | sup_name,sup_id,sup_city,sup_contact,sup_email 2 | Hardik Pvt.Ltd,1,Noida,7506433098,hardik.arora05@gmail.com 3 | -------------------------------------------------------------------------------- /supplier_functions.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from tempfile import NamedTemporaryFile 3 | import shutil 4 | def supplier_id_generator(): 5 | with open('supplier.csv', 'r') as csvfile: 6 | reader=csv.DictReader(csvfile) 7 | i=1 8 | for r in reader: 9 | if int(r['sup_id'])==i: 10 | i=i+1 11 | return i 12 | def create_supplier(): 13 | with open('supplier.csv', 'a+') as csvfile: 14 | columns = ['sup_name', 'sup_id', 'sup_city', 'sup_contact', 'sup_email'] 15 | writer = csv.DictWriter(csvfile, fieldnames = columns) 16 | 17 | sup_name = input("Enter New Supplier's Name : ") 18 | sup_id = supplier_id_generator() 19 | print('Unique Supplier ID Generated : ', sup_id) 20 | sup_city = input("Enter New Supplier's City : ") 21 | sup_contact = int(input("Enter New Supplier's Contact Number : ")) 22 | sup_email = input("Enter New Supplier's Email Id : ") 23 | writer.writerow({'sup_name':sup_name, 'sup_id':sup_id, 'sup_city':sup_city, 'sup_contact':sup_contact, 'sup_email':sup_email}) 24 | def s_searchbyname(): 25 | with open('supplier.csv','r') as csvfile: 26 | name=input('Enter Supplier Name!\n') 27 | reader=csv.DictReader(csvfile) 28 | for r in reader: 29 | if r['sup_name'] == name: 30 | print('Name : ', r['sup_name'], '\n', 'Id : ', r['sup_id'],'\n', 'City : ', r['sup_city'], '\n', 'Contact No :', r['sup_contact'], '\n', 'Email id : ', r['sup_email']) 31 | def s_searchbyid(): 32 | with open('supplier.csv','r') as csvfile: 33 | id=int(input('Enter Supplier ID!\n')) 34 | reader=csv.DictReader(csvfile) 35 | for r in reader: 36 | if r['sup_id'] == id: 37 | print('Name : ', r['sup_name'], '\n', 'Id : ', r['sup_id'],'\n', 'City : ', r['sup_city'], '\n', 'Contact No :', r['sup_contact'], '\n', 'Email id : ', r['sup_email']) 38 | def search_supplier(): 39 | ss_choice=0 40 | while(ss_choice!=3): 41 | print('---------------------------------------------') 42 | print("|Enter 1 to search supplier by name! |") 43 | print('---------------------------------------------') 44 | print("|Enter 2 to search supplier by id! |") 45 | print('---------------------------------------------') 46 | print("|Enter 3 to exit supplier search! |") 47 | print('---------------------------------------------') 48 | ss_choice=int(input("Enter your choice!\n")) 49 | if ss_choice==1 : 50 | s_searchbyname() 51 | elif ss_choice==2 : 52 | s_searchbyid() 53 | else: 54 | print("Invalid Input! Try again!\n") 55 | def update_supplier_info(): 56 | tempfile = NamedTemporaryFile(mode='w', delete=False) 57 | columns = ['sup_name', 'sup_id', 'sup_city', 'sup_contact', 'sup_email'] 58 | with open('supplier.csv', 'r') as csvfile, tempfile: 59 | reader = csv.DictReader(csvfile) 60 | writer = csv.DictWriter(tempfile, fieldnames=columns) 61 | writer.writeheader() 62 | suppp_name=input('Enter the name of the supplier you want to modify!\n') 63 | for r in reader: 64 | if r['sup_name'] == suppp_name: 65 | print('---------------------------------------------') 66 | print('|Enter 1 to update supplier name. |') 67 | print('---------------------------------------------') 68 | print('|Enter 2 to update supplier id. |') 69 | print('---------------------------------------------') 70 | print('|Enter 3 to update supplier city. |') 71 | print('---------------------------------------------') 72 | print('|Enter 4 to update supplier contact no. |') 73 | print('---------------------------------------------') 74 | print('|Enter 5 to update supplier email id. |') 75 | print('---------------------------------------------') 76 | choice=int(input('Enter your choice!\n')) 77 | if(choice==1): 78 | r['sup_name']=input("Enter updated name : ") 79 | elif(choice==2): 80 | r['sup_id']=int(input("Enter updated id : ")) 81 | elif(choice==3): 82 | r['sup_city']=input("Enter updated city : ") 83 | elif(choice==4): 84 | r['sup_contact']=int(input("Enter updated contact : ")) 85 | elif(choice==5): 86 | r['sup_email']=int(input("Enter updated email id : ")) 87 | else: 88 | print("Invalid Input!\n") 89 | r = {'sup_name':r['sup_name'], 'sup_id':r['sup_id'], 'sup_city':r['sup_city'], 'sup_contact':r['sup_contact'], 'sup_email':r['sup_email']} 90 | writer.writerow(r) 91 | shutil.move(tempfile.name, 'supplier.csv') --------------------------------------------------------------------------------