Exemplo n.º 1
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def buy_finishBtn_clicked(self):
        if self.buy_model.rowCount() == 0:
            return
        for row in range(self.buy_model.rowCount()):
            role = Qt.DisplayRole
            vol = self.buy_model.data(self.buy_model.index(row, 5), role)
            vendor = self.buy_model.data(self.buy_model.index(row, 7), role)
            part = self.buy_model.data(self.buy_model.index(row, 2), role)
            vehicle = self.buy_model.data(self.buy_model.index(row, 3), role)

            # databaseOperations.update_existing_stock(vol,vendor,part,vehicle)
            # databaseOperations.update_existing_Threshold(days_passed_global,vol,part,vehicle)

        self.buy_model = CustomModel.CustomTableModelUserData([], [
            "id_", "Part Name", "Vehicle Type", "Price", "Volume", "Amount",
            "Vendor Name"
        ], [
            "part_name", "vehicle_type", "price", "volume", "amount",
            "vendor_name"
        ], "Invoice")
        self.buy_delegate = CustomModel.InLineEditDelegate()

        self.ui.buy_Table.setModel(self.buy_model)
        self.ui.buy_Table.setItemDelegate(self.buy_delegate)

        self.ui.buy_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.buy_Table.setColumnWidth(0, 30)
        self.ui.buy_Table.hideColumn(0)
        self.ui.buy_Table.hideColumn(8)
        self.ui.buy_Table.setSelectionBehavior(QTableView.SelectRows)
        self.ui.buy_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
Exemplo n.º 2
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def add_remove_choiceBox_selectionchanged(self, index):
        if (index == 0):
            self.add_remove_model = CustomModel.CustomTableModel(Vendors())
            self.add_remove_delegate = CustomModel.InLineEditDelegate()

            self.add_remove_filter_proxy_model = QtCore.QSortFilterProxyModel()
            self.add_remove_filter_proxy_model.setSourceModel(
                self.add_remove_model)
            self.add_remove_filter_proxy_model.setFilterKeyColumn(1)

            self.add_remove_filter_proxy_model.setFilterCaseSensitivity(
                Qt.CaseInsensitive)
            self.ui.add_remove_searchBar.textChanged.connect(
                self.add_remove_filter_proxy_model.setFilterRegExp)

            self.ui.add_remove_Table.setModel(
                self.add_remove_filter_proxy_model)
            self.ui.add_remove_Table.setItemDelegate(self.add_remove_delegate)

            self.ui.add_remove_Table.hideColumn(0)
        else:
            self.add_remove_model = CustomModel.CustomTableModel(Parts())
            self.add_remove_delegate = CustomModel.InLineEditDelegate()

            self.add_remove_filter_proxy_model = QtCore.QSortFilterProxyModel()
            self.add_remove_filter_proxy_model.setSourceModel(
                self.add_remove_model)
            self.add_remove_filter_proxy_model.setFilterKeyColumn(1)

            self.add_remove_filter_proxy_model.setFilterCaseSensitivity(
                Qt.CaseInsensitive)
            self.ui.add_remove_searchBar.textChanged.connect(
                self.add_remove_filter_proxy_model.setFilterRegExp)

            self.ui.add_remove_Table.setModel(
                self.add_remove_filter_proxy_model)
            self.ui.add_remove_Table.setItemDelegate(self.add_remove_delegate)

            self.ui.add_remove_Table.hideColumn(0)
            self.ui.add_remove_Table.hideColumn(4)

        self.ui.add_remove_Table.setSelectionBehavior(
            QtWidgets.QTableView.SelectRows)
        self.ui.add_remove_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.add_remove_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
