Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime, date, time
- from collections import Counter
- class my:
- def __init__(self):
- self.name=""
- self.stuff=[]
- self.temp=[]
- self.history=[]
- def set_name(self,str_name):
- self.name=str_name
- return self.name
- def add_stuff(self,nameofstuff,price,code):
- return self.stuff.append([nameofstuff,price,code,0])
- def get_date(self):
- return datetime.strftime(datetime.now(), "%Y.%m.%d %H:%M:%S")
- def buy(self,code):
- return self.temp.append(code)
- def check(self):
- temp1=[]
- c = Counter(self.temp)
- self.temp=list(set(self.temp))
- for i in self.stuff:
- if c[i[2]]!=0:
- i[3]=c[i[2]]
- temp1.extend(i[0])
- temp1.append(c[i[2]])
- a=i[1]*c[i[2]]
- temp1.append(a)
- self.history.append(temp1[:])
- def cout(self):
- k=2
- summa=0
- print('{:^20}'.format(self.name))
- print('{0:^10}{1:^3}{2:^7}'.format("Товар","X","Цена"))
- for i in self.history[-1]:
- if k ==2 or k==1:
- if k==2:
- print(i,end=" ")
- k=k-1
- else:
- print('{0:>10}'.format(i),end=" ")
- k=k-1
- else:
- print('{:^5}'.format(i))
- k=2
- summa=summa+i
- print("Сумма без НДС: ",summa)
- print("Сумма НДС: ",summa/10)
- print("Сумма c НДС: ",summa/10+summa)
- print(self.get_date())
- k=my()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement