コード例 #1
0
ファイル: providers.py プロジェクト: Ciwara/GCiss
    def refresh_prov_clt(self):

        try:
            self.name_client, self.phone = self.name_client_field.lineEdit(
            ).text().split(",")
            clt = ProviderOrClient.get(phone=int(self.phone.replace(" ", "")))
            self.table.refresh_(provid_clt_id=clt.id)
        except Exception as e:
            self.table.refresh_()
            print(" ", e)
コード例 #2
0
ファイル: debt_manager.py プロジェクト: Ciwara/GCiss
    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]
コード例 #3
0
ファイル: providers.py プロジェクト: Ciwara/GCiss
    def set_data_for(self, date_, provid_clt_id=None, search=None):
        self.provid_clt_id = provid_clt_id
        qs = Invoice.select().order_by(Invoice.number.asc())
        if isinstance(self.provid_clt_id, int):
            self.provider_clt = ProviderOrClient.get(id=self.provid_clt_id)
            qs = qs.select().where(Invoice.client == self.provider_clt)
        else:
            self.provider_clt = "Tous"

        self.data = [(vl.date, vl.number, vl.client.name, vl.amount_ivoice, "")
                     for vl in qs
                     if (vl.date > date_[0] and vl.date < date_[1])]
コード例 #4
0
ファイル: debt_manager.py プロジェクト: Ciwara/GCiss
    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())

        self.remaining = 0
        if isinstance(provid_clt_id, int):
            qs = qs.select().where(
                Refund.provider_client == ProviderOrClient.get(
                    id=provid_clt_id))
        else:
            for prov in ProviderOrClient.select().where(
                    ProviderOrClient.type_ == ProviderOrClient.CLT):
                self.remaining += prov.last_remaining()
        self.parent.remaining_box.setText(
            self.display_remaining(formatted_number(self.remaining)))

        self.data = [(ref.id, ref.type_, ref.date, ref.invoice.number,
                      ref.amount, ref.remaining) for ref in qs.iterator()]
コード例 #5
0
ファイル: debt_manager.py プロジェクト: Ciwara/GCiss
    def popup(self, pos):
        row = self.selectionModel().selection().indexes()[0].row()
        if row < 1:
            return
        menu = QMenu()
        refund = menu.addAction("Reglement")
        editaction = menu.addAction("Modifier")
        action = menu.exec_(self.mapToGlobal(pos))

        provid_clt = ProviderOrClient.get(
            ProviderOrClient.phone == self.item(row).text().split(",")[1])
        if action == refund:
            if provid_clt.is_indebted():
                self.parent.new_refund(provid_clt)
            else:
                self.parent.parent.Notify(
                    "Le client {} n'est pas endetté".format(self.item(row).text()), "error")
        if action == editaction:
            from GCommon.ui.provider_client_edit_add import EditOrAddClientOrProviderDialog
            self.parent.open_dialog(EditOrAddClientOrProviderDialog, modal=True,
                                    prov_clt=provid_clt, table_p=self)
コード例 #6
0
ファイル: debt_manager.py プロジェクト: Ciwara/GCiss
    def popup(self, pos):
        row = self.selectionModel().selection().indexes()[0].row()
        if row < 1:
            return
        menu = QMenu()
        refund = menu.addAction("Reglement")
        editaction = menu.addAction("Modifier")
        action = menu.exec_(self.mapToGlobal(pos))

        provid_clt = ProviderOrClient.get(
            ProviderOrClient.phone == self.item(row).text().split(",")[1])
        if action == refund:
            if provid_clt.is_indebted():
                self.parent.new_refund(provid_clt)
            else:
                self.parent.parent.Notify(
                    "Le client {} n'est pas endetté".format(
                        self.item(row).text()), "error")
        if action == editaction:
            from GCommon.ui.provider_client_edit_add import EditOrAddClientOrProviderDialog
            self.parent.open_dialog(EditOrAddClientOrProviderDialog,
                                    modal=True,
                                    prov_clt=provid_clt,
                                    table_p=self)