Exemplo n.º 3
0
    def __init__(self,
                 features,
                 auto_struct,
                 auto_activation,
                 n_clusters,
                 alpha,
                 n_channels,
                 image_size,
                 kernel_size_and_stride,
                 cnn,
                 pretrain_weights_path,
                 dec_batch_size,
                 dectrain_epochs,
                 dec_lr,
                 pretrain_batch_size,
                 pretrain_epochs,
                 pretrain_lr,
                 gamma,
                 target_update_epochs,
                 device,
                 distrain=False):

        self.distrain = distrain
        self.device = device
        self.alpha = alpha
        self.gamma = gamma
        self.clusters = n_clusters
        self.pretrain_weights_path = pretrain_weights_path
        self.dec_batch_size = dec_batch_size
        self.dectrain_epochs = dectrain_epochs
        self.dec_lr = dec_lr
        self.n_features = features  #X.shape[1]
        self.target_update_epochs = target_update_epochs

        self.autoencoder = AE.AutoEncoder(auto_struct,
                                          auto_activation,
                                          self.n_features,
                                          n_channels,
                                          image_size,
                                          kernel_size_and_stride,
                                          pretrain_batch_size,
                                          pretrain_epochs,
                                          pretrain_lr,
                                          pretrain_weights_path,
                                          cnn,
                                          distrain=self.distrain)

        hidden_features = self.autoencoder.autonet.hidden.out_features

        self.model = CM.CustomModel(self.autoencoder, n_clusters,
                                    hidden_features, alpha).to(self.device)

        if self.distrain:
            self.dt = DT.DistributedTraining()
Exemplo n.º 4
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def buy_select_finishBtn_clicked(self):

        self.ui.stackedWidget.setCurrentWidget(self.ui.page_buy)

        self.buy_model = CustomModel.CustomTableModelNoDatabase(
            self.buy_model.user_data, [
                "id_", "Part Name", "Vehicle Type", "Price", "Volume",
                "Amount", "Vendor Name"
            ], [
                "part_name", "vehicle_type", "price", "volume", "amount",
                "vendor_name"
            ], "Invoice")
        self.buy_delegate = CustomModel.InLineEditDelegate()
        self.ui.buy_Table.setModel(self.buy_model)

        self.ui.buy_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.buy_Table.setColumnWidth(0, 30)
        self.ui.buy_Table.hideColumn(0)
        self.ui.buy_Table.hideColumn(8)
        self.ui.buy_Table.setSelectionBehavior(QTableView.SelectRows)
        self.ui.buy_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
Exemplo n.º 5
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def buy_addBtn_clicked(self):
        self.ui.stackedWidget.setCurrentWidget(self.ui.page_buy_select)
        self.ui.buy_select_finishBtn.clicked.connect(
            self.buy_select_finishBtn_clicked)
        self.ui.buy_select_addBtn.clicked.connect(
            self.buy_select_addBtn_clicked)
        self.ui.buy_select_volEdit.setText("1")

        self.buy_select_model = CustomModel.CustomTableModel(Stats())
        self.buy_select_delegate = CustomModel.InLineEditDelegate()
        self.buy_select_filter_proxy_model = QtCore.QSortFilterProxyModel()
        self.buy_select_filter_proxy_model.setSourceModel(
            self.buy_select_model)

        if self.ui.buy_select_choiceBox.currentIndex() == 0:
            self.buy_select_filter_proxy_model.setFilterKeyColumn(6)
        else:
            self.buy_select_filter_proxy_model.setFilterKeyColumn(1)

        self.ui.buy_select_choiceBox.currentIndexChanged.connect(
            self.selectionchange_buy_select)

        self.buy_select_filter_proxy_model.setFilterCaseSensitivity(
            Qt.CaseInsensitive)
        self.ui.buy_select_searchBar.textChanged.connect(
            self.buy_select_filter_proxy_model.setFilterRegExp)

        self.ui.buy_select_Table.setModel(self.buy_select_filter_proxy_model)
        self.ui.buy_select_Table.setItemDelegate(self.buy_select_delegate)
        self.ui.buy_select_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.buy_select_Table.setColumnWidth(0, 30)
        self.ui.buy_select_Table.hideColumn(0)
        self.ui.buy_Table.hideColumn(8)
        self.ui.buy_select_Table.setSelectionBehavior(QTableView.SelectRows)

        self.ui.buy_select_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
