-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.py
127 lines (123 loc) · 4.94 KB
/
save.py
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
120
121
122
123
124
125
126
127
from variables import *
def save_reports(letter):
if letter == "a":
with open('reports/report_a.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ value[1] + "|"
+ value[2] + "|"
+ value[3] + "|"
+ value[4] + "|"
+ value[5] + "\n")
file.close()
elif letter == "b":
with open('reports/report_b.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ value[1] + "|"
+ value[2] + "|"
+ value[3] + "|"
+ value[4] + "|"
+ value[5] + "\n")
file.close()
elif letter == "c":
with open('reports/report_c.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ value[1] + "|"
+ value[2] + "|"
+ value[3] + "|"
+ value[4] + "|"
+ value[5] + "\n")
file.close()
elif letter == "d":
with open('reports/report_d.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ str(value[1]) + "|"
+ str(value[2]) + "\n")
file.close()
elif letter == "e":
with open('reports/report_e.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ value[1] + "|"
+ value[2] + "|"
+ str(value[3]) + "|"
+ str(value[4]) + "\n")
file.close()
elif letter == "f":
with open('reports/report_f.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ str(value[1]) + "|"
+ str(value[2]) + "\n")
file.close()
elif letter == "g":
with open('reports/report_g.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ value[1] + "|"
+ str(value[2]) + "|"
+ str(value[3]) + "\n")
file.close()
elif letter == "h":
with open('reports/report_h.txt', 'w') as file:
for value in report:
file.write(value[0] + "|"
+ str(value[1]) + "|"
+ str(value[2]) + "\n")
file.close()
def save_data():
with open('files/users.txt', 'w') as file:
for user in all_users:
file.write(user[0] + "|"
+ user[1] + "|"
+ user[2] + "|"
+ user[3] + "\n")
file.close()
with open('files/movies.txt', 'w') as file:
for movie in all_movies:
file.write(movie[0] + "|"
+ movie[1] + "|"
+ movie[2] + "|"
+ movie[3] + "|"
+ movie[4] + "|"
+ movie[5] + "|"
+ movie[6] + "\n")
file.close()
with open('files/projections.txt', 'w') as file:
for projection_code, projection in projections.items():
file.write(str(projection["code"]) + "|"
+ projection["hall"] + "|"
+ projection["start time"] + "|"
+ projection["end time"] + "|"
+ projection["days"] + "|"
+ projection["movie"] + "|"
+ str(projection["ticket price"]) + "\n")
file.close()
with open('files/dates.txt', 'w') as file:
for screening_code, screening in screenings.items():
file.write(screening_code + "|"
+ screening["date"] + "|"
+ screening["status"] + "\n")
file.close()
with open('files/tickets.txt', 'w') as file:
for key, ticket in tickets.items():
file.write(str(key) + "|"
+ ticket["seat"] + "|"
+ ticket["client"] + "|"
+ ticket["screening code"] + "|"
+ ticket["date sold"] + "|"
+ ticket["status"] + "\n")
file.close()
with open('files/sold_tickets.txt', 'w') as file:
for key, ticket in sold_tickets.items():
file.write(str(key) + "|"
+ ticket["seat"] + "|"
+ ticket["client"] + "|"
+ ticket["screening code"] + "|"
+ ticket["date sold"] + "|"
+ str(ticket["ticket price"]) + "|"
+ ticket["sold by"] + "\n")
file.close()