Переглянути джерело

ADD FIX Extensión eiru_reports informe especial para radio positiva - suceso

Sebas 6 роки тому
коміт
85e76c380e

+ 3 - 0
__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+import controllers
+import models


+ 25 - 0
__openerp__.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "Eiru Reports - Positiva",
+    'author': "Eiru",
+    'category': 'report',
+    'version': '0.1',
+    'depends': [
+        'base',
+        'product',
+        'account',
+        'stock',
+        'eiru_assets',
+        'eiru_reports',
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+        'static/src/reports/*.xml'
+    ],
+    'data': [
+        'templates.xml',
+        'views/actions.xml',
+        'views/menus.xml',
+        # 'views/payment_term.xml',
+    ],
+}

+ 2 - 0
controllers.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from openerp import http

BIN
controllers.pyc


+ 122 - 0
models.py

@@ -0,0 +1,122 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+class AccountInvoice(models.Model):
+	_inherit = 'account.invoice'
+
+	############################################################
+	#	ACCOUNT INVOICE
+	############################################################
+
+	@api.model
+	def getAccountInvoiceDental(self,domain):
+		AccountInvoice = self.env['account.invoice'].search(domain)
+		decimal_precision = self.env['decimal.precision'].precision_get('Account')
+		values = []
+		for invoice in AccountInvoice:
+			values.append({
+				'id': invoice.id,
+				'type': invoice.type,
+				'state': invoice.state,
+				'number': invoice.number,
+				'journal_id': [
+					invoice.journal_id.id,
+					invoice.journal_id.name
+				],
+				'invoice_currency': [
+					invoice.currency_id.id,
+					invoice.currency_id.name,
+					invoice.currency_id.rate
+				],
+				'company_currency': [
+					invoice.company_id.currency_id.id,
+					invoice.company_id.currency_id.name,
+					invoice.company_id.currency_id.rate
+				],
+				'date_invoice': invoice.date_invoice,
+				'partner_id': [
+					invoice.partner_id.id,
+					invoice.partner_id.name,
+				],
+				'supplier_invoice_number': invoice.supplier_invoice_number,
+				'user_id': [
+					invoice.user_id.id,
+					invoice.user_id.name
+				],
+                'period_id': [
+                	invoice.period_id.id,
+                	invoice.period_id.name
+                ],
+				'origin': invoice.origin,
+				'reference': invoice.reference,
+				'payment_term': {
+					'id' : invoice.payment_term.id,
+					'name' : invoice.payment_term.name,
+					'check_credit' : invoice.payment_term.check_credit,
+					},
+                'amount_untaxed': invoice.amount_untaxed,
+                'residual': invoice.residual,
+                'amount_tax': invoice.amount_tax,
+				'amount_total': invoice.amount_total,
+				'amount_untaxed_currency': invoice.amount_untaxed * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
+				'residual_currency': invoice.residual * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
+				'amount_tax_currency': invoice.amount_tax * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
+				'amount_total_currency': invoice.amount_total * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
+			})
+
+		return values
+
+class AccountInvoiceLine(models.Model):
+	_inherit = 'account.invoice.line'
+
+	############################################################
+	#	ACCOUNT INVOICE LINE
+	############################################################
+
+	@api.model
+	def getAccountInvoiceLineDental(self,domain):
+		AccountInvoiceLine = self.env['account.invoice.line'].search(domain)
+		decimal_precision = self.env['decimal.precision'].precision_get('Account')
+		values = []
+		for line in AccountInvoiceLine:
+			values.append({
+				'id': line.id,
+				'invoice_id':line.invoice_id.id,
+				'journal_id' : line.invoice_id.journal_id.id,
+				'product_id': {
+					'id' : line.product_id.id,
+					'name' : line.product_id.name,
+					'standard_price' : line.product_id.standard_price,
+				},
+				'quantity' : line.quantity,
+			})
+
+		return values
+
+class AccountVoucher(models.Model):
+	_inherit = 'account.voucher'
+
+	############################################################
+	#	ACCONT VOUCHER
+	############################################################
+
+	@api.model
+	def getAccountVoucherDental(self,domain):
+		AccountVoucher = self.env['account.voucher'].search(domain)
+		values = []
+		for voucher in AccountVoucher:
+			values.append({
+				'id': voucher.id,
+				'number':voucher.number,
+				'journal_id': voucher.journal_id.id,
+				'amount': voucher.amount,
+				'reference' : voucher.reference,
+			})
+
+		return values
+
+class AccounPaymentTerm(models.Model):
+	_inherit = 'account.payment.term'
+
+	check_credit = fields.Boolean("Es crédito?", default=True)


BIN
static/description/icon.png


+ 20 - 0
static/src/js/main.js

@@ -0,0 +1,20 @@
+openerp.eiru_reports_positiva= function (instance) {
+    "use strict";
+
+    var reporting = instance.eiru_reports_positiva;
+
+    reporting_base(instance,reporting);
+
+    try {
+        report_account_pay(reporting);
+    } catch (e) {
+        // ignorar error
+    }
+
+    // Ventas para positiva
+
+    instance.web.client_actions.add('eiru_reports_positiva.account_pay_action', 'instance.eiru_reports_positiva.ReportAccountPayWidget');
+
+
+
+}

+ 22 - 0
static/src/js/reporting_base.js

