def makeInvoice(self, invoiceId, discount, amountPaid): prods = [] for x in range(len(self.cart.products)): prods.append([ self.cart.products[x].name, '', self.cart.products[x].qty, self.cart.products[x].origPrice, self.cart.products[x].price ]) im.imaker(str(invoiceId), invoiceId, self.operatorId, self.customerId, self.customerName, self.customerContact, prods, discount, amountPaid)
def makeInvoice(self, event): conn = connectToDB() qry = 'select p.name, pi.quantity, pi.price, pi.discount from productinvoice pi, products p where pi.product = p.id and invoiceId = %s' % ( self.iid) curs = conn.cursor() curs.execute(qry) r = curs.fetchone() prods = [] while r is not None: prods.append([ r['name'], '', int(r['quantity']), int(r['price']) + int(r['discount']), int(r['price']) ]) r = curs.fetchone() qry = 'select i.id, i.employeeid, i.timeStamp, i.amount, i.amountRecieved, i.discount, c.id, c.name, c.contact from customer c, invoice i where i.buyerId = c.id ORDER BY i.id DESC' curs = conn.cursor() curs.execute(qry) r = curs.fetchone() im.imaker(str(self.iid), self.iid, r['employeeid'], r['c.id'], r['name'], r['contact'], prods, int(r['discount']), int(r['amountRecieved']), r['timeStamp']) import os cmd = "lpr -P HP-LaserJet-M101-M106 " + str(self.iid) os.system(cmd) self.Destroy()