Esempio n. 1
0
 def Clicked(self, item):
     # role handel
     role = getLoginDataPKL()['role']
     if int(role) == 1 or int(role) == 2:
         self.deletebtn.setEnabled(False)
     self.editbtn.setEnabled(True)
     self.deletebtn.setEnabled(True)
     code = before(item.text(), '-')
     if select_row_material_bycode(code):
         rawMat = select_row_material_bycode(code)
         self.codeled.setText(rawMat.code)
         self.nameled.setText(rawMat.name)
         self.unitled.setText(rawMat.unit)
         self.numsizeled.setText(str(rawMat.default_size))
         self.strsizeled.setText(rawMat.string_size)
         self.costled.setText(str(rawMat.cost_per_default_size))
         self.invQtyled.setText(str(rawMat.inv_qty))
         self.miniled.setText(str(rawMat.mini_qty))
     if not select_all_bill_of_material_item(
     ) == [] and not select_all_outbound() == []:
         for item in select_all_bill_of_material_item():
             if item.raw_material_id == rawMat.id:
                 self.deletebtn.setEnabled(False)
         for item in select_all_outbound():
             if item.raw_material_id == rawMat.id:
                 self.deletebtn.setEnabled(False)
     return rawMat
 def Clicked(self, item):
     self.addbtn.setEnabled(True)
     code = before(item.text(), '-')
     if select_row_material_bycode(code):
         rawMat = select_row_material_bycode(code)
         self.rmcodeled.setText(rawMat.code)
         self.rmnameled.setText(rawMat.name)
         self.rmdefaultsizeled.setText(str(rawMat.default_size))
         self.rminqtyled.setText(str(rawMat.inv_qty))
     return rawMat
Esempio n. 3
0
 def do_delete(self):
     code = self.codeled.text()
     if not code == '':
         if select_row_material_bycode(code):
             rawMat = select_row_material_bycode(code)
         reply = QMessageBox.question(
             QMessageBox(), "OOP'S", 'Are you sure to delete ?\n Raw '
             'Material \n Code : {}'.format(rawMat.code) +
             '\n Name : {}'.format(rawMat.name) +
             '\n This Action Cant Undo', QMessageBox.Yes | QMessageBox.No)
         if reply == QMessageBox.Yes:
             delete_raw_material(rawMat.id)
             self.deletebtn.setEnabled(False)
             self.editbtn.setEnabled(False)
Esempio n. 4
0
 def update_data(self):
     id_code = self.rwcodelbl.text()
     uprm = select_row_material_bycode(id_code)
     xname = self.rwnameled.text()
     idx = self.unitcomboBox.currentIndex()
     xunit = list(self.unitdict.keys())[list(
         self.unitdict.values()).index(idx)]
     xdefault_size = self.defaultsizSpinBox.value()
     xstr_size = self.strsizeled.text()
     xminiqty = self.miniqtySpinBox.value()
     # # spesial case
     xcode = uprm.code
     xcost = uprm.cost_per_default_size
     xinv_qty = uprm.inv_qty
     #
     if xname == '':
         xname = uprm.name
     if xunit == uprm.unit:
         xunit = uprm.unit
     if xdefault_size == uprm.default_size:
         xdefault_size = uprm.default_size
     if xstr_size == '':
         xstr_size = uprm.string_size
     update_raw_material(uprm.id, xcode, xname, xdefault_size, xstr_size,
                         xunit, xcost, xinv_qty, xminiqty)
     self.statulbl.setText("Data updated successfully")
 def do_add(self):
     code = self.rmcodeled.text()
     rawmat = select_row_material_bycode(code)
     qty = self.reqqtyled_2.text()
     if not qty == '':
         # print(self.bomObj)
         self.close()
         createNewBOMItem(self.bomObj.id, rawmat.id, None, int(qty))
     else:
         self.statulbl.setText("You must enter quantity you want")
