def confirmMainte(self):
        datetimestr = datetime.now()
        timestampstr = datetimestr.strftime('%Y-%m-%d %H:%M:%S')
        indexes = self.tableView.selectionModel().selectedRows(0)
        for ind in sorted(indexes):
            maint = select_maintenance_by_code(ind.data())
        bom = select_bill_of_material_for_maintenance(maint.id)
        bomitem = select_bill_of_material_item_for_BOM(bom.id)
        for item in bomitem:
            if item.rawMaterial != None:
                decreaseRawMaterialInvQty(item.rawMaterial,
                                          item.qty_of_material)
            if item.spareParts != None:
                decreaseSparePartsInvQty(item.spareParts, item.qty_of_material)
        update_maintenance_confirm(maint.id, timestampstr)
        CreateAcConfReport(maint).create_pdf()
        CreateProConfReport(maint).create_pdf()

        self.tableData = MaintenanceTableModel()
        self.tableView.setModel(self.tableData)
        for idx, val in enumerate(getMaintenanceHolded()):
            self.tableData.addCustomer(
                Customers(getMaintenanceHolded()[idx].customers.name,
                          getMaintenanceHolded()[idx].customers.mobile_number,
                          None, None, None, None,
                          getMaintenanceHolded()[idx].m_code, None, None))
 def detailsDia(self):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
     from uiview.ui_maintenanceDetails import Ui_maintenanceDetailsDialog
     self.md = Ui_maintenanceDetailsDialog(maint)
     self.md.exec_()
    def openCreateBom(self):
        indexes = self.tableView.selectionModel().selectedRows(2)
        for ind in sorted(indexes):
            maint = select_maintenance_by_code(ind.data())

        from uiview.ui_createBOM import Ui_createBOMDialog
        self.cbom = Ui_createBOMDialog(maint)
        self.cbom.exec_()
Exemplo n.º 4
0
 def Clicked(self, item):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         self.mainteCode.setText(maint.m_code)
         self.mainteProductlbl.setText(maint.product_of_maintenance)
         self.mainteStatuslbl.setText(str(getMaintenanceStatus(maint)))
     self.detailsbtn.setEnabled(True)
 def Clicked(self, item):
     indexes = self.tableView.selectionModel().selectedRows(2)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         self.custNamelbl.setText(maint.customers.name)
         self.custMobilePhonelbl.setText(maint.customers.mobile_number)
         self.maintCodelbl.setText(maint.m_code)
         self.maintProductlbl.setText(maint.product_of_maintenance)
         self.maintDesclbl.setText(maint.maintenance_description)
     self.createBOMbtn.setEnabled(True)
     self.deletebtn.setEnabled(True)
     role = getLoginDataPKL()['role']
     if int(role) == 2 or int(role) == 3 or int(role) == 1:
         self.deletebtn.setEnabled(False)
Exemplo n.º 6
0
 def do_finish(self):
     datetimestr = datetime.now()
     timestampstr = datetimestr.strftime('%Y-%m-%d %H:%M:%S')
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         update_maintenance_finish(maint.id, timestampstr)
     self.tableData = MaintenanceTableModel()
     self.tableView.setModel(self.tableData)
     for idx, val in enumerate(getMaintenanceUnderProccessing()):
         self.tableData.addCustomer(
             Customers(
                 getMaintenanceUnderProccessing()[idx].customers.name,
                 getMaintenanceUnderProccessing()
                 [idx].customers.mobile_number, None, None, None, None,
                 getMaintenanceUnderProccessing()[idx].m_code, None, None))
 def Clicked(self, item):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         self.custNamelbl.setText(maint.customers.name)
         self.custMobilePhonelbl.setText(maint.customers.mobile_number)
         self.maintCodelbl.setText(maint.m_code)
         self.maintProductlbl.setText(maint.product_of_maintenance)
         self.maintDesclbl.setText(maint.maintenance_description)
         bom = select_bill_of_material_for_maintenance(maint.id)
         self.rowCostlbl.setText(str(bom.cost_of_raw_material))
         self.spCostlbl.setText(str(bom.cost_of_spare_parts))
         self.matTotalCostlbl.setText(str(maint.cost_of_bill_of_material))
         self.calcbtn.setEnabled(True)
         self.detailsbtn.setEnabled(True)
         self.deletebtn.setEnabled(True)
         role = getLoginDataPKL()['role']
         if int(role) == 1:
             self.deletebtn.setEnabled(False)
Exemplo n.º 8
0
 def Clicked(self, item):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         self.custNamelbl.setText(maint.customers.name)
         self.custMobilePhonelbl.setText(maint.customers.mobile_number)
         self.maintCodelbl.setText(maint.m_code)
         self.maintProductlbl.setText(maint.product_of_maintenance)
         self.maintDesclbl.setText(maint.maintenance_description)
         self.createdlbl.setText(str(maint.created_at))
         self.laborled.setText(str(maint.cost_of_labor))
         self.startlbl.setText(str(maint.start_date))
         bom = select_bill_of_material_for_maintenance(maint.id)
         self.rowCostlbl.setText(str(bom.cost_of_raw_material))
         self.spCostlbl.setText(str(bom.cost_of_spare_parts))
         self.matTotalCostlbl.setText(str(maint.cost_of_bill_of_material))
         self.totalCostlbl.setText(
             str(maint.cost_of_bill_of_material + maint.cost_of_labor))
         self.finishbtn.setEnabled(True)
         self.detailsbtn.setEnabled(True)
Exemplo n.º 9
0
 def do_delete(self):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
     reply = QMessageBox.question(
         QMessageBox(), "OOP'S",
         'Are you sure to delete ?\n Maintenance \n Code : {}'.format(
             maint.m_code) +
         '\n Customer Name : {}'.format(maint.customers.name) +
         '\n This Action Cant Undo', QMessageBox.Yes | QMessageBox.No)
     if reply == QMessageBox.Yes:
         delete_maintenance(maint.id)
     self.tableData = MaintenanceTableModel()
     self.tableView.setModel(self.tableData)
     for idx, val in enumerate(getMaintenanceUnderProccessing()):
         self.tableData.addCustomer(
             Customers(
                 getMaintenanceUnderProccessing()[idx].customers.name,
                 getMaintenanceUnderProccessing()
                 [idx].customers.mobile_number, None, None, None, None,
                 getMaintenanceUnderProccessing()[idx].m_code, None, None))
 def do_addLaborCost(self):
     indexes = self.tableView.selectionModel().selectedRows(0)
     for ind in sorted(indexes):
         maint = select_maintenance_by_code(ind.data())
         laborCost = self.laborled.text()
         update_maintenance(maint.id, maint.cost_of_bill_of_material,
                            laborCost, None, None, maint.created_at,
                            maint.close_at, maint.product_of_maintenance,
                            maint.maintenance_description, maint.start_date,
                            maint.done_date)
         self.totalCostlbl.setText(
             str(maint.cost_of_bill_of_material + maint.cost_of_labor))
         self.tableData = MaintenanceTableModel()
         self.tableView.setModel(self.tableData)
         for idx, val in enumerate(getMaintenanceWaitLaborCost()):
             self.tableData.addCustomer(
                 Customers(
                     getMaintenanceWaitLaborCost()[idx].customers.name,
                     getMaintenanceWaitLaborCost()
                     [idx].customers.mobile_number, None, None, None, None,
                     getMaintenanceWaitLaborCost()[idx].m_code, None, None))