deisy 6 سال پیش
کامیت
957320467f

+ 3 - 0
__init__.py

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

BIN
__init__.pyc


+ 25 - 0
__openerp__.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "Eiru Reports - Dental G6",
+    '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
models.pyc


BIN
static/description/icon.png


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

@@ -0,0 +1,34 @@
+openerp.eiru_reports_g6= function (instance) {
+    "use strict";
+
+    var reporting = instance.eiru_reports_g6;
+
+    reporting_base(instance,reporting);
+
+    try {
+        report_seller(reporting);
+        report_type_income(reporting);
+        report_receipt_dental(reporting);
+        report_expenses_dental(reporting);
+    } catch (e) {
+        // ignorar error
+    }
+
+    // Venta / Costo / Utilidad por vendedores
+
+    instance.web.client_actions.add('eiru_reports_g6.seller_action', 'instance.eiru_reports_g6.ReportSellerWidget');
+
+    // Ingreso Total por tipo de Ingreso
+
+    instance.web.client_actions.add('eiru_reports_g6.type_income_action', 'instance.eiru_reports_g6.ReportTypeIncomeWidget');
+
+    // Cobro por vendedor contado-credito
+
+    instance.web.client_actions.add('eiru_reports_g6.receipt_dental_action', 'instance.eiru_reports_g6.ReportPaymentDentalWidget');
+
+    // Gastos
+
+    instance.web.client_actions.add('eiru_reports_g6.expenses_dental_action', 'instance.eiru_reports_g6.ReportExpensesDentalWidget');
+
+
+}

+ 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;
+        }
+    });
+}

+ 549 - 0
static/src/js/reports/report_expenses_dental.js

