Exemplo n.º 1
0
 def do_delete(self):
     code = self.codeled.text()
     if select_tools_by_gen_code(code):
         rawMat = select_tools_by_gen_code(code)
     reply = QMessageBox.question(
         QMessageBox(), "OOP'S",
         'Are you sure to delete ?\n Tool  \n System Code : {}'.format(
             rawMat.gen_code) + '\n Name : {}'.format(rawMat.name) +
         '\n This Action Cant Undo', QMessageBox.Yes | QMessageBox.No)
     if reply == QMessageBox.Yes:
         delete_tools(rawMat.id)
Exemplo n.º 2
0
 def Clicked(self, item):
     self.addbtn.setEnabled(True)
     code = before(item.text(), '-')
     if select_tools_by_gen_code(code):
         rawMat = select_tools_by_gen_code(code)
         if rawMat.back == 0:
             self.spnameled.setText(rawMat.name + "/ Not Backable")
         if rawMat.back == 1:
             self.spnameled.setText(rawMat.name)
         self.spinqtyled.setText(str(rawMat.inv_qty))
         self.spgencodeled.setText(rawMat.gen_code)
     return rawMat
Exemplo n.º 3
0
    def Clicked(self, item):
        role = getLoginDataPKL()['role']
        if int(role) == 1 or int(role) == 2:
            self.deletebtn.setEnabled(False)
        self.editbtn.setEnabled(True)
        self.deletebtn.setEnabled(True)
        gencode = before(item.text(), ' -')
        if select_tools_by_gen_code(gencode):
            spart = select_tools_by_gen_code(gencode)
            print(gencode)
            self.nameled.setText(spart.name)
            self.unitled.setText(spart.unit)
            self.codeled.setText(spart.gen_code)
            self.costled.setText(str(spart.price))
            self.invQtyled.setText(str(spart.inv_qty))
            self.miniQtyled.setText(str(spart.mini_qty))
        if not select_all_outbound() == []:
            for item in select_all_outbound():
                if item.tools_id == spart.id:
                    self.deletebtn.setEnabled(False)

        return spart
Exemplo n.º 4
0
    def Clicked(self, item):
        self.dataupdatebtn.setEnabled(True)
        self.updatecostbtn.setEnabled(True)
        self.updateqtybtn.setEnabled(True)
        self.minupdateqtybtn.setEnabled(True)

        role = getLoginDataPKL()['role']
        if int(role) == 2:
            self.updatecostbtn.setEnabled(False)
            self.updateqtybtn.setEnabled(False)
            self.dataupdatebtn.setEnabled(False)
        if int(role) == 3:
            self.updatecostbtn.setEnabled(False)
            self.updateqtybtn.setEnabled(True)
            self.dataupdatebtn.setEnabled(True)
        if int(role) == 1:
            self.updatecostbtn.setEnabled(True)
            self.updateqtybtn.setEnabled(False)
            self.dataupdatebtn.setEnabled(False)

        gencode = before(item.text(), '-')
        if select_tools_by_gen_code(gencode):
            tool = select_tools_by_gen_code(gencode)
            print(tool)
            self.tonamelbl.setText(tool.name)
            self.tounitlbl.setText(tool.unit)
            self.togencodelbl.setText(tool.gen_code)
            self.tocostlbl.setText(str(tool.price))
            self.toinvqtylbl.setText(str(tool.inv_qty))
            self.miniqtylbl.setText(str(tool.mini_qty))
            self.miniled.setText(str(tool.mini_qty))
            self.tonameled.setText(tool.name)
            self.unitcomboBox.setCurrentIndex(self.unitdict[tool.unit])
            ## old (cost and inv_qty)
            self.oldcostlbl.setText(str(tool.price))
            self.oldqtylbl.setText(str(tool.inv_qty))
        return tool
Exemplo n.º 5
0
 def do_add(self):
     datetimestr = datetime.now()
     timestampstr = datetimestr.strftime('%Y-%m-%d %H:%M:%S')
     code = self.spgencodeled.text()
     rawmat = select_tools_by_gen_code(code)
     qty = self.reqqtyled_2.text()
     reas = self.reasonled.text()
     if qty != '' or reas != '':
         if type(self.obj) == Employees:
             add_outbound(OutBCode(), timestampstr, reas, None, self.obj.id,
                          None, None, rawmat.id, None, qty, 1)
         if type(self.obj) == Customers:
             add_outbound(OutBCode(), timestampstr, reas, self.obj.id, None,
                          None, None, rawmat.id, None, qty, 1)
         decreaseToolsInvQty(rawmat, int(qty))
         self.close()
Exemplo n.º 6
0
    def minupdate_inv(self):
        if self.minnewqtySpinBox_2.value() == 0:
            self.statulbl.setText("New Quantity is Required ")
        else:
            reply = QMessageBox.question(
                QMessageBox(), 'Delete', "Are you sure to update cost ?\n"
                "This action you can't undo", QMessageBox.Yes | QMessageBox.No)
            id_code = self.togencodelbl.text()
            upsp = select_tools_by_gen_code(id_code)

            n_inv = self.minnewqtySpinBox_2.value()

            if reply == QMessageBox.Yes:
                decreaseToolsInvQty(upsp, n_inv)
                self.statulbl.setText("Data updated successfully")
            else:
                self.statulbl.setText("Data not updated ")
Exemplo n.º 7
0
    def update_cost(self):
        if self.newcostled.text() == '':
            self.statulbl.setText('New Cost is Required ')
        else:
            reply = QMessageBox.question(
                QMessageBox(), 'Delete', "Are you sure to update cost ?\n"
                "This action you can't undo", QMessageBox.Yes | QMessageBox.No)
            id_code = self.togencodelbl.text()
            upsp = select_tools_by_gen_code(id_code)

            n_cost = self.newcostled.text()
            if n_cost == '':
                n_cost = upsp.price

            if reply == QMessageBox.Yes:
                updateToolsCost(upsp, n_cost)
                self.statulbl.setText("Data updated successfully")
            else:
                self.statulbl.setText("Data not updated ")
Exemplo n.º 8
0
 def update_data(self):
     id_code = self.togencodelbl.text()
     upsp = select_tools_by_gen_code(id_code)
     xname = self.tonameled.text()
     idx = self.unitcomboBox.currentIndex()
     xunit = list(self.unitdict.keys())[list(
         self.unitdict.values()).index(idx)]
     # # spesial case
     xcost = upsp.price
     xinv_qty = upsp.inv_qty
     xgen_code = upsp.gen_code
     xmini = self.miniled.text()
     #
     if xname == '':
         xname = upsp.name
     if xunit == upsp.unit:
         xunit = upsp.unit
     update_tools(upsp.id, xname, xcost, xinv_qty, xunit, xgen_code, xmini)
     self.statulbl.setText("Data updated successfully")
Exemplo n.º 9
0
 def do_edit(self):
     from uiview.ui_updatereNewTO import Ui_editTODialog
     spp = select_tools_by_gen_code(self.codeled.text())
     self.dd = Ui_editTODialog(spp)
     self.dd.exec_()