Exemple #1
0
    def __init__(self, supModel, itemType=0, parent=None, ascForm=None):
        super(FindItemForm, self).__init__(parent)
        self.setupUi(self)
        self.typeCombo.setCurrentIndex(itemType)
        self.session = Session()
        self.query = None
        self.fieldList = []
        self.reportName = None
        self.columnsToTotal = []
        self.model = None
        self.proxyModel = QSortFilterProxyModel()
        self.myParent = parent
        self.ascForm = ascForm

        self.sup_comb.setVisible(False)
        self.supplierCombo = modelsandviews.SupplierComboBox(supModel, self)
        self.supplierCombo.setGeometry(QRect(70, 99, 285, 25))
        self.supplierCombo.setTabOrder(self.descLineedit, self.supplierCombo)

        catModel = QSqlTableModel(self)
        db = QSqlDatabase.database('prod')
        catModel.setQuery(
            QSqlQuery('SELECT item FROM lists WHERE type = "itemCategory"',
                      db))
        catModel.select()
        self.category_combo = QComboBox(self)
        self.category_combo.setModel(catModel)
        self.category_combo.setEditable(False)
        self.category_combo.setCurrentIndex(-1)
        self.category_combo.setGeometry(QRect(70, 99, 150, 25))
        self.category_combo.setTabOrder(self.descLineedit, self.supplierCombo)

        view = self.resultsView
        view.verticalHeader().setVisible(False)
        view.setSelectionMode(QTableView.SingleSelection)
        view.setSelectionBehavior(QTableView.SelectRows)

        self.changeLayout()

        self.typeCombo.currentIndexChanged.connect(self.changeLayout)
        self.resultsView.doubleClicked.connect(self.edit)
        self.findButton.clicked.connect(self.find)
        self.clearButton.clicked.connect(self.clear)
        self.editButton.clicked.connect(self.edit)
        self.reportButton.clicked.connect(self.printReport)
        self.closeButton.clicked.connect(self.reject)

        self.setWindowTitle(localTITLE)
Exemple #2
0
    def __init__(self, model, parent=None):
        super(SupplierForm, self).__init__(parent)

        label_3 = QLabel("Recall Supplier")
        self.model = model
        self.view = modelsandviews.SupplierView(self.model)
        self.recall_supplier = modelsandviews.SupplierComboBox(self.model)
        label_3.setBuddy(self.recall_supplier)
        label_1 = QLabel("Name")
        self.suppliername_lineEdit = QLineEdit()
        label_1.setBuddy(self.suppliername_lineEdit)
        label_2 = QLabel("Currency")
        self.supplier_currency = QComboBox()
        self.supplier_currency.addItems(("CAD", "USD", "EU"))
        label_2.setBuddy(self.supplier_currency)
        frame = QFrame()
        hLine = QFrame()
        hLine.setFrameShape(QFrame.HLine)
        hLine.setFrameShadow(QFrame.Sunken)

        self.save_button = QPushButton("&Save New")
        self.delete_button = QPushButton("&Delete")
        self.close_button = QPushButton("C&lose")

        self.save_button.setIcon(QIcon(':/icons/save'))
        self.delete_button.setIcon(QIcon(':/icons/delete'))
        self.close_button.setIcon(QIcon(':/icons/exit'))

        buttonLayout = QHBoxLayout()
        buttonLayout.addWidget(self.save_button)
        buttonLayout.addWidget(self.delete_button)
        buttonLayout.addWidget(self.close_button)
        spacer = QSpacerItem(0, 0, QSizePolicy.Expanding,
                             QSizePolicy.Expanding)
        buttonLayout.setContentsMargins(11, 25, 11, 11)
        buttonLayout.addSpacerItem(spacer)
        fieldlayout = QGridLayout()
        fieldlayout.addWidget(label_3, 0, 0, 1, 1)
        fieldlayout.addWidget(self.recall_supplier, 0, 1, 1, 3)
        fieldlayout.addWidget(frame, 1, 1, 1, 3)
        fieldlayout.addWidget(label_1, 2, 0, 1, 1)
        fieldlayout.addWidget(self.suppliername_lineEdit, 2, 1, 1, 3)
        fieldlayout.addWidget(label_2, 3, 0, 1, 1)
        fieldlayout.addWidget(self.supplier_currency, 3, 1, 1, 3)
        vlayout = QVBoxLayout()
        vlayout.addLayout(fieldlayout)
        vlayout.addWidget(hLine)
        vlayout.addLayout(buttonLayout)
        vlayout.addSpacerItem(spacer)
        layout = QHBoxLayout()
        layout.addLayout(vlayout)
        layout.addSpacerItem(spacer)
        self.setLayout(layout)

        self.setWindowIcon(QIcon(':/icons/account'))
        self.setWindowTitle(localTITLE)
        self.dirty = False
        self.editing = False
        self.session = Session()
        self.query = self.session.query(Suppliers)
        self.current_record = None
        self.record_id = None
        self.my_parent = parent

        self.connect(self.save_button, SIGNAL("clicked()"), self.save)
        self.connect(self.close_button, SIGNAL("clicked()"), self.accept)
        self.connect(self.delete_button, SIGNAL("clicked()"), self.delete)
        self.connect(self.recall_supplier, SIGNAL("activated(int)"),
                     self.recall)
        self.connect(self.supplier_currency,
                     SIGNAL("currentIndexChanged(int)"), self.dataChanged)
        self.connect(self.suppliername_lineEdit, SIGNAL("textEdited(QString)"),
                     self.dataChanged)
        self.connect(self.recall_supplier, SIGNAL("keyPressEvent(QKeyEvent*)"),
                     self.verify)