Exemplo n.º 6
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def add_remove_modifylist_clicked(self, clicked):

        if len(self.ui.add_remove_Table.selectedIndexes()) == 0:
            print("None selected")
            return

        self.ui.stackedWidget.setCurrentWidget(self.ui.page_modifylist)

        if self.ui.add_remove_choiceBox.currentIndex() == 0:
            self.ui.modifylist_title_label.setText("List of Parts Sold")

        else:
            self.ui.modifylist_title_label.setText("List of Vendors Selling")

        rowid = self.ui.add_remove_Table.selectedIndexes()[0].row()

        l = [self.add_remove_model.user_data[rowid]]
        self.ui.modifylist_Table_2.setModel(
            CustomModel.CustomTableModelNoHeaders(l,
                                                  ["id_", "Name", ".", "."]))
        self.ui.modifylist_Table_2.setItemDelegate(self.add_remove_delegate)
        self.ui.modifylist_Table_2.setSelectionBehavior(
            QtWidgets.QTableView.SelectRows)
        self.ui.modifylist_Table_2.verticalHeader().setDefaultSectionSize(50)
        self.ui.modifylist_Table_2.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
        self.ui.modifylist_Table_2.hideColumn(0)

        self.modifylist_model = CustomModel.CustomTableModel(Stats())
        self.modifylist_delegate = CustomModel.InLineEditDelegate()

        self.modifylist_filter_proxy_model = QtCore.QSortFilterProxyModel()
        self.modifylist_filter_proxy_model.setSourceModel(
            self.modifylist_model)

        if self.ui.add_remove_choiceBox.currentIndex() == 0:

            self.modifylist_filter_proxy_model.setFilterKeyColumn(1)

            # self.add_remove_filter_proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)

            #Filter Data
            self.modifylist_filter_proxy_model.setFilterRegExp(str(l[0][1]))

            self.ui.modifylist_Table.setModel(
                self.modifylist_filter_proxy_model)
            self.ui.modifylist_Table.setItemDelegate(self.modifylist_delegate)
            self.ui.modifylist_Table.setSelectionBehavior(
                QtWidgets.QTableView.SelectRows)
            self.ui.modifylist_Table.verticalHeader().setDefaultSectionSize(50)
            self.ui.modifylist_Table.horizontalHeader().setSectionResizeMode(
                QtWidgets.QHeaderView.Stretch)
            self.ui.modifylist_Table.hideColumn(0)
            self.ui.modifylist_Table.hideColumn(1)
            self.ui.modifylist_Table.showColumn(2)
            self.ui.modifylist_Table.showColumn(3)
            self.ui.modifylist_Table.hideColumn(4)

        else:

            self.modifylist_filter_proxy_model.setFilterKeyColumn(2)

            # self.add_remove_filter_proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)

            #Filter Data
            self.modifylist_filter_proxy_model.setFilterRegExp(str(l[0][1]))

            self.modifylist_filter_proxy_model_1 = QtCore.QSortFilterProxyModel(
            )
            self.modifylist_filter_proxy_model_1.setSourceModel(
                self.modifylist_filter_proxy_model)
            self.modifylist_filter_proxy_model_1.setFilterKeyColumn(3)
            self.modifylist_filter_proxy_model_1.setFilterRegExp(str(l[0][2]))

            self.ui.modifylist_Table.setModel(
                self.modifylist_filter_proxy_model_1)
            self.ui.modifylist_Table.setItemDelegate(self.modifylist_delegate)
            self.ui.modifylist_Table.setSelectionBehavior(
                QtWidgets.QTableView.SelectRows)
            self.ui.modifylist_Table.verticalHeader().setDefaultSectionSize(50)
            self.ui.modifylist_Table.horizontalHeader().setSectionResizeMode(
                QtWidgets.QHeaderView.Stretch)
            self.ui.modifylist_Table.hideColumn(0)
            if self.ui.modifylist_Table.isColumnHidden(1):
                self.ui.modifylist_Table.showColumn(1)
            self.ui.modifylist_Table.hideColumn(2)
            self.ui.modifylist_Table.hideColumn(3)
            self.ui.modifylist_Table.hideColumn(4)
