コード例 #1
0
    def __init__(self, parent=0, *args, **kwargs):
        super(BuyViewWidget, self).__init__(parent=parent, *args, **kwargs)
        self.parentWidget().setWindowTitle(Config.APP_NAME +
                                           u"    Arrivage d'article")
        self.parent = parent

        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        editbox = QGridLayout()

        self.date = FormatDate(QDate.currentDate())
        self.name_client = LineEdit()
        self.search_field = LineEdit()
        self.search_field.setPlaceholderText("Rechercher un article")
        self.search_field.setMaximumHeight(40)
        self.search_field.textChanged.connect(self.finder)
        # self.search_field.setFixedWidth(200)

        self.add_prod = Button(u"+ &Article")
        self.add_prod.clicked.connect(self.add_product)
        self.add_prod.setFixedWidth(80)
        # self.add_prod.setFixedHeight(20)
        self.add_prod.setStyleSheet("Text-align:botton")
        self.add_prod.setToolTip("Ajouter un nouvel article")

        self.table_buy = BuyTableWidget(parent=self)
        self.table_resultat = ResultatTableWidget(parent=self)
        self.table_info = InfoTableWidget(parent=self)

        editbox.addWidget(self.add_prod, 0, 1)
        editbox.addWidget(FormLabel(u"Date d'achat:"), 0, 4)
        editbox.addWidget(self.date, 0, 5)

        editbox.setColumnStretch(3, 3)
        splitter = QSplitter(Qt.Horizontal)

        splitter_left = QSplitter(Qt.Vertical)
        splitter_down = QSplitter(Qt.Vertical)
        splitter_left.addWidget(self.search_field)
        splitter_left.addWidget(self.table_resultat)
        splitter_down.resize(35, 20)
        splitter_down.addWidget(self.table_info)

        splitter_rigth = QSplitter(Qt.Vertical)
        splitter_rigth.addWidget(self.table_buy)
        splitter_rigth.resize(800, 900)

        splitter_left.addWidget(splitter_down)
        splitter.addWidget(splitter_left)
        splitter.addWidget(splitter_rigth)

        hbox.addWidget(splitter)
        vbox.addLayout(editbox)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
コード例 #2
0
ファイル: buy.py プロジェクト: Ciwara/GCiss
    def __init__(self, parent=0, *args, **kwargs):
        super(BuyViewWidget, self).__init__(parent=parent, *args, **kwargs)
        self.parentWidget().setWindowTitle(
            Config.APP_NAME + u"    Arrivage d'article")
        self.parent = parent

        vbox = QVBoxLayout(self)
        hbox = QHBoxLayout(self)
        editbox = QGridLayout()

        self.date = FormatDate(QDate.currentDate())
        self.name_client = LineEdit()
        self.search_field = LineEdit()
        self.search_field.setPlaceholderText("Rechercher un article")
        self.search_field.textChanged.connect(self.finder)
        # self.search_field.setFixedWidth(200)

        self.add_prod = Button(u"+ &Article")
        self.add_prod.clicked.connect(self.add_product)
        self.add_prod.setFixedWidth(80)
        # self.add_prod.setFixedHeight(20)
        self.add_prod.setStyleSheet("Text-align:botton")
        self.add_prod.setToolTip("Ajouter un nouvel article")

        self.table_buy = BuyTableWidget(parent=self)
        self.table_resultat = ResultatTableWidget(parent=self)
        self.table_info = InfoTableWidget(parent=self)

        editbox.addWidget(self.add_prod, 0, 1)
        editbox.addWidget(FormLabel(u"Date d'achat:"), 0, 4)
        editbox.addWidget(self.date, 0, 5)

        editbox.setColumnStretch(3, 3)
        splitter = QSplitter(Qt.Horizontal)

        splitter_left = QSplitter(Qt.Vertical)
        splitter_down = QSplitter(Qt.Vertical)
        splitter_left.addWidget(self.search_field)
        splitter_left.addWidget(self.table_resultat)
        splitter_down.resize(35, 20)
        splitter_down.addWidget(self.table_info)

        splitter_rigth = QSplitter(Qt.Vertical)
        splitter_rigth.addWidget(self.table_buy)
        splitter_rigth.resize(800, 900)

        splitter_left.addWidget(splitter_down)
        splitter.addWidget(splitter_left)
        splitter.addWidget(splitter_rigth)

        hbox.addWidget(splitter)
        vbox.addLayout(editbox)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