Exemple #3
0
    def __init__(self, supplierModel, parent=None):
        super(FindForm, self).__init__(parent)
        self.setupUi(self)
        self.tabWidget.setCurrentIndex(0)
        self.session = Session()
        self.query = None
        self.model = None
        self.reportName = QString()
        self.fieldList = []
        self.columnsToTotal = []
        self.proxyModel = QSortFilterProxyModel()
        self.myParent = parent

        ## == Standard tab GUI setup ==
        journalList = QStringList()
        journalList << 'Receive' << 'Batch' << 'Production' << 'Adjustment' << 'Preparation'
        self.journal_combo.addItems(journalList)

        self.supCom.setVisible(False)
        self.supplierModel = supplierModel
        self.supplier_combo = modelsandviews.SupplierComboBox(
            self.supplierModel)
        self.supplier_combo.setMinimumSize(QSize(218, 25))
        self.supplier_combo.setMaximumSize(QSize(218, 25))
        self.gridLayout.addWidget(self.supplier_combo, 2, 1, 1, 2)

        self.batchDesc_lineEdit = QLineEdit()
        self.batchDesc_lineEdit.setMinimumSize(QSize(218, 25))
        self.batchDesc_lineEdit.setMaximumSize(QSize(218, 85))
        self.gridLayout.addWidget(self.batchDesc_lineEdit, 2, 1, 1, 2)
        self.batchDesc_lineEdit.setVisible(False)

        validator = QDoubleValidator()
        validator.StandardNotation
        self.amountHi_lineEdit.setValidator(validator)
        self.amountLow_lineEdit.setValidator(validator)

        self.dtcom.setVisible(False)
        self.dateRange_combo = modelsandviews.DateRangeComboBox(
            self.layoutWidget)
        self.dateRange_combo.setCurrentIndex(0)
        self.dateRange_combo.setMinimumSize(QSize(96, 25))
        self.dateRange_combo.setMaximumSize(QSize(96, 25))
        self.gridLayout.addWidget(self.dateRange_combo, 4, 1, 1, 1)
        self.dateLow_dateEdit.setDate(QDate.currentDate())
        self.dateHi_dateEdit.setDate(QDate.currentDate())

        self.results_tableView.setSelectionMode(QTableView.SingleSelection)
        self.results_tableView.setSelectionBehavior(QTableView.SelectRows)

        ## == Detail tab GUI setup ==
        self.filter_stackedWidget.setCurrentIndex(0)
        crtList = QStringList()
        crtList << 'Journal Number' << 'Journal ID' << 'Supplier' << 'Items' << 'Description' << 'Journal Type' \
        << 'Item Type' << 'Date' << 'Date Modified'
        crtView = self.criteriaList_listWidget
        crtView.addItems(crtList)
        crtView.setEditTriggers(QListView.NoEditTriggers)

        self.filterModel = FilterModel()
        fltView = self.criteria_tableView
        fltView.setModel(self.filterModel)
        fltView.hideColumn(0)
        fltView.horizontalHeader().setStretchLastSection(True)
        fltView.horizontalHeader().setVisible(False)
        fltView.verticalHeader().setVisible(False)
        fltView.setSelectionMode(QTableView.SingleSelection)
        fltView.setSelectionBehavior(QTableView.SelectRows)
        fltView.resizeColumnsToContents()

        self.dateLowFilter_dateEdit.setDate(QDate.currentDate())
        self.dateHiFilter_dateEdit.setDate(QDate.currentDate())
        self.modDateLowFilter_dateEdit.setDate(QDate.currentDate())
        self.modDateHiFilter_dateEdit.setDate(QDate.currentDate())

        ## == stackWidget items setup ==
        self.journalStart_lineEdit.setValidator(validator)
        self.journalEnd_lineEdit.setValidator(validator)

        self.supplier_list = modelsandviews.SupplierListModel()
        self.supplierFilter_tableView.setModel(self.supplier_list)
        supplier_view = self.supplierFilter_tableView
        supplier_view.hideColumn(1)
        supplier_view.setColumnWidth(0, 25)
        supplier_view.verticalHeader().setVisible(False)
        supplier_view.setSelectionMode(QTableView.SingleSelection)
        supplier_view.setSelectionBehavior(QTableView.SelectRows)

        self.ItemList = modelsandviews.UnionItemListModel()
        itemView = self.itemFilter_tableView
        itemView.setModel(self.ItemList)
        itemView.hideColumn(1)
        itemView.verticalHeader().setVisible(False)
        itemView.setSelectionMode(QTableView.SingleSelection)
        itemView.setSelectionBehavior(QTableView.SelectRows)
        itemView.resizeColumnsToContents()

        self.journalFilter_combo.addItems(journalList)
        self.journalFilter_combo.removeItem(1)
        self.journalFilter_combo.setCurrentIndex(-1)

        self.bothItemTypeFilter_checkBox.setChecked(True)

        self.dtfilcom.setVisible(False)
        self.dateFilter_combo = modelsandviews.DateRangeComboBox(
            self.layoutWidget6)
        self.dateFilter_combo.setMinimumSize(QSize(96, 25))
        self.dateFilter_combo.setMaximumSize(QSize(96, 25))
        self.gridLayout_7.addWidget(self.dateFilter_combo, 1, 1, 1, 1)
        self.dtfilcom_2.setVisible(False)
        self.modfiedDateFilter_combo = modelsandviews.DateRangeComboBox(
            self.layoutWidget_10)
        self.modfiedDateFilter_combo.setMinimumSize(QSize(96, 25))
        self.modfiedDateFilter_combo.setMaximumSize(QSize(96, 25))
        self.gridLayout_8.addWidget(self.modfiedDateFilter_combo, 1, 1, 1, 1)

        self.amountLow_lineEdit.editingFinished.connect(self.standardAmount)
        self.amountHi_lineEdit.editingFinished.connect(self.standardAmount)
        self.dateRange_combo.currentIndexChanged.connect(
            lambda: self.dateRangeSelection(self.dateRange_combo, self.
                                            dateLow_dateEdit, self.
                                            dateHi_dateEdit))
        self.dateFilter_combo.currentIndexChanged.connect(
            lambda: self.dateRangeSelection(self.dateFilter_combo, self.
                                            dateLowFilter_dateEdit, self.
                                            dateHiFilter_dateEdit))
        self.modfiedDateFilter_combo.currentIndexChanged.connect(
            lambda: self.dateRangeSelection(self.modfiedDateFilter_combo, self.
                                            modDateLowFilter_dateEdit, self.
                                            modDateHiFilter_dateEdit))
        self.connect(crtView, SIGNAL('currentRowChanged(int)'),
                     self.filter_stackedWidget, SLOT('setCurrentIndex(int)'))
        self.journal_combo.currentIndexChanged.connect(self.layoutChange)
        self.findButton.clicked.connect(self.find)
        self.editButton.clicked.connect(self.edit)
        self.results_tableView.doubleClicked.connect(self.edit)
        self.reportButton.clicked.connect(self.printReport)
        self.clearButton.clicked.connect(self.clear)
        self.closeButton.clicked.connect(self.reject)

        ## == Setup stackedWidget operations ==
        self.journalRef_lineEdit.editingFinished.connect(self.journalNum)
        self.journalStart_lineEdit.editingFinished.connect(self.journalIDRange)
        self.journalEnd_lineEdit.editingFinished.connect(self.journalIDRange)
        self.itemDesc_lineEdit.editingFinished.connect(self.itemDesc)
        self.journalFilter_combo.currentIndexChanged.connect(self.journalType)
        self.rmFilter_checkBox.stateChanged.connect(self.itemType)
        self.fgFilter_checkBox.stateChanged.connect(self.itemType)
        self.dateLowFilter_dateEdit.dateChanged.connect(self.dateRange)
        self.dateHiFilter_dateEdit.dateChanged.connect(self.dateRange)
        self.modDateLowFilter_dateEdit.dateChanged.connect(self.modDateRange)
        self.modDateHiFilter_dateEdit.dateChanged.connect(self.modDateRange)

        self.removeFilter_button.clicked.connect(self.removeFilter)
        itemView.clicked.connect(self.checkItem)
        supplier_view.clicked.connect(self.checkItem)

        self.setWindowTitle(localTITLE)
