Parcourir la source

FIX ADD Informes Dental

Sebas il y a 6 ans
Parent
commit
2547158f61

+ 3 - 0
static/src/js/reports/report_resumen_ingresos.js

@@ -274,10 +274,13 @@ function report_resumen_ingresos (reporting){
             for (var i = 0; i < objJournal.length; i++) {
                 voucherObjectItem=[];
                 journal=objJournal[i];
+
                 //Generar la Cabecera con el nombre de la sucursal
                 for (var f = 0; f < journal.journal_ids.length; f++) {
                     voucherLine = journal.journal_ids[f];
                     voucherItem = self.getVoucherjournal(objVoucher,voucherLine)
+
+                    console.log(voucherItem);
                     if (voucherItem.length > 0){
                         sumaAmount=_.reduce(_.map(voucherItem,function(item){return item.amount}), function(memo, num){ return memo + num; },0);
                         itemVoucher = voucherItem.shift();

+ 631 - 0
static/src/js/reports/report_sale_vendor (copia).js

@@ -0,0 +1,631 @@
+function report_sale_vendor (reporting){
+
+    var instance = openerp;
+
+    reporting.ReportSaleVendorWidget = reporting.Base.extend({
+        template :'ReportSaleVendor',
+        accountVoucher:[],
+        resCurrency:[],
+        accountJournal:[],
+        dataVoucher:[],
+        currencyRate:[],
+        resCompany:[],
+        modules:[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #X' : 'fectSearch',
+            'click #A' : 'fectSearch',
+            'click #B' : 'fectSearch',
+            'click #C' : 'fectSearch',
+            'click #D' : 'fectSearch',
+            'click #Z' : 'fectSearch',
+
+            'click #Y' : 'fectSearch',
+            'change #current-journal': 'fectSearch',
+            'change #current-warehouse': 'fectSearch',
+            'change #current-currency': 'fectSearch',
+            'change #from' : 'fectSearch',
+            'change #to': 'fectSearch',
+            'click #volver_btn': 'volver',
+        },
+
+        init:function(parent){
+            this._super(parent);
+        },
+        start: function(){
+            var self = this;
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.dataVoucher});
+            self.fecthFecha();
+            self.fecthInitial();
+        },
+        // Redirecionar
+        renderReport: function () {
+            var self = this;
+
+            var container = this.$el.closest('.oe_form_sheet.oe_form_sheet_width');
+            this.$el.closest('.report_view').remove();
+            container.find('.report_view').show({
+                effect: 'fade',
+                duration: 200,
+            });
+        },
+        // Verificar el modelo
+        checkModel : function(model){
+            var self = this;
+            return _.filter(self.modules,function(item){return item.name === model});
+        },
+        // Lanzar el mensaje
+        showMensaje : function(modelos){
+            var self = this;
+            $("#dialog" ).dialog({
+                autoOpen: true,
+                resizable: false,
+                modal: true,
+                title: 'Atención',
+                width: 500,
+                open: function() {
+                    $(this).html('Reporte in-disponible, contacte con el administrador del sistema ref : '+modelos);
+                },
+                show: {
+                    effect: "fade",
+                    duration: 200
+                },
+                hide: {
+                    effect: "fade",
+                    duration: 200
+                },
+                buttons: {
+                    Aceptar: function() {
+                        $(this).dialog('close');
+                        self.renderReport()
+                    }
+                }
+            });
+            return
+        },
+
+        //  Metodo inicial
+        fecthInitial: function(){
+            var self = this;
+            self.fecthIrModuleModule().then(function(modules){
+                self.modules = modules;
+                return modules;
+            }).then(function(modules){
+                return self.fecthJournalStore();
+            }).then(function(accountJournal){
+                self.accountJournal=accountJournal;
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las SUC.</option>');
+                _.each(accountJournal,function(item){
+                    self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                return self.fetchResCurrency();
+             }).then(function(ResCurrency){
+                self.ResCurrency = ResCurrency;
+                return self.fecthCompanyCurrency();
+            }).then(function(ResCompany){
+                self.ResCompany = ResCompany;
+                return self.fecthCurrencyRate();
+            }).then(function(currencyRate){
+                self.currencyRate =currencyRate;
+                return self.fecthVoucher();
+            }).then(function(accountVoucher){
+                self.accountVoucher=accountVoucher;
+                return self.fetchInvoiceV2();
+            }).then(function (invoices){
+               self.invoices = invoices;
+                return self.fetchWarehouse();
+            }).then(function(WareHouse){
+                self.WareHouse=WareHouse;
+                self.$el.find('#current-warehouse').append('<option value="9999999">Todos los vendedores</option>');
+                _.each(WareHouse,function(item){
+                    self.$el.find('#current-warehouse').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
+            });
+        },
+
+        // Fecha
+        fecthFecha: function() {
+            var to;
+            var dateFormat1 = "mm/dd/yy",
+            from = $( "#from" )
+            .datepicker({
+                dateFormat: "dd/mm/yy",
+                changeMonth: true,
+                numberOfMonths: 1,
+            })
+            .on( "change", function() {
+                to.datepicker( "option", "minDate", getDate(this), "dd/mm/yyyy");
+            });
+            to = $( "#to" ).datepicker({
+                dateFormat: "dd/mm/yy",
+                defaultDate: "+7d",
+                changeMonth: true,
+                numberOfMonths: 1,
+            })
+            .on( "change", function() {
+                from.datepicker( "option", "maxDate", getDate(this));
+            });
+
+            function getDate( element ) {
+                var fechaSel =element.value.split('/');
+                var date;
+                try {
+                    date = $.datepicker.parseDate( dateFormat1, (fechaSel[1]+"/"+fechaSel[0]+"/"+fechaSel[2]));
+                } catch( error ) {
+                    date = null;
+                }
+                return date;
+            }
+        },
+
+        // Modelos instalados
+        fecthIrModuleModule: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['name','id'];
+            var domain=[['state','=','installed']];
+            var irModule = new instance.web.Model('ir.module.module');
+
+            irModule.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+        // Journal
+        fecthJournalStore: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var modules = _.flatten(self.checkModel('multi_store'));
+
+            if (modules.length <= 0){
+                self.showMensaje('multi_store');
+                return defer;
+            }
+
+            var journal = new instance.web.Model('res.store');
+            var field=['id', 'name','journal_ids'];
+
+            journal.query(field).order_by('id').all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+        // company_curency
+        fecthCompanyCurrency: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field=['id','name', 'currency_id', 'vat'];
+            var domain = [['id', '=', self.session.company_id]];
+            var ResCompany = new instance.web.Model('res.company');
+            ResCompany.query(field).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+        // Moneda
+        fetchResCurrency:function(){
+            var self = this;
+            var defer = $.Deferred();
+            var ResCurrency = new instance.web.Model('res.currency');
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active','=', true]];
+            ResCurrency.query(fields).filter(domain).order_by('id').all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+        // Cambio de la moneda
+        fecthCurrencyRate:function(){
+            var defer = $.Deferred();
+            var currency_Rate = new instance.web.Model('res.currency.rate');
+            var fields = ['id', 'name', 'currency_id', 'rate', 'create_date'];
+            var domain = [['currency_id', 'in', [166 , 20, 7, 3]]];
+            currency_Rate.query(fields).filter(domain).all().then(function (results) {
+              defer.resolve(results);
+            });
+            return defer;
+        },
+        // Invoice (FACTURAS)
+        fetchInvoiceV2: function () {
+            var self = this;
+            var filter ="[['state', 'in',['open','paid']],['type', '=', 'out_invoice']";
+            var journal_ids = _.flatten(_.map(self.AccountJournal, function (item) {
+                return item.id;
+            }));
+            if (journal_ids){
+                filter=filter.concat(",['journal_id', 'in',["+journal_ids+"]]");
+            }
+            filter=filter.concat("]");
+            var field =['id', 'type', 'number', 'origin', 'reference', 'state', 'journal_id', 'currency_id', 'user_id','date_invoice','amount_total','amount_tax','amount_untaxed','partner_id'];
+            var defer = $.Deferred();
+            var invoices = new instance.web.Model('account.invoice');
+            invoices.query(field).filter(filter).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // Voucher -
+        fecthVoucher: function () {
+             var self = this;
+             var defer = $.Deferred();
+             var voucher = new instance.web.Model('sale.order');
+             var filter = [['state', 'in', ['progress','done']],['shipped', '=', true]];
+             // var warehouse_ids = _.flatten(_.map(self.WareHouse, function (item) {
+             //     return item.id;
+             // }));
+             // if (warehouse_ids){
+             //     filter=filter.concat(",['warehouse_id', 'in',["+ warehouse_ids+"]]");
+             // }
+             // filter=filter.concat("]");
+             var field =['id', 'number', 'name','origin', 'state', 'type_id', 'warehouse_id', 'currency_id', 'amount_total', 'date_order', 'shipped'];
+             voucher.query(field).filter(filter).all().then(function (results) {
+                 defer.resolve(results);
+             });
+             return defer;
+         },
+
+        fetchWarehouse: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field=['id', 'name'];
+            var WareHouse = new instance.web.Model('stock.warehouse');
+            WareHouse.query(field).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+         },
+
+         getResCurrency: function (id) {
+             var self = this;
+             return _.filter(self.ResCurrency,function (item) {
+                 return item.id === id;
+             })
+         },
+
+         getSaleOrder: function (id) {
+             var self = this;
+             return _.filter(self.accountVoucher,function (item) {
+                 return item.number === id;
+             });
+         },
+
+        // Verificar Valor null
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        // Join object
+        fecthDataVoucher:function(objVoucher,objJournal){
+            var self=this;
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            var item;
+            var journal;
+            var voucherLine;
+            var voucherItem;//Contenido del voucher
+            var sumaAmount; //Guardar la suma de los pagos
+            var voucherObject=[];
+            var voucherObjectItem=[];
+            var sale = [];
+            var cutrrencyRate; //Valor del cambio
+            var total=0;
+            var sumaAmountTot=0;
+            var  itemVoucher;
+
+            for (var i = 0; i < objJournal.length; i++) {
+                voucherObjectItem=[];
+                journal=objJournal[i];
+
+                for (var f = 0; f < journal.journal_ids.length; f++) {
+                    voucherLine = journal.journal_ids[f];
+                    voucherItem = self.getVoucherjournal(objVoucher,voucherLine)
+
+                    // sale = self.getSaleOrder(voucherItem.name);
+                    // console.log(sale);
+
+                    if (voucherItem.length > 0){
+                         sumaAmount=_.reduce(_.map(voucherItem,function(item){return item.amount_total}), function(memo, num){ return memo + num; },0);
+                         itemVoucher = voucherItem.shift();
+                         var currency = self.getResCurrency(itemVoucher.currency_id[0]).shift();
+
+                         // Guardar item
+                         voucherObjectItem.push({journal : " ",
+                                 method  :self.valorNull(itemVoucher.warehouse_id[1]),
+                                 amount  : accounting.formatNumber(self.valorNull(sumaAmount * (CurrencyBase.rate_silent/currency.rate_silent)),0, ".", ","),
+                                 currency_name : self.valorNull(itemVoucher.currency_id[0]),
+                                 currency_id : self.valorNull(itemVoucher.currency_id[1]),
+                                 amountBase : self.valorNull(sumaAmount * (CurrencyBase.rate_silent/currency.rate_silent)),
+                                 journal_id: journal.id,
+                                 journal_name: journal.name,
+                                 warehouse_id: itemVoucher.warehouse_id[0],
+                                 graficar: false
+                         })
+                     }
+                 }
+                 if (voucherObjectItem.length > 0){
+                     var company = _.map(self.ResCompany, function (map) {
+                         return map.currency_id[1];
+                     });
+
+                     sumaAmountTot=_.reduce(_.map(voucherObjectItem,function(item){return (item.amountBase)}), function(memo, num){ return memo + num; },0);
+                     total=total+sumaAmountTot;
+                     voucherObjectItem.push({journal : " ",
+                         method  :"Total " + company,
+                         amount  : accounting.formatNumber(self.valorNull(sumaAmountTot),0, ".", ","),
+                         currency_name : "",
+                         currency_id : "",
+                         rate : "cutrrencyRate.rate",
+                         amountBase:"",
+                         journal_id: journal.id,
+                         journal_name: journal.name,
+                         graficar: true
+                     });
+
+                    // General la Cabezera
+                    voucherObjectItem.unshift({ journal : journal.name, method  :"", amount  :"", voucherLine_name :"", voucherLine_id :"",rate :"",amountBase :"", warehouse_id:"",journal_id:journal.id, journal_name:journal.name, graficar:false});
+                    // Generar Objeto Principal
+                    voucherObject=voucherObject.concat(voucherObjectItem);
+                }
+            }
+            if (voucherObject.length >0){
+                voucherObject.push({journal : " Total de Egreso",
+                    method  :"",
+                    amount  : accounting.formatNumber(self.valorNull(total),0, ".", ","),
+                    currency_name : "",
+                    currency_id : "",
+                    rate : "",
+                    amountBase:"",
+                    journal_id: journal.id,
+                    journal_name: journal.name,
+                    warehouse_id:"",
+                    graficar: false
+                });
+            }
+            self.loadTable(voucherObject);
+            self.content = voucherObject;
+        },
+        // Obtener Voucher
+        getVoucherjournal:function(objVoucher,journal_id){
+            return _.map(_.filter(objVoucher, function (inv){return inv.warehouse_id[0] === journal_id}),function(item){return item});
+        },
+        // Obtener Cambio
+        // getCutrrencyRate: function(currency_id){
+        //     return _.filter(this.currencyRate, function(rate){return rate.currency_id[0] === currency_id}).shift();
+        // },
+        // Generar la tabla
+        loadTable:function(rowsTable){
+            this.dataVoucher=rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load' ,rowsTable);
+        },
+        // Buscar
+        fectSearch: function(){
+            var self = this;
+            var today = moment().format('YYYY-MM-DD');
+            var yesterday = moment().add(-1, 'days').format('YYYY-MM-DD');
+            var month = moment().format('YYYY-MM');
+            var last_month = moment().add(-1, 'months').format('YYYY-MM');
+            var desde =this.$el.find('#from').val();
+            var hasta =this.$el.find('#to').val();
+            var journal =this.$el.find('#current-journal').val();
+            var currency =this.$el.find('#current-currency').val();
+            var newJournal= self.accountJournal; //copia del Diario
+            var newVoucher= self.accountVoucher; //copia del Vouacher
+
+            if ($('#A').is(":checked")){
+                newVoucher = _.filter(newVoucher, function (inv){
+                    return inv.date_order == today;
+                });
+            }
+            if ($('#B').is(":checked")){
+                newVoucher = _.filter(newVoucher, function (inv){
+                    return moment(inv.date_order).format('YYYY-MM-DD') == yesterday;
+                });
+            }
+            if ($('#C').is(":checked")){
+                newVoucher = _.filter(newVoucher, function (inv){
+                    return moment(inv.date_order).format('YYYY-MM') == month;
+                });
+            }
+            if ($('#D').is(":checked")){
+                newVoucher = _.filter(newVoucher, function (inv){
+                    return moment(inv.date_order).format('YYYY-MM') == last_month;
+                });
+            }
+
+            if ($('#Z').is(":checked")){
+                $('#datepicker').css('display','block');
+                if (desde.length > 0){
+                    var date= desde.split('/');
+                    newVoucher = _.filter(newVoucher, function (inv){
+                        return inv.date_order >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+                if (hasta.length > 0){
+                    var date= hasta.split('/');
+                    newVoucher = _.filter(newVoucher, function (inv){
+                        return inv.date_order <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+            }else{
+                $('#datepicker').css('display','none');
+            }
+
+            if (journal != 9999999){
+                var botonChart =this.$el.find('#chart').attr("disabled", true);
+                 newJournal=_.filter(newJournal, function (inv){ return inv.id == journal});
+            }else {
+                var botonChart =this.$el.find('#chart').attr("disabled", false);
+            }
+            self.fecthDataVoucher(newVoucher,newJournal);
+        },
+        // volver
+        volver: function(){
+            this.$el.find('#volver').empty();
+            this.$el.find('#grafico').empty();
+            this.$el.find('.bootstrap-table').show({
+                effect: 'drop',
+                direction: 'down',
+                duration: 200,
+            });
+            this.$el.find('#toolbar').show({
+                effect: 'drop',
+                direction: 'down',
+                duration: 200,
+            });
+        },
+        // Click pdf -Grafic
+        clickOnAction: function (e) {
+            var action = this.$el.find(e.target).val();
+            var self = this;
+            var getColumns=[];
+            var rows=[];
+            var table = this.$el.find("#table");
+            var data2 = table.bootstrapTable('getVisibleColumns');
+            if (action === 'pdf') {
+              var dataNEW = _.map(data2, function (val){ return val.field});
+              _.each(this.dataVoucher,function (item){
+                        rows.push(_.pick(item, dataNEW));
+              });
+              // Obtener los nombre de la Cabezera
+              _.each(_.map(data2,function(val){return val}), function(item){
+                 getColumns.push([{title: item.title, dataKey: item.field}]);
+              });
+              // Llamar al pdf
+              this.drawPDF(_.flatten(getColumns),rows)
+            }
+            // if (action === 'chart'){
+            //     var self = this;
+            //     var objetChar;
+            //     objetChar = _.filter(self.dataVoucher,function(item){return item.graficar === true});
+            //     self.fectCharFilter(objetChar);
+            // }
+        },
+        // pdfDoc
+        drawPDF:function(getColumns,rows){
+            var self = this;
+            var fechaActu= new Date();
+            var sucusal = this.sucDescrip = this.$el.find('#current-journal option:selected').text();
+            var desde =(this.$el.find('#from').val());
+            var hasta =(this.$el.find('#to').val());
+            var totalPagesExp = "{total_pages_count_string}";
+            var pdfDoc = new window.jsPDF();
+
+            pdfDoc.autoTable(getColumns, rows, {
+                    styles: { overflow: 'linebreak', fontSize:10 , columnWidth: 'wrap'},
+                    columnStyles:{journal: {fontStyle: 'bold'},
+                                  method :{columnWidth: '10px'},
+                                  amount : {halign:'right'},
+                                },
+                    margin: { top: 16, horizontal: 7},
+                    addPageContent: function (data) {
+                        pdfDoc.setFontSize(12);
+                        pdfDoc.setFontStyle('bold');
+                        pdfDoc.setTextColor(40);
+                        pdfDoc.text('Resumen de Egreso de '+ sucusal, data.settings.margin.left, 10);
+                        if(desde.length > 0 || hasta.length > 0){
+                            var fecha='';
+                            if(desde){
+                                fecha=fecha.concat(' Desde '+desde);
+                            }
+                            if (hasta){
+                                fecha=fecha.concat(' Hasta '+hasta);
+                            }
+                            pdfDoc.setFontSize(10);
+                            pdfDoc.setFontStyle('bold');
+                            pdfDoc.setTextColor(40)
+                            pdfDoc.text(fecha, data.settings.margin.left,14);
+                        }
+                        // FOOTER
+                        var str = "Pagina  " + data.pageCount;
+                        // Total page number plugin only available in jspdf v1.0+
+                        if (typeof pdfDoc.putTotalPages === 'function') {
+                            str = str + " de " + totalPagesExp +"\n  Día de Expedición  "+fechaActu.getDate()+"/"+fechaActu.getMonth()+"/"+fechaActu.getFullYear();
+                        }
+                        pdfDoc.setFontSize(9);
+                        pdfDoc.setFontStyle('bold');
+                        pdfDoc.setTextColor(40);
+                        pdfDoc.text(str, data.settings.margin.left, pdfDoc.internal.pageSize.height - 5);
+                    }
+                });
+                if (typeof pdfDoc.putTotalPages === 'function') {
+                    pdfDoc.putTotalPages(totalPagesExp);
+                }
+                pdfDoc.save('Resumen de Egreso.pdf');
+            },
+        // // Char filter
+        // fectCharFilter: function(objetChar){
+        //     var self = this;
+        //     var dataBody=[];
+        //     var dataHeader=[];
+        //     // objetChar
+        //     var canvas="<canvas id='graf_resume'></canvas>";
+        //       this.$el.find('#grafico').append(canvas);
+        //     _.each(objetChar,function(voucher){
+        //         dataHeader.push(voucher.journal_name);
+        //         dataBody.push(parseFloat(((voucher.amount.replace(".","")).replace(",","."))));
+        //     });
+        //   var selector ="<button type='button' class='oe_button oe_form_button oe_highlight' id='volver_btn' name='volver_btn'><span>Atras</span></button>";
+        //   this.$el.find('#volver').append(selector);
+        //   this.$el.find('.bootstrap-table').hide({
+        //       effect: 'drop',
+        //       direction: 'up',
+        //       duration: 200,
+        //       complete: function () {
+        //         self.drawChart(dataHeader,dataBody);
+        //       }
+        //   });
+        //   this.$el.find('#toolbar').hide({
+        //       effect: 'drop',
+        //       direction: 'up',
+        //       duration: 200,
+        //       complete: function () {
+        //         self.drawChart(dataHeader,dataBody);
+        //       }
+        //   });
+        // },
+        // //Chart
+        // drawChart: function (dataHeader,dataBody) {
+        //     var barChart = new Chart(this.$el.find('#graf_resume'), {
+        //         type: 'doughnut',//bar, doughnut
+        //         data: {
+        //             labels: dataHeader,
+        //             datasets: [
+        //                 {
+        //                     labels: dataHeader,
+        //                     backgroundColor: [
+        //                         'rgba(255, 99, 132, 0.2)',
+        //                         'rgba(54, 162, 235, 0.2)',
+        //                         'rgba(255, 206, 86, 0.2)',
+        //                         'rgba(75, 192, 192, 0.2)',
+        //                         'rgba(153, 102, 255, 0.2)',
+        //                     ],
+        //                     borderColor: [
+        //                         'rgba(255,99,132,1)',
+        //                         'rgba(54, 162, 235, 1)',
+        //                         'rgba(255, 206, 86, 1)',
+        //                         'rgba(75, 192, 192, 1)',
+        //                         'rgba(153, 102, 255, 1)',
+        //                     ],
+        //                     borderWidth: 1,
+        //                     data: dataBody,
+        //                 }
+        //             ]
+        //         },
+        //         options: {
+        //             maintainAspectRatio: false,
+        //             layout: {
+        //                 padding: 30
+        //             }
+        //         },
+        //     });
+        // },
+    });
+}

+ 264 - 304
static/src/js/reports/report_sale_vendor.js

@@ -6,9 +6,11 @@ function report_sale_vendor (reporting){
         template :'ReportSaleVendor',
         accountVoucher:[],
         resCurrency:[],
-        accountJournal:[],
+        invoices:[],
+        Journal:[],
         dataVoucher:[],
-        currencyRate:[],
+        rowsData :[],
+        content :[],
         resCompany:[],
         modules:[],
 
@@ -27,19 +29,28 @@ function report_sale_vendor (reporting){
             'change #current-currency': 'fectSearch',
             'change #from' : 'fectSearch',
             'change #to': 'fectSearch',
-            'click #volver_btn': 'volver',
         },
 
-        init:function(parent){
+        init : function(parent){
             this._super(parent);
         },
-        start: function(){
+
+        start: function () {
             var self = this;
             var table = this.$el.find('#table');
             table.bootstrapTable({data : self.dataVoucher});
-            self.fecthFecha();
-            self.fecthInitial();
+            this.fecthFecha();
+            this.fetchInitial();
         },
+
+        valorNull:function(dato){
+            var valor = "";
+            if (dato){
+                valor = dato;
+            }
+            return valor;
+        },
+
         // Redirecionar
         renderReport: function () {
             var self = this;
@@ -51,78 +62,59 @@ function report_sale_vendor (reporting){
                 duration: 200,
             });
         },
-        // Verificar el modelo
+
         checkModel : function(model){
             var self = this;
-            return _.filter(self.modules,function(item){return item.name === model});
-        },
-        // Lanzar el mensaje
-        showMensaje : function(modelos){
-            var self = this;
-            $("#dialog" ).dialog({
-                autoOpen: true,
-                resizable: false,
-                modal: true,
-                title: 'Atención',
-                width: 500,
-                open: function() {
-                    $(this).html('Reporte in-disponible, contacte con el administrador del sistema ref : '+modelos);
-                },
-                show: {
-                    effect: "fade",
-                    duration: 200
-                },
-                hide: {
-                    effect: "fade",
-                    duration: 200
-                },
-                buttons: {
-                    Aceptar: function() {
-                        $(this).dialog('close');
-                        self.renderReport()
-                    }
-                }
+            return _.filter(self.IrModuleModule,function(item){
+                return item.name === model
             });
-            return
         },
 
-        //  Metodo inicial
-        fecthInitial: function(){
+        fetchInitial: function () {
             var self = this;
-            self.fecthIrModuleModule().then(function(modules){
-                self.modules = modules;
-                return modules;
-            }).then(function(modules){
-                return self.fecthJournalStore();
-            }).then(function(accountJournal){
-                self.accountJournal=accountJournal;
-                self.$el.find('#current-journal').append('<option value="9999999">Todas las SUC.</option>');
-                _.each(accountJournal,function(item){
+            self.fecthIrModuleModule().then(function (IrModuleModule) {
+                return IrModuleModule;
+            }).then(function(IrModuleModule) {
+                self.IrModuleModule = IrModuleModule;
+                return self.fetchResUser();
+            }).then(function (ResUser) {
+                self.ResUser = ResUser;
+                return self.fetchResCompany();
+            }).then(function(ResCompany){
+                self.ResCompany = ResCompany;
+                if(ResCompany.length > 1){
+                    self.$el.find('#current-company').append('<option value="9999999">Todas las empresas</option>');
+                    _.each(ResCompany,function(item){
+                        self.$el.find('#current-company').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.company').css('display','none');
+                }
+                return self.fetchResStore();
+            }).then(function(ResStore){
+                self.ResStore = ResStore;
+                if(ResStore.length > 1){
+                    self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
+                    _.each(ResStore,function(item){
+                        self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.store').css('display','none');
+                }
+                return self.fetchAccountJournal();
+            }).then(function(AccountJournal){
+                self.AccountJournal = AccountJournal;
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                _.each(AccountJournal,function(item){
                     self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
                 });
                 return self.fetchResCurrency();
-             }).then(function(ResCurrency){
+            }).then(function(ResCurrency){
                 self.ResCurrency = ResCurrency;
-                return self.fecthCompanyCurrency();
-            }).then(function(ResCompany){
-                self.ResCompany = ResCompany;
-                return self.fecthCurrencyRate();
-            }).then(function(currencyRate){
-                self.currencyRate =currencyRate;
-                return self.fecthVoucher();
-            }).then(function(accountVoucher){
-                self.accountVoucher=accountVoucher;
-                return self.fetchInvoiceV2();
-            }).then(function (invoices){
-               self.invoices = invoices;
-                return self.fetchWarehouse();
-            }).then(function(WareHouse){
-                self.WareHouse=WareHouse;
-                self.$el.find('#current-warehouse').append('<option value="9999999">Todos los vendedores</option>');
-                _.each(WareHouse,function(item){
-                    self.$el.find('#current-warehouse').append('<option value="' + item.id + '">' + item.name + '</option>');
-                });
-                return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
+                return self.fetchAccountInvoice();
+            }).then(function (AccountInvoice) {
+                self.AccountInvoice = AccountInvoice;
+                return self.BuildTable(self.AccountInvoice,self.ResStore);
             });
         },
 
@@ -167,34 +159,51 @@ function report_sale_vendor (reporting){
             var defer = $.Deferred();
             var fields = ['name','id'];
             var domain=[['state','=','installed']];
-            var irModule = new instance.web.Model('ir.module.module');
+            var IrModuleModule = new instance.web.Model('ir.module.module');
 
-            irModule.query(fields).filter(domain).all().then(function(results){
+            IrModuleModule.query(fields).filter(domain).all().then(function(results){
                 defer.resolve(results);
             });
             return defer;
         },
-        // Journal
-        fecthJournalStore: function(){
+
+        fetchResUser: function() {
             var self = this;
             var defer = $.Deferred();
-            var modules = _.flatten(self.checkModel('multi_store'));
-
-            if (modules.length <= 0){
-                self.showMensaje('multi_store');
-                return defer;
-            }
+            var fields = ['id','name','store_id'];
+            var domain = [['id','=',self.session.uid]];
+            var ResUser = new instance.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
 
-            var journal = new instance.web.Model('res.store');
+        fetchResStore: function(){
+            var self = this;
+            var defer = $.Deferred();
             var field=['id', 'name','journal_ids'];
+            var ResStore = new instance.web.Model('res.store');
+            ResStore.query(field).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
 
-            journal.query(field).order_by('id').all().then(function(results){
+        fetchAccountJournal: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field = ['id', 'name','store_ids','type'];
+            var domain = [['active','=',true],['type', '=', 'sale']];
+            var AccountJournal = new instance.web.Model('account.journal');
+            AccountJournal.query(field).filter(domain).all().then(function(results){
                 defer.resolve(results);
             });
             return defer;
         },
+
         // company_curency
-        fecthCompanyCurrency: function(){
+        fetchResCompany: function(){
             var self = this;
             var defer = $.Deferred();
             var field=['id','name', 'currency_id', 'vat'];
@@ -205,7 +214,6 @@ function report_sale_vendor (reporting){
             });
             return defer;
         },
-        // Moneda
         fetchResCurrency:function(){
             var self = this;
             var defer = $.Deferred();
@@ -217,82 +225,20 @@ function report_sale_vendor (reporting){
             });
             return defer;
         },
-        // Cambio de la moneda
-        fecthCurrencyRate:function(){
-            var defer = $.Deferred();
-            var currency_Rate = new instance.web.Model('res.currency.rate');
-            var fields = ['id', 'name', 'currency_id', 'rate', 'create_date'];
-            var domain = [['currency_id', 'in', [166 , 20, 7, 3]]];
-            currency_Rate.query(fields).filter(domain).all().then(function (results) {
-              defer.resolve(results);
-            });
-            return defer;
-        },
-        // Invoice (FACTURAS)
-        fetchInvoiceV2: function () {
-            var self = this;
-            var filter ="[['state', 'in',['open','paid']],['type', '=', 'out_invoice']";
-            var journal_ids = _.flatten(_.map(self.AccountJournal, function (item) {
-                return item.id;
-            }));
-            if (journal_ids){
-                filter=filter.concat(",['journal_id', 'in',["+journal_ids+"]]");
-            }
-            filter=filter.concat("]");
-            var field =['id', 'type', 'number', 'origin', 'reference', 'state', 'journal_id', 'currency_id', 'user_id','date_invoice','amount_total','amount_tax','amount_untaxed','partner_id'];
-            var defer = $.Deferred();
-            var invoices = new instance.web.Model('account.invoice');
-            invoices.query(field).filter(filter).all().then(function (results) {
-                defer.resolve(results);
-            });
-            return defer;
-        },
 
-        // Voucher -
-        fecthVoucher: function () {
-             var self = this;
-             var defer = $.Deferred();
-             var voucher = new instance.web.Model('sale.order');
-             var filter = [['state', 'in', ['progress','done']],['shipped', '=', true]];
-             // var warehouse_ids = _.flatten(_.map(self.WareHouse, function (item) {
-             //     return item.id;
-             // }));
-             // if (warehouse_ids){
-             //     filter=filter.concat(",['warehouse_id', 'in',["+ warehouse_ids+"]]");
-             // }
-             // filter=filter.concat("]");
-             var field =['id', 'number', 'name','origin', 'state', 'type_id', 'warehouse_id', 'currency_id', 'amount_total', 'date_order', 'shipped'];
-             voucher.query(field).filter(filter).all().then(function (results) {
-                 defer.resolve(results);
-             });
-             return defer;
-         },
-
-        fetchWarehouse: function(){
+        fetchAccountInvoice: function () {
             var self = this;
             var defer = $.Deferred();
-            var field=['id', 'name'];
-            var WareHouse = new instance.web.Model('stock.warehouse');
-            WareHouse.query(field).all().then(function(results){
+            var AccountInvoice = new instance.web.Model('account.invoice');
+            var filter =[['state', 'in',['open','paid']],['type', '=', 'out_invoice']];
+
+            var fields =['id', 'type', 'number', 'origin', 'reference', 'state', 'journal_id', 'currency_id', 'user_id','date_invoice','amount_total','amount_tax','amount_untaxed','partner_id'];
+
+            AccountInvoice.query(fields).filter(filter).all().then(function (results) {
                 defer.resolve(results);
             });
             return defer;
-         },
-
-         getResCurrency: function (id) {
-             var self = this;
-             return _.filter(self.ResCurrency,function (item) {
-                 return item.id === id;
-             })
-         },
-
-         getSaleOrder: function (id) {
-             var self = this;
-             return _.filter(self.accountVoucher,function (item) {
-                 return item.number === id;
-             });
-         },
-
+        },
         // Verificar Valor null
         valorNull:function(dato){
             var valor ="";
@@ -302,110 +248,132 @@ function report_sale_vendor (reporting){
             return valor;
         },
 
+        getAccountInvoice: function (id) {
+            var self = this;
+            return _.filter(self.AccountInvoice,function (item) {
+                return item.journal_id[0] === id;
+            });
+        },
+
+        getStore: function (id) {
+            var self = this;
+            return _.filter(self.ResStore,function (item) {
+                return item.id === id;
+            });
+        },
+
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrency,function (item) {
+                return item.id === id;
+            })
+        },
+
         // Join object
-        fecthDataVoucher:function(objVoucher,objJournal){
+        BuildTable:function(objVoucher,objJournal){
             var self=this;
             var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
             var item;
-            var journal;
+            //var journal=self.AccountJournal;
+
+            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 voucherLine;
             var voucherItem;//Contenido del voucher
             var sumaAmount; //Guardar la suma de los pagos
             var voucherObject=[];
+            var invoice=[];
+            var cabjournal;
             var voucherObjectItem=[];
-            var sale = [];
-            var cutrrencyRate; //Valor del cambio
+            var currency;
+            var store;
+            var store_id="";
+            var store_name="";
             var total=0;
             var sumaAmountTot=0;
             var  itemVoucher;
+            var  itemjournal;
 
             for (var i = 0; i < objJournal.length; i++) {
+
                 voucherObjectItem=[];
-                journal=objJournal[i];
+                cabjournal=objJournal[i];
+
+                for (var f = 0; f < cabjournal.journal_ids.length; f++) { //este
+                    voucherLine = cabjournal.journal_ids[f];
 
-                for (var f = 0; f < journal.journal_ids.length; f++) {
-                    voucherLine = journal.journal_ids[f];
                     voucherItem = self.getVoucherjournal(objVoucher,voucherLine)
 
-                    // sale = self.getSaleOrder(voucherItem.name);
-                    // console.log(sale);
+                    // invoice = self.getAccountInvoice(cabjournal.id);
 
                     if (voucherItem.length > 0){
-                         sumaAmount=_.reduce(_.map(voucherItem,function(item){return item.amount_total}), function(memo, num){ return memo + num; },0);
-                         itemVoucher = voucherItem.shift();
-                         var currency = self.getResCurrency(itemVoucher.currency_id[0]).shift();
-
-                         // Guardar item
-                         voucherObjectItem.push({journal : " ",
-                                 method  :self.valorNull(itemVoucher.warehouse_id[1]),
-                                 amount  : accounting.formatNumber(self.valorNull(sumaAmount * (CurrencyBase.rate_silent/currency.rate_silent)),0, ".", ","),
-                                 currency_name : self.valorNull(itemVoucher.currency_id[0]),
-                                 currency_id : self.valorNull(itemVoucher.currency_id[1]),
-                                 amountBase : self.valorNull(sumaAmount * (CurrencyBase.rate_silent/currency.rate_silent)),
-                                 journal_id: journal.id,
-                                 journal_name: journal.name,
-                                 warehouse_id: itemVoucher.warehouse_id[0],
-                                 graficar: false
-                         })
-                     }
-                 }
-                 if (voucherObjectItem.length > 0){
-                     var company = _.map(self.ResCompany, function (map) {
-                         return map.currency_id[1];
-                     });
-
-                     sumaAmountTot=_.reduce(_.map(voucherObjectItem,function(item){return (item.amountBase)}), function(memo, num){ return memo + num; },0);
-                     total=total+sumaAmountTot;
-                     voucherObjectItem.push({journal : " ",
-                         method  :"Total " + company,
-                         amount  : accounting.formatNumber(self.valorNull(sumaAmountTot),0, ".", ","),
-                         currency_name : "",
-                         currency_id : "",
-                         rate : "cutrrencyRate.rate",
-                         amountBase:"",
-                         journal_id: journal.id,
-                         journal_name: journal.name,
-                         graficar: true
-                     });
-
-                    // General la Cabezera
-                    voucherObjectItem.unshift({ journal : journal.name, method  :"", amount  :"", voucherLine_name :"", voucherLine_id :"",rate :"",amountBase :"", warehouse_id:"",journal_id:journal.id, journal_name:journal.name, graficar:false});
+                        sumaAmount=_.reduce(_.map(voucherItem,function(item){return item.amount_total}), function(memo, num){ return memo + num; },0);
+
+                        itemVoucher = voucherItem.shift();
+                        var currency = self.getResCurrency(itemVoucher.currency_id[0]).shift();
+
+                        // Guardar item
+                        voucherObjectItem.push({    journal : " ",
+                                                method  :self.valorNull(itemVoucher.journal_id[1]),
+                                                amount  : accounting.formatNumber(self.valorNull(sumaAmount* (CurrencyBase.rate_silent/currency.rate_silent)),0, ".", ","),
+                                                amountBase : self.valorNull(sumaAmount* (CurrencyBase.rate_silent/currency.rate_silent)),
+                                                journal_id: cabjournal.id,
+                                                journal_name: cabjournal.name,
+                                                graficar: false
+                        })
+                    }
+                }
+                if (voucherObjectItem.length > 0){
+                    var company = _.map(self.ResCompany, function (map) {
+                        return map.currency_id[1];
+                    });
+
+                    sumaAmountTot=_.reduce(_.map(voucherObjectItem,function(item){return (item.amountBase)}), function(memo, num){ return memo + num; },0);
+                    total=total+sumaAmountTot;
+                    voucherObjectItem.push({journal : " ",
+                                            method  :"Total "+ company,
+                                            amount  : accounting.formatNumber(self.valorNull(sumaAmountTot),0, ".", ","),
+                                            amountBase:"",
+                                            journal_id: cabjournal.id,
+                                            journal_name: cabjournal.name,
+                                            graficar: true
+                                    });
+                    // Generar la Cabecera
+                    voucherObjectItem.unshift({ journal : cabjournal.name, method  :"", amount  :"", voucherLine_name :"", voucherLine_id :"",rate :"",amountBase :"",journal_id:cabjournal.id, journal_name:cabjournal.name, graficar:false});
                     // Generar Objeto Principal
                     voucherObject=voucherObject.concat(voucherObjectItem);
                 }
             }
-            if (voucherObject.length >0){
-                voucherObject.push({journal : " Total de Egreso",
-                    method  :"",
-                    amount  : accounting.formatNumber(self.valorNull(total),0, ".", ","),
-                    currency_name : "",
-                    currency_id : "",
-                    rate : "",
-                    amountBase:"",
-                    journal_id: journal.id,
-                    journal_name: journal.name,
-                    warehouse_id:"",
-                    graficar: false
-                });
+            if (voucherObject.length > 0){
+                voucherObject.push({journal : " Total de Ingreso",
+                                        method  :"",
+                                        amount  : accounting.formatNumber(self.valorNull(total),0, ".", ","),
+                                        amountBase:"",
+                                        journal_id: cabjournal.id,
+                                        journal_name: cabjournal.name,
+                                        graficar: false
+                                });
             }
             self.loadTable(voucherObject);
-            self.content = voucherObject;
         },
+
         // Obtener Voucher
         getVoucherjournal:function(objVoucher,journal_id){
-            return _.map(_.filter(objVoucher, function (inv){return inv.warehouse_id[0] === journal_id}),function(item){return item});
+            return _.map(_.filter(objVoucher, function (inv){return inv.journal_id[0] === journal_id}),function(item){return item});
         },
-        // Obtener Cambio
-        // getCutrrencyRate: function(currency_id){
-        //     return _.filter(this.currencyRate, function(rate){return rate.currency_id[0] === currency_id}).shift();
-        // },
-        // Generar la tabla
+
         loadTable:function(rowsTable){
-            this.dataVoucher=rowsTable;
+            var self = this;
+            self.dataVoucher = rowsTable;
             var table = this.$el.find('#table');
-            table.bootstrapTable('load' ,rowsTable);
+            table.bootstrapTable('load',rowsTable);
         },
-        // Buscar
+
         fectSearch: function(){
             var self = this;
             var today = moment().format('YYYY-MM-DD');
@@ -415,28 +383,27 @@ function report_sale_vendor (reporting){
             var desde =this.$el.find('#from').val();
             var hasta =this.$el.find('#to').val();
             var journal =this.$el.find('#current-journal').val();
-            var currency =this.$el.find('#current-currency').val();
-            var newJournal= self.accountJournal; //copia del Diario
-            var newVoucher= self.accountVoucher; //copia del Vouacher
+            var newJournal= self.ResStore; //copia del Diario
+            var newVoucher= self.AccountInvoice; //copia del Vouacher
 
             if ($('#A').is(":checked")){
                 newVoucher = _.filter(newVoucher, function (inv){
-                    return inv.date_order == today;
+                    return inv.date_invoice == today;
                 });
             }
             if ($('#B').is(":checked")){
                 newVoucher = _.filter(newVoucher, function (inv){
-                    return moment(inv.date_order).format('YYYY-MM-DD') == yesterday;
+                    return moment(inv.date_invoice).format('YYYY-MM-DD') == yesterday;
                 });
             }
             if ($('#C').is(":checked")){
                 newVoucher = _.filter(newVoucher, function (inv){
-                    return moment(inv.date_order).format('YYYY-MM') == month;
+                    return moment(inv.date_invoice).format('YYYY-MM') == month;
                 });
             }
             if ($('#D').is(":checked")){
                 newVoucher = _.filter(newVoucher, function (inv){
-                    return moment(inv.date_order).format('YYYY-MM') == last_month;
+                    return moment(inv.date_invoice).format('YYYY-MM') == last_month;
                 });
             }
 
@@ -445,13 +412,13 @@ function report_sale_vendor (reporting){
                 if (desde.length > 0){
                     var date= desde.split('/');
                     newVoucher = _.filter(newVoucher, function (inv){
-                        return inv.date_order >= (date[2]+"-"+date[1]+"-"+date[0]);
+                        return inv.date_invoice >= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
                 if (hasta.length > 0){
                     var date= hasta.split('/');
-                    newVoucher = _.filter(newVoucher, function (inv){
-                        return inv.date_order <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    newVoucher= _.filter(newVoucher, function (inv){
+                        return inv.date_invoice <= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
             }else{
@@ -464,7 +431,8 @@ function report_sale_vendor (reporting){
             }else {
                 var botonChart =this.$el.find('#chart').attr("disabled", false);
             }
-            self.fecthDataVoucher(newVoucher,newJournal);
+            self.BuildTable(newVoucher,newJournal);
+            // self.loadTable(content)
         },
         // volver
         volver: function(){
@@ -529,7 +497,7 @@ function report_sale_vendor (reporting){
                         pdfDoc.setFontSize(12);
                         pdfDoc.setFontStyle('bold');
                         pdfDoc.setTextColor(40);
-                        pdfDoc.text('Resumen de Egreso de '+ sucusal, data.settings.margin.left, 10);
+                        pdfDoc.text('Resumen de Ventas por Vendedores '+ sucusal, data.settings.margin.left, 10);
                         if(desde.length > 0 || hasta.length > 0){
                             var fecha='';
                             if(desde){
@@ -558,74 +526,66 @@ function report_sale_vendor (reporting){
                 if (typeof pdfDoc.putTotalPages === 'function') {
                     pdfDoc.putTotalPages(totalPagesExp);
                 }
-                pdfDoc.save('Resumen de Egreso.pdf');
+                pdfDoc.save('Resumen de Ventas por Vendedores.pdf');
             },
-        // // Char filter
-        // fectCharFilter: function(objetChar){
-        //     var self = this;
-        //     var dataBody=[];
-        //     var dataHeader=[];
-        //     // objetChar
-        //     var canvas="<canvas id='graf_resume'></canvas>";
-        //       this.$el.find('#grafico').append(canvas);
-        //     _.each(objetChar,function(voucher){
-        //         dataHeader.push(voucher.journal_name);
-        //         dataBody.push(parseFloat(((voucher.amount.replace(".","")).replace(",","."))));
-        //     });
-        //   var selector ="<button type='button' class='oe_button oe_form_button oe_highlight' id='volver_btn' name='volver_btn'><span>Atras</span></button>";
-        //   this.$el.find('#volver').append(selector);
-        //   this.$el.find('.bootstrap-table').hide({
-        //       effect: 'drop',
-        //       direction: 'up',
-        //       duration: 200,
-        //       complete: function () {
-        //         self.drawChart(dataHeader,dataBody);
-        //       }
-        //   });
-        //   this.$el.find('#toolbar').hide({
-        //       effect: 'drop',
-        //       direction: 'up',
-        //       duration: 200,
-        //       complete: function () {
-        //         self.drawChart(dataHeader,dataBody);
-        //       }
-        //   });
-        // },
-        // //Chart
-        // drawChart: function (dataHeader,dataBody) {
-        //     var barChart = new Chart(this.$el.find('#graf_resume'), {
-        //         type: 'doughnut',//bar, doughnut
-        //         data: {
-        //             labels: dataHeader,
-        //             datasets: [
-        //                 {
-        //                     labels: dataHeader,
-        //                     backgroundColor: [
-        //                         'rgba(255, 99, 132, 0.2)',
-        //                         'rgba(54, 162, 235, 0.2)',
-        //                         'rgba(255, 206, 86, 0.2)',
-        //                         'rgba(75, 192, 192, 0.2)',
-        //                         'rgba(153, 102, 255, 0.2)',
-        //                     ],
-        //                     borderColor: [
-        //                         'rgba(255,99,132,1)',
-        //                         'rgba(54, 162, 235, 1)',
-        //                         'rgba(255, 206, 86, 1)',
-        //                         'rgba(75, 192, 192, 1)',
-        //                         'rgba(153, 102, 255, 1)',
-        //                     ],
-        //                     borderWidth: 1,
-        //                     data: dataBody,
-        //                 }
-        //             ]
-        //         },
-        //         options: {
-        //             maintainAspectRatio: false,
-        //             layout: {
-        //                 padding: 30
-        //             }
-        //         },
-        //     });
-        // },
+            // Char filter
+            // fectCharFilter: function(objetChar){
+            //     var self = this;
+            //     var dataBody=[];
+            //     var dataHeader=[];
+            //     // objetChar
+            //     var canvas="<canvas id='graf_resume'></canvas>";
+            //     this.$el.find('#grafico').append(canvas);
+            //     _.each(objetChar,function(voucher){
+            //         dataHeader.push(voucher.journal_name);
+            //         dataBody.push(parseFloat(((voucher.amount.replace(".","")).replace(",","."))));
+            //     });
+            //     var selector ="<button type='button' class='oe_button oe_form_button oe_highlight' id='volver_btn' name='volver_btn'><span>Atras</span></button>";
+            //     this.$el.find('#volver').append(selector);
+            //     this.$el.find('.bootstrap-table').hide({
+            //             effect: 'drop',
+            //             direction: 'up',
+            //             duration: 200,
+            //             complete: function () {
+            //                 self.drawChart(dataHeader,dataBody);
+            //             }
+            //         });
+            // },
+            // //Chart
+            // drawChart: function (dataHeader,dataBody) {
+            //     var barChart = new Chart(this.$el.find('#graf_resume'), {
+            //         type: 'doughnut',//bar, doughnut
+            //         data: {
+            //             labels: dataHeader,
+            //             datasets: [
+            //                 {
+            //                     labels: dataHeader,
+            //                     backgroundColor: [
+            //                         'rgba(255, 99, 132, 0.2)',
+            //                         'rgba(54, 162, 235, 0.2)',
+            //                         'rgba(255, 206, 86, 0.2)',
+            //                         'rgba(75, 192, 192, 0.2)',
+            //                         'rgba(153, 102, 255, 0.2)',
+            //                     ],
+            //                     borderColor: [
+            //                         'rgba(255,99,132,1)',
+            //                         'rgba(54, 162, 235, 1)',
+            //                         'rgba(255, 206, 86, 1)',
+            //                         'rgba(75, 192, 192, 1)',
+            //                         'rgba(153, 102, 255, 1)',
+            //                     ],
+            //                     borderWidth: 1,
+            //                     data: dataBody,
+            //                 }
+            //             ]
+            //         },
+            //         options: {
+            //             maintainAspectRatio: false,
+            //             layout: {
+            //                 padding: 30
+            //             }
+            //         },
+            //     });
+            // },
     });
 }

+ 3 - 3
static/src/reports/report_invoice_balance.xml

@@ -127,9 +127,9 @@
                 <thead>
                     <tr>
                         <th data-field="number" data-sortable="true">Factura</th>
-                        <th data-field="partner">Cliente / Proveedor</th>
-                        <th data-field="date_invoice">Fecha</th>
-                        <th data-field="user">Responsable</th>
+                        <th data-field="partner" data-sortable="true">Cliente / Proveedor</th>
+                        <th data-field="date_invoice" data-sortable="true">Fecha</th>
+                        <th data-field="user" data-sortable="true">Responsable</th>
                         <th data-field="amount_total" data-sortable="true" data-align="right">Valor</th>
                         <th data-field="entry" data-sortable="true" data-align="right">Ingreso</th>
                         <th data-field="egress" data-sortable="true" data-align="right">Egreso</th>

+ 2 - 2
static/src/reports/report_sale_vendor.xml

@@ -50,7 +50,7 @@
                             </div>
                         </div>
                     </div>
-                    <div class="col-xs-6">
+                    <!-- <div class="col-xs-6">
                         <div class="panel panel-default">
                             <div class="panel-heading">Características</div>
                             <div class="panel-body">
@@ -60,7 +60,7 @@
                                 </div>
                             </div>
                         </div>
-                    </div>
+                    </div> -->
                 </div>
             </div>
             <div id="toolbar">