Esempio n. 1
0
 def set_data_for(self):
     reports = lastes_upper_of(10)
     if multi_store:
         self.data = [(rep.store.name, rep.product.name, rep.remaining, show_date(rep.date))
                      for rep in reports]
     else:
         self.data = [(rep.product.name, rep.remaining, show_date(rep.date))
                      for rep in reports]
Esempio n. 2
0
 def export_xls(self):
     # TODO A
     from Common.exports_xlsx import export_dynamic_data
     from num2words import num2words
     table = self.table_show
     hheaders = table.hheaders[:-1]
     data = table.data
     endrowx = len(hheaders) - 1
     dict_data = {
         'file_name': "facture n {}".format(self.invoice.number),
         'headers': hheaders,
         'data': data,
         "extend_rows": [(3, table.montant_ht), ],
         'sheet': self.title,
         # 'title': self.title,
         'widths': table.stretch_columns,
         "date": show_date(self.invoice.date),
         "others": [
             ("A7", "B7", "FACTURE N° : {}".format(self.invoice.number)),
             ("A8", "B8", "Doit: {}".format(self.invoice.client.name)),
             ("A35", "D35", "Arrêté la présente facture à la somme de : {} FCFA".format(
                 num2words(table.montant_ht, lang="fr"))),
             ("A38", "B38", "Pour acquit"),
             ("C38", "D38", "Le fournisseur"),
         ],
         # 'exclude_row': len(data) - 2,
     }
     export_dynamic_data(dict_data)
Esempio n. 3
0
 def set_data_for(self, on, end):
     self.data = [(rap.type_, rap.store.name, rap.product,
                   formatted_number(rap.qty_use),
                   formatted_number(rap.remaining),
                   show_date(rap.date), rap.id)
                  for rap in Reports.filter(deleted=False, date__gte=on, date__lte=end)
                  .order_by(Reports.date.desc())]
Esempio n. 4
0
    def __init__(self, buy="", parent=0, *args, **kwargs):
        super(BuyShowViewWidget, self).__init__(parent=parent, *args, **kwargs)
        self.buy = buy

        self.parentWidget().setWindowTitle(Config.APP_NAME + "  CONSULTATION DES ACHAT")

        self.parent = parent
        self.title = "Arivage"
        vbox = QVBoxLayout()
        vbox.addWidget(FPageTitle(self.title))

        self.table_show = ShowBuyTableWidget(parent=self)

        editbox = QGridLayout()
        self.btt_export = BttExportXLS("Exporter")
        self.btt_export.clicked.connect(self.export_xls)
        self.button_dl = Deleted_btt("Annuler la facture")
        self.button_dl.released.connect(self.cancellation)

        editbox.addWidget(FLabel("<b>Achat N°: </b>%s" % self.buy.id), 0, 0)
        editbox.addWidget(FLabel("<b>Par : </b> %s " % self.buy.owner), 1, 0)
        editbox.addWidget(FLabel("<b>Date : </b>%s" % (show_date(self.buy.date))), 1, 3)
        editbox.addWidget(self.button_dl, 0, 4)
        editbox.addWidget(self.btt_export, 1, 4)

        vbox.addLayout(editbox)
        vbox.addWidget(self.table_show)
        self.setLayout(vbox)
Esempio n. 5
0
    def __init__(self, table_p, buy="", parent=0, *args, **kwargs):
        # super(BuyShowViewWidget, self).__init__(parent=parent,
        #                                         *args, **kwargs)
        QDialog.__init__(self, parent, *args, **kwargs)
        self.parentWidget().setWindowTitle(Config.APP_NAME +
                                           u"  CONSULTATION DES ACHAT")

        self.parent = parent
        self.buy = buy
        self.table_p = table_p
        self.title = "Arivage"

        vbox = QVBoxLayout()
        vbox.addWidget(FPageTitle(self.title))

        self.table_show = ShowBuyTableWidget(parent=self)

        editbox = QGridLayout()
        self.btt_export = BttExportXLSX("")
        self.btt_export.clicked.connect(self.export_xls)
        self.button_dl = DeletedBtt(u"Annuler la facture")
        self.button_dl.released.connect(self.cancellation)

        editbox.addWidget(FLabel(u"<b>Achat N°: </b>%s" % self.buy.id), 0, 0)
        editbox.addWidget(FLabel(u"<b>Par : </b> %s " % self.buy.owner), 1, 0)
        editbox.addWidget(
            FLabel(u"<b>Date : </b>%s" % (show_date(self.buy.date))), 1, 3)
        editbox.addWidget(self.button_dl, 0, 4)
        editbox.addWidget(self.btt_export, 1, 4)

        vbox.addLayout(editbox)
        vbox.addWidget(self.table_show)
        self.setLayout(vbox)
