Beispiel #1
0
    def on_print_booklets__clicked(self, button):
        # Remove cancelled and not store_credit payments
        payments = [p for p in self.payments_list if
                    p.method.method_name == u'store_credit' and
                    not p.is_cancelled()]

        print_report(BookletReport, payments)
Beispiel #2
0
 def _print_test_bill(self):
     try:
         bank_info = get_bank_info_by_number(self.bank_model.bank_number)
     except NotImplementedError:
         info(_("This bank does not support printing of bills"))
         return
     kwargs = dict(
         valor_documento=12345.67,
         data_vencimento=datetime.date.today(),
         data_documento=datetime.date.today(),
         data_processamento=datetime.date.today(),
         nosso_numero=u'624533',
         numero_documento=u'1138',
         sacado=[_(u"Drawee"), _(u"Address"),
                 _(u"Details")],
         cedente=_(u"Supplier"),
         demonstrativo=[_(u"Demonstration")],
         instrucoes=[_(u"Instructions")],
         agencia=self.bank_model.bank_branch,
         conta=self.bank_model.bank_account,
     )
     for opt in self.bank_model.options:
         kwargs[opt.option] = opt.value
     data = bank_info(**kwargs)
     print_report(BillTestReport, data)
Beispiel #3
0
    def _print_report(self):
        if self.model.status == PurchaseOrder.ORDER_QUOTING:
            report = PurchaseQuoteReport
        else:
            report = PurchaseOrderReport

        print_report(report, self.model)
Beispiel #4
0
    def _print_report(self):
        if self.model.status == PurchaseOrder.ORDER_QUOTING:
            report = PurchaseQuoteReport
        else:
            report = PurchaseOrderReport

        print_report(report, self.model)
Beispiel #5
0
 def on_print_button_clicked(self, widget):
     print_report(
         ProductionItemReport,
         self.results,
         list(self.results),
         filters=self.search.get_search_filters(),
     )
Beispiel #6
0
    def _print_transaction_report(self):
        assert not self._is_accounts_tab()

        page = self._get_current_page_widget()
        print_report(AccountTransactionReport, page.results, list(page.results),
                     account=page.model,
                     filters=page.search.get_search_filters())
Beispiel #7
0
 def on_PrintReceipt__activate(self, action):
     receivable_view = self.results.get_selected_rows()[0]
     payment = receivable_view.payment
     date = localtoday().date()
     print_report(InPaymentReceipt,
                  payment=payment,
                  order=receivable_view.sale,
                  date=date)
Beispiel #8
0
    def on_print_booklets__clicked(self, button):
        # Remove cancelled and not store_credit payments
        payments = [
            p for p in self.payments_list if
            p.method.method_name == u'store_credit' and not p.is_cancelled()
        ]

        print_report(BookletReport, payments)
Beispiel #9
0
 def on_PrintReceipt__activate(self, action):
     payment_views = self.results.get_selected_rows()
     payments = [v.payment for v in payment_views]
     date = localtoday().date()
     print_report(OutPaymentReceipt,
                  payment=payments[0],
                  order=payment_views[0].purchase,
                  date=date)
Beispiel #10
0
    def _print_transaction_report(self):
        assert not self._is_accounts_tab()

        page = self.get_current_page()
        print_report(AccountTransactionReport, page.result_view,
                     list(page.result_view),
                     account=page.model,
                     filters=page.search.get_search_filters())
Beispiel #11
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            # We want to close the checkout, so the user will be back to the
            # list of items in the sale.
            self.close()
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.retval = True
        invoice_number = self.invoice_model.invoice_number

        # Workaround for bug 4218: If the invoice is was already used by
        # another store (another cashier), try using the next one
        # available, or show a warning if the number was manually set.
        while True:
            try:
                self.store.savepoint('before_set_invoice_number')
                self.model.invoice_number = invoice_number
                # We need to flush the database here, or a possible collision
                # of invoice_number will only be detected later on, when the
                # execution flow is not in the try-except anymore.
                self.store.flush()
            except IntegrityError:
                self.store.rollback_to_savepoint('before_set_invoice_number')
                if self._invoice_changed():
                    warning(
                        _(u"The invoice number %s is already used. "
                          "Confirm the sale again to chose another one.") %
                        invoice_number)
                    self.retval = False
                    break
                else:
                    invoice_number += 1
            else:
                break

        self.close()

        group = self.model.group
        # FIXME: This is set too late on Sale.confirm(). If PaymentGroup don't
        #        have a payer, we won't be able to print bills/booklets.
        group.payer = self.model.client and self.model.client.person

        booklets = list(group.get_payments_by_method_name(u'store_credit'))
        bills = list(group.get_payments_by_method_name(u'bill'))

        if (booklets and yesno(
                _("Do you want to print the booklets for this sale?"),
                gtk.RESPONSE_YES, _("Print booklets"), _("Don't print"))):
            print_report(BookletReport, booklets)

        if (bills and BillReport.check_printable(bills) and yesno(
                _("Do you want to print the bills for this sale?"),
                gtk.RESPONSE_YES, _("Print bills"), _("Don't print"))):
            print_report(BillReport, bills)