Exemplo n.º 7
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def sell_select_addBtn_clicked(self):
        if self.ui.sell_select_Table.selectionModel().selectedRows() == None:
            return

        data = []
        data.append(invoice_number_global)
        # for i in range (5):
        #     print(self.ui.sell_select_Table.selectedIndexes()[i].data())

        data.append(self.ui.sell_select_Table.selectedIndexes()[1].data())
        data.append(self.ui.sell_select_Table.selectedIndexes()[2].data())
        if self.ui.sell_select_priceEdit.text() != "":
            if float(self.ui.sell_select_priceEdit.text()) >= 0:
                data.append(float(self.ui.sell_select_priceEdit.text()))
            else:
                data.append(-1 * float(self.ui.sell_select_priceEdit.text()))
                self.ui.sell_select_priceEdit.setText(
                    str(-1 * float(self.ui.sell_select_priceEdit.text())))
        else:
            self.ui.sell_select_priceEdit.setText("0")
            data.append(0)

        if int(self.ui.sell_select_volEdit.text()
               ) <= self.ui.sell_select_Table.selectedIndexes()[3].data():
            data.append(int(self.ui.sell_select_volEdit.text()))

        else:
            self.ui.sell_select_volEdit.setText(
                str(self.ui.sell_select_Table.selectedIndexes()[3].data()))
            data.append(self.ui.sell_select_Table.selectedIndexes()[3].data())

        data.append(
            float(self.ui.sell_select_priceEdit.text()) *
            int(self.ui.sell_select_volEdit.text()))
        data.append(self.ui.sell_select_Table.selectedIndexes()[0].data())
        data.append(self.ui.sell_select_Table.selectedIndexes()[4].data())

        databaseOperations.insert_data(data, [
            "invoice_number", "part_name", "vehicle_type", "price", "volume",
            "amount", "vendor_name", "cp"
        ], "Invoice")

        self.sell_model = CustomModel.CustomTableModelUserData(
            databaseOperations.get_multiple_data_invoice(
                invoice_number_global, "Invoice"), [
                    "id_", "Invoice No.", "Part Name", "Vehicle Type", "Price",
                    "Volume", "Amount", "Vendor Name", "Cost Price"
                ], [
                    "invoice_number", "part_name", "vehicle_type", "price",
                    "volume", "amount", "vendor_name", "cp"
                ], "Invoice")

        self.ui.sell_Table.setModel(self.sell_model)

        self.ui.sell_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.sell_Table.setColumnWidth(0, 30)
        self.ui.sell_Table.hideColumn(0)
        self.ui.sell_Table.hideColumn(8)
        self.ui.sell_Table.setSelectionBehavior(QTableView.SelectRows)
        self.ui.sell_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)

        databaseOperations.update_existing_stock(data[4], data[6], data[1],
                                                 data[2])

        self.sell_addBtn_clicked()
