def Clicked(self, item): self.addbtn.setEnabled(True) code = before(item.text(), '-') if select_finish_product_by_gen_code(code): rawMat = select_finish_product_by_gen_code(code) self.spnameled.setText(rawMat.name) self.spcodeled.setText(rawMat.code) self.spinqtyled.setText(str(rawMat.inv_qty)) self.spgencodeled.setText(rawMat.gen_code) return rawMat
def do_delete(self): code = self.codeled.text() if select_finish_product_by_gen_code(code): rawMat = select_finish_product_by_gen_code(code) reply = QMessageBox.question( QMessageBox(), "OOP'S", 'Are you sure to delete ?\n Finish Product \n Code : {}'.format( rawMat.code) + '\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_finish_product(rawMat.id)
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.dataupdatebtn.setEnabled(False) if int(role) == 3: # self.updatecostbtn.setEnabled(False) self.updateqtybtn.setEnabled(True) self.updateqtybtn_2.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_finish_product_by_gen_code(gencode): fpor = select_finish_product_by_gen_code(gencode) print(fpor) self.fpnamelbl.setText(fpor.name) self.fpunitlbl.setText(fpor.source) self.fpcodelbl.setText(fpor.code) self.fpcostlbl.setText(str(fpor.price)) self.fpinvqtylbl.setText(str(fpor.inv_qty)) self.fpgencodelbl.setText(fpor.gen_code) self.fpnameled.setText(fpor.name) self.fpsourled.setText(fpor.source) self.fpcodeled.setText(fpor.code) # ## old (cost and inv_qty) self.oldcostlbl.setText(str(fpor.price)) self.oldqtylbl.setText(str(fpor.inv_qty)) if fpor.mini_qty == None: miq = 0 else: miq = float(fpor.mini_qty) self.miniqtySpinBox.setValue(miq) return fpor
def Clicked(self, item): role = getLoginDataPKL()['role'] if int(role) == 1 or int(role) == 2 or int(role) == 3: self.deletebtn.setEnabled(False) self.editbtn.setEnabled(True) gencode = before(item.text(), ' -') if select_finish_product_by_gen_code(gencode): spart = select_finish_product_by_gen_code(gencode) print(gencode) self.nameled.setText(spart.name) self.unitled.setText(spart.source) self.strsizeled.setText(spart.code) 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
def do_add(self): datetimestr = datetime.now() timestampstr = datetimestr.strftime('%Y-%m-%d %H:%M:%S') code = self.spgencodeled.text() rawmat = select_finish_product_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, None, rawmat.id, qty, 1) if type(self.obj) == Customers: add_outbound(OutBCode(), timestampstr, reas, self.obj.id, None, None , None, None, rawmat.id, qty, 1) decreaseFinishProductInvQty(rawmat, int(qty)) self.close()
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 cost ?\n" "This action you can't undo", QMessageBox.Yes | QMessageBox.No) id_code = self.fpgencodelbl.text() upsp = select_finish_product_by_gen_code(id_code) n_inv = self.newqtySpinBox_2.value() if reply == QMessageBox.Yes: decreaseFinishProductInvQty(upsp, n_inv) self.statulbl.setText("Data updated successfully") else: self.statulbl.setText("Data not updated ")
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.fpgencodelbl.text() upsp = select_finish_product_by_gen_code(id_code) n_cost = self.newcostled.text() if n_cost == '': n_cost = upsp.price if reply == QMessageBox.Yes: upFinishProductCost(upsp, n_cost) self.statulbl.setText("Data updated successfully") else: self.statulbl.setText("Data not updated ")
def update_data(self): id_code = self.fpgencodelbl.text() upsp = select_finish_product_by_gen_code(id_code) xname = self.fpnameled.text() xsource = self.fpsourled.text() # # # spesial case xcode = self.fpcodeled.text() miqty = self.miniqtySpinBox.value() xcost = upsp.price xinv_qty = upsp.inv_qty xgen_code = upsp.gen_code # if xname == '': xname = upsp.name if xsource == '': xsource = upsp.source if xcode == '': xcode = upsp.code update_finish_product(upsp.id, xname, xcode, xcost, xinv_qty, xsource, xgen_code) update_finish_product_mini_qty(upsp.id, miqty) self.statulbl.setText("Data updated successfully")
def do_edit(self): from uiview.ui_updatereNewFP import Ui_editFPDialog spp = select_finish_product_by_gen_code(self.codeled.text()) self.dd = Ui_editFPDialog(spp) self.dd.exec_()