Beispiel #12
0
    def on_print_bills__clicked(self, button):
        # Remove cancelled and not bill payments
        payments = [p for p in self.payments_list if
                    p.method.method_name == u'bill' and
                    not p.is_cancelled()]

        if not BillReport.check_printable(payments):
            return False

        print_report(BillReport, payments)
Beispiel #13
0
    def finish(self):
        missing = get_missing_items(self.model, self.store)
        if missing:
            # We want to close the checkout, so the user will be back to the
            # list of items in the sale.
            self.close()
            run_dialog(MissingItemsDialog, self, self.model, missing)
            return False

        self.retval = True
        invoice_number = self.invoice_model.invoice_number

        # Workaround for bug 4218: If the invoice is was already used by
        # another store (another cashier), try using the next one
        # available, or show a warning if the number was manually set.
        while True:
            try:
                self.store.savepoint('before_set_invoice_number')
                self.model.invoice_number = invoice_number
                # We need to flush the database here, or a possible collision
                # of invoice_number will only be detected later on, when the
                # execution flow is not in the try-except anymore.
                self.store.flush()
            except IntegrityError:
                self.store.rollback_to_savepoint('before_set_invoice_number')
                if self._invoice_changed():
                    warning(_(u"The invoice number %s is already used. "
                              "Confirm the sale again to chose another one.") %
                            invoice_number)
                    self.retval = False
                    break
                else:
                    invoice_number += 1
            else:
                break

        self.close()

        group = self.model.group
        # FIXME: This is set too late on Sale.confirm(). If PaymentGroup don't
        #        have a payer, we won't be able to print bills/booklets.
        group.payer = self.model.client and self.model.client.person

        booklets = list(group.get_payments_by_method_name(u'store_credit'))
        bills = list(group.get_payments_by_method_name(u'bill'))

        if (booklets and
            yesno(_("Do you want to print the booklets for this sale?"),
                  gtk.RESPONSE_YES, _("Print booklets"), _("Don't print"))):
            print_report(BookletReport, booklets)

        if (bills and BillReport.check_printable(bills) and
            yesno(_("Do you want to print the bills for this sale?"),
                  gtk.RESPONSE_YES, _("Print bills"), _("Don't print"))):
            print_report(BillReport, bills)
Beispiel #14
0
    def on_print_bills__clicked(self, button):
        # Remove cancelled and not bill payments
        payments = [
            p for p in self.payments_list
            if p.method.method_name == u'bill' and not p.is_cancelled()
        ]

        if not BillReport.check_printable(payments):
            return False

        print_report(BillReport, payments)
Beispiel #15
0
    def _print_quote_details(self, quote, payments_created=False):
        msg_list = []
        if not quote.group.payments.is_empty():
            msg_list.append(
                _('The created payments can be found in the Accounts '
                  'Receivable application and you can set them as paid '
                  'there at any time.'))
        msg_list.append(_('Would you like to print the quote details now?'))

        # We can only print the details if the quote was confirmed.
        if yesno('\n\n'.join(msg_list), gtk.RESPONSE_YES,
                 _("Print quote details"), _("Don't print")):
            print_report(SaleOrderReport, self.model)
Beispiel #16
0
    def _print_quote_details(self, quote, payments_created=False):
        msg_list = []
        if not quote.group.payments.is_empty():
            msg_list.append(
                _('The created payments can be found in the Accounts '
                  'Receivable application and you can set them as paid '
                  'there at any time.'))
        msg_list.append(_('Would you like to print the quote details now?'))

        # We can only print the details if the quote was confirmed.
        if yesno('\n\n'.join(msg_list), gtk.RESPONSE_YES,
                 _("Print quote details"), _("Don't print")):
            print_report(SaleOrderReport, self.model)
Beispiel #17
0
    def confirm(self):
        state = self._date_filter.get_state()
        from stoqlib.database.queryexecuter import DateQueryState
        if isinstance(state, DateQueryState):
            start, end = state.date, state.date
        else:
            start, end = state.start, state.end

        results = PaymentFlowDay.get_flow_history(self.store, start, end)
        if not results:
            info(_('No payment history found.'))
            return False

        print_report(PaymentFlowHistoryReport, payment_histories=results)
        return True