Esempio n. 6
0
 def set_data_for(self):
     self.data = [(rap.type_, rap.store.name, rap.product,
                   formatted_number(rap.qty_use),
                   formatted_number(rap.remaining),
                   show_date(rap.date))
                  for rap in Reports.select().where(
         Reports.date < date_on_or_end(self.today, on=False),
         Reports.date > date_on_or_end(self.today)
     ).order_by(Reports.id.desc())]
Esempio n. 7
0
    def set_data_for(self, provid_clt_id=None, search=None):
        self.provid_clt_id = provid_clt_id
        qs = Refund.select().where(
            Refund.status == False).order_by(Refund.date.desc())

        if isinstance(provid_clt_id, int):
            qs = qs.select().where(
                Refund.provider_client == ProviderOrClient.get(id=provid_clt_id))
        self.data = [(ref.id, ref.type_, show_date(ref.date), ref.invoice.number,
                      ref.amount, ref.remaining) for ref in qs]
Esempio n. 8
0
    def set_data_for(self, value):

        if value:
            try:
                invoices = Invoice.select().where(Invoice.number == int(value))
            except Exception as e:
                Config.logging.error(e)
                invoices = Invoice.select().where(Invoice.location.contains(value) |
                                                  Invoice.client.contains(value))
        else:
            invoices = Invoice.select().order_by(Invoice.number.asc())

        self.data = [(invoice.owner, invoice.number, show_date(invoice.date),
                      invoice.client, "") for invoice in invoices]
Esempio n. 9
0
    def __init__(self, parent=0, *args, **kwargs):
        super(GReportViewWidget, self).__init__(parent=parent,
                                                *args, **kwargs)
        self.parentWidget().setWindowTitle(Config.NAME_ORGA +
                                           u"    GESTION DES RAPPORTS")
        self.parent = parent
        self.title = u"Tous les mouvements"
        tablebox = QVBoxLayout()
        self.table_op = GReportTableWidget(parent=self)
        tablebox.addWidget(self.table_op)

        self.on_date = FormatDate(QDate(date.today().year, 1, 1))
        self.end_date = FormatDate(QDate.currentDate())
        self.Button = Button(_(u"OK"))
        self.Button.clicked.connect(self.report_filter)
        vbox = QVBoxLayout()
        # Grid
        gridbox = QGridLayout()
        gridbox.addWidget(FormLabel(_(u"Debut")), 0, 2)
        gridbox.addWidget(self.on_date, 0, 3)
        gridbox.addWidget(FormLabel(_(u"Fin")), 0, 4)
        gridbox.addWidget(self.end_date, 0, 5)
        gridbox.addWidget(self.Button, 0, 6)
        gridbox.setColumnStretch(7, 5)

        period = " Du {} au {}".format(
            show_date(self.on_date.text(), time=False),
            show_date(self.end_date.text(), time=False))
        self.report_filter()

        vbox = QVBoxLayout()
        vbox.addWidget(FPageTitle(self.title))
        vbox.addWidget(FormLabel(period))
        vbox.addLayout(gridbox)
        vbox.addLayout(tablebox)
        self.setLayout(vbox)
Esempio n. 10
0
    def __init__(self, table_p, invoice_num, parent=0, *args, **kwargs):
        # super(ShowInvoiceViewWidget, self).__init__(
        #     parent=parent, *args, **kwargs)
        QDialog.__init__(self, parent, *args, **kwargs)

        self.invoice = Invoice.get(number=invoice_num)
        self.parentWidget().setWindowTitle(
            "{} {}".format(Config.APP_NAME, "CONSULTATION DE FACTURE"))

        self.parent = parent
        self.table_p = table_p

        vbox = QVBoxLayout()
        self.title = self.invoice.type_

        self.table_show = ShowOrderTableWidget(parent=self)

        editbox = QGridLayout()
        xls_bicon = QIcon.fromTheme(
            'document-del', QIcon(u"{}xls.png".format(Config.img_cmedia)))
        pdf_icon = QIcon.fromTheme(
            'document-del', QIcon(u"{}pdf.png".format(Config.img_cmedia)))
        self.button_pdf = QPushButton(pdf_icon, u"")
        self.button_pdf.setFixedWidth(30)
        self.button_pdf.setFixedHeight(30)
        self.button_xls = QPushButton(xls_bicon, u"")
        self.button_xls.setFixedWidth(30)
        self.button_xls.setFixedHeight(30)
        self.button_pdf.released.connect(self.printer_pdf)
        self.button_xls.released.connect(self.export_xls)
        self.button_dl = DeletedBtt(u"Annuler la facture")
        self.button_dl.released.connect(self.cancellation)

        editbox.addWidget(FLabel(u"{typ} N°: {num}".format(
            num=self.invoice.number, typ=self.invoice.type_)), 0, 0)
        editbox.addWidget(FLabel(u"%s le %s" % (
            self.invoice.location, show_date(self.invoice.date))), 1, 4)
        editbox.addWidget(FLabel(u"Doit: %s " % self.invoice.client), 1, 0)
        editbox.addWidget(self.button_pdf, 1, 5)
        editbox.addWidget(self.button_dl, 0, 4)
        editbox.addWidget(self.button_xls, 1, 6)

        vbox.addLayout(editbox)
        vbox.addWidget(self.table_show)
        self.setLayout(vbox)
