def on_click(self):
     now = datetime.datetime.now()
     stock_name_inp = self.stock_name.text().replace(' ','_').lower()
     stock_count_inp = int(self.stock_count.text())
     stock_cost_inp = int(self.stock_cost.text())
     #print(stock_name_inp,stock_count_inp,stock_cost_inp)
     stock_add_date_time = now.strftime("%Y-%m-%d %H:%M")
     d = mp.insert_prod(stock_name_inp,stock_count_inp,stock_cost_inp,stock_add_date_time)
     print(d)
Пример #2
0
    def on_click(
        self
    ):  # Add user input data to the database when ADD STOCK button is pressed
        stock_name_inp = self.stock_name.text().replace(' ', '_').lower()
        stock_count_inp = int(self.stock_count.text())
        stock_cost_inp = int(self.stock_cost.text())

        if (stock_count_inp and stock_cost_inp > 0):
            message = mp.insert_prod(stock_name_inp, stock_count_inp,
                                     stock_cost_inp)
            self.add_mes.setText(message)
        else:
            self.add_mes.setText('Invalid input')