Exemplo n.º 8
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def Button(self):
        # GET BT CLICKED
        btnWidget = self.sender()

        # PAGE HOME
        if btnWidget.objectName() == "btn_home":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_home)
            UIFunctions.resetStyle(self, "btn_home")
            UIFunctions.labelPage(self, "Home")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))

        # PAGE SELL
        if btnWidget.objectName() == "btn_sell":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_sell)
            UIFunctions.resetStyle(self, "btn_sell")
            UIFunctions.labelPage(self, "Sell")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))

        # PAGE BUY
        if btnWidget.objectName() == "btn_buy":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_buy)
            UIFunctions.resetStyle(self, "btn_buy")
            UIFunctions.labelPage(self, "Buy")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))

        # PAGE ADD/REMOVE
        if btnWidget.objectName() == "btn_add_remove":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_add_remove)
            UIFunctions.resetStyle(self, "btn_add_remove")
            UIFunctions.labelPage(self, "Add/remove")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))

        # PAGE STATS
        if btnWidget.objectName() == "btn_stats":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_stats)
            UIFunctions.resetStyle(self, "btn_stats")
            UIFunctions.labelPage(self, "Statistics")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))

            self.stats_model = CustomModel.CustomTableModelThreshold(Stats())
            # self.delegate = CustomModel.InLineEditDelegate()
            self.ui.statsTable.setModel(self.stats_model)
            self.ui.statsTable.verticalHeader().setDefaultSectionSize(50)
            self.ui.statsTable.setColumnWidth(0, 30)
            self.ui.statsTable.hideColumn(0)
            self.ui.statsTable.hideColumn(5)

            self.ui.statsTable.horizontalHeader().setSectionResizeMode(
                QtWidgets.QHeaderView.Stretch)

        # PAGE STATS
        if btnWidget.objectName() == "btn_help":
            self.ui.stackedWidget.setCurrentWidget(self.ui.page_help)
            UIFunctions.resetStyle(self, "btn_help")
            UIFunctions.labelPage(self, "Help")
            btnWidget.setStyleSheet(
                UIFunctions.selectMenu(btnWidget.styleSheet()))
