-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.py
62 lines (59 loc) · 1.73 KB
/
invoice.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
from address import Address
from datetime import datetime
from items import Items
class Bill:
SHOP = '---------------* MOBILO! *-----------------'
INFO = '------------* MOBILE CITY *----------------'
SLOGAN = 'WE DEAL WITH ALL KIND OF MOBILE ACCESSARIES'
CELL = '09000067578'
no=0
SHOP_ADDRESS = Address(12,2,'model town','lahore','punjab')
def __init__(self,name,address):
self.name = name
self.date = datetime.now().strftime('%d-%b-%Y')
self.address = address
Bill.no+=1
self.__str__()
def __str__(self):
result = f"Date: {self.date}\n"
result += f"Customer Name: {self.name}\n"
result += f"Customer address: {self.address}\n"
return result
@property
def name(self):
return self.__name
@name.setter
def name(self,new):
if isinstance(new,str):
self.__name = new
@property
def address(self):
return self.__address
@address.setter
def address(self,address):
if isinstance(address,list) and len(address)==5:
self.__address = Address(address[0],address[1],address[2],address[3],address[4])
@classmethod
def info(cls):
print(cls.SHOP)
print(cls.INFO)
print(cls.SLOGAN)
print('Contact us: ',cls.CELL)
print('No: ',cls.no)
print()
def main():
total=0
x = Bill('Hasaan rana ',[23,2,'Muslim Town','Lahore','Punjab'])
Bill.info()
p1= Items('Mobile',50000,2)
p2= Items('Sim ',300,5)
p3= Items('Charger',500,12)
p4 =Items('Remote',1250,10)
print(x)
print('PRODUCT:\tRATE:\tQUANTITY:\tAMOUNT:')
print(p1)
print(p2)
print(p3)
print(p4)
print('TOTAL:',Items.total)
main()