Exemplo n.º 1
0
 def on_click_btn8(self):
     self.table_new.clearContents()
     result = supermarket.select('stock_record', '*')
     for i in range(len(result)):
         for j in range(len(result[i])):
             if type(result[i][j] == int):
                 r = str(result[i][j])
             else:
                 r = result[i][j].toString()
             item = QTableWidgetItem(r)
             self.table_new.setItem(i, j, item)
Exemplo n.º 2
0
 def on_click_btn5(self):
     self.table_stock.clearContents()
     result = supermarket.select('refresh', [10])
     for i in range(len(result)):
         for j in range(len(result[i])):
             if type(result[i][j] == int):
                 r = str(result[i][j])
             else:
                 r = result[i][j].toString()
             item = QTableWidgetItem(r)
             self.table_stock.setItem(i, j, item)
Exemplo n.º 3
0
 def on_click_btn10(self):
     self.table_bad.clearContents()
     l2 = list()
     for i in self.edit_bad:
         l2.append(i.text())
     result = supermarket.select('off_record', '*')
     for i in range(len(result)):
         for j in range(len(result[i])):
             if type(result[i][j] == int):
                 r = str(result[i][j])
             else:
                 r = result[i][j].toString()
             item = QTableWidgetItem(r)
             self.table_bad.setItem(i, j, item)
Exemplo n.º 4
0
 def on_click_btn2(self):
     self.table_sale.clearContents()
     l2 = list()
     for i in self.edit_sale:
         l2.append(i.text())
     result = supermarket.select('sale', l2)
     for i in range(len(result)):
         for j in range(5):
             if type(result[i][j] == int):
                 r = str(result[i][j])
             else:
                 r = result[i][j].toString()
             item = QTableWidgetItem(r)
             self.table_sale.setItem(i, j, item)
Exemplo n.º 5
0
 def on_click_btn3(self):
     self.table_sell.clearContents()
     l2 = list()
     for i in self.edit_sell:
         l2.append(i.text())
     l2.append(str(int(l2[2]) * int(l2[3])))
     supermarket.insert('sale_record', l2)
     result = supermarket.select('sale', '*')
     supermarket.update('goods', [l2[0], l2[2]], False)
     for i in range(len(result)):
         for j in range(len(result[i])):
             if type(result[i][j] == int):
                 r = str(result[i][j])
             else:
                 r = result[i][j].toString()
             item = QTableWidgetItem(r)
             self.table_sell.setItem(i, j, item)
Exemplo n.º 6
0
 def get_record(self, date, value):
     l2 = list()
     head_sale = ['产品编号', '销售日期', '销售数量', '单价', '总价']
     l2.append('')
     l2.append(date)
     l2.append(datetime.datetime.now().strftime('%Y-%m-%d'))
     result = supermarket.select('sale', l2)
     workbook = xlwt.Workbook(encoding='utf-8')
     booksheet = workbook.add_sheet('Day', cell_overwrite_ok=True)
     for i in range(5):
         booksheet.write(0, i, head_sale[i])
     for i, row in enumerate(result):
         for j, col in enumerate(row):
             if type(result[i][j] == int):
                 booksheet.write(i + 1, j, str(col))
             else:
                 booksheet.write(i + 1, j, col.toString())
     print('%s.xlsx' % value)
     workbook.save('%s.xlsx' % value)