Beispiel #18
0
    def confirm(self):
        state = self._date_filter.get_state()
        from kiwi.db.query import DateQueryState
        if isinstance(state, DateQueryState):
            start, end = state.date, state.date
        else:
            start, end = state.start, state.end

        results = PaymentFlowDay.get_flow_history(self.store, start, end)
        if not results:
            info(_('No payment history found.'))
            return False

        print_report(PaymentFlowHistoryReport, payment_histories=results)
        return True
Beispiel #19
0
 def _print_test_bill(self):
     try:
         bank_info = get_bank_info_by_number(self.bank_model.bank_number)
     except NotImplementedError:
         info(_("This bank does not support printing of bills"))
         return
     kwargs = dict(
         valor_documento=12345.67,
         data_vencimento=datetime.date.today(),
         data_documento=datetime.date.today(),
         data_processamento=datetime.date.today(),
         nosso_numero=u'624533',
         numero_documento=u'1138',
         sacado=[_(u"Drawee"), _(u"Address"), _(u"Details")],
         cedente=_(u"Supplier"),
         demonstrativo=[_(u"Demonstration")],
         instrucoes=[_(u"Instructions")],
         agencia=self.bank_model.bank_branch,
         conta=self.bank_model.bank_account,
     )
     for opt in self.bank_model.options:
         kwargs[opt.option] = opt.value
     data = bank_info(**kwargs)
     print_report(BillTestReport, data)
Beispiel #20
0
 def _print_quote(self):
     selected = self.quoting_list.get_selected()
     self.model.supplier = selected.supplier
     print_report(PurchaseQuoteReport, self.model)
Beispiel #21
0
 def _print_button_clicked(self, button):
     till_entries = self.results.get_selected_rows() or list(self.results)
     print_report(TillHistoryReport, self.results, till_entries,
                  filters=self.search.get_search_filters())
 def _print_quote(self):
     selected = self.quoting_list.get_selected()
     self.model.supplier = selected.supplier
     print_report(PurchaseQuoteReport, self.model)
Beispiel #23
0
 def on_PrintDocument__activate(self, action):
     view = self.results.get_selected_rows()[0]
     payments = [view.payment]
     report = view.operation.print_(payments)
     if report is not None:
         print_report(report, payments)
Beispiel #24
0
 def on_PrintReceipt__activate(self, action):
     workorderview = self.results.get_selected()
     print_report(WorkOrderReceiptReport, workorderview.work_order)