Exemplo n.º 9
0
Arquivo: main.py Projeto: Kargnin/MPSS
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        ## PRINT ==> SYSTEM
        print('System: ' + platform.system())
        print('Version: ' + platform.release())

        ## REMOVE ==> STANDARD TITLE BAR
        UIFunctions.removeTitleBar(True)
        ## ==> END ##

        ## SET ==> WINDOW TITLE
        self.setWindowTitle('MPSS')
        UIFunctions.labelTitle(self, 'MPSS')
        UIFunctions.labelDescription(self, "Day " + str(days_passed_global))
        ## ==> END ##

        startSize = QSize(1000, 720)
        self.resize(startSize)
        self.setMinimumSize(startSize)

        ## ==> CREATE MENUS
        ########################################################################

        ## ==> TOGGLE MENU SIZE
        self.ui.btn_toggle_menu.clicked.connect(
            lambda: UIFunctions.toggleMenu(self, 220, True))
        ## ==> END ##

        ## ==> ADD CUSTOM MENUS
        self.ui.stackedWidget.setMinimumWidth(20)
        UIFunctions.addNewMenu(self, "Home", "btn_home",
                               "url(:/icons/icons/home.png)", True)
        UIFunctions.addNewMenu(self, "Sell", "btn_sell",
                               "url(:/icons/icons/sell.png)", True)
        UIFunctions.addNewMenu(self, "Buy", "btn_buy",
                               "url(:/icons/icons/buy.png)", True)
        UIFunctions.addNewMenu(self, "Add/Remove", "btn_add_remove",
                               "url(:/icons/icons/add_remove.png)", True)
        UIFunctions.addNewMenu(self, "Statistics", "btn_stats",
                               "url(:/icons/icons/stats.png)", True)
        UIFunctions.addNewMenu(self, "Help", "btn_help",
                               "url(:/icons/icons/help.png)", False)
        ## ==> END ##

        # START MENU => SELECTION
        UIFunctions.selectStandardMenu(self, "btn_home")
        ## ==> END ##

        ## ==> START PAGE
        self.ui.stackedWidget.setCurrentWidget(self.ui.page_home)
        ## ==> END ##

        ## USER ICON ==> SHOW HIDE
        UIFunctions.userIcon(self, "G8", "", True)

        ## ==> END ##

        ## ==> MOVE WINDOW / MAXIMIZE / RESTORE
        ########################################################################
        def moveWindow(event):
            # IF MAXIMIZED CHANGE TO NORMAL
            if UIFunctions.returStatus() == 1:
                UIFunctions.maximize_restore(self)

            # MOVE WINDOW
            if event.buttons() == Qt.LeftButton:
                self.move(self.pos() + event.globalPos() - self.dragPos)
                self.dragPos = event.globalPos()
                event.accept()

        # WIDGET TO MOVE
        self.ui.frame_label_top_btns.mouseMoveEvent = moveWindow
        ## ==> END ##

        ## ==> LOAD DEFINITIONS
        ########################################################################
        UIFunctions.uiDefinitions(self)
        ## ==> END ##

        ########################################################################
        ## END - WINDOW ATTRIBUTES
        ############################## ---/--/--- ##############################

        ########################################################################
        #                                                                      #
        ## START -------------- WIDGETS FUNCTIONS/PARAMETERS ---------------- ##
        #                                                                      #
        ## ==> USER CODES BELLOW                                              ##
        ########################################################################

        ########################################################################
        #                                                                      #
        ## END --------------- WIDGETS FUNCTIONS/PARAMETERS ----------------- ##
        #                                                                      #
        ############################## ---/--/--- ##############################

        #sell

        self.ui.sell_addBtn.clicked.connect(self.sell_addBtn_clicked)
        self.ui.sell_removeBtn.clicked.connect(self.sell_removeBtn_clicked)
        self.ui.sell_finishBtn.clicked.connect(self.sell_finishBtn_clicked)

        self.ui.sell_select_choiceBox.addItems(
            ["Vendor Name", "Part Name", "Vehicle Type"])

        self.sell_model = CustomModel.CustomTableModelUserData([], [
            "id_", "Invoice No.", "Part Name", "Vehicle Type", "Price",
            "Volume", "Amount", "Vendor Name", "Cost Price"
        ], [
            "invoice_number", "part_name", "vehicle_type", "price", "volume",
            "amount", "vendor_name", "cp"
        ], "Invoice")
        self.sell_delegate = CustomModel.InLineEditDelegate()

        self.ui.sell_Table.setModel(self.sell_model)
        self.ui.sell_Table.setItemDelegate(self.sell_delegate)

        self.ui.sell_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.sell_Table.setColumnWidth(0, 30)
        self.ui.sell_Table.hideColumn(0)
        self.ui.sell_Table.hideColumn(8)
        self.ui.sell_Table.setSelectionBehavior(QTableView.SelectRows)
        self.ui.sell_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)

        #buy

        self.ui.buy_addBtn.clicked.connect(self.buy_addBtn_clicked)
        self.ui.buy_removeBtn.clicked.connect(self.buy_removeBtn_clicked)
        self.ui.buy_orderBtn.clicked.connect(self.buy_finishBtn_clicked)

        self.ui.buy_select_choiceBox.addItems(["Vendor", "Part"])

        self.buy_model = CustomModel.CustomTableModelNoDatabase([], [
            "id_", "Part Name", "Vehicle Type", "Price", "Volume", "Amount",
            "Vendor Name"
        ], [
            "part_name", "vehicle_type", "price", "volume", "amount",
            "vendor_name"
        ], "Invoice")
        self.buy_delegate = CustomModel.InLineEditDelegate()

        self.ui.buy_Table.setModel(self.buy_model)
        self.ui.buy_Table.setItemDelegate(self.buy_delegate)

        self.ui.buy_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.buy_Table.setColumnWidth(0, 30)
        self.ui.buy_Table.hideColumn(0)
        self.ui.buy_Table.hideColumn(8)
        self.ui.buy_Table.setSelectionBehavior(QTableView.SelectRows)
        self.ui.buy_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)

        # #Buy
        # self.ui.buy_addBtn.clicked.connect(self.buy_addBtn_clicked)
        # self.ui.buy_removeBtn.clicked.connect(self.buy_removeBtn_clicked)
        # self.ui.buy_finishBtn.clicked.connect(self.buy_finishBtn_clicked)
        # self.buy_user_data = []
        # self.buy_model = CustomModel.CustomTableModel(self.buy_user_data, ["id_","Invoice No.","Part Name","Vehicle Type","Price","Volume","Amount","Vendor Name","Cost Price"],["invoice_number","part_name","vehicle_type","price","volume","amount","vendor_name","cp"],"Invoice")
        # self.buy_delegate = CustomModel.InLineEditDelegate()

        # self.ui.buy_Table.setModel(self.buy_model)
        # self.ui.buy_Table.setItemDelegate(self.buy_delegate)

        # self.ui.buy_Table.verticalHeader().setDefaultSectionSize(50)
        # self.ui.buy_Table.setColumnWidth(0, 30)
        # self.ui.buy_Table.hideColumn(0)
        # self.ui.buy_Table.hideColumn(1)
        # self.ui.buy_Table.setSelectionBehavior(QTableView.SelectRows)
        # self.ui.buy_Table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)

        ## ==> PAGE ADD/REMOVE
        ########################################################################

        ## ==> ADD_REMOVE_TABLE PARAMETERS
        ########################################################################
        #Set ComboBox
        self.ui.add_remove_choiceBox.addItems(["Vendors", "Parts"])
        self.ui.add_remove_choiceBox.currentIndexChanged.connect(
            self.add_remove_choiceBox_selectionchanged)

        #Show Vendors Data Initially
        self.add_remove_model = CustomModel.CustomTableModel(Vendors())
        self.add_remove_delegate = CustomModel.InLineEditDelegate()

        #Filter model
        self.add_remove_filter_proxy_model = QtCore.QSortFilterProxyModel()
        self.add_remove_filter_proxy_model.setSourceModel(
            self.add_remove_model)
        self.add_remove_filter_proxy_model.setFilterKeyColumn(1)

        #SearchBar
        self.add_remove_filter_proxy_model.setFilterCaseSensitivity(
            Qt.CaseInsensitive)
        self.ui.add_remove_searchBar.textChanged.connect(
            self.add_remove_filter_proxy_model.setFilterRegExp)

        #Initial Table
        self.ui.add_remove_Table.setModel(self.add_remove_filter_proxy_model)
        self.ui.add_remove_Table.setItemDelegate(self.add_remove_delegate)
        self.ui.add_remove_Table.verticalHeader().setDefaultSectionSize(50)
        self.ui.add_remove_Table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)
        self.ui.add_remove_Table.setSelectionBehavior(
            QtWidgets.QTableView.SelectRows)

        self.ui.add_remove_Table.hideColumn(0)

        self.ui.add_remove_addBtn.clicked.connect(
            self.add_remove_addBtn_clicked)
        self.ui.add_remove_removeBtn.clicked.connect(
            self.add_remove_removeBtn_clicked)
        self.ui.add_remove_modifylistBtn.clicked.connect(
            self.add_remove_modifylist_clicked)

        self.ui.modifylist_addBtn.clicked.connect(
            self.modifylist_addBtn_clicked)
        self.ui.modifylist_removeBtn.clicked.connect(
            self.modifylist_removeBtn_clicked)
        self.ui.modifylist_finishBtn.clicked.connect(
            self.modifylist_finishBtn_clicked)

        ## ==> END ##

        ## ==> END ##

        ## ==> PAGE STATS
        ########################################################################

        ## ==> STATSTABLE PARAMETERS
        ########################################################################

        self.stats_model = CustomModel.CustomTableModelThreshold(Stats())
        # self.delegate = CustomModel.InLineEditDelegate()
        self.ui.statsTable.setModel(self.stats_model)
        self.ui.statsTable.verticalHeader().setDefaultSectionSize(50)
        self.ui.statsTable.setColumnWidth(0, 30)
        self.ui.statsTable.hideColumn(0)
        self.ui.statsTable.hideColumn(5)

        self.ui.statsTable.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Stretch)

        self.ui.eodBtn.clicked.connect(self.eodBtn_clicked)
        self.ui.revenueBtn.clicked.connect(self.generate_revenue)
        self.ui.graphBtn.clicked.connect(self.show_plot)

        ## ==> END ##

        ## ==> END ##

        ## SHOW ==> MAIN WINDOW
        ########################################################################
        self.show()