Esempio n. 6
0
    def Clicked(self, item):
        self.dataupdatebtn.setEnabled(True)
        self.updatecostbtn.setEnabled(True)
        self.updateqtybtn.setEnabled(True)
        self.updateqtybtn_2.setEnabled(True)
        role = getLoginDataPKL()['role']
        if int(role) == 2:
            self.updatecostbtn.setEnabled(False)
            self.updateqtybtn.setEnabled(False)
            self.updateqtybtn_2.setEnabled(False)
            self.dataupdatebtn.setEnabled(False)
        if int(role) == 3:
            self.dataupdatebtn.setEnabled(True)
            self.updatecostbtn.setEnabled(False)
            self.updateqtybtn_2.setEnabled(True)
            self.updateqtybtn.setEnabled(True)
        if int(role) == 1:
            self.updatecostbtn.setEnabled(True)
            self.updateqtybtn.setEnabled(False)
            self.updateqtybtn_2.setEnabled(False)
            self.dataupdatebtn.setEnabled(False)

        code = before(item.text(), '-')
        if select_row_material_bycode(code):
            rawMat = select_row_material_bycode(code)
            self.rwcodelbl.setText(rawMat.code)
            self.rwnamelbl.setText(rawMat.name)
            self.rwunitlbl.setText(rawMat.unit)
            self.rwdefaultsize.setText(str(rawMat.default_size))
            self.rwstrsize.setText(rawMat.string_size)
            self.rwcostlbl.setText(str(rawMat.cost_per_default_size))
            self.rwinvqtylbl.setText(str(rawMat.inv_qty))
            self.minilbl.setText(str(rawMat.mini_qty))
            self.rwnameled.setText(rawMat.name)
            self.unitcomboBox.setCurrentIndex(self.unitdict[rawMat.unit])
            self.defaultsizSpinBox.setValue(rawMat.default_size)
            self.strsizeled.setText(rawMat.string_size)
            self.miniqtySpinBox.setValue(rawMat.mini_qty)
            ## old (cost and inv_qty)
            self.oldcostlbl.setText(str(rawMat.cost_per_default_size))
            self.oldqtylbl.setText(str(rawMat.inv_qty))
        return rawMat
Esempio n. 7
0
 def do_add(self):
     datetimestr = datetime.now()
     timestampstr = datetimestr.strftime('%Y-%m-%d %H:%M:%S')
     code = self.rmcodeled.text()
     rawmat = select_row_material_bycode(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,
                          rawmat.id, None, None, None, qty, 1)
         if type(self.obj) == Customers:
             add_outbound(OutBCode(), timestampstr, reas, self.obj.id, None,
                          rawmat.id, None, None, None, qty, 1)
         decreaseRawMaterialInvQty(rawmat, int(qty))
         self.do_close()
Esempio n. 8
0
    def minupdate_inv(self):
        if self.newqtySpinBox_2.value() == 0:
            self.statulbl.setText('New Quantity is required ')
        else:
            reply = QMessageBox.question(
                QMessageBox(), 'Delete', "Are you sure to update "
                "inventory quantity ?\n"
                "This action you can't undo", QMessageBox.Yes | QMessageBox.No)
            id_code = self.rwcodelbl.text()
            uprm = select_row_material_bycode(id_code)

            n_inv = self.newqtySpinBox_2.value()
            if reply == QMessageBox.Yes:
                decreaseRawMaterialInvQty(uprm, n_inv)
                self.statulbl.setText("Data updated successfully")
            else:
                self.statulbl.setText("Data not updated ")
Esempio n. 9
0
    def update_cost(self):
        if self.newcostled.text() == '':
            self.statulbl.setText('The 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.rwcodelbl.text()
            uprm = select_row_material_bycode(id_code)

            n_cost = self.newcostled.text()
            if n_cost == '':
                n_cost = uprm.cost_per_default_size
            if reply == QMessageBox.Yes:
                upRawMaterialCost(uprm, n_cost)
                self.statulbl.setText("Data updated successfully")
            else:
                self.statulbl.setText("Data not updated ")
Esempio n. 10
0
 def do_edit(self):
     from uiview.ui_updatereNewRM import Ui_editRWDialog
     spp = select_row_material_bycode(self.codeled.text())
     self.dd = Ui_editRWDialog(spp)
     self.dd.exec_()