Beispiel #25
0
 def _print_report(self):
     print_report(CardPaymentReport, self.results, list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #26
0
    def print_report(self, report_class, *args, **kwargs):
        filters = self.search.get_search_filters()
        if filters:
            kwargs['filters'] = filters

        print_report(report_class, *args, **kwargs)
Beispiel #27
0
 def on_print_button_clicked(self, button):
     print_report(PurchaseReceivalReport,
                  self.results,
                  list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #28
0
 def on_print_button__clicked(self, widget):
     print_report(ProductionOrderReport, self.model)
Beispiel #29
0
 def on_print_button__clicked(self, button):
     print_report(PurchaseOrderReport, self.model)
Beispiel #30
0
 def on_print_button_clicked(self, button):
     salesperson_name = self._salesperson_filter.combo.get_selected()
     print_report(SalesPersonReport,
                  list(self.results),
                  salesperson_name=salesperson_name,
                  filters=self.search.get_search_filters())
Beispiel #31
0
 def on_print_button__clicked(self, button):
     print_report(PurchaseOrderReport, self.model)
Beispiel #32
0
 def on_PrintReceipt__activate(self, action):
     payment_views = self.results.get_selected_rows()
     payments = [v.payment for v in payment_views]
     date = localtoday().date()
     print_report(OutPaymentReceipt, payment=payments[0],
                  order=payment_views[0].purchase, date=date)
Beispiel #33
0
 def on_print_button_clicked(self, button):
     orders = self.results.get_selected_rows()
     if len(orders) == 1:
         print_report(StockDecreaseReceipt, orders[0])
Beispiel #34
0
 def on_PrintReceipt__activate(self, action):
     receivable_view = self.results.get_selected_rows()[0]
     payment = receivable_view.payment
     date = localtoday().date()
     print_report(InPaymentReceipt, payment=payment,
                  order=receivable_view.sale, date=date)
Beispiel #35
0
 def on_PrintReceipt__activate(self, action):
     workorderview = self.search.get_selected_item()
     print_report(WorkOrderReceiptReport, workorderview.work_order)
Beispiel #36
0
 def on_PrintDocument__activate(self, action):
     view = self.results.get_selected_rows()[0]
     payments = [view.payment]
     report = view.operation.print_(payments)
     if report is not None:
         print_report(report, payments)
Beispiel #37
0
 def on_print_button__clicked(self, button):
     print_report(SaleOrderReport, self.store.get(Sale, self.model.id))
Beispiel #38
0
 def _on_print_button__clicked(self, widget):
     print_report(CallsReport, self.results, list(self.results),
                  filters=self.search.get_search_filters(),
                  person=self.person)
Beispiel #39
0
 def on_print_button_clicked(self, widget):
     print_report(ProductionItemReport, self.results, list(self.results),
                  filters=self.search.get_search_filters(), )
Beispiel #40
0
 def on_print_button_clicked(self, button):
     view = self.results.get_selected_rows()[0]
     print_report(TransferOrderReceipt, view.transfer_order)
Beispiel #41
0
 def _print_report(self):
     payments = self.results.get_selected_rows() or list(self.results)
     print_report(BillCheckPaymentReport, self.results, payments,
                  filters=self.search.get_search_filters())
Beispiel #42
0
 def _print_button_clicked(self, button):
     till_entries = self.results.get_selected_rows() or list(self.results)
     print_report(TillHistoryReport,
                  self.results,
                  till_entries,
                  filters=self.search.get_search_filters())
Beispiel #43
0
 def on_print_button_clicked(self, button):
     print_report(PurchaseReceivalReport, self.results, list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #44
0
 def _print_receipt(self, order):
     # we can only print the receipt if the loan was confirmed.
     if yesno(_('Would you like to print the receipt now?'),
              gtk.RESPONSE_YES, _("Print receipt"), _("Don't print")):
         print_report(LoanReceipt, order)
Beispiel #45
0
 def print_sale(self):
     print_report(SalesReport,
                  self.sales,
                  list(self.sales),
                  filters=self._report_filters)
Beispiel #46
0
 def _print_report(self):
     print_report(SoldItemsByBranchReport, self.results, list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #47
0
 def on_print_button__clicked(self, button):
     print_report(SaleOrderReport, self.store.get(Sale, self.model.id))
Beispiel #48
0
 def on_print_price_button_clicked(self, button):
     print_report(ProductPriceReport, list(self.results),
                  filters=self.search.get_search_filters(),
                  branch_name=self.branch_filter.combo.get_active_text())
Beispiel #49
0
 def on_print_price_button_clicked(self, button):
     print_report(ServicePriceReport,
                  list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #50
0
 def on_print_button_clicked(self, button):
     print_report(ProductsSoldReport, self.results, list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #51
0
 def _receipt_dialog(self):
     msg = _('Would you like to print a receipt?')
     if yesno(msg, gtk.RESPONSE_YES,
              _("Print receipt"), _("Don't print")):
         print_report(StockDecreaseReceipt, self.model)
     return
Beispiel #52
0
 def on_print_button_clicked(self, widget):
     print_report(ProductClosedStockReport, self.results,
                  filters=self.search.get_search_filters(),
                  branch_name=self.branch_filter.combo.get_active_text())
 def _receipt_dialog(self, order):
     msg = _('Would you like to print a receipt for this transfer?')
     if yesno(msg, gtk.RESPONSE_YES, _("Print receipt"), _("Don't print")):
         print_report(TransferOrderReceipt, order)
Beispiel #54
0
 def on_print_price_button_clicked(self, button):
     print_report(ProductPriceReport,
                  list(self.results),
                  filters=self.search.get_search_filters(),
                  branch_name=self.branch_filter.combo.get_active_text())
Beispiel #55
0
 def on_print_button_clicked(self, button):
     view = self.results.get_selected_rows()[0]
     print_report(TransferOrderReceipt, view.transfer_order)
Beispiel #56
0
 def on_print_button_clicked(self, button):
     print_report(ProductsSoldReport,
                  self.results,
                  list(self.results),
                  filters=self.search.get_search_filters())
Beispiel #57
0
 def print_sale(self):
     print_report(SalesReport, self.sales, list(self.sales),
                  filters=self._report_filters)
Beispiel #58
0
 def on_print_button_clicked(self, widget):
     print_report(ProductClosedStockReport,
                  self.results,
                  filters=self.search.get_search_filters(),
                  branch_name=self.branch_filter.combo.get_active_text())
Beispiel #59
0
 def on_print_button_clicked(self, button):
     orders = self.results.get_selected_rows()
     if len(orders) == 1:
         loan = self.store.get(Loan, orders[0].id)
         print_report(LoanReceipt, loan)
Beispiel #60
0
 def _print_receipt(self, order):
     # we can only print the receipt if the loan was confirmed.
     if yesno(_('Would you like to print the receipt now?'),
              gtk.RESPONSE_YES, _("Print receipt"), _("Don't print")):
         print_report(LoanReceipt, order)