コード例 #3
0
ファイル: buy.py プロジェクト: Ciwara/GCiss
class BuyViewWidget(FWidget):

    def __init__(self, parent=0, *args, **kwargs):
        super(BuyViewWidget, self).__init__(parent=parent, *args, **kwargs)
        self.parentWidget().setWindowTitle(
            Config.APP_NAME + u"    Arrivage d'article")
        self.parent = parent

        vbox = QVBoxLayout(self)
        hbox = QHBoxLayout(self)
        editbox = QGridLayout()

        self.date = FormatDate(QDate.currentDate())
        self.name_client = LineEdit()
        self.search_field = LineEdit()
        self.search_field.setPlaceholderText("Rechercher un article")
        self.search_field.textChanged.connect(self.finder)
        # self.search_field.setFixedWidth(200)

        self.add_prod = Button(u"+ &Article")
        self.add_prod.clicked.connect(self.add_product)
        self.add_prod.setFixedWidth(80)
        # self.add_prod.setFixedHeight(20)
        self.add_prod.setStyleSheet("Text-align:botton")
        self.add_prod.setToolTip("Ajouter un nouvel article")

        self.table_buy = BuyTableWidget(parent=self)
        self.table_resultat = ResultatTableWidget(parent=self)
        self.table_info = InfoTableWidget(parent=self)

        editbox.addWidget(self.add_prod, 0, 1)
        editbox.addWidget(FormLabel(u"Date d'achat:"), 0, 4)
        editbox.addWidget(self.date, 0, 5)

        editbox.setColumnStretch(3, 3)
        splitter = QSplitter(Qt.Horizontal)

        splitter_left = QSplitter(Qt.Vertical)
        splitter_down = QSplitter(Qt.Vertical)
        splitter_left.addWidget(self.search_field)
        splitter_left.addWidget(self.table_resultat)
        splitter_down.resize(35, 20)
        splitter_down.addWidget(self.table_info)

        splitter_rigth = QSplitter(Qt.Vertical)
        splitter_rigth.addWidget(self.table_buy)
        splitter_rigth.resize(800, 900)

        splitter_left.addWidget(splitter_down)
        splitter.addWidget(splitter_left)
        splitter.addWidget(splitter_rigth)

        hbox.addWidget(splitter)
        vbox.addLayout(editbox)
        vbox.addLayout(hbox)
        self.setLayout(vbox)

    def add_product(self):
        """ """
        self.open_dialog(EditOrAddProductsDialog, modal=True,
                         product=None, table_p=self.table_resultat)

    def finder(self):
        search_term = str(self.search_field.text())
        self.table_resultat.refresh_(search_term)

    def save_b(self):
        ''' add operation '''
        # entete de la facture
        if not self.table_buy.isvalid:
            return False
        owner = Owner.get(Owner.islog == True)
        date = str(self.date.text())
        values_t = self.table_buy.get_table_items()
        buy = Buy()
        # buy.date = datetime_
        buy.provd_or_clt = \
            ProviderOrClient.get_or_create(
                "Fournisseur", 000000, ProviderOrClient.FSEUR)
        buy.owner = owner
        try:
            buy.save()
            err = False
        except:
            raise
            raise_error(
                "Erreur", u"Impossible d'enregistrer l'entête de la facture")
            return False
        for name, qty, cost_buying, selling_price in values_t:
            rep = Report()
            rep.buy = buy
            rep.type_ = Report.E
            rep.store = 1
            rep.date = date_to_datetime(date)
            rep.product = Product.get(name=name)
            rep.qty = int(qty)
            rep.cost_buying = int(cost_buying)
            rep.selling_price = int(selling_price)
            try:
                rep.save()
            except Exception as e:
                print(e)
                err = True
        if err:
            buy.delete_instance()
            raise_error("Erreur", u"Ce mouvement n'a pas pu etre "
                        u"enregistré dans les rapports")
            return False
        else:
            self.parent.Notify(u"L'entrée des articles avec succès", "success")
        self.change_main_context(BuyShowViewWidget, buy=buy)
