from invoice_base import * class Invoice(BaseInvoice): def __str__(self): result = ">>>>>>\n" result += f"inv,{'CREDTNOTE' if self.debit else 'SALE'},{self.nr}\n" result += f"str,{self.storename}\n" result += f"{self.sales}" if self.seller: result += str(self.seller) else: result += "[ == no country / PVH-ofice found ==]\n" if self.buyer: result += str(self.buyer) for a in self.articles: result += str(a) for t in self.tenders: result += str(t) for x in self.taxes: result += str(x) result += "<<<<<<<\n" return result class Discount(BaseDiscount): def __str__(self): return(f"prm,{self.promotionID},{self.action},{self.amount},{self.reasoncode}\n") class Tax(BaseTax): spaces = 'tax' def __str__(self): return f"{self.spaces},{self.typesubtype},{self.code},{self.amount},{self.percentage}%,{self.translated_group()},{self.taxableamount}\n" class TotalTax(BaseTotalTax): ''' Docstring for TotalTax ''' spaces = 'tax,' class Sales(BaseSales): def __str__(self): result = f"sal,{self.store},{self.year}{self.month}{self.day},{self.till},{self.seq}\n" result += f"tot,{self.grandAmount},{self.netAmount},{self.taxAmount}\n" return result class Buyer(BaseBuyer): def __str__(self): return f"buy,{self.orgid},{self.name},{self.city},{self.taxID}\n" class Seller(BaseSeller): def __str__(self): return f"sel,{self.orgid},{self.name},{self.city},{self.taxID}\n" class Tender(BaseTender): def __str__(self): return(f"tdr,{self.description},{self.amount},{self.type},{self.code} \n") class Article(BaseArticle): def __str__(self): result = f"itm,{self.itemid},{self.description},{self.quantity},{self.unit},{self.salesPrice},{self.basePrice}\n" for d in self.discounts: result += str(d) for t in self.taxes: result += str(t) return result