-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathreport_functions.py
More file actions
119 lines (115 loc) · 4.71 KB
/
report_functions.py
File metadata and controls
119 lines (115 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import csv
from tempfile import NamedTemporaryFile
import shutil
import datetime
d = datetime.datetime.now()
date= d.strftime("%d")
month= d.strftime("%m")
year = d.strftime("%Y")
def day_sale():
print('Enter Date : ')
date = input()
print('Enter Month : ')
month = input()
print('Enter Year : ')
year = input()
count=0.0
with open('sales.csv','r+') as csvfile:
reader = csv.DictReader(csvfile)
print('-----------------Day\'s Sales-----------------')
for r in reader:
if r['sale_date']==date and r['sale_month']==month and r['sale_year']==year :
count=count+float(r['total'])
print('Medicine Name : ', r['medi_name'])
print('Medicine Id : ', r['med_id'])
print('Sale : ', r['sale'])
print('Quantity : ', r['quantity'])
print('Total : ', r['total'])
print('\n')
print('-----------------------------------------------')
print('Total sales for the day : ', count)
print('-----------------------------------------------')
def month_sale():
print('Enter Month : ')
month = input()
print('Enter Year : ')
year = input()
count=0.0
with open('sales.csv','r+') as csvfile:
reader = csv.DictReader(csvfile)
print('-----------------Day\'s Sales-----------------')
for r in reader:
if r['sale_month']==month and r['sale_year']==year :
count=count+float(r['total'])
print('Medicine Name : ', r['medi_name'])
print('Medicine Id : ', r['med_id'])
print('Sale : ', r['sale'])
print('Quantity : ', r['quantity'])
print('Total : ', r['total'])
print('\n')
print('-----------------------------------------------')
print('Total sales for the month : ', count)
print('-----------------------------------------------')
def day_purchase():
print('Enter Date : ')
date = input()
print('Enter Month : ')
month = input()
print('Enter Year : ')
year = input()
count=0.0
with open('purchase.csv','r+') as csvfile:
reader = csv.DictReader(csvfile)
print('-----------------Day\'s Purchase-----------------')
for r in reader:
if r['pur_date']==date and r['pur_month']==month and r['pur_year']==year :
count=count+float(r['total'])
print('Medicine Name : ', r['medi_name'])
print('Medicine Id : ', r['med_id'])
print('Purchase cost per item : ', r['unit'])
print('Quantity : ', r['quantity'])
print('Total : ', r['cost'])
print('\n')
print('-----------------------------------------------')
print('Total Purchase cost for the day : ', count)
print('-----------------------------------------------')
def month_purchase():
print('Enter Month : ')
month = input()
print('Enter Year : ')
year = input()
count=0.0
with open('purchase.csv','r+') as csvfile:
reader = csv.DictReader(csvfile)
print('-----------------Day\'s Purchase-----------------')
for r in reader:
if r['pur_month']==month and r['pur_year']==year :
count=count+float(r['total'])
print('Medicine Name : ', r['medi_name'])
print('Medicine Id : ', r['med_id'])
print('Purchase cost per item : ', r['unit'])
print('Quantity : ', r['quantity'])
print('Total : ', r['cost'])
print('\n')
print('-----------------------------------------------')
print('Total Purchase cost for the month : ', count)
print('-----------------------------------------------')
def profit_report():
print('Enter Month : ')
month = input()
print('Enter Year : ')
year = input()
count1=0.0
count2=0.0
with open('sales.csv','r+') as csvfile :
reader = csv.DictReader(csvfile)
for r in reader:
if r['sale_month']==month and r['sale_year']==year :
count1=count1+float(r['total'])
with open('purchase.csv', 'r+') as csvfile :
reader = csv.DictReader(csvfile)
for r in reader:
if r['pur_month']==month and r['pur_year']==year :
count2=count2+float(r['cost'])
profit = count1-count2
print("Profit for ", month, " - ", year, " is ", profit, "!\n")