Esempio n. 11
0
    def __init__(self, parent=0, *args, **kwargs):
        super(DashbordViewWidget, self).__init__(
            parent=parent, *args, **kwargs)

        self.parentWidget().setWindowTitle(
            Config.APP_NAME + u"    TABLEAU DE BORD")

        self.parent = parent
        vbox = QVBoxLayout()
        table_invoice = QVBoxLayout()
        table_alert = QVBoxLayout()
        table_mouvement = QVBoxLayout()

        self.search_field = LineEdit()
        self.search_field.setToolTip("Rechercher un produit")
        self.search_field.setMaximumSize(
            500, self.search_field.maximumSize().height())
        self.search_field.textChanged.connect(self.finder)

        self.title = FPageTitle("TABLEAU DE BORD")

        self.title_alert = FBoxTitle(u"Les alertes ")
        self.table_alert = AlertTableWidget(parent=self)
        # table_alert.addWidget(self.title_alert)
        table_alert.addWidget(self.table_alert)

        self.title_invoice = FBoxTitle(u"Les stocks actual")
        self.table_invoice = InvoiceTableWidget(parent=self)
        table_invoice.addWidget(self.search_field)
        table_invoice.addWidget(self.table_invoice)

        self.table_mouvement = GReportTableWidget(parent=self)
        self.title_mouvement = FBoxTitle(
            show_date(self.table_mouvement.today, time=False))
        # table_invoice.addWidget(self.title_invoice)
        # table_mouvement.addWidget(self.title_mouvement)
        table_mouvement.addWidget(self.table_mouvement)
        tab_widget = tabbox((table_mouvement, u"Les Mouvements"),
                            (table_invoice, u"Les Factures"),
                            (table_alert, u"Alertes sur les produits "))

        vbox.addWidget(self.title)
        vbox.addWidget(tab_widget)
        self.setLayout(vbox)
Esempio n. 12
0
    def __init__(self, invoice_num, parent=0, *args, **kwargs):
        super(ShowInvoiceViewWidget, self).__init__(
            parent=parent, *args, **kwargs)
        self.invoice = Invoice.get(number=invoice_num)
        self.parentWidget().setWindowTitle(Config.NAME_ORGA +
                                           u"  CONSULTATION DE FACTURE")

        self.parent = parent

        vbox = QVBoxLayout()
        self.title = self.invoice.type_

        self.table_show = ShowOrderTableWidget(parent=self)

        editbox = QGridLayout()
        xls_bicon = QIcon.fromTheme(
            'document-del', QIcon(u"{}xls.png".format(Config.img_cmedia)))
        pdf_icon = QIcon.fromTheme(
            'document-del', QIcon(u"{}pdf.png".format(Config.img_cmedia)))
        self.button_pdf = QPushButton(pdf_icon, u"")
        self.button_pdf.setFixedWidth(30)
        self.button_pdf.setFixedHeight(30)
        self.button_xls = QPushButton(xls_bicon, u"")
        self.button_xls.setFixedWidth(30)
        self.button_xls.setFixedHeight(30)
        self.button_pdf.released.connect(self.printer_pdf)
        self.button_xls.released.connect(self.export_xls)
        self.button_dl = Deleted_btt(u"Annuler la facture")
        self.button_dl.released.connect(self.cancellation)

        editbox.addWidget(FLabel(u"{typ} N°: {num}".format(
            num=self.invoice.number, typ=self.invoice.type_)), 0, 0)
        editbox.addWidget(FLabel(u"%s le %s" % (self.invoice.location,
                                                show_date(self.invoice.date))), 1, 4)
        editbox.addWidget(FLabel(u"Doit: %s " % self.invoice.client), 1, 0)
        # editbox.addWidget(self.button_pdf, 1, 5)
        editbox.addWidget(self.button_dl, 0, 4)
        editbox.addWidget(self.button_xls, 1, 6)

        vbox.addLayout(editbox)
        vbox.addWidget(self.table_show)
        self.setLayout(vbox)
Esempio n. 13
0
 def set_data_for(self, value):
     # if not value:
     #     print("is value")
     invoices = Invoice.select().order_by(Invoice.number.desc())
     if value:
         # return
         qs = (
             Invoice.location.contains(value)
             |
             # Invoice.date.contains(value) |
             Invoice.client.contains(value)
         )
         try:
             qs = qs | (Invoice.number.contains(int(value)))
         except Exception as e:
             print(e)
         # invoices = invoices.where(qs).execute()
         invoices = qs
     try:
         self.data = [(invoice.number, show_date(invoice.date), invoice.client, "") for invoice in invoices]
     except Exception as e:
         print(e)
Esempio n. 14
0
 def set_data_for(self):
     self.data = [(buy.id, show_date(buy.date), "") for buy in Buy.select()]