def SqlDatas2SellRecord(datas): rec = SellRecord() rec.uid = str(datas[0]) rec.product_class = str(datas[1]) rec.product_type = datas[2] rec.deal_unit_price = str(datas[3]) rec.amount = str(datas[4]) rec.buyer = str(datas[5]) rec.deal_price = str(datas[6]) rec.deal_date = datas[7] # datetime.datetime.strptime(datas[7], "%Y-%m-%d").strftime("%Y-%m-%d") rec.paid = str(datas[8]) rec.buyer_name = datas[9] rec.total_price = str(float(rec.deal_unit_price) * float(rec.amount)) rec.unpaid = str(float(rec.deal_price) - float(rec.paid)) return rec
def SqlDatas2SellRecord(datas): rec = SellRecord() rec.uid = str(datas[0]) rec.product_class = str(datas[1]) rec.product_type = datas[2] rec.deal_unit_price = str(datas[3]) rec.amount = str(datas[4]) rec.buyer = str(datas[5]) rec.deal_price = str(datas[6]) rec.deal_date = datas[ 7] # datetime.datetime.strptime(datas[7], "%Y-%m-%d").strftime("%Y-%m-%d") rec.paid = str(datas[8]) rec.buyer_name = datas[9] rec.total_price = str(float(rec.deal_unit_price) * float(rec.amount)) rec.unpaid = str(float(rec.deal_price) - float(rec.paid)) return rec
def GetSellRecord(self): category_str = self.m_choice8.GetStringSelection() category_int = models.ALL_PRODUCT_TYPE[category_str] rec = SellRecord() rec.product_class = category_int rec.product_type = self.m_choice2.GetStringSelection() rec.deal_unit_price = self.m_textCtrl8.GetValue() rec.amount = self.m_textCtrl6.GetValue() rec.deal_price = self.m_textCtrl10.GetValue() rec.deal_date = str(self.m_datePicker3.GetValue().Format("%Y-%m-%d")) rec.paid = self.m_textCtrl11.GetValue() rec.buyer_name = self.m_choice3.GetStringSelection() buyer = db.GetBuyer(rec.buyer_name, self.all_buyers) rec.buyer = buyer.uid rec.total_price = str(float(rec.deal_unit_price) * float(rec.amount)) rec.unpaid = str(float(rec.deal_price) - float(rec.paid)) return rec