diff --git a/report/close_statement.fodt b/report/close_statement.fodt index e52df94..e1ae729 100644 --- a/report/close_statement.fodt +++ b/report/close_statement.fodt @@ -1,28 +1,28 @@ - LibreOffice/7.4.7.2$Linux_X86_64 LibreOffice_project/40$Build-22008-06-07T15:28:222009-01-10T16:03:331PT0S + LibreOffice/7.4.7.2$Linux_X86_64 LibreOffice_project/40$Build-22008-06-07T15:28:222009-01-10T16:03:331PT0S - 1152 + 8013 0 - 22274 - 10453 + 19602 + 8786 true false view2 - 6115 - 5258 + 3868 + 12654 0 - 1152 - 22273 - 11603 + 8013 + 19600 + 16798 0 0 false - 220 + 250 false false false @@ -90,7 +90,7 @@ true true - 2765799 + 3010409 true false @@ -149,14 +149,12 @@ - - - - - + + + + - @@ -181,15 +179,15 @@ - + - + - + @@ -211,7 +209,7 @@ - + @@ -308,6 +306,12 @@ + + + + + + $ @@ -319,10 +323,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -338,30 +427,75 @@ - - - - + - - + + - - + + + + - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -372,7 +506,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -387,273 +555,134 @@ - - - + + + - - - - + + + + + + + - + - + - - - - + - + - + - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -693,8 +722,7 @@ - - + /9j/4AAQSkZJRgABAQEAYABgAAD/4S6eRXhpZgAATU0AKgAAAAgABgALAAIAAAAmAAAIYgES AAMAAAABAAEAAAExAAIAAAAmAAAIiAEyAAIAAAAUAAAIrodpAAQAAAABAAAIwuocAAcAAAgM AAAAVgAAEUYc6gAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA @@ -1841,137 +1869,156 @@ - NIT: 901575528 - Regimen Común - TRANSV 46 E 42 ESTE 789 32667 - SANTA ELENA - Cel: 3014287624 - - + + <shop> + NIT: 901575528 + Fecha: <date> + + <if test="range_pos"> + + + + + + Facturas Pos: <range_pos[-1]>/ <range_pos[0]> + + + + + + + </if> + <if test="range_fe"> + + + + + + Facturas Fe: <range_fe[-1]>/ <range_fe[0]> + + + + + + + </if> + + Ventas Diarias + + + + + Base + + + Impuestos + + + Total + + + + + <format_currency(untaxed_amount, lang=None, currency=currency)> + + + <format_currency(tax_amount, lang=None, currency=currency)> + + + <format_currency(total_amount, lang=None, currency=currency)> + + + + + Declaración Diaria: + - - - Declaración Diaria: + + + Nombre + + + Inicio + + + Saldo + + + Final - - - - - Nombre - - - Inicio - - - Saldo - - - Final - - - - - <for each="statement in statements"> + + <for each="statement in statements"> - - - <statement['name']> + + + <statement['name']> - - <statement['start_balance']> + + <format_currency(statement['start_balance'], lang=None, currency=currency)> - - <statement['total_amount']> + + <format_currency(statement['total_amount'], lang=None, currency=currency)> - - <statement['end_balance']> + + <format_currency(statement['end_balance'], lang=None, currency=currency)> - - - </for> + + + </for> - - - Total: + + + Total: <format_currency(total_statements, lang=None, currency=currency)> - - <total_statements> - + - - Ventas Diarias - - - - - Base - - - Impuestos - - - Total - - - - - <untaxed_amount> - - - <tax_amount> - - - <total_amount> - - - - - Venta de Pizzas - + + Venta de Pizzas + - + - Pizzas vendidas + Pizzas vendidas - Total x Pizzas + Total x Pizzas - Propinas + Propinas - - - <number_pizzas_sold> + + + <number_pizzas_sold> - - <amount_w_tax_pizzas> + + <format_currency(amount_w_tax_pizzas, lang=None, currency=currency)> - - <tips> + + <format_currency(tips, lang=None, currency=currency)> - + \ No newline at end of file diff --git a/report_close_statement.py b/report_close_statement.py index ce6613c..ce0d0d3 100644 --- a/report_close_statement.py +++ b/report_close_statement.py @@ -18,9 +18,23 @@ class ReportCloseStatementStart(ModelView): "Vista inicial de reporte de extracto" __name__ = 'sale.print_cash_register.start' + company = fields.Many2One( + 'company.company', "Company", readonly=True, required=True) + currency = fields.Many2One('currency.currency', 'Currency', required=True) date = fields.Date('Date', required=True) shop = fields.Many2One('sale.shop', 'Shop', required=True) + @staticmethod + def default_company(): + return Transaction().context.get('company') + + @staticmethod + def default_currency(): + Company = Pool().get('company.company') + if Transaction().context.get('company'): + company = Company(Transaction().context['company']) + return company.currency.id + @classmethod def default_date(cls): return date.today() @@ -49,8 +63,10 @@ class PrintReportCloseStatement(Wizard): def do_print_cash_register(self, action): data = { + 'lang': self.start.company.party.lang, 'date': self.start.date, - 'shop': self.start.shop.id + 'shop': self.start.shop.id, + 'currency': self.start.currency.id, } return action, data @@ -97,16 +113,44 @@ class CashRegister(Report): ]) return statements + def _get_invoices_by_subtype(date, shop): + pool = Pool() + Invoice = pool.get('account.invoice') + Shop = pool.get('sale.shop') + fe_pos_subtype = Shop(shop).fe_pos_subtype.id + pos_subtype = Shop(shop).pos_subtype.id + ranges = {} + invoices_fe = Invoice.search([('invoice_date', '=', date), + ('subtype', '=', fe_pos_subtype)]) + + if invoices_fe: + ranges['range_fe'] = \ + [invoices_fe[0].number, invoices_fe[-1].number] + + invoices_pos = Invoice.search([('invoice_date', '=', date), + ('subtype', '=', pos_subtype)]) + + if invoices_pos: + ranges['range_pos'] = \ + [invoices_pos[0].number, invoices_pos[-1].number] + + return ranges + @classmethod def get_context(cls, records, header, data): report_context = super( CashRegister, cls).get_context(records, header, data) pool = Pool() + Shop = pool.get('sale.shop') Sale = pool.get('sale.sale') + Currency = pool.get('currency.currency') + currency = Currency(data['currency']) + date = data['date'] + shop = data['shop'] today_sales_domain = [('state', 'in', ['processing', 'done']), - ('sale_date', '=', data['date']), - ('shop', '=', data['shop'])] + ('sale_date', '=', date), + ('shop', '=', shop)] today_sales = Sale.search(today_sales_domain, order=[('id', 'ASC')]) @@ -141,6 +185,20 @@ class CashRegister(Report): report_context['total_statements'] = sum( [s['total_amount'] for s in report_context['statements']]) + ranges = cls._get_invoices_by_subtype(date, shop) + ranges_keys = ranges.keys() + if 'range_fe' in ranges_keys: + report_context['range_fe'] = ranges['range_fe'] + else: + report_context['range_fe'] = [] + if 'range_pos' in ranges: + report_context['range_pos'] = ranges['range_pos'] + else: + report_context['range_pos'] = [] + + report_context['shop'] = Shop(shop).name + report_context['date'] = date + report_context['currency'] = currency report_context['amount_w_tax_pizzas'] = sum(amount_w_tax_pizzas) report_context['tips'] = sum(amount_tips) report_context['untaxed_amount'] = untaxed_amount diff --git a/view/print_cash_register_start_form.xml b/view/print_cash_register_start_form.xml index 6061380..7b46022 100644 --- a/view/print_cash_register_start_form.xml +++ b/view/print_cash_register_start_form.xml @@ -2,9 +2,14 @@
+