@@ -0,0 +1,549 @@
+function report_expenses_dental(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportExpensesDentalWidget = reporting.Base.extend({
+        template: 'ReportExpensesDental',
+        rowsData :[],
+        content :[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'click-row.bs.table #table' : 'clickAnalysisDetail',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateStoreSelections',
+            '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');
+            }
+
+        },
+
+        clickAnalysisDetail: function(e, row, $element,field){
+            if (field == 'supplier_invoice_number' || field == 'number'){
+                this.do_action({
+                    name:"Factura",
+                    type: 'ir.actions.act_window',
+                    res_model: "account.invoice",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+
+        fetchInitial: function () {
+            var self = this;
+            this.fetchResPartner().then(function(ResPartner) {
+                return ResPartner;
+            }).then(function (ResPartner) {
+                self.ResPartner = ResPartner;
+                if(ResPartner.length > 1){
+                    self.$el.find('#current-partner').append('<option value="9999999">Todos los gastos</option>');
+                    _.each(ResPartner,function(item){
+                        self.$el.find('#current-partner').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.partner').css('display','none');
+                }
+                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.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.BuildTable();
+            });
+        },
+
+        /*=====================================================================
+            RES PARTNER
+        =====================================================================*/
+        fetchResPartner: function() {
+            var self = this;
+            var domain = [['active', '=', true],['supplier','=',true]];
+            var ResPartner = new model.web.Model('res.partner');
+            return ResPartner.call('getResPartner',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            ACCOUNT PERIOD
+        =====================================================================*/
+        fetchAccountPeriod: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var domain = [['special','=',false]];
+            var fields =['id', 'name', 'date_start','date_stop','company_id'];
+            var AccountPeriod = new model.web.Model('account.period');
+            AccountPeriod.query(fields).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 INVOICE
+        ====================================================================*/
+        fetchAccountInvoice: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var period = self.$el.find('#current-period').val();
+            var partner = self.$el.find('#current-partner').val();
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').val();
+            var domain = [
+                ['state', 'in',['open','paid']],
+                ['type', '=', 'in_invoice'],
+                ['origin', '=', null],
+            ];
+            if(period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+            if(partner && partner != 9999999){
+                domain.push(['partner_id','=',parseInt(partner)]);
+            }
+
+            if(date && date != 9999999){
+
+                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('getAccountInvoiceDental',[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(parseInt(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">Todas los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    if(parseInt(company) == item.company_id[0]){
+                        self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+                /*====================
+                    PARTNER SELECTION
+                ====================*/
+                var partner = self.$el.find('#current-partner').empty();
+                self.$el.find('#current-partner').append('<option value="9999999">Todas los gastos</option>');
+                _.each(self.ResPartner,function(item){
+                    if(parseInt(company) == item.company_id[0]){
+                        self.$el.find('#current-partner').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">Todas los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                /*====================
+                    PARTNER SELECTION
+                ====================*/
+                var partner = self.$el.find('#current-partner').empty();
+                self.$el.find('#current-partner').append('<option value="9999999">Todas los gastos</option>');
+                _.each(self.ResPartner,function(item){
+                    self.$el.find('#current-partner').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        updateStoreSelections: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            if(store != 9999999){
+                /*====================
+                    PARTNER SELECTION
+                ====================*/
+                var partner = self.$el.find('#current-partner').empty();
+                self.$el.find('#current-partner').append('<option value="9999999">Todas los gastos</option>');
+                _.each(self.ResPartner,function(item){
+                    if(parseInt(store) == item.store_id[0]){
+                        self.$el.find('#current-partner').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*====================
+                    PARTNER SELECTION
+                ====================*/
+                var partner = self.$el.find('#current-partner').empty();
+                self.$el.find('#current-partner').append('<option value="9999999">Todas los gastos</option>');
+                _.each(self.ResPartner,function(item){
+                    self.$el.find('#current-partner').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        /*====================================================================
+            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;
+            })
+        },
+
+        /*============================
+            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');
+            }));
+        },
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+            var self = this;
+            var data = [];
+            var AccountInvoice = self.AccountInvoice;
+            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();
+            }
+            _.each(AccountInvoice, function(item){
+
+                data.push({
+                    id : item.id,
+                    reference : self.valorNull(item.reference),
+                    number : item.number,
+                    date_invoice : moment(item.date_invoice).format('DD/MM/YYYY'),
+                    partner_id : item.partner_id[1],
+                    amount_untaxed_total : accounting.formatMoney(item.amount_untaxed_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    amount_tax_total : accounting.formatMoney(item.amount_tax_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),
+                    /*
+                    ============================
+                        VALORES SIN FORMATAR
+                    ============================
+                    */
+
+                    amount_untaxed : item.amount_untaxed_currency,
+                    amount_tax : item.amount_tax_currency,
+                    amount : item.amount_total_currency,
+                    /*==============================
+                        TOTAL FOOTER CONFIGURATION
+                    ==============================*/
+                    decimal_places : CurrencyBase.decimal_places,
+                    thousands_separator: CurrencyBase.thousands_separator,
+                    decimal_separator: CurrencyBase.decimal_separator,
+                });
+            });
+            self.content = data;
+            self.loadTable(data);
+            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 amount_untaxed = _.reduce(_.map(row, function (map) {
+                return map.amount_untaxed;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var amount_tax = _.reduce(_.map(row, function (map) {
+                return map.amount_tax;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total = _.reduce(_.map(row, function (map) {
+                return map.amount;
+            }), function (memo, num) {
+                return memo + num;
+            });
+            row.push({
+                partner_id : 'Totales',
+                amount_untaxed_total : accounting.formatMoney(amount_untaxed, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                amount_tax_total : accounting.formatMoney(amount_tax, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                amount_total : accounting.formatMoney(total, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+            });
+            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 = 'Gastos.';
+                var pdf_type = '';
+                var pdf_name = 'gastos_';
+                var pdf_columnStyles = {
+                    reference :{halign:'left'},
+                    number : {halign:'left'},
+                    date_invoice : {halign:'left'},
+                    partner_id : {halign:'left'},
+                    amount_untaxed_total : {columnWidth: 30, halign:'right'},
+                    amount_tax_total : {columnWidth: 30, halign:'right'},
+                    amount_total : {columnWidth: 30, 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,
+                );
+            }
+        },
+    });
+}

+ 611 - 0
static/src/js/reports/report_receipt_dental.js

@@ -0,0 +1,611 @@
+function report_receipt_dental(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportPaymentDentalWidget = reporting.Base.extend({
+        template: 'ReportPaymentDental',
+        rowsData :[],
+        content :[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateJournalSelections',
+            '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.fetchResCompany().then(function (ResCompany) {
+                return ResCompany;
+            }).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 > 0){
+                    self.$el.find('#current-journal').append('<option value="9999999">Todos los vendedores</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.fetchAccountJournal().then(function(AccountJournal) {
+                return AccountJournal;
+            }).then(function (AccountJournal) {
+                self.AccountJournal = AccountJournal;
+                return self.fetchAccountVoucher();
+            }).then(function(AccountVoucher){
+                self.AccountVoucher = AccountVoucher;
+                return self.fetchAccountInvoice();
+            }).then(function (AccountInvoice){
+                self.AccountInvoice = AccountInvoice;
+                return self.BuildTable();
+            });
+        },
+
+
+
+        /*====================================================================
+            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 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 journal = self.$el.find('#current-journal').val();
+            var domain = [['active','=',true],['type','=','sale']];
+            if(journal && journal != 9999999){
+                domain.push(['id','=',parseInt(journal)]);
+            }
+            var AccountJournal = new model.web.Model('account.journal');
+            return AccountJournal.call('getAccountJournal',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            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 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;
+        },
+
+        /*====================================================================
+            ACCOUNT VOUCHER
+        ====================================================================*/
+        fetchAccountVoucher: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            var period = self.$el.find('#current-period').val();
+            var company = self.$el.find('#current-company').val();
+
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').val();
+
+            if(store && store != 9999999){
+                var journal_ids = _.map(_.filter(self.AccountVoucher,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', '=','posted'],
+                ['type', '=', 'receipt'],
+            ];
+
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+
+            if(period && period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+
+            if(date && date != 9999999){
+
+                if(desde){
+                    var date = desde.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date','>=',date]);
+                }
+
+                if(hasta){
+                    var date = hasta.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date','<=',date]);
+                }
+
+                if(date == 'today'){
+                    var today = moment().format('YYYY-MM-DD');
+                    domain.push(['date','=',today]);
+                }
+
+                if(date == 'yesterday'){
+                    var yesterday = moment().add(-1,'days').format('YYYY-MM-DD');
+                    domain.push(['date','=',yesterday]);
+                }
+
+                if(date == 'currentMonth'){
+                    var currentMonth = moment().format('YYYY-MM');
+                    domain.push(['date','like',currentMonth]);
+                }
+
+                if(date == 'lastMonth'){
+                    var lastMonth = moment().add(-1,'months').format('YYYY-MM');
+                    domain.push(['date','like',lastMonth]);
+                }
+            }
+
+            var AccountVoucher = new model.web.Model('account.voucher');
+            return AccountVoucher.call('getAccountVoucherDental',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE
+        ====================================================================*/
+        fetchAccountInvoice: function () {
+            var self = this;
+            var domain = [
+                ['state', 'in',['open','paid']],
+                ['type', '=', 'out_invoice'],
+            ];
+
+            var AccountInvoice = new model.web.Model('account.invoice');
+            return AccountInvoice.call('getAccountInvoiceDental',[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('getAccountInvoiceLineDental',[domain], {
+                      context: new model.web.CompoundContext()
+                  });
+              },
+
+
+        /*====================================================================
+            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 sucursellers</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 sucursellers</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">Todas 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>');
+                });
+            }
+        },
+
+        /*====================================================================
+            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
+        ====================================================================*/
+        getAccountInvoice: function (id, reference) {
+          var self = this;
+          return _.filter(self.AccountInvoice,function (item) {
+
+            return item.journal_id[0] === id && item.number === reference;
+          });
+        },
+
+        /*====================================================================
+            GET ACCOUNT VOUCHER
+        ====================================================================*/
+        getAccountVoucher: function (id) {
+          var self = this;
+          return _.filter(self.AccountVoucher,function (item) {
+            return item.journal_id === id;
+          });
+        },
+
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+          var self = this;
+          var data = [];
+          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();
+          };
+
+          var AccountJournal = self.AccountJournal;
+          _.each(AccountJournal,function(item) {
+            var total_cash = 0;
+            var total_credit = 0;
+            var total_amount = 0;
+
+
+            var AccountVoucher = self.AccountVoucher;
+            _.each(AccountVoucher, function(item2){
+
+                var AccountInvoice = self.getAccountInvoice(item.id, item2.reference);
+                _.each(AccountInvoice, function(item3){
+
+                  if(item3.payment_term.id && item3.payment_term.check_credit == true){
+                    total_credit = total_credit + item2.amount;
+                  }
+                  else{
+                    total_cash = total_cash + item2.amount;
+                  }
+                });
+            });
+
+            total_amount = total_cash + total_credit;
+
+            if(total_amount > 0){
+
+              data.push({
+
+                id: item.id,
+                name: item.name,
+                total_cash : accounting.formatMoney(total_cash,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_credit : accounting.formatMoney(total_credit,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_amount : accounting.formatMoney(total_amount,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+
+
+                /*=======================
+                        VALORES SIN FORMATEAR
+                    =======================*/
+                total_cash_no_format : total_cash,
+                total_credit_no_format : total_credit,
+                total_amount_no_format : total_amount,
+
+
+                /*==============================
+                      TOTAL FOOTER CONFIGURATION
+                  ==============================*/
+                decimal_places : CurrencyBase.decimal_places,
+                thousands_separator: CurrencyBase.thousands_separator,
+                decimal_separator: CurrencyBase.decimal_separator,
+
+              });
+            }
+          });
+
+          self.content = data;
+          self.loadTable(data);
+          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 cash_total = _.reduce(_.map(row, function (map) {
+                return map.total_cash_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var credit_total = _.reduce(_.map(row, function (map) {
+                return map.total_credit_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total_amount = _.reduce(_.map(row, function (map) {
+                return map.total_amount_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            row.push({
+                name: 'Totales',
+                total_cash: accounting.formatMoney(cash_total, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_credit: accounting.formatMoney(credit_total, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_amount: accounting.formatMoney(total_amount, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+
+            })
+
+            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 = 'Cobro por vendedor';
+                var pdf_type = '';
+                var pdf_name = 'cobro_por_vendedor_';
+                var pdf_columnStyles =  {
+                  name : {columnWidth: '25%', halign:'left'},
+                  total_cash : {columnWidth: '25%', halign:'right'},
+                  total_credit : {columnWidth: '25%', halign:'right'},
+                  total_amount : {columnWidth: '25%', 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,
+                );
+            }
+        },
+    });
+}

+ 633 - 0
static/src/js/reports/report_seller.js

@@ -0,0 +1,633 @@
+function report_seller(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportSellerWidget = reporting.Base.extend({
+        template: 'ReportSeller',
+        rowsData :[],
+        content :[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateJournalSelections',
+            '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.fetchResCompany().then(function (ResCompany) {
+                return ResCompany;
+            }).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 > 0){
+                    self.$el.find('#current-journal').append('<option value="9999999">Todos los vendedores</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.fetchAccountJournal().then(function(AccountJournal) {
+                return AccountJournal;
+            }).then(function (AccountJournal) {
+                self.AccountJournal = AccountJournal;
+                return self.fetchAccountInvoice();
+            }).then(function (AccountInvoice){
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchAccountInvoiceLine();
+            }).then(function (AccountInvoiceLine){
+                self.AccountInvoiceLine = AccountInvoiceLine;
+                return self.BuildTable();
+            });
+        },
+
+
+
+        /*====================================================================
+            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 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 journal = self.$el.find('#current-journal').val();
+            var domain = [['active','=',true],['type','=','sale']];
+            if(journal && journal != 9999999){
+                domain.push(['id','=',parseInt(journal)]);
+            }
+            var AccountJournal = new model.web.Model('account.journal');
+            return AccountJournal.call('getAccountJournal',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            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 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;
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE
+        ====================================================================*/
+        fetchAccountInvoice: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            var period = self.$el.find('#current-period').val();
+            var company = self.$el.find('#current-company').val();
+
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').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(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+
+            if(period && period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+
+            if(date && date != 9999999){
+
+                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('getAccountInvoiceDental',[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('getAccountInvoiceLineDental',[domain], {
+                      context: new model.web.CompoundContext()
+                  });
+              },
+
+
+        /*====================================================================
+            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 sucursellers</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 sucursellers</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">Todas 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>');
+                });
+            }
+        },
+
+        /*====================================================================
+            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
+        ====================================================================*/
+        getAccountInvoice: function (id) {
+          var self = this;
+          return _.filter(self.AccountInvoice,function (item) {
+            return item.journal_id[0] === id;
+          });
+        },
+
+      /*====================================================================
+           GET ACCOUNT INVOICE LINE
+       ====================================================================*/
+       getAccountInvoiceLine: function (id) {
+         var self = this;
+         return _.filter(self.AccountInvoiceLine, function(item){
+             return item.invoice_id === id;
+         });
+       },
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+          var self = this;
+          var data = [];
+          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();
+          };
+
+          var AccountJournal = self.AccountJournal;
+          _.each(AccountJournal,function(item) {
+            var total_cash = 0;
+            var total_credit = 0;
+            var total_amount = 0;
+            var total_cost = 0;
+            var utility = 0;
+            var cost_percent = 0;
+            var sale_percent = 0;
+
+            var AccountInvoice = self.getAccountInvoice(item.id);
+            _.each(AccountInvoice,function(item2) {
+
+              if(item2.payment_term.id && item2.payment_term.check_credit == true){
+                total_credit = total_credit + item2.amount_total;
+              }
+              else{
+                total_cash = total_cash + item2.amount_total;
+              }
+
+
+              var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
+              _.each(AccountInvoiceLine, function(line_item){
+                total_cost = total_cost + (line_item.product_id.standard_price * line_item.quantity);
+              });
+            });
+
+            total_amount = total_cash + total_credit;
+            utility = total_amount - total_cost;
+            cost_percent = utility * 100 / total_cost;
+            sale_percent = utility * 100 / total_amount;
+
+            if(total_amount > 0){
+
+              data.push({
+
+                id: item.id,
+                name: item.name,
+                total_cash : accounting.formatMoney(total_cash,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_credit : accounting.formatMoney(total_credit,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_amount : accounting.formatMoney(total_amount,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_cost : accounting.formatMoney(total_cost,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                utility : accounting.formatMoney(utility,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                cost_percent : accounting.formatNumber(cost_percent,2,".",",") + ' %',
+                sale_percent : accounting.formatNumber(sale_percent,2,".",",") + ' %',
+
+                /*=======================
+                        VALORES SIN FORMATEAR
+                    =======================*/
+                total_cash_no_format : total_cash,
+                total_credit_no_format : total_credit,
+                total_amount_no_format : total_amount,
+                total_cost_no_format : total_cost,
+                utility_no_format : utility,
+                cost_percent_no_format : cost_percent,
+                sale_percent_no_format : sale_percent,
+
+
+                /*==============================
+                      TOTAL FOOTER CONFIGURATION
+                  ==============================*/
+                decimal_places : CurrencyBase.decimal_places,
+                thousands_separator: CurrencyBase.thousands_separator,
+                decimal_separator: CurrencyBase.decimal_separator,
+
+              });
+            }
+          });
+
+          self.content = data;
+          self.loadTable(data);
+          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 cash_total = _.reduce(_.map(row, function (map) {
+                return map.total_cash_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var credit_total = _.reduce(_.map(row, function (map) {
+                return map.total_credit_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total_amount = _.reduce(_.map(row, function (map) {
+                return map.total_amount_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total_cost = _.reduce(_.map(row, function (map) {
+                return map.total_cost_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total_utility = _.reduce(_.map(row, function (map) {
+                return map.utility_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            var total_cost_percent = total_utility * 100 / total_cost;
+            var total_sale_percent = total_utility * 100 / total_amount;
+
+            row.push({
+                name: 'Totales',
+                total_cash: accounting.formatMoney(cash_total, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_credit: accounting.formatMoney(credit_total, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_amount: accounting.formatMoney(total_amount, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                total_cost: accounting.formatMoney(total_cost, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                utility: accounting.formatMoney(total_utility, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                cost_percent: accounting.formatNumber(total_cost_percent,2,CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' %',
+                sale_percent: accounting.formatNumber(total_sale_percent,2,CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' %',
+
+            })
+
+            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 = 'Venta/Costo/Utilidad por vendedores';
+                var pdf_type = '';
+                var pdf_name = 'venta_costo_utilidad_por_vendedores_';
+                var pdf_columnStyles =  {
+                  name : {columnWidth: 30, halign:'left'},
+                  total_cash : {columnWidth: 25, halign:'right'},
+                  total_credit : {columnWidth: 25, halign:'right'},
+                  total_amount : {columnWidth: 25, halign:'right'},
+                  total_cost : {columnWidth: 25, halign:'right'},
+                  utility : {columnWidth: 25, halign:'right'},
+                  cost_percent : {columnWidth: 20, halign:'right'},
+                  sale_percent : {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,
+                );
+            }
+        },
+    });
+}

+ 530 - 0
static/src/js/reports/report_type_income.js

@@ -0,0 +1,530 @@
+function report_type_income(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportTypeIncomeWidget = reporting.Base.extend({
+        template: 'ReportTypeIncome',
+        rowsData :[],
+        content :[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateJournalSelections',
+            '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.fetchResCompany().then(function (ResCompany) {
+                return ResCompany;
+            }).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 > 0){
+                    self.$el.find('#current-journal').append('<option value="9999999">Todos los métodos de pago</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.fetchAccountJournal().then(function(AccountJournal) {
+                return AccountJournal;
+            }).then(function (AccountJournal) {
+                self.AccountJournal = AccountJournal;
+                return self.fetchAccountVoucher();
+            }).then(function (AccountVoucher){
+                self.AccountVoucher = AccountVoucher;
+                return self.BuildTable();
+            });
+        },
+
+
+
+        /*====================================================================
+            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 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 journal = self.$el.find('#current-journal').val();
+            var domain = [
+              ['active','=',true],
+              ['type','in',['bank','cash']],
+
+            ];
+            if(journal && journal != 9999999){
+                domain.push(['id','=',parseInt(journal)]);
+            }
+            var AccountJournal = new model.web.Model('account.journal');
+            return AccountJournal.call('getAccountJournal',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            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 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;
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE
+        ====================================================================*/
+        fetchAccountVoucher: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            var period = self.$el.find('#current-period').val();
+            var company = self.$el.find('#current-company').val();
+
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').val();
+
+            if(store && store != 9999999){
+                var journal_ids = _.map(_.filter(self.AccountVoucher,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', '=','posted'],
+                ['type', '=', 'receipt'],
+
+            ];
+
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+
+            if(period && period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+
+            if(date && date != 9999999){
+
+                if(desde){
+                    var date = desde.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date','>=',date]);
+                }
+
+                if(hasta){
+                    var date = hasta.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date','<=',date]);
+                }
+
+                if(date == 'today'){
+                    var today = moment().format('YYYY-MM-DD');
+                    domain.push(['date','=',today]);
+                }
+
+                if(date == 'yesterday'){
+                    var yesterday = moment().add(-1,'days').format('YYYY-MM-DD');
+                    domain.push(['date','=',yesterday]);
+                }
+
+                if(date == 'currentMonth'){
+                    var currentMonth = moment().format('YYYY-MM');
+                    domain.push(['date','like',currentMonth]);
+                }
+
+                if(date == 'lastMonth'){
+                    var lastMonth = moment().add(-1,'months').format('YYYY-MM');
+                    domain.push(['date','like',lastMonth]);
+                }
+            }
+
+            var AccountVoucher = new model.web.Model('account.voucher');
+            return AccountVoucher.call('getAccountVoucherDental',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+
+        /*====================================================================
+            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 sucursellers</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 sucursellers</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">Todas 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>');
+                });
+            }
+        },
+
+        /*====================================================================
+            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
+        ====================================================================*/
+        getAccountVoucher: function (id) {
+          var self = this;
+          return _.filter(self.AccountVoucher,function (item) {
+            return item.journal_id === id;
+          });
+        },
+
+
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+          var self = this;
+          var data = [];
+          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();
+          };
+
+          var AccountJournal = self.AccountJournal;
+          _.each(AccountJournal,function(item) {
+
+            var amount = 0;
+
+            var AccountVoucher = self.getAccountVoucher(item.id);
+            _.each(AccountVoucher,function(item2) {
+              amount = amount + item2.amount;
+            });
+
+            data.push({
+
+                id: item.id,
+                name: item.name,
+                amount: accounting.formatMoney(amount,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+
+                /*=======================
+                        VALORES SIN FORMATEAR
+                    =======================*/
+                amount_no_format : amount,
+
+                /*==============================
+                      TOTAL FOOTER CONFIGURATION
+                  ==============================*/
+                decimal_places : CurrencyBase.decimal_places,
+                thousands_separator: CurrencyBase.thousands_separator,
+                decimal_separator: CurrencyBase.decimal_separator,
+
+              });
+        });
+
+          self.content = data;
+          self.loadTable(data);
+          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 amount = _.reduce(_.map(row, function (map) {
+                return map.amount_no_format;
+            }), function (memo, num) {
+                return memo + num;
+            });
+
+            row.push({
+                name: 'Totales',
+                amount: accounting.formatMoney(amount, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+            })
+
+            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 = 'Ingreso por método de pago';
+                var pdf_type = '';
+                var pdf_name = 'ingreso_por_metodo_pago_';
+                var pdf_columnStyles =  {
+                    name :{halign:'left'},
+                    amount:{columnWidth: '50%', 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,
+                );
+            }
+        },
+    });
+}

+ 201 - 0
static/src/reports/report_expenses_dental.xml

@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportExpensesDental">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title"> Gastos</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 partner filter-style">
+                        <label>Gastos</label>
+                        <select id="current-partner" 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 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 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-hover 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=" "
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="partner_id" data-align="left" data-footer-formatter="Totales">Gastos</th>
+                                <th data-field="reference" data-align="left" >Referencia</th>
+                                <th data-field="number" data-align="left">Factura</th>
+                                <th data-field="date_invoice" data-align="center">Fecha</th>
+                                <th data-field="amount_untaxed_total" data-align="right" data-footer-formatter="totalUntaxedFormatter" data-width="12%">SubTotal</th>
+                                <th data-field="amount_tax_total" data-align="right" data-footer-formatter="totalTaxFormatter" data-width="12%">Impuesto</th>
+                                <th data-field="amount_total" data-align="right" data-footer-formatter="totalFormatter" data-width="12%">Total</th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+
+
+            <script>
+
+                <!--
+                    RESIDUAL TOTAL
+                -->
+                function totalResidualFormatter(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.residual);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+                <!--
+                    UNTAXED TOTAL
+                -->
+                function totalUntaxedFormatter(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_untaxed);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+                <!--
+                    UNTAXED TOTAL
+                -->
+                function totalTaxFormatter(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_tax);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                }
+                <!--
+                    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);
+                }
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold"
+                        }
+                    };
+                };
+
+            </script>
+        </div>
+    </t>
+</template>

+ 177 - 0
static/src/reports/report_receipt_dental.xml

@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportPaymentDental">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Cobro por Vendedores</h1>
+            </div>
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:95%;">
+                <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 journal filter-style">
+                        <label>Vendedor</label>
+                        <select id="current-journal" 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 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 id="toolbar">
+                    <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+                </div>
+                <div class="container" style="width:95%;">
+                    <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=" "
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="name" data-footer-formatter="Totales" data-align="left">Nombre</th>
+                                <th data-field="total_cash" data-footer-formatter="totalCashFormatter" data-align="right">Total Contado</th>
+                                <th data-field="total_credit" data-footer-formatter="totalCreditFormatter" data-align="right">Total Credito</th>
+                                <th data-field="total_amount" data-footer-formatter="totalAmountFormatter" data-align="right">Total Cobro</th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+            <script>
+
+                <!--
+                    TOTAL CASH
+                -->
+                function totalCashFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_cash_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL CREDIT
+                -->
+                function totalCreditFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_credit_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL AMOUNT
+                -->
+                function totalAmountFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_amount_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold"
+                        }
+                    };
+                };
+            </script>
+        </div>
+    </t>
+</template>

+ 271 - 0
static/src/reports/report_seller.xml

@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportSeller">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Venta/Costo/Utilidad por Vendedores</h1>
+            </div>
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:95%;">
+                <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 journal filter-style">
+                        <label>Vendedor</label>
+                        <select id="current-journal" 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 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 id="toolbar">
+                    <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+                </div>
+                <div class="container" style="width:95%;">
+                    <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=" "
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="name" data-footer-formatter="Totales" data-align="left">Nombre</th>
+                                <th data-field="total_cash" data-footer-formatter="totalCashFormatter" data-align="right">Total Contado</th>
+                                <th data-field="total_credit" data-footer-formatter="totalCreditFormatter" data-align="right">Total Credito</th>
+                                <th data-field="total_amount" data-footer-formatter="totalAmountFormatter" data-align="right">Total Ventas</th>
+                                <th data-field="total_cost" data-footer-formatter="totalCostFormatter" data-align="right">Costo Total</th>
+                                <th data-field="utility" data-footer-formatter="totalUtilityFormatter" data-align="right">Utilidad Ventas</th>
+                                <th data-field="cost_percent" data-footer-formatter="totalCostPercentFormatter" data-align="right">Rent. Costo %</th>
+                                <th data-field="sale_percent" data-footer-formatter="totalSalePercentFormatter" data-align="right">Rent. Venta %</th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+            <script>
+
+                <!--
+                    TOTAL CASH
+                -->
+                function totalCashFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_cash_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL CREDIT
+                -->
+                function totalCreditFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_credit_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL AMOUNT
+                -->
+                function totalAmountFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_amount_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL COST
+                -->
+                function totalCostFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_cost_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL UTILITY
+                -->
+                function totalUtilityFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.utility_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,decimal_places,thousands_separator,decimal_separator);
+                }
+
+                <!--
+                    TOTAL COST PERCENT
+                -->
+                function totalCostPercentFormatter(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 totalUtility = _.reduce(_.map(rowsTable,function(item){
+                          return (item.utility_no_format);
+                      }), function(memo, num){
+                      return memo + num; },0)
+
+                    var totalCost =  _.reduce(_.map(rowsTable,function(item){
+                          return (item.total_cost_no_format);
+                      }), function(memo, num){
+                      return memo + num; },0)
+
+                    var amount =  totalUtility * 100 / totalCost;
+                    return accounting.formatNumber(amount,2,thousands_separator,decimal_separator) + ' %';
+                }
+
+                <!--
+                    TOTAL SALE PERCENT
+                -->
+                function totalSalePercentFormatter(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 totalUtility = _.reduce(_.map(rowsTable,function(item){
+                          return (item.utility_no_format);
+                      }), function(memo, num){
+                      return memo + num; },0)
+
+                    var totalSale =  _.reduce(_.map(rowsTable,function(item){
+                          return (item.total_amount_no_format);
+                      }), function(memo, num){
+                      return memo + num; },0)
+
+                    var amount =  totalUtility * 100 / totalSale;
+                    return accounting.formatNumber(amount,2,thousands_separator,decimal_separator)+' %';
+                }
+
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold"
+                        }
+                    };
+                };
+            </script>
+        </div>
+    </t>
+</template>

+ 138 - 0
static/src/reports/report_type_income.xml

@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportTypeIncome">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Ingreso por Método de Pago</h1>
+            </div>
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:95%;">
+                <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 journal filter-style">
+                        <label>Tipo de Ingreso</label>
+                        <select id="current-journal" 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 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 id="toolbar">
+                    <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+                </div>
+                <div class="container" style="width:95%;">
+                    <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=" "
+                        >
+                        <thead style="background:none;">
+                            <tr>
+                                <th data-field="name" data-footer-formatter="Totales" data-align="left">Tipo de Ingreso</th>
+                                <th data-field="amount" data-footer-formatter="totalAmountFormatter" data-align="right">Total</th>
+                            </tr>
+                        </thead>
+                    </table>
+                </div>
+            </div>
+            <script>
+
+                <!--
+                    TOTAL AMOUNT
+                -->
+                function totalAmountFormatter(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 amount =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.amount_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+                    return accounting.formatNumber(amount,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>

+ 26 - 0
templates.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <template id="eiru_reports_g6_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+
+                <!-- configuration < main > -->
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/main.js" />
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/reporting_base.js" />
+
+                <!-- venta_costo_utilidad_por_vendedor -->
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/reports/report_seller.js"/>
+
+                <!-- ingreso por metodo de pago -->
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/reports/report_type_income.js"/>
+
+                <!-- cobro por vendedores -->
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/reports/report_receipt_dental.js"/>
+
+                <!-- gastos -->
+                <script type="text/javascript" src="/eiru_reports_g6/static/src/js/reports/report_expenses_dental.js"/>
+
+            </xpath>
+        </template>
+    </data>
+</openerp>

+ 23 - 0
views/actions.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+
+		<record id="seller_action" model="ir.actions.client">
+            <field name="name">Ventas</field>
+            <field name="tag">eiru_reports_g6.seller_action</field>
+    </record>
+		<record id="type_income_action" model="ir.actions.client">
+						<field name="name">Tipo de Ingreso</field>
+						<field name="tag">eiru_reports_g6.type_income_action</field>
+		</record>
+		<record id="receipt_dental_action" model="ir.actions.client">
+						<field name="name">Cobro por Vendedores</field>
+						<field name="tag">eiru_reports_g6.receipt_dental_action</field>
+		</record>
+		<record id="expenses_dental_action" model="ir.actions.client">
+						<field name="name">Gastos</field>
+						<field name="tag">eiru_reports_g6.expenses_dental_action</field>
+		</record>
+
+    </data>
+</openerp>

+ 36 - 0
views/menus.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+      <!--
+       =======================================================================
+           Dental G6
+       =======================================================================
+       -->
+       <menuitem id="dental_parent_menu" name="Dental G6" parent="eiru_reports.eiru_reports_main_menu" sequence="4"/>
+
+       <menuitem id="seller_menu"
+            parent="dental_parent_menu"
+            name="Venta/Costo/Utilidad por Vendedores"
+            action="seller_action"
+            sequence="5"/>
+
+        <menuitem id="type_income_menu"
+            parent="dental_parent_menu"
+            name="Ingreso por Método de Pago"
+            action="type_income_action"
+            sequence="6"/>
+
+        <menuitem id="receipt_dental_menu"
+            parent="dental_parent_menu"
+             name="Cobro por Vendedores"
+            action="receipt_dental_action"
+            sequence="7"/>
+
+        <menuitem id="expenses_dental_menu"
+             parent="dental_parent_menu"
+             name="Gastos"
+            action="expenses_dental_action"
+            sequence="8"/>
+
+    </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>