@@ -170,8 +170,8 @@ def run_day(stats):
170
170
sold_out_text , feedback , rep_score ,
171
171
potential_cust
172
172
]
173
- save_data (stats , False )
174
173
clear_terminal ()
174
+ # Header for sales report
175
175
text = cyan ("12 noon time sales report:" )
176
176
print (f'{ text } ' )
177
177
stats = sales_report (stats , data )
@@ -181,14 +181,14 @@ def run_day(stats):
181
181
for i in range (total_locations ):
182
182
sold += cust_count [i ]
183
183
stats = deduct_stock (stats , sold )
184
- save_data (stats , False )
185
184
data = [
186
185
cust_count , sold ,
187
186
open_loc_name , loc_sale_value ,
188
187
sold_out_text , feedback , rep_score ,
189
188
potential_cust
190
189
]
191
190
clear_terminal ()
191
+ # Header for sales report
192
192
text = cyan ("End of day sales report:" )
193
193
print (f'{ text } ' )
194
194
stats = sales_report (stats , data )
@@ -214,13 +214,16 @@ def sales_report(stats, data):
214
214
# rep_score = data[6]
215
215
# potential_cust = data[7]
216
216
217
+ # If sold out of prooduct during trading, show sold out message.
217
218
if data [4 ]:
218
219
print (data [4 ])
219
220
221
+ # Add up total values from different locations.
220
222
total_sale_value = 0
221
223
for i in data [3 ]:
222
224
total_sale_value += i
223
225
226
+ # Show sales report to user. Location, units sold, net profit.
224
227
print (constants .LINE )
225
228
print (f'{ "Location" :<13} { "-" :<3} { "Units" :<8} { "-" :<3} { "Value (£)" :<8} ' )
226
229
print (constants .LINE )
@@ -235,21 +238,30 @@ def sales_report(stats, data):
235
238
text = green (f'£{ floor (total_sale_value * 100 )/ 100 } ' )
236
239
print (f'Total daily sales value: { text } (var +/- £0.01)' )
237
240
print ('\n Sales values are net profit (Sold price minus product cost).' )
241
+
242
+ # Get user input to continue.
238
243
print_press_enter_to ("Press Enter to see feedback.." )
244
+
245
+ # Customer feedback
239
246
print (f'\n { cyan ("Customer feedback / improvements to be made:" )} ' )
240
247
print (constants .LINE )
241
248
print (f'{ "Location" :<13} { "-" :<3} { "Amount" :<7} { "-" :<3} { "Comment" :<13} ' )
242
249
print (constants .LINE )
243
250
244
251
txt_decline = red ('(Declined)' )
245
252
253
+ # Variable to count total feedback
254
+ t_count = 0
255
+
246
256
for count in enumerate (data [0 ]):
257
+ f_count = 0
247
258
for key in data [5 ]:
248
259
if data [5 ][key ][count [0 ]] > 0 :
249
260
250
- if count [ 0 ] == 0 :
261
+ if f_count == 0 :
251
262
text = data [2 ][count [0 ]]
252
263
dash = "-"
264
+ t_count += 1
253
265
else :
254
266
text = ""
255
267
dash = ""
@@ -260,13 +272,17 @@ def sales_report(stats, data):
260
272
text2 = f"{ txt_decline } Overpriced!"
261
273
262
274
text3 = data [5 ][key ][count [0 ]]
263
-
264
275
print (f'{ text :<13} { dash :<3} { text3 :<7} { "-" :<3} { text2 :<13} ' )
276
+ f_count += 1
265
277
266
- if count [ 0 ] != 0 :
278
+ if f_count != 0 :
267
279
print (constants .LINE )
268
280
281
+ if t_count == 0 :
282
+ print (green ('\n No feedback for improvment was given.' ))
283
+
269
284
print_press_enter_to ("Press Enter to see if any reputation update...\n " )
285
+
270
286
rep_change (stats , data [6 ], data [7 ])
271
287
272
288
if (stats ["day" ] % 1 ) == 0 :
0 commit comments