Exemple #4
0
    def __init__(self, supplierModel, bomModel, parent=None):
        super(ReceiveForm, self).__init__(parent)
        self.setupUi(self)
        self.session = Session()
        self.my_parent = parent

        self.supplierModel = supplierModel
        self.supcom.setVisible(False)
        self.supplier_comboBox = modelsandviews.SupplierComboBox(
            self.supplierModel)
        self.supplier_comboBox.setMaximumSize(QSize(197, 25))
        self.supplier_comboBox.setMinimumSize(QSize(197, 25))
        self.gridLayout_2.addWidget(self.supplier_comboBox, 0, 1, 1, 2)
        self.setTabOrder(self.note_textEdit, self.supplier_comboBox)

        self.date_dateEdit.setDate(self.my_parent.getDate())
        self.curr_lineEdit.setText("1")
        self.amount_lineEdit.setText('0.00')
        self.receive_radioButton.setChecked(True)
        self.export_checkBox.setChecked(True)
        self.supplier_comboBox.setFocus()

        self.itemModel = bomModel
        self.itemView = modelsandviews.SupplierView(self.supplierModel)

        self.detailModel = ReceivingDetailModel(self.session)
        self.receive_tableView.setModel(self.detailModel)
        delegate = genericdelegates.GenericDelegate(self)
        delegate.insertDelegate(
            ITEM, genericdelegates.ComboDelegate(self.itemModel, True))
        delegate.insertDelegate(DESCRIPTION,
                                genericdelegates.PlainTextDelegate())
        delegate.insertDelegate(QTY, genericdelegates.NumberDelegate())
        delegate.insertDelegate(PRICE, genericdelegates.NumberDelegate())
        delegate.insertDelegate(MEMO, genericdelegates.PlainTextDelegate())
        tblView = self.receive_tableView
        tblView.setItemDelegate(delegate)
        tblView.setColumnWidth(ITEM, 50)
        tblView.setColumnWidth(DESCRIPTION, 200)
        tblView.setColumnWidth(QTY, 70)
        tblView.setColumnWidth(PRICE, 70)
        tblView.setColumnWidth(SHIPPING, 70)
        tblView.setColumnWidth(COST, 100)
        tblView.setColumnWidth(TOTAL, 100)
        tblView.setColumnWidth(MEMO, 200)
        self.receive_tableView.setColumnHidden(CAD_TOTAL, True)
        tblView.horizontalHeader().setStretchLastSection(True)

        self.detailModel.dataChanged.connect(self.autoAddRow)
        self.shipping_lineEdit.editingFinished.connect(self.updateDetailModel)
        self.curr_lineEdit.editingFinished.connect(self.updateDetailModel)
        self.detailModel.dataChanged.connect(self.updateSumTotal)
        self.billno_lineEdit.editingFinished.connect(self.checkBillNo)
        self.supplier_comboBox.currentIndexChanged.connect(self.changeLayout)
        self.date_dateEdit.dateChanged.connect(self.setModelDate)
        self.date_dateEdit.dateChanged.connect(self.setParentDate)

        self.newButton.clicked.connect(self.clear)
        self.saveButton.clicked.connect(self.save)
        self.deleteButton.clicked.connect(self.delete)
        self.calcButton.clicked.connect(self.updateDetailModel)
        self.findButton.clicked.connect(self.find)
        self.closeButton.clicked.connect(self.accept)
        self.receive_tableView.doubleClicked.connect(self.findBomID)

        self.setupConnection()
        self.setModelDate()
        self.dirty = False
        self.editing = False
        self.record_id = None
        self.current_record = None