コード例 #4
0
class BuyViewWidget(FWidget):
    def __init__(self, parent=0, *args, **kwargs):
        super(BuyViewWidget, self).__init__(parent=parent, *args, **kwargs)
        self.parentWidget().setWindowTitle(Config.APP_NAME +
                                           u"    Arrivage d'article")
        self.parent = parent

        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        editbox = QGridLayout()

        self.date = FormatDate(QDate.currentDate())
        self.name_client = LineEdit()
        self.search_field = LineEdit()
        self.search_field.setPlaceholderText("Rechercher un article")
        self.search_field.setMaximumHeight(40)
        self.search_field.textChanged.connect(self.finder)
        # self.search_field.setFixedWidth(200)

        self.add_prod = Button(u"+ &Article")
        self.add_prod.clicked.connect(self.add_product)
        self.add_prod.setFixedWidth(80)
        # self.add_prod.setFixedHeight(20)
        self.add_prod.setStyleSheet("Text-align:botton")
        self.add_prod.setToolTip("Ajouter un nouvel article")

        self.table_buy = BuyTableWidget(parent=self)
        self.table_resultat = ResultatTableWidget(parent=self)
        self.table_info = InfoTableWidget(parent=self)

        editbox.addWidget(self.add_prod, 0, 1)
        editbox.addWidget(FormLabel(u"Date d'achat:"), 0, 4)
        editbox.addWidget(self.date, 0, 5)

        editbox.setColumnStretch(3, 3)
        splitter = QSplitter(Qt.Horizontal)

        splitter_left = QSplitter(Qt.Vertical)
        splitter_down = QSplitter(Qt.Vertical)
        splitter_left.addWidget(self.search_field)
        splitter_left.addWidget(self.table_resultat)
        splitter_down.resize(35, 20)
        splitter_down.addWidget(self.table_info)

        splitter_rigth = QSplitter(Qt.Vertical)
        splitter_rigth.addWidget(self.table_buy)
        splitter_rigth.resize(800, 900)

        splitter_left.addWidget(splitter_down)
        splitter.addWidget(splitter_left)
        splitter.addWidget(splitter_rigth)

        hbox.addWidget(splitter)
        vbox.addLayout(editbox)
        vbox.addLayout(hbox)
        self.setLayout(vbox)

    def add_product(self):
        """ """
        self.open_dialog(EditOrAddProductsDialog,
                         modal=True,
                         product=None,
                         table_p=self.table_resultat)

    def finder(self):
        search_term = str(self.search_field.text())
        self.table_resultat.refresh_(search_term)

    def save_b(self):
        ''' add operation '''
        # entete de la facture
        if not self.table_buy.isvalid:
            return False
        owner = Owner.get(Owner.islog == True)
        date = str(self.date.text())
        values_t = self.table_buy.get_table_items()
        buy = Buy()
        # buy.date = datetime_
        buy.provd_or_clt = \
            ProviderOrClient.get_or_create(
                "Fournisseur", 000000, ProviderOrClient.FSEUR)
        buy.owner = owner
        try:
            buy.save()
            err = False
        except:
            raise
            raise_error("Erreur",
                        u"Impossible d'enregistrer l'entête de la facture")
            return False
        for name, qty, cost_buying, selling_price in values_t:
            rep = Report()
            rep.buy = buy
            rep.type_ = Report.E
            rep.store = 1
            rep.date = date_to_datetime(date)
            rep.product = Product.get(name=name)
            rep.qty = int(qty)
            rep.cost_buying = int(cost_buying)
            rep.selling_price = int(selling_price)
            try:
                rep.save()
            except Exception as e:
                print(e)
                err = True
        if err:
            buy.delete_instance()
            raise_error(
                "Erreur", u"Ce mouvement n'a pas pu etre "
                u"enregistré dans les rapports")
            return False
        else:
            self.parent.Notify(u"L'entrée des articles avec succès", "success")
        self.change_main_context(BuyShowViewWidget, buy=buy)