Exemplo n.º 1
0
    def refreshReport(self, model, report=None):
        period = ''
        model.load(self.reportName, period, self.query, self.fieldList,
                   self.columnsToTotal)

    def clear(self):
        widgets = self.findChildren(QWidget)
        for widget in widgets:
            if isinstance(widget, (QLineEdit, QTextEdit)):
                widget.clear()
            elif isinstance(widget, QComboBox):
                if widget != self.typeCombo:
                    widget.setCurrentIndex(-1)
            elif isinstance(widget, QCheckBox):
                widget.setChecked(False)
        if self.model is not None:
            self.model.clear()

    def formClosed(self):
        self.myParent.formClosed()

if __name__ == '__main__':

    app = QApplication(sys.argv)
    setupDatabase("Production.sqlite")
    supModel = modelsandviews.SupplierModel()
    form = FindItemForm(supModel)
    form.show()
    app.exec_()
Exemplo n.º 2
0
    def setupUi(self):
        # setup Models
        self.supplierModel = modelsandviews.SupplierModel()
        self.bomModel = modelsandviews.ItemModel('BOM')
        self.itemModel = modelsandviews.ItemModel('Items')
        self.baseListModel = modelsandviews.BaseListModel()
        self.batchListModel = modelsandviews.BatchListModel()
        self.prepListModel = modelsandviews.PrepListModel()
        
        # prepare form variables
        self.home_form = None
        self.supplier_form = None
        self.item_form = None
        self.receive_form = None
        self.batch_form = None
        self.prodprep_form = None
        self.production_form = None
        self.inventoryAdj_form = None
        self.batchAdj_form = None
        self.findItem_form = None
        self.find_form = None
        self.settings_form = None
        
        # // prepare other variables
        self.from_date = QDate().currentDate().toPyDate()
        self.to_date = QDate().currentDate().toPyDate()
        self.report_bomId = None
        accounts = functions.dLookup(databaseschema.Settings.value_1, databaseschema.Settings.setting == 'export_accounts')
        accounts = accounts.split('|')
        self.ap_account = accounts[0].strip()
        self.ap_usAccount = accounts[1].strip()
        self.inv_account = accounts[2].strip()
        self.exp_class = accounts[3].strip()

        self.openWindowDock.show()
        self.openWindowDock.setObjectName('OpenWindowDock')
        self.openWindowDock.setAllowedAreas(Qt.LeftDockWidgetArea| Qt.RightDockWidgetArea)
        self.openWindowList = QListWidget()
        self.openWindowDock.setWidget(self.openWindowList)
        self.addDockWidget(Qt.LeftDockWidgetArea, self.openWindowDock)
        self.openWindowList.clicked.connect(self.dockWindow)
        
        importSupplierAction = self.createAction('Import Supplier List', self.importSupplier, None, ':/icons/import', 'Import supplier list from excel')
        importBOMAction = self.createAction('Import BOM List', self.importBOM, None, ':/icons/import', 'Import Bill Of Material list from excel')
        importBaseAction  = self.createAction('Import Base', self.importBase, None, ':/icons/import', 'Import Bases from excel')
        importItemAction  = self.createAction('Import Item List', self.importItem, None, ':/icons/import', 'Import item list from excel')
        importReceiveAction  = self.createAction('Import Receive', self.importReceive, None, ':/icons/import', 'Import inventory receiving from excel')
        exportReceiveAction = self.createAction('Export IIF', self.exportReceive, None, ':/icons/export', 'Export receive reports to an IIF file.')
        setupUserAction = self.createAction('Setup User', self.userSetup, None, ':/icons/settings', 'Setup new user name and password')
        settingsAction = self.createAction('Preferences', self.settingsForm, None, ':/icons/settings', 'Settings and Tools')
        utilitiesMenu = self.fileMenu.addMenu('Utilities')
        self.addActions(utilitiesMenu, (importSupplierAction, importBOMAction, importBaseAction, importItemAction, importReceiveAction,
                                         None, exportReceiveAction, None, setupUserAction, settingsAction))
        self.fileMenu.insertMenu(self.fileQuitAction, utilitiesMenu)
        self.fileMenu.insertSeparator(self.fileQuitAction)

        formHomeAction = self.createAction("Home", self.homeForm, 'Ctrl+H', ":/icons/home", "Go To Home")
        formSupplierAction = self.createAction("New Supplier", self.supplierForm, None, ":/icons/account", "Add New Supplier")
        formItemAction = self.createAction("New Item", self.itemForm, None, ":/icons/item", "Add New Item")
        formReceiveAction = self.createAction("Receive Inventory", self.receiveForm, None, ":/icons/inventory", "Receive Inventory")
        formProdprepAction = self.createAction('Prepare Production', self.prodprepForm, None, ":/icons/prep", "Prepare A Production")
        formBatchAction = self.createAction('Create Batch', self.batchForm, None, ':/icons/batch', 'Create A Batch')
        formBaseAction = self.createAction('Record Base', self.baseForm, None, ':/icons/batch', 'Record A New Base')
        formProduction = self.createAction('Production', self.productionForm, None, ':/icons/production', 'Record A Production')
        formInvAdjustment = self.createAction('Adjust Inventory', self.invAdjustment, None, ':/icons/journal', 'Adjust Inventory')
        formBatchAdjAction = self.createAction('Adjust Batch RM', self.batchAdjForm, None, ':/icons/settings',
                                                'Adjust Raw Materials on a batch before production')
        
        formMenu = self.menuBar().addMenu("Form")
        self.addActions(formMenu, (formHomeAction, formSupplierAction, formItemAction, formReceiveAction, formProdprepAction, formBatchAction,
                                   formBaseAction, formProduction, formInvAdjustment, formBatchAdjAction))
        
        findMenu = self.menuBar().addMenu('Find')
        findItemAction = self.createAction('Find Item', self.findItem, None, ':/icons/find', 'Find Item')
        findAction = self.createAction('&Find', self.findForm, 'Ctrl+F', ':/icons/search', 'Find Transaction')
        self.addActions(findMenu, (findItemAction, findAction))
        
        reportInventorySumAction = self.createAction('Inventory Evaluation', self.inventorySumReport, None, ':/icons/report', 'Invenatory Report')
        reportInventoryDetailAction = self.createAction('Inventory Detail', self.inventoryDetReport, None, 
                                                        ':/icons/report', 'Inventory Detail Report')
        reportMenu = self.menuBar().addMenu('Reports')
        self.addActions(reportMenu, (reportInventorySumAction, reportInventoryDetailAction))
        
        
        self.windowNextAction = self.createAction("&Next", self.mdi.activateNextWindow, QKeySequence.NextChild)
        self.windowPrevAction = self.createAction("&Previous", self.mdi.activatePreviousWindow, QKeySequence.PreviousChild)
        self.windowCascadeAction = self.createAction("Casca&de", self.mdi.cascade)
        self.windowTileAction = self.createAction("&Tile", self.mdi.tile)
        self.windowRestoreAction = self.createAction("&Restore All", self.windowRestoreAll)
        self.windowMinimizeAction = self.createAction("&Iconize All", self.windowMinimizeAll)
        self.windowArrangeIconsAction = self.createAction("&Arrange Icons", self.mdi.arrangeIcons)
        self.windowCloseAction = self.createAction("&Close", self.mdi.closeActiveWindow, QKeySequence.Close)
        self.showDockAction = self.createAction('Show Dock Window', self.showDockWindow)
        
        formToolBar = self.addToolBar('Forms Toolbar')
        formToolBar.setObjectName('FormToolBar')
        self.addActions(formToolBar, (formHomeAction, formSupplierAction, formItemAction, formReceiveAction, formProdprepAction, 
                                      formBatchAction, formProduction, formBatchAdjAction, formInvAdjustment))
        findToolBar = self.addToolBar('Find Toolbar')
        findToolBar.setObjectName('FindToolBar')
        self.addActions(findToolBar, (findItemAction, findAction))
        
        self.windowMapper = QSignalMapper(self)
        self.connect(self.windowMapper, SIGNAL("mapped(QWidget*)"), self.mdi, SLOT("setActiveWindow(QWidget*)"))
        self.windowMenu = self.menuBar().addMenu("&Window")
        self.connect(self.windowMenu, SIGNAL("aboutToShow()"), self.updateWindowMenu)
        
        helpMenu = self.menuBar().addMenu('Help')
        aboutAction = self.createAction('&About Production Program', self.helpAbout)
        self.addActions(helpMenu, (aboutAction,))
        
        self.homeForm()
        
        self.updateWindowMenu()