Exemple #5
0
    def __init__(self,
                 supplierModel,
                 itemModel,
                 baseModel,
                 itemType=0,
                 parent=None):
        super(ItemForm, self).__init__(parent)
        self.setupUi(self)
        self.type_comboBox.setCurrentIndex(itemType)
        self.setWindowFlags(Qt.WindowMinMaxButtonsHint)

        self.season_combo = QComboBox(self.frame_5)
        self.season_combo.setEditable(False)
        self.season_combo.setCurrentIndex(-1)
        self.season_combo.setGeometry(QRect(70, 198, 150, 25))
        self.setTabOrder(self.price_lineEdit, self.season_combo)
        db = QSqlDatabase.database('prod')
        seasonModel = QSqlTableModel(self)
        seasonModel.setQuery(
            QSqlQuery('SELECT item FROM lists WHERE type = "season"', db))
        seasonModel.select()
        self.season_combo.setModel(seasonModel)

        catModel = QSqlTableModel(self)
        catModel.setQuery(
            QSqlQuery('SELECT item FROM lists WHERE type = "itemCategory"',
                      db))
        catModel.select()
        self.category_combo = QComboBox()
        self.category_combo.setModel(catModel)
        self.category_combo.setEditable(False)
        self.category_combo.setCurrentIndex(-1)
        self.category_combo.setMinimumSize(QSize(150, 25))
        self.category_combo.setMaximumSize(QSize(150, 25))
        self.gridLayout_2.addWidget(self.category_combo, 0, 1, 1, 1)
        self.setTabOrder(self.season_combo, self.category_combo)

        self.supplierModel = supplierModel
        self.sup_combo.setVisible(False)
        self.supplier_combo = modelsandviews.SupplierComboBox(
            self.supplierModel)
        self.supplier_combo.setMinimumSize(QSize(150, 25))
        self.supplier_combo.setMaximumSize(QSize(150, 25))
        self.gridLayout_2.addWidget(self.supplier_combo, 1, 1, 1, 1)
        self.setTabOrder(self.supplierno_lineEdit, self.supplier_combo)

        self.base = baseModel
        self.baseModel = BaseAssemblyModel()
        self.bsView.setVisible(False)
        self.baseAssembly_view = modelsandviews.AssemblyTableView(
            self.baseModel, self.base, self.assembly_frame)
        self.baseAssembly_view.setColumnHidden(VALUE, True)
        self.baseAssembly_view.setGeometry(QRect(10, 29, 273, 149))

        self.itemModel = itemModel
        self.bomModel = ItemAssemblyModel()
        self.bmView.setVisible(False)
        self.bom_view = modelsandviews.AssemblyTableView(
            self.bomModel, self.itemModel, self.assembly_frame)
        self.bom_view.setGeometry(QRect(289, 29, 272, 149))

        validator = QDoubleValidator()
        validator.StandardNotation
        self.price_lineEdit.setValidator(validator)
        self.pack_lineEdit.setValidator(validator)

        self.dirty = False
        self.editing = False
        self.session = Session()
        self.query = None
        self.current_record = None
        self.record_id = None
        self.mixItem = False
        self.itemType = itemType
        self.myParent = parent
        self.setupConnection()

        self.type_comboBox.currentIndexChanged.connect(self.changeLayout)
        self.baseModel.dataChanged.connect(
            lambda: self.autoAddRow(self.baseAssembly_view, self.baseModel))
        self.bomModel.dataChanged.connect(
            lambda: self.autoAddRow(self.bom_view, self.bomModel))
        self.itemno_pushButton.clicked.connect(self.itemNum)
        self.connect(self.save_pushButton, SIGNAL("clicked()"), self.save)
        self.connect(self.new_pushButton, SIGNAL("clicked()"),
                     lambda: self.clear(self.type_comboBox.currentIndex()))
        self.connect(self.delete_pushButton, SIGNAL("clicked()"), self.delete)
        self.connect(self.find_pushButton, SIGNAL("clicked()"), self.findItem)
        self.connect(self.close_pushButton, SIGNAL("clicked()"), self.accept)

        self.setWindowTitle(localTITLE)

        self.changeLayout()