@@ -0,0 +1,22 @@
+function reporting_base (instance, widget) {
+    "use strict";
+
+    widget.Base = instance.Widget.extend({
+
+        position: 0,
+
+        init: function (parent, position) {
+            this._super(parent);
+            this.position = position || this.position;
+        },
+        start: function () {
+            
+        },
+        getPosition: function () {
+            return this.position;
+        },
+        setPosition: function (position) {
+            this.position = position;
+        }
+    });
+}

+ 1014 - 0
static/src/js/reports/report_account_pay.js

@@ -0,0 +1,1014 @@
+function report_account_pay(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportAccountPayWidget = reporting.Base.extend({
+        template: 'ReportAccountPay',
+        rowsData :[],
+        content :[],
+        modules: [],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateJournalSelections',
+            'change #current-period' : 'updatePeriodSelections',
+            'change #current-date' : 'ShowDateRange',
+        },
+
+        init : function(parent){
+            this._super(parent);
+        },
+
+        start: function () {
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowsData});
+            var date = new model.eiru_reports.ReportDatePickerWidget(self);
+            date.fecthFecha();
+            this.fetchInitial();
+        },
+
+        valorNull:function(dato){
+            var valor = "";
+            if (dato){
+                valor = dato;
+            }
+            return valor;
+        },
+
+        ShowDateRange : function(){
+            var self = this;
+            var date = self.$el.find('#current-date').val();
+            if(date == 'range'){
+                self.$el.find('.datepicker').css('display','block');
+            }
+            if(date != 'range'){
+                self.$el.find('.datepicker').css('display','none');
+            }
+
+        },
+
+        fetchInitial: function () {
+            var self = this;
+            self.fecthIrModuleModule().then(function (IrModuleModule) {
+                return IrModuleModule;
+            }).then(function(IrModuleModule) {
+                self.IrModuleModule = IrModuleModule;
+                return self.fetchResUser;
+            }).then(function (ResUser) {
+                self.ResUser = ResUser;
+                return self.fetchResCompany();
+            }).then(function(ResCompany){
+                self.ResCompany = ResCompany;
+                if(ResCompany.length > 1){
+                    self.$el.find('#current-company').append('<option value="9999999">Todas las empresas</option>');
+                    _.each(ResCompany,function(item){
+                        self.$el.find('#current-company').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.company').css('display','none');
+                }
+                return self.fetchResStore();
+            }).then(function(ResStore){
+                self.ResStore = ResStore;
+                if(ResStore.length > 1){
+                    self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
+                    _.each(ResStore,function(item){
+                        self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.store').css('display','none');
+                }
+                return self.fetchAccountJournal();
+            }).then(function(AccountJournal){
+                self.AccountJournal = AccountJournal;
+                if(AccountJournal.length > 1){
+                    self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                    _.each(AccountJournal,function(item){
+                        self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.journal').css('display','none');
+                }
+                return self.fetchAccountPeriod();
+            }).then(function(AccountPeriod){
+                self.AccountPeriod = AccountPeriod;
+                self.$el.find('#current-period').append('<option value="9999999">Todos los periodos</option>');
+                _.each(AccountPeriod,function(item){
+                    self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                return self.fetchResCurrency();
+            }).then(function(ResCurrency){
+                self.ResCurrency = ResCurrency;
+            });
+            self.$el.find('#generate').css('display','inline');
+            return;
+        },
+
+        fetchGenerate: function () {
+            var self = this;
+            self.$el.find('.search-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.report-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            this.fetchAccountInvoice().then(function(AccountInvoice) {
+                return AccountInvoice;
+            }).then(function (AccountInvoice) {
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchAccountInvoiceLine();
+            }).then(function (AccountInvoiceLine){
+                self.AccountInvoiceLine = AccountInvoiceLine;
+                return self.fetchAccountMoveLine();
+            }).then(function (AccountMoveLine){
+                self.AccountMoveLine = AccountMoveLine;
+                return self.fetchAccountVoucher();
+            }).then(function (AccountVoucher){
+                self.AccountVoucher = AccountVoucher;
+                return self.BuildTable();
+            });
+        },
+
+        /*=====================================================================
+            IR MODULE
+        =====================================================================*/
+        fecthIrModuleModule: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['name','id'];
+            var domain=[['state','=','installed'],['name','in',self.modules]];
+            var IrModuleModule = new model.web.Model('ir.module.module');
+            IrModuleModule.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            })
+            return defer;
+        },
+
+        /*=====================================================================
+            USER
+        =====================================================================*/
+        fetchResUser: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','store_id'];
+            var domain = [['id','=',self.session.uid]];
+            var ResUser = new model.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*=====================================================================
+            ACCOUNT PERIOD
+        =====================================================================*/
+        fetchAccountPeriod: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var domain = [['special','=',false]];
+            var field =['id', 'name', 'date_start','date_stop','company_id'];
+            var AccountPeriod = new model.web.Model('account.period');
+            AccountPeriod.query(field).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            RES STORE
+        ====================================================================*/
+        fetchResStore: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field = ['id','name','company_id'];
+            var ResStore = new model.web.Model('res.store');
+            ResStore.query(field).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            ACCOUNT JOURNAL
+        ====================================================================*/
+        fetchAccountJournal: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var company = $('#current-company').val();
+            var store = $('#current-store').val();
+            var domain = [['active','=',true],['type','=','sale']];
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseFloat(company)]);
+            }
+            if(store && store != 9999999){
+                domain.push(['store_ids','=',parseFloat(store)]);
+            }
+            var field = ['id', 'name','store_ids'];
+            var AccountJournal = new model.web.Model('account.journal');
+            AccountJournal.query(field).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE
+        ====================================================================*/
+        fetchAccountInvoice: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            var period = self.$el.find('#current-period').val();
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').val();
+            var journal = self.$el.find('#current-journal').val();
+            if(store && store != 9999999){
+                var journal_ids = _.map(_.filter(self.AccountJournal,function (item) {
+                    return item.store_ids == store;
+                }), function(map){
+                    return map.id;
+                });
+            }else{
+                var journal_ids = _.flatten(_.map(self.AccountJournal, function (item) {
+                    return item.id;
+                }));
+            }
+            var domain = [
+                ['state', 'in',['open','paid']],
+                ['type', '=', 'out_invoice'],
+                ['journal_id','in',journal_ids],
+            ];
+            if(period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+            if(journal && journal != 9999999){
+                domain.push(['journal_id','=',parseInt(journal)]);
+            }
+            if(date && date != 9999999){
+                if(date == 'range'){
+                    if(desde){
+                        var date = desde.split('/')
+                        date = (date[2]+"-"+date[1]+"-"+date[0]);
+                        domain.push(['date_invoice','>=',date]);
+                    }
+                    if(hasta){
+                        var date = hasta.split('/')
+                        date = (date[2]+"-"+date[1]+"-"+date[0]);
+                        domain.push(['date_invoice','<=',date]);
+                    }
+                }
+                if(date == 'today'){
+                    var today = moment().format('YYYY-MM-DD');
+                    domain.push(['date_invoice','=',today]);
+                }
+
+                if(date == 'yesterday'){
+                    var yesterday = moment().add(-1,'days').format('YYYY-MM-DD');
+                    domain.push(['date_invoice','=',yesterday]);
+                }
+                if(date == 'currentMonth'){
+                    var currentMonth = moment().format('YYYY-MM');
+                    domain.push(['date_invoice','like',currentMonth]);
+                }
+                if(date == 'lastMonth'){
+                    var lastMonth = moment().add(-1,'months').format('YYYY-MM');
+                    domain.push(['date_invoice','like',lastMonth]);
+                }
+            }
+            var AccountInvoice = new model.web.Model('account.invoice');
+            return AccountInvoice.call('getAccountInvoice',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE LINE
+        ====================================================================*/
+        fetchAccountInvoiceLine: function (){
+            var self = this;
+            var invoice_ids = _.flatten(_.map(self.AccountInvoice, function (item) {
+                return item.id;
+            }));
+            var domain = [
+                ['invoice_id','in',invoice_ids],
+            ];
+            var AccountInvoiceLine = new model.web.Model('account.invoice.line');
+            return AccountInvoiceLine.call('getAccountInvoiceLine',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE LINE
+        ====================================================================*/
+        fetchAccountMoveLine: function (){
+            var self = this;
+            var invoice_numbers = _.flatten(_.map(self.AccountInvoice, function (item) {
+                return item.number;
+            }));
+            var domain = [
+                ['move_id','in',invoice_numbers],
+                ['debit','>',0],
+            ];
+            var AccountMoveLine = new model.web.Model('account.move.line');
+            return AccountMoveLine.call('getAccountMoveLine',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            ACCOUNT VOUCHER
+        =====================================================================*/
+        fetchAccountVoucher: function () {
+            var self = this;
+            var invoice_numbers = _.flatten(_.map(self.AccountInvoice, function (item) {
+                return item.number;
+            }));
+            var domain = [
+                ['state','=','posted'],
+                ['reference','in',invoice_numbers]
+            ];
+            var AccountVoucher = new model.web.Model('account.voucher');
+            return AccountVoucher.call('getAccountVoucher',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            RES COMPANY
+        ====================================================================*/
+        fetchResCompany: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var currency = new model.web.Model('res.company');
+            var field=['id','name','currency_id','logo'];
+            currency.query(field).filter().all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            RES CURRENCY
+        ====================================================================*/
+        fetchResCurrency : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrency = new model.web.Model('res.currency');
+            ResCurrency.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            UPDATE SELECTIONS
+        ====================================================================*/
+        updateSelections: function () {
+            var self = this;
+            var company = self.$el.find('#current-company').val();
+            if(company != 9999999){
+                /*===================
+                    STORE SELECTION
+                ===================*/
+                var store = self.$el.find('#current-store').empty();
+                self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
+                _.each(self.ResStore,function(item){
+                    if(parseFloat(company) == item.company_id[0]){
+                        self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+                /*====================
+                    PERIOD SELECTION
+                ====================*/
+                var period = self.$el.find('#current-period').empty();
+                self.$el.find('#current-period').append('<option value="9999999">Todos los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    if(parseFloat(company) == item.company_id[0]){
+                        self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*===================
+                    STORE SELECTION
+                ===================*/
+                var store = self.$el.find('#current-store').empty();
+                self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
+                _.each(self.ResStore,function(item){
+                    self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                /*====================
+                    PERIOD SELECTION
+                ====================*/
+                var period = self.$el.find('#current-period').empty();
+                self.$el.find('#current-period').append('<option value="9999999">Todos los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        updateJournalSelections: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            if(store != 9999999){
+                /*=============================
+                    ACCOUNT JOURNAL SELECTION
+                =============================*/
+                var journal = self.$el.find('#current-journal').empty();
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                _.each(self.AccountJournal,function(item){
+                    if(parseFloat(store) == item.store_ids){
+                        self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*=============================
+                    ACCOUNT JOURNAL SELECTION
+                =============================*/
+                var journal = self.$el.find('#current-journal').empty();
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                _.each(self.AccountJournal,function(item){
+                    self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        updatePeriodSelections: function () {
+            var self = this;
+            var period = self.$el.find('#current-period').val();
+            if(period != 9999999){
+                self.$el.find('#current-date').val(9999999);
+                self.$el.find('#current-date').prop('disabled','disabled');
+                self.$el.find('.datepicker').css('display','none');
+            }else{
+                self.$el.find('#current-date').prop('disabled',false);
+            }
+        },
+
+        /*====================================================================
+            GET RES COMPANY
+        ====================================================================*/
+        getResCompany: function (id) {
+            var self = this;
+            return _.filter(self.ResCompany,function (item) {
+                return item.id == id;
+            })
+        },
+
+        /*====================================================================
+            GET RES CURRENCY BASE
+        ====================================================================*/
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrency,function (item) {
+                return item.id === id;
+            })
+        },
+
+
+        /*====================================================================
+            GET ACCOUNT INVOICE LINE
+        ====================================================================*/
+        getAccountInvoiceLine: function (id) {
+            var self = this;
+            return _.filter(self.AccountInvoiceLine,function (item) {
+                return item.invoice_id === id;
+            })
+        },
+
+        /*====================================================================
+            GET ACCOUNT MOVE LINE
+        ====================================================================*/
+        getAccountMoveLine: function (number) {
+            var self = this;
+            return _.filter(self.AccountMoveLine,function (item) {
+                return item.move_id[1] == number;
+            })
+        },
+
+        /*====================================================================
+            GET ACCOUNT VOUCHER
+        ====================================================================*/
+        getAccountVoucher: function (number) {
+            var self = this;
+            return _.filter(self.AccountVoucher,function (item) {
+                return item.reference == number;
+            })
+        },
+
+        /*============================
+            ACCOUNT DATA BY MONTH
+        ============================*/
+        getContent:function(mes) {
+            var self = this;
+            return _.flatten(_.filter(self.content,function (inv) {
+                return moment(inv.date).format('YYYY-MM') === moment(mes).format('YYYY-MM');
+            }));
+        },
+
+        /*============================
+            ACCOUNT DATA BY DAY
+        ============================*/
+        getContentByDay:function(date) {
+            var self = this;
+            return _.flatten(_.filter(self.content,function (inv) {
+                return moment(inv.date).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+            var self = this;
+            var data = [];
+            var info = [];
+            var payments = [];
+            var type = $('#current-type').val();
+            var company = $('#current-company').val();
+            if(company && company != 9999999){
+                var ResCompany = self.getResCompany(company).shift();
+                var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+            }else{
+                var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            }
+
+            /*
+            ==========================================
+                ACCOUNT INVOICE
+            ==========================================
+            */
+
+            var AccountInvoice = self.AccountInvoice;
+            _.each(AccountInvoice, function(item){
+                info = [];
+                payments = [];
+
+                var AccountInvoiceLine = self.getAccountInvoiceLine(item.id);
+                var AccountMoveLine = self.getAccountMoveLine(item.number);
+
+
+                var Currency = self.getResCurrency(item.invoice_currency[0]).shift();
+                var i = AccountMoveLine.length;
+                var x = AccountMoveLine.length;
+
+                _.each(AccountInvoiceLine, function(index){
+                    var price_unit = 0;
+                    var amount = 0;
+                    if(Currency.id != CurrencyBase.id){
+                        price_unit = accounting.formatMoney(index.price_unit_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_unit, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
+                        amount = accounting.formatMoney(index.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_subtotal, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
+                    }else{
+                        price_unit = accounting.formatMoney(index.price_unit_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                        amount = accounting.formatMoney(index.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                    }
+                    info.push({
+                        product_name : index.product_id[1],
+                        price_unit : price_unit,
+                        quantity : index.quantity,
+                        amount: amount,
+                    });
+                });
+
+                _.each(AccountMoveLine, function(index){
+
+                    var amount = 0;
+                    var date;
+
+                    if(Currency.id != CurrencyBase.id){
+                        amount = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_subtotal, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
+                    }else{
+                        amount = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                    };
+                    var state = 'No Pagado';
+                    if(index.reconcile_ref){
+                        if(index.amount_residual == 0){
+                            state = 'Pagado'
+                        };
+                        if(index.amount_residual > 0){
+                            var value = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                            state = 'Parcialmente Amortizado de' + ' ( ' + value + ' )';
+                        };
+                    };
+                    date = moment(index.date_maturity).format('DD/MM/YYYY');
+
+                    if(state == 'No Pagado'){
+                        if(index.date_maturity < moment().format('YYYY-MM-DD')){
+                            date = moment(index.date_maturity).format('DD/MM/YYYY') + ' (vencido) ';
+                        };
+                    };
+
+                    var AccountVoucher = self.getAccountVoucher(index.move_id[1]);
+
+                        if(AccountVoucher.length > 0){
+                            _.each(AccountVoucher, function(item2){
+                                var CurrencyVoucher = self.getResCurrency(item2.currency_id[0]).shift();
+                                var amount_pagado = 0;
+                                if(CurrencyVoucher.id != CurrencyBase.id){
+                                    amount_pagado = accounting.formatMoney(item2.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(item2.amount, '', CurrencyVoucher.decimal_places, CurrencyVoucher.thousands_separator, CurrencyVoucher.decimal_separator) +')';
+                                }else{
+                                    amount_pagado = accounting.formatMoney(item2.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                                }
+                                payments.push({
+                                    date_maturity : date,
+                                    user : item2.create_uid,
+                                    journal_name : item2.journal_id[1],
+                                    amount : amount_pagado,
+                                    amount_saldo: accounting.formatMoney(index.amount_residual, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                                    state : state,
+                                    date : moment(item2.date).format('DD/MM/YYYY'),
+                                });
+                            });
+                        }else{
+
+                        payments.push({
+                            date_maturity : date,
+                            user : "",
+                            journal_name : "",
+                            amount : 0,
+                            amount_saldo: amount,
+                            state : state,
+                            date : "",
+                        });
+                        }
+
+                    // info.push({
+                    //     date : date,
+                    //     name : 'Cuota ' + i +' / ' + x,
+                    //     state : state,
+                    //     amount: amount,
+                    // });
+                    // i--;
+                });
+
+                var residual_total = 0;
+                var amount_untaxed_total = 0;
+                var amount_tax_total = 0;
+                var amount_total = 0;
+                var pasadoMonth;
+
+                pasadoMonth = moment(item.date_due).subtract(1, 'month').format('DD/MM/YYYY');
+
+                if(Currency.id != CurrencyBase.id){
+                    residual_total = accounting.formatMoney(item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + '  (' + accounting.formatMoney(item.residual, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) + ')';
+                    amount_total = accounting.formatMoney(item.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + '  (' + accounting.formatMoney(item.amount_total, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) + ')';
+                }else{
+                    residual_total = accounting.formatMoney(item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                    amount_total = accounting.formatMoney(item.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
+                }
+
+                data.push({
+                    /*=======================
+                        IDS
+                    =======================*/
+                    id : item.id,
+                    /*=======================
+                        INFO
+                    =======================*/
+                    number : item.number,
+                    date_invoice : moment(item.date_invoice).format('DD/MM/YYYY'),
+                    date : moment(item.date_invoice).format('YYYY-MM-DD'),
+                    date_past : moment(item.date_due).subtract(1, 'month').format('DD/MM/YYYY'),
+                    date_due : moment(item.date_due).format('DD/MM/YYYY'),
+                    user_id : item.user_id[1],
+                    partner_id : self.valorNull(item.partner_id[1]),
+                    residual_total : residual_total,
+                    amortized_total: accounting.formatMoney(item.amount_total_currency - item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    amount_total : amount_total,
+                    /*=======================
+                        VALORES SIN FORMATEAR
+                    =======================*/
+                    residual : item.residual_currency,
+                    amortized: item.amount_total_currency - item.residual_currency,
+                    amount : item.amount_total_currency,
+                    /*==============================
+                        TOTAL FOOTER CONFIGURATION
+                    ==============================*/
+                    decimal_places : CurrencyBase.decimal_places,
+                    thousands_separator: CurrencyBase.thousands_separator,
+                    decimal_separator: CurrencyBase.decimal_separator,
+                    /*==============================
+                        DATA
+                    ==============================*/
+                    info : info,
+                    payments : payments,
+                });
+            });
+
+            data.sort(function (a, b) {
+                if (a.date > b.date) {
+                    return -1;
+                }
+                if (a.date < b.date) {
+                    return 1;
+                }
+                return 0;
+            });
+            self.content = data;
+            self.loadTable(data);
+            self.BuildChartByPeriod();
+        },
+
+        /*====================================================================
+            BUILD CHART BY PERIOD
+        ====================================================================*/
+        BuildChartByPeriod: function(){
+            var self = this;
+            var data = [];
+            var label = [];
+            var body = [];
+            var period = self.$el.find('#current-period').val();
+            var date = self.$el.find('#current-date').val();
+            var AccountPeriod = self.AccountPeriod;
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            /*
+            =============================================================================
+                GRAFICAR TENIENDO EN CUENTA EL PERIODO
+            =============================================================================
+            */
+            if(period != 9999999){
+                var range = _.filter(self.AccountPeriod,function (inv) {
+                    return inv.id == parseInt(period);
+                });
+                var date = range[0].date_start;
+                for (var i = 0; i < 32; i++) {
+                    if(i > 0){
+                        date = moment(date).add(1,'day').format('YYYY-MM-DD');
+                    }
+                    if(date > range[0].date_stop){
+                        break;
+                    }
+                    var data = self.getContentByDay(date);
+                    if(data.length > 0){
+                        var total = _.reduce(_.map(data,function(item) {
+                            return item.amount;
+                        }),function(memo, num) {
+                            return memo + num;
+                        },0);
+                        label.push(moment(date).format('DD/MM/YYYY'));
+                        body.push(total);
+                    }
+                }
+                self.$el.find('.chart-container').css('display','block');
+            }
+
+            /*
+            =============================================================================
+                GRAFICAR TENIENDO EN CUENTA EL RANGO DE FECHAS
+            =============================================================================
+            */
+            if(date == 'range'){
+
+                // DESDE
+                var desde = self.$el.find('#from').val();
+                desde = desde.split('/');
+                desde = (desde[2] + "-" + desde[1] + "-" + desde[0]);
+
+                // HASTA
+                var hasta = self.$el.find('#to').val();
+                if(hasta){
+                    hasta = hasta.split('/');
+                    hasta = (hasta[2] + "-" + hasta[1] + "-" + hasta[0]);
+                }else{
+                    hasta = moment().format('YYYY-MM-DD');
+                }
+                // DETERMINAR RANGO DE FECHAS
+                const diff = moment(hasta).diff(moment(desde),'days');
+
+                if(diff > 0 & diff < 32){
+                    self.$el.find('.chart-container').css('display','block');
+                    var date = desde;
+                    for (var i = 0; i < 32; i++) {
+                        if(i > 0){
+                            date = moment(date).add(1,'day').format('YYYY-MM-DD');
+                        }
+                        if(date > hasta){
+                            break;
+                        }
+                        var data = self.getContentByDay(date);
+                        if(data.length > 0){
+                            var total = _.reduce(_.map(data,function(item) {
+                                return item.amount;
+                            }),function(memo, num) {
+                                return memo + num;
+                            },0);
+                            label.push(moment(date).format('DD/MM/YYYY'));
+                            body.push(total);
+                        }
+                    }
+                    self.$el.find('.chart-container').css('display','block');
+                }
+                if(diff > 31){
+                    self.$el.find('.chart-container').css('display','block');
+                    _.each(AccountPeriod, function(item){
+                        var data = self.getContent(item.date_start);
+                        if(data.length > 0){
+                            var total = _.reduce(_.map(data,function(item) {
+                                return item.amount;
+                            }),function(memo, num) {
+                                return memo + num;
+                            },0);
+                            label.push(item.name);
+                            body.push(total);
+                        }
+                    });
+                    self.$el.find('.chart-container').css('display','block');
+                }
+                if(diff == 0){
+                    self.$el.find('.chart-container').css('display','none');
+                }
+            }
+            /*
+            =============================================================================
+                OCULTAR GRAFICO EN EL CASO DE QUE EL FILTRO SEA AYER U HOY
+            =============================================================================
+            */
+            if(date == 'today' || date == 'yesterday'){
+                self.$el.find('.chart-container').css('display','none');
+            }
+            /*
+            =============================================================================
+                GRAFICAR TENIENDO EN CUENTA EL MES ACTUAL
+            =============================================================================
+            */
+            if(date == 'currentMonth'){
+                self.$el.find('.chart-container').css('display','block');
+                var date = moment().startOf('month').format('YYYY-MM-DD');
+                var hasta = moment().endOf('month').format('YYYY-MM-DD');
+                for (var i = 0; i < 32; i++) {
+                    if(i > 0){
+                        date = moment(date).add(1,'day').format('YYYY-MM-DD');
+                    }
+                    if(date > hasta){
+                        break;
+                    }
+                    var data = self.getContentByDay(date);
+                    if(data.length > 0){
+                        var total = _.reduce(_.map(data,function(item) {
+                            return item.amount;
+                        }),function(memo, num) {
+                            return memo + num;
+                        },0);
+                        label.push(moment(date).format('DD/MM/YYYY'));
+                        body.push(total);
+                    }
+                }
+                self.$el.find('.chart-container').css('display','block');
+            }
+            /*
+            =============================================================================
+                GRAFICAR TENIENDO EN CUENTA EL MES PASADO
+            =============================================================================
+            */
+            if(date == 'lastMonth'){
+                self.$el.find('.chart-container').css('display','block');
+                var date = moment().add(-1,'month').startOf('month').format('YYYY-MM-DD');
+                var hasta = moment().add(-1,'month').endOf('month').format('YYYY-MM-DD');
+                for (var i = 0; i < 32; i++) {
+                    if(i > 0){
+                        date = moment(date).add(1,'day').format('YYYY-MM-DD');
+                    }
+                    if(date > hasta){
+                        break;
+                    }
+                    var data = self.getContentByDay(date);
+                    if(data.length > 0){
+                        var total = _.reduce(_.map(data,function(item) {
+                            return item.amount;
+                        }),function(memo, num) {
+                            return memo + num;
+                        },0);
+                        label.push(moment(date).format('DD/MM/YYYY'));
+                        body.push(total);
+                    }
+                }
+                self.$el.find('.chart-container').css('display','block');
+            }
+            /*
+            =============================================================================
+                GRAFICAR SIN FILTRO
+            =============================================================================
+            */
+            if(date == 9999999 & period == 9999999){
+                _.each(AccountPeriod, function(item){
+                    var data = self.getContent(item.date_start);
+                    if(data.length > 0){
+                        var total = _.reduce(_.map(data,function(item) {
+                            return item.amount;
+                        }),function(memo, num) {
+                            return memo + num;
+                        },0);
+                        label.push(item.name);
+                        body.push(total);
+                    }
+                });
+                self.$el.find('.chart-container').css('display','block');
+            }
+
+            var chart = new model.eiru_reports.ReportChartWidget(self);
+            chart.BuildLineChart(label,body,CurrencyBase);
+            self.$el.find('.report-form').css('display','block');
+            self.$el.find('.search-form').unblock();
+            self.$el.find('.report-form').unblock();
+        },
+
+        /*====================================================================
+            LOAD BOOTSTRAP TABLE
+        ====================================================================*/
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load', rowsTable);
+        },
+
+        /*====================================================================
+            PRINT PDF
+        ====================================================================*/
+        clickOnAction: function (e) {
+            var self = this;
+            var ResCompany;
+            var action = this.$el.find(e.target).val();
+            var company = $('#current-company').val();
+            if(company && company != 9999999){
+                ResCompany = self.getResCompany(company).shift();
+                var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+            }else{
+                ResCompany = self.ResCompany[0];
+                var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            }
+
+            var getColumns=[];
+            var rows=[];
+            var table = this.$el.find("#table");
+            var column = table.bootstrapTable('getVisibleColumns');
+            var row = table.bootstrapTable('getData');
+
+            var total = totalFormatter(row);
+            var amortized = totalAmortizedFormatter(row);
+            var residual = totalResidualFormatter(row);
+
+            row.push({
+                number : 'Totales',
+                amount_total : total,
+                amortized_total : amortized,
+                residual_total : residual,
+            });
+
+            if (action === 'pdf') {
+                var data = _.map(column, function (val){ return val.field});
+                _.each(_.map(column,function(val){
+                    return val}), function(item){
+                    getColumns.push([{
+                        title: item.title,
+                        dataKey: item.field
+                    }]);
+                });
+                /*
+                ============================================================
+                    CONFIGURACION DEL PDF
+                ============================================================
+                */
+                var pdf_title = 'Estado de Clientes.';
+                var pdf_type = '';
+                var pdf_name = 'estado_de_clientes_';
+                var pdf_columnStyles = {
+                    number :{columnWidth: 25, halign:'center'},
+                    date_past : {columnWidth: 18, halign:'center'},
+                    date_due : {columnWidth: 18, halign:'center'},
+                    partner_id : {halign:'left'},
+                    amount_total : {columnWidth: 20, halign:'right'},
+                    amortized_total : {columnWidth: 20, halign:'right'},
+                    residual_total : {columnWidth: 20, halign:'right'},
+                };
+                /*
+                ============================================================
+                    LLAMAR FUNCION DE IMPRESION
+                ============================================================
+                */
+                var pdf = new model.eiru_reports.ReportPdfWidget(self);
+                pdf.drawPDF(
+                    _.flatten(getColumns),
+                    row,
+                    ResCompany,
+                    pdf_title,
+                    pdf_type,
+                    pdf_name,
+                    pdf_columnStyles,
+                );
+            }
+        },
+    });
+}

+ 235 - 0
static/src/reports/report_account_pay.xml

@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportAccountPay">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Estado de Clientes</h1>
+            </div>
+
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:90%;">
+
+                <div class="row">
+                    <div class="col-lg-3 company filter-style">
+                        <label>Empresa</label>
+                        <select id="current-company" class="form-control form-control-sm"></select>
+                    </div>
+                    <div class="col-lg-3 store filter-style">
+                        <label>Sucursal</label>
+                        <select id="current-store" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 filter-style">
+                        <label>Periodo</label>
+                        <select id="current-period" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 journal filter-style">
+                        <label>Factura</label>
+                        <select id="current-journal" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 filter-style">
+                       <label>Fechas</label>
+                       <select id="current-date" class="form-control form-control-sm">
+                           <option value="9999999">Sin fechas</option>
+                           <option value="today">Hoy</option>
+                           <option value="yesterday">Ayer</option>
+                           <option value="currentMonth">Mes Actual</option>
+                           <option value="lastMonth">Mes Pasado</option>
+                           <option value="range">Busqueda Avanzada</option>
+                       </select>
+                   </div>
+                </div>
+                <div class="row" >
+                    <div class="datepicker" style="display:none;">
+                        <div class="col-lg-3 filter-style col-md-offset-3">
+                            <div class="input-group">
+                                <span class="input-group-addon" id="basic-addon1">Desde</span>
+                                <input type="text" id="from" class="form-control" aria-describedby="basic-addon1"/>
+                            </div>
+                        </div>
+                        <div class="col-lg-3 filter-style">
+                            <div class="input-group">
+                                <span class="input-group-addon" id="basic-addon1">Hasta</span>
+                                <input type="text" id="to" class="form-control" aria-describedby="basic-addon1"/>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="row">
+                    <div class="text-center" style="padding-top:20px;">
+                        <a id="generate" type="button" class="btn btn-danger" aria-label="Left Align" style="color:#fff;display:none;">
+                          Generar
+                        </a>
+                    </div>
+                    <br/>
+                </div>
+            </div>
+
+            <div class="report-form" style="display:none;">
+
+                <div class="chart-container center-block" style="padding-top:10px; height:300px;width:90%;">
+                    <canvas class="reporting-chart"></canvas>
+                </div>
+                <div id="toolbar">
+                    <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+                </div>
+                <div class="container" style="width:90%;">
+                    <table id="table"
+                        data-pagination="true"
+                        data-toggle="table"
+                        data-toolbar="#toolbar"
+                        data-show-columns="true"
+                        data-height="auto"
+                        data-classes="table table-condensed  table-no-bordered"
+                        data-row-style="rowStyle"
+                        data-search="true"
+                        data-show-export="true"
+                        data-show-toggle="true"
+                        data-pagination-detail-h-align="left"
+                        data-show-footer="true"
+                        data-footer-style="footerStyle"
+                        data-buttons-class="oe_button oe_form_button oe_highlight"
+                        data-show-pagination-switch="true"
+                        data-page-size="10"
+                        data-search-on-enter-key="true"
+                        data-undefined-text=" "
+                        data-detail-view="true"
+                        data-detail-formatter="detailFormatter"
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="number" data-align="center" data-footer-formatter="Totales">Factura</th>
+                                <th data-field="partner_id" data-align="left">Cliente</th>
+                                <th data-field="date_past" data-align="center">Desde</th>
+                                <th data-field="date_due" data-align="center">Hasta</th>
+                                <th data-field="amount_total"
+                                    data-align="right"
+                                    data-footer-formatter="totalFormatter"
+                                    data-width="12%">
+                                    Total
+                                </th>
+                                <th data-field="amortized_total"
+                                    data-align="right"
+                                    data-footer-formatter="totalResidualFormatter"
+                                    data-width="12%">
+                                    Amortizado
+                                </th>
+                                <th data-field="residual_total"
+                                    data-align="right"
+                                    data-footer-formatter="totalResidualFormatter"
+                                    data-width="12%">
+                                    A Cobrar
+                                </th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+
+
+            <script>
+                <!--
+                    DETAIL
+                -->
+                function detailFormatter(index, row) {
+                    var html = [];
+                    html.push('<div class="panel panel-info">');
+                    html.push('<div class="panel-heading">Detalles de la factura</div>');
+                    html.push('<div class="panel-body">');
+                    html.push('<table class="table table-condensed table-no-bordered">');
+                    html.push('<thead style="background:none;"><tr><th>Producto</th><th style="text-align:right;">Precio Unitario</th><th style="text-align:right;">Cantidad</th><th style="text-align:right;">Total</th></tr></thead>');
+                    if(row.info.length > 0){
+                        _.each(row.info,function(item) {
+                            html.push('<tr><td>' + item.product_name + '</td><td style="text-align:right;">' + item.price_unit + '</td><td style="text-align:right;">' + item.quantity + '</td><td style="text-align:right;">' + item.amount + '</td></tr>');
+                        });
+                    }
+                    html.push('</table>');
+                    html.push('</div></div>');
+                    if(row.payments.length > 0){
+                        html.push('<div class="panel panel-second-style">');
+                        html.push('<div class="panel-heading panel-header-second-style">Detalles</div>');
+                        html.push('<div class="panel-body">');
+                        html.push('<table class="table table-condensed table-no-bordered">');
+                        html.push('<thead style="background:none;"><tr><th>Vencimiento</th><th>Responsable</th><th>Método de Pago</th><th>Estado</th><th style="text-align:center;">Monto Pagado</th><th style="text-align:center;">Saldo</th><th>Fecha Pago</th></tr></thead>');
+                        _.each(row.payments,function(item) {
+                            html.push('<tr><td>' + item.date_maturity + '</td><td>' + item.user + '</td><td>' + item.journal_name + '</td><td>' + item.state + '</td><td style="text-align:right;">' + item.amount + '</td><td style="text-align:right;">' + item.amount_saldo + '</td><td>' + item.date + '</td></tr>');
+                        });
+                        html.push('</table>');
+                        html.push('</div></div>');
+                    }
+                    return html.join('');
+                }
+                <!--
+                    TOTAL
+                -->
+                function totalFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.amount);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    AMORTIZADO
+                -->
+                function totalAmortizedFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.amortized);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    RESIDUAL TOTAL
+                -->
+                function totalResidualFormatter(rowsTable) {
+                    var self = this;
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.residual);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold"
+                        }
+                    };
+                };
+
+            </script>
+        </div>
+    </t>
+</template>

+ 5 - 0
static/src/xml/eiru_reporting.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<template xml:space="preserve">
+    
+</template>

+ 5 - 0
static/src/xml/eiru_reporting_base.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<template xml:space="preserve">
+    
+</template>

+ 17 - 0
templates.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <template id="eiru_reports_positiva_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+
+                <!-- configuration < main > -->
+                <script type="text/javascript" src="/eiru_reports_positiva/static/src/js/main.js" />
+                <script type="text/javascript" src="/eiru_reports_positiva/static/src/js/reporting_base.js" />
+
+                <!-- venta_positiva -->
+                <script type="text/javascript" src="/eiru_reports_positiva/static/src/js/reports/report_account_pay.js"/>
+
+            </xpath>
+        </template>
+    </data>
+</openerp>

+ 15 - 0
views/actions.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+
+		<!--======================
+			ESTADO DE CLIENTES
+		=======================-->
+		<record id="account_pay_action" model="ir.actions.client">
+			<field name="name">Estado de Clientes</field>
+			<field name="tag">eiru_reports_positiva.account_pay_action</field>
+		</record>
+
+
+    </data>
+</openerp>

+ 18 - 0
views/menus.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+      <!--
+       =======================================================================
+           Positiva
+       =======================================================================
+       -->
+       <menuitem id="positiva_parent_menu" name="Positiva" parent="eiru_reports.eiru_reports_main_menu" sequence="6"/>
+
+       <!--============================
+           Resumen de Ventas
+       =============================-->
+       <menuitem id="account_pay_menu" parent="positiva_parent_menu" name="Estado de Clientes" action="account_pay_action" sequence="11"/>
+
+
+    </data>
+</openerp>

+ 15 - 0
views/payment_term.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- <openerp>
+  <data>
+    <record model="ir.ui.view" id="view_payment_term_form2">
+      <field name="name">view_payment_term_form2</field>
+      <field name="model">account.payment.term</field>
+      <field name="inherit_id" ref="account.view_payment_term_form" />
+      <field name="arch" type="xml">
+        <field name="active" position="after">
+          <field name="check_credit"/>
+        </field>
+      </field>
+    </record>
+  </data>
+</openerp> -->