Browse Source

ADD-FIX añadido report de cabecera de ventas normales, filtros como sucursal, hora y método de pagos

Sebas 6 years ago
parent
commit
056aca6f1f

+ 18 - 3
static/src/js/configuration_reporting.js

@@ -28,11 +28,21 @@ function configuration_reporting (instance, widget) {
                 description: 'Permite visualizar las facturas',
                 action: 'ReportInvoiceBalance'
             },
+            {
+                title: 'Histórico de Movimiento de Banco',
+                description: 'Permite visualizar un histórico de Movimiento de Banco.',
+                action: 'ReportBankMovements'
+            },
             // {
-            //     title: 'Histórico de Movimiento de Banco',
-            //     description: 'Permite visualizar un histórico de Movimiento de Banco.',
-            //     action: 'ReportBankMovements'
+            //     title: 'LIstado Generales por Banco',
+            //     description: 'Permite visualizar un Generales por Banco.',
+            //     action: 'ReportBankGral'
             // },
+            {
+                title: 'Histórico de Ventas',
+                description: 'Permite realizar un listado de las cabeceras de facturas de venta.',
+                action: 'ReportSaleCab'
+            },
             {
                 title: 'Análisis de Ventas',
                 description: 'Permite realizar un analisis de las facturas de venta.',
@@ -58,6 +68,11 @@ function configuration_reporting (instance, widget) {
                 description: 'Permite visualizar de forma global los ingresos obtenidos por la empresa.',
                 action: 'ReportPosOrders'
             },
+            // {
+            //     title: 'Analisis de ventas generales',
+            //     description: 'Permite visualizar de forma global los ingresos obtenidos por la empresa. Tanto ventas normales y punto de ventas',
+            //     action: 'ReportVentasPosOrders'
+            // },
             {
                 title: 'Ranking Productos más Vendidos',
                 description: 'Permite realizar un analisis de los Productos más Vendidos.',

+ 16 - 4
static/src/js/main.js

@@ -40,7 +40,10 @@ openerp.eiru_reporting = function (instance) {
         report_product_pack_utilidad(reporting);
         report_product_pack(reporting);
         ranking_purchases_orders_product_cy(reporting);
-        // report_bank_movements(reporting);
+        report_bank_movements(reporting);
+        // report_bank_gral(reporting);
+        // report_ventas_pos_orders(reporting);
+        report_sale_cab(reporting);
         report_pos_orders(reporting);
 
     } catch (e) {
@@ -60,7 +63,9 @@ openerp.eiru_reporting = function (instance) {
     // Historico de facturas
     instance.web.client_actions.add('eiru_reporting.invoice_action_report', 'instance.eiru_reporting.ReportInvoiceBalanceWidget');
     // Historico de Movimiento de Banco
-    // instance.web.client_actions.add('eiru_reporting.bank_movements_action_report', 'instance.eiru_reporting.ReportBankMovementsWidget');
+    instance.web.client_actions.add('eiru_reporting.bank_movements_action_report', 'instance.eiru_reporting.ReportBankMovementsWidget');
+    // Historico de gral de Banco
+    // instance.web.client_actions.add('eiru_reporting.bank_gral_action_report', 'instance.eiru_reporting.ReportBankGralWidget');
     // Historico de pagos
     instance.web.client_actions.add('eiru_reporting.voucher_action_report', 'instance.eiru_reporting.ReportVoucherWidget');
     // Listado de cuentas a cobrar Vencidas
@@ -69,6 +74,9 @@ openerp.eiru_reporting = function (instance) {
     instance.web.client_actions.add('eiru_reporting.account_action_report', 'instance.eiru_reporting.ReportingAccountWidget');
 
     // ******************************************* Ventas *************************************************************************
+    // Historico de ventas
+    instance.web.client_actions.add('eiru_reporting.sale_order_action_report', 'instance.eiru_reporting.ReportSaleCabWidget');
+
     // Analisis de ventas
     instance.web.client_actions.add('eiru_reporting.sale_action_report', 'instance.eiru_reporting.ReportSaleInvoiceAnalysisWidget');
 
@@ -79,12 +87,16 @@ openerp.eiru_reporting = function (instance) {
     instance.web.client_actions.add('eiru_reporting.productranking_action_report', 'instance.eiru_reporting.RankingSalesOrdersProductcyWidget');
 
     // ******************************************* Terminal de Ventas *************************************************************************
-    // Analisis de ventas
-    instance.web.client_actions.add('eiru_reporting.point_of_sale_detail_action_report', 'instance.eiru_reporting.ReportPosOrdersWidget');
 
     // Historico de ventas
     instance.web.client_actions.add('eiru_reporting.point_of_sale_action_report', 'instance.eiru_reporting.ReportPosWidget');
 
+    // Analisis de ventas
+    instance.web.client_actions.add('eiru_reporting.point_of_sale_detail_action_report', 'instance.eiru_reporting.ReportPosOrdersWidget');
+
+    // Historico de pos y ventas
+    // instance.web.client_actions.add('eiru_reporting.point_venta_action_report', 'instance.eiru_reporting.ReportVentasPosOrdersWidget');
+
     // Ranking de productos
     instance.web.client_actions.add('eiru_reporting.point_of_sale_ranking_action_report', 'instance.eiru_reporting.RankingPosOrdersProductcyWidget');
      // Ranking de clientes

+ 574 - 0
static/src/js/reports/report_bank_gral.js

@@ -0,0 +1,574 @@
+function report_bank_gral (reporting){
+    "use strict";
+
+    var instance = openerp;
+
+    reporting.ReportBankGralWidget = reporting.Base.extend({
+        template: 'ReportBankGral',
+        content:[],
+        ResBank:[],
+        BankPaymentLine:[],
+        BankPayment:[],
+        rowsData :[],
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+
+            'click #X' : 'factSearch',
+            'click #A' : 'factSearch',
+            'click #B' : 'factSearch',
+            'click #C' : 'factSearch',
+            'click #D' : 'factSearch',
+            'click #Z' : 'factSearch',
+
+            'click #Y' : 'factSearch',
+            'click #current-bank' : 'factSearch',
+            'click #bankPaymentsType' : 'factSearch',
+
+            'click #W' : 'factSearch',
+            'click #available' : 'factSearch',
+            'click #cashed' : 'factSearch',
+            'click #negotiated' : 'factSearch',
+            'click #renegotiated' : 'factSearch',
+
+            'change #from' : 'factSearch',
+            'change #to' : 'factSearch',
+
+            'click-row.bs.table #table ' : 'clickAnalysisDetail',
+        },
+        init : function(parent){
+            this._super(parent);
+        },
+        start: function () {
+            var self = this;
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowsData});
+            this.fecthFecha();
+            this.submitForm();
+        },
+        clickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'create_date'){
+                this.do_action({
+                    name:"Detalles del Movimiento",
+                    type: 'ir.actions.act_window',
+                    res_model: "res.bank.payments",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            if (field == 'bank'){
+                this.do_action({
+                    name:"Registro Banco",
+                    type: 'ir.actions.act_window',
+                    res_model: "res.bank",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.bank_id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.bank_id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+        submitForm: function () {
+            var self = this;
+            self.fetchBankPayment().then(function(BankPayment) {
+                return BankPayment;
+            }).then(function (BankPayment) {
+                self.BankPayment = BankPayment;
+                return self.fetchBankPaymentLine();
+            }).then(function (BankPaymentLine) {
+                self.BankPaymentLine = BankPaymentLine;
+                // console.log(self.BankPaymentLine);
+            //     return self.fecthResBank();
+            // }).then(function(ResBank){
+            //     self.ResBank = ResBank;
+            //     self.$el.find('#current-bank').append('<option value="9999999">Todas los bancos</option>');
+            //     _.each(ResBank,function(item){
+            //         self.$el.find('#current-bank').append('<option value="' + item.id + '">' + item.name + '</option>');
+            //     });
+            //     return self.fetchResBankPaymentsType();
+            // }).then(function(BankPaymentsType){
+            //     self.BankPaymentsType = BankPaymentsType;
+            //     self.$el.find('#current-bank-type').append('<option value="9999999">Todas los tipos</option>');
+            //     _.each(BankPaymentsType,function(item){
+            //         self.$el.find('#current-bank-type').append('<option value="' + item.id + '">' + item.name + '</option>');
+            //     });
+            //     return self.fetchResPartner();
+            // }).then(function(ResPartner){
+            //     self.ResPartner = ResPartner;
+                self.search();
+                // self.searchBank();
+                // self.searchBankPaymentsType();
+                return self.BuildTable();
+            });
+        },
+
+        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;
+            }
+        },
+
+        fetchBankPayment: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var field = ['id', 'create_date', 'number', 'name_holder', 'state', 'number_cta', 'currency_id', 'bank_id','date','partner_id','payments_line','amount_total','bank_payments_type_id'];
+            var BankPayment = new instance.web.Model('res.bank.payments');
+            BankPayment.query(field).filter().all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchBankPaymentLine: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var linesIds = _.flatten(_.map(self.BankPayment, function (item) {
+                console.log(linesIds);
+                return item.payments_line;
+            }));
+
+            var fields = ['id', 'date', 'bank_payments_id', 'amount'];
+            var domain = [['id', 'in', linesIds]];
+            var BankPaymentLine = new instance.web.Model('res.bank.payments.line');
+            BankPaymentLine.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results)
+            });
+            return defer;
+        },
+
+        //Obtener la Detalles de la Factura
+        getBankPayment: function (id_line){
+            return _.find(this.BankPayment, function (inv) {
+                return _.contains(inv.payments_line, id_line);
+            });
+        },
+
+        // getBankPayment: function(id){
+        //     var self = this;
+        //     return _.filter(self.BankPayment,function (item) {
+        //         return item.id == id;
+        //     });
+        // },
+
+        // fecthResBank: function() {
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var ResBank = new instance.web.Model('res.bank');
+        //     ResBank.query(['id', 'name', 'ruc', 'active']).filter([['active', '=', true]]).all().then(function (results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+        //
+        // searchBank: function () {
+        //     var self = this;
+        //     var results = self.ResBank;
+        //     results = _.map(results, function (item) {
+        //         return {
+        //                 label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
+        //                 value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
+        //         }
+        //     });
+        //     self.$('#bank').autocomplete({
+        //         source: results,
+        //         minLength:0,
+        //         search: function(event, ui) {
+        //             if (!(self.$('#bank').val())){
+        //                 self.factSearch();
+        //             }
+        //         },
+        //         close: function( event, ui ) {
+        //                 self.factSearch();
+        //         },
+        //         select: function(event, ui) {
+        //             self.factSearch();
+        //         }
+        //     });
+        // },
+        //
+        // fetchResBankPaymentsType: function() {
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var ResBankPaymentsType = new instance.web.Model('res.bank.payments.type');
+        //     ResBankPaymentsType.query(['id', 'name', 'code', 'is_receipt', 'is_payment']).filter().all().then(function (results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+        //
+        // searchBankPaymentsType: function () {
+        //     var self = this;
+        //     var results = self.ResBankPaymentsType;
+        //     results = _.map(results, function (item) {
+        //         return {
+        //                 label: item.id + '-'+ item.name + ' ' + self.valorNull(item.code),
+        //                 value: item.id + '-'+ item.name + ' ' + self.valorNull(item.code)
+        //         }
+        //     });
+        //     self.$('#bankPaymentsType').autocomplete({
+        //         source: results,
+        //         minLength:0,
+        //         search: function(event, ui) {
+        //             if (!(self.$('#bankPaymentsType').val())){
+        //                 self.factSearch();
+        //             }
+        //         },
+        //         close: function( event, ui ) {
+        //                 self.factSearch();
+        //         },
+        //         select: function(event, ui) {
+        //             self.factSearch();
+        //         }
+        //     });
+        // },
+        //
+        // fetchResPartner: function() {
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var ResPartner = new instance.web.Model('res.partner');
+        //     ResPartner.query(['id', 'name', 'ruc', 'active']).filter([['active', '=', true]]).all().then(function (results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        // search: function () {
+        //     var self = this;
+        //     var results = self.ResPartner;
+        //     results = _.map(results, function (item) {
+        //         return {
+        //                 label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
+        //                 value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
+        //         }
+        //     });
+        //     self.$('#partner').autocomplete({
+        //         source: results,
+        //         minLength:0,
+        //         search: function(event, ui) {
+        //             if (!(self.$('#partner').val())){
+        //                 self.factSearch();
+        //             }
+        //         },
+        //         close: function( event, ui ) {
+        //                 self.factSearch();
+        //         },
+        //         select: function(event, ui) {
+        //             self.factSearch();
+        //         }
+        //     });
+        // },
+
+        BuildTable: function(){
+            var self = this;
+            var data = [];
+            var payment;
+            var item;
+            var BankPayment;
+            var amount_total_num;
+            for (var i = 0; i < this.BankPaymentLine.length; i++) {
+                item = this.BankPaymentLine[i];
+                // payment = this.getBankPayment(item.id);
+                    data.push({
+                        // id : payment.id,
+                        // number: payment.number,
+                        // titular: payment.name_holder,
+                        // partner: payment.partner_id[1],
+                        create_date: moment(item.date).format("DD/MM/YYYY"),
+                        // number_cta: payment.number_cta,
+                        amount_total: accounting.formatNumber(item.amount,0,".",","),
+                        // type_bank: payment.bank_payments_type_id[1],
+                        // bank: payment.bank_id[1],
+                        // state: payment.state,
+                        date: item.date,
+                        // partner_id : payment.partner_id[0],
+                        // bank_id : payment.bank_id[0],
+                        // bank_payments_type_id: payment.bank_payments_type_id[0],
+                        amount_total_num: item.amount,
+                    });
+            }
+            self.content = data;
+            this.loadTable(data);
+        },
+
+        factSearch: function(){
+            var self = this;
+            var hoy = moment().format('YYYY-MM-DD');
+            var desde = this.$el.find('#from').val();
+            var hasta = this.$el.find('#to').val();
+            var partner = this.$el.find('#partner').val().split('-');
+
+            var bank = this.$el.find('#current-bank').val().split('-');
+            var bankPaymentsType = this.$el.find('#bankPaymentsType').val();
+            var content = self.content;
+
+            if ($('#A').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.date == hoy;
+                });
+            }
+            if ($('#B').is(":checked")){
+                var date = hoy.split('-');
+                var ayer = date[2] - 1;
+                date.splice(2,0);
+                if(date[2] < 10){
+                    date[2] = '0'+ayer;
+                }else{
+                    date[2] = ayer;
+                }
+                content = _.filter(content, function (inv){
+                    return inv.date == date[0]+'-'+date[1]+'-'+date[2];
+                });
+            }
+            if ($('#C').is(":checked")){
+                var date = hoy.split('-');
+                content = _.filter(content, function (inv){
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                });
+            }
+            if ($('#D').is(":checked")){
+                var date = hoy.split('-');
+                var mes = date[1] - 1;
+                var year;
+                date.splice(1,0);
+                if(date[1] == 1){
+                    date[1] = '12';
+                    year = date[0] - 1;
+                    date[0] = year;
+                }else{
+
+                    if(date[1] < 10){
+                        date[1] = '0'+mes;
+                    }else{
+                        date[1] = mes;
+                    }
+                }
+                content = _.filter(content, function (inv){
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                });
+            }
+            if ($('#Z').is(":checked")){
+                $('#datepicker').css('display','block');
+                if (desde.length > 0){
+                    var date= desde.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+                if (hasta.length > 0){
+                    var date= hasta.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+            }else{
+                $('#datepicker').css('display','none');
+            }
+
+            if (partner != ""){
+                content = _.filter(content, function(inv){
+                    return inv.partner_id == partner[0];
+                });
+            }
+            if ($('#available').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.state == 'available';
+                });
+            }
+            if ($('#cashed').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.state == 'cashed';
+                });
+            }
+            if ($('#negotiated').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.state == 'negotiated';
+                });
+            }
+            if ($('#renegotiated').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.state == 'renegotiated';
+                });
+            }
+            if(bank != 9999999){
+                content=_.filter(content, function (inv){
+                    return inv.bank_id == bank[0];
+                });
+            }
+
+            var amount_egress_num = _.reduce(_.map(content,function(map){
+                return(map.amount_payment_num);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var amount_to_receive_num = _.reduce(_.map(content,function(map){
+                return(map.amount_receipt_num);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var amount_entry_num = _.reduce(_.map(content,function(map){
+                return(map.amount_total_num);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            content.push({
+                create_date: "Totales",
+                amount_payment: accounting.formatNumber(amount_egress_num,0,".",","),
+                amount_receipt: accounting.formatNumber(amount_to_receive_num,0,".",","),
+                amount_total: accounting.formatNumber(amount_entry_num,0,".",","),
+            });
+
+            self.loadTable(content)
+        },
+
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load',rowsTable);
+        },
+
+        getObjectPdf: function(rowsTable){
+            var self = this;
+            var rowsPdf=[];
+            var rows=[];
+            var rows = self.rowsData;
+            return rows;
+        },
+
+        clickOnAction: function (e) {
+            var self = this;
+            var rowsNew;
+            var action = self.$el.find(e.target).val();
+            var table = self.$el.find("#table");
+            var data2 = table.bootstrapTable('getVisibleColumns');
+            var getColumns=[];
+            var rows=[];
+            rowsNew = self.getObjectPdf();
+            if (action === 'pdf') {
+                var dataNEW = _.map(data2, function (val){
+                    return val.field;
+                });
+                _.each(rowsNew,function (item){
+                    rows.push(_.pick(item, dataNEW));
+                });
+                _.each(_.map(data2,function(val){
+                        return val;
+                    }), function(item){
+                            getColumns.push([{
+                                        title: item.title,
+                                        dataKey: item.field
+                                    }]);
+                });
+                this.drawPDF(_.flatten(getColumns),rows);
+            }
+        },
+
+        drawPDF: function (getColumns,rows) {
+            var self = this;
+            var hoy = moment().format('DD/MM/YYYY');
+            var desde =(this.$el.find('#from').val());
+            var hasta =(this.$el.find('#to').val());
+            var totalPagesExp = "{total_pages_count_string}";
+            var pdfDoc = new jsPDF('l');
+
+            pdfDoc.autoTable(getColumns, rows, {
+                styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
+                columnStyles: {
+                    number : {columnWidth: '8px'},
+                    create_date : {columnWidth: '8px'},
+                    titular : {columnWidth: '8px'},
+                    number_cta : {columnWidth: '6px'},
+                    type_bank : {columnWidth: '6px'},
+                    amount_payment: {halign:'right',columnWidth: '8px'},
+                    amount_receipt: {halign:'right',columnWidth: '8px'},
+                    amount_total: {halign:'right',columnWidth: '8px'},
+                    date_maturity: {halign:'right',columnWidth: '8px'},
+                    bank_id: {halign:'right',columnWidth: '8px'},
+                    state: {halign:'right',columnWidth: '8px'}
+                },
+                margin: { top: 20, horizontal: 7},
+
+                addPageContent: function (data) {
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text('Seguimiento de Cheque', 80, 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);
+                    }
+
+                    var str = " Pagina  " + data.pageCount;
+                    if (typeof pdfDoc.putTotalPages === 'function') {
+                        str = str + " de " + totalPagesExp
+                    }
+                    pdfDoc.setFontSize(9);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text(175,pdfDoc.internal.pageSize.height - 5,str);
+                    }
+            });
+            if (typeof pdfDoc.putTotalPages === 'function') {
+                pdfDoc.putTotalPages(totalPagesExp);
+            }
+            pdfDoc.save('Seguimiento de Cheque.pdf')
+        },
+    });
+}

+ 172 - 239
static/src/js/reports/report_bank_movements.js

@@ -6,6 +6,7 @@ function report_bank_movements (reporting){
     reporting.ReportBankMovementsWidget = reporting.Base.extend({
         template: 'ReportBankMovements',
         content:[],
+        ResBank:[],
         rowsData :[],
         events:{
             'click #toolbar > button' : 'clickOnAction',
@@ -18,13 +19,14 @@ function report_bank_movements (reporting){
             'click #Z' : 'factSearch',
 
             'click #Y' : 'factSearch',
-            'click #sale' : 'factSearch',
-            'click #purchase' : 'factSearch',
-            'click #expense' : 'factSearch',
+            'click #current-bank' : 'factSearch',
+            'click #bankPaymentsType' : 'factSearch',
 
             'click #W' : 'factSearch',
-            'click #open' : 'factSearch',
-            'click #paid' : 'factSearch',
+            'click #available' : 'factSearch',
+            'click #cashed' : 'factSearch',
+            'click #negotiated' : 'factSearch',
+            'click #renegotiated' : 'factSearch',
 
             'change #from' : 'factSearch',
             'change #to' : 'factSearch',
@@ -42,54 +44,60 @@ function report_bank_movements (reporting){
             this.submitForm();
         },
         clickAnalysisDetail: function(e, row, $element, field){
-            if (field == 'number'){
+            if (field == 'create_date'){
                 this.do_action({
-                    name:"Factura de proveedor",
+                    name:"Detalles del Movimiento",
                     type: 'ir.actions.act_window',
-                    res_model: "account.invoice",
+                    res_model: "res.bank.payments",
                     views: [[false,'form']],
                     target: 'new',
-                    domain: [['type', '=', 'in_invoice'],['id','=', row.id]],
+                    domain: [['id','=', row.id]],
                     context: {},
                     flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
                     res_id: row.id,
                 });
             }
-            if (field == 'partner'){
+            if (field == 'bank'){
                 this.do_action({
-                    name:"Registro",
+                    name:"Registro Banco",
                     type: 'ir.actions.act_window',
-                    res_model: "res.partner",
+                    res_model: "res.bank",
                     views: [[false,'form']],
                     target: 'new',
-                    domain: [['id','=', row.partner_id]],
+                    domain: [['id','=', row.bank_id]],
                     context: {},
                     flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
-                    res_id: row.partner_id,
+                    res_id: row.bank_id,
                 });
             }
             e.stopImmediatePropagation();
         },
         submitForm: function () {
             var self = this;
-            self.fetchAccountInvoice().then(function(AccountInvoice) {
-                return AccountInvoice;
-            }).then(function (AccountInvoice) {
-                self.AccountInvoice = AccountInvoice;
-            //     return self.fecthResStore();
-            // }).then(function(ResStore){
-            //     self.ResStore = ResStore;
-            //     self.$el.find('#current-store').append('<option value="9999999">Todas las SUC.</option>');
-            //     _.each(ResStore,function(item){
-            //         self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
-            //     });
-                 return self.fecthAccountJournal();
-            }).then(function(AccountJournal){
-                self.AccountJournal = AccountJournal;
+            self.fetchBankPayment().then(function(BankPayment) {
+                return BankPayment;
+            }).then(function (BankPayment) {
+                self.BankPayment = BankPayment;
+                return self.fecthResBank();
+            }).then(function(ResBank){
+                self.ResBank = ResBank;
+                self.$el.find('#current-bank').append('<option value="9999999">Todas los bancos</option>');
+                _.each(ResBank,function(item){
+                    self.$el.find('#current-bank').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                return self.fetchResBankPaymentsType();
+            }).then(function(BankPaymentsType){
+                self.BankPaymentsType = BankPaymentsType;
+                self.$el.find('#current-bank-type').append('<option value="9999999">Todas los tipos</option>');
+                _.each(BankPaymentsType,function(item){
+                    self.$el.find('#current-bank-type').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
                 return self.fetchResPartner();
             }).then(function(ResPartner){
                 self.ResPartner = ResPartner;
                 self.search();
+                self.searchBank();
+                self.searchBankPaymentsType();
                 return self.BuildTable();
             });
         },
@@ -128,41 +136,89 @@ function report_bank_movements (reporting){
             }
         },
 
-        // fecthResStore: function(){
-        //     var self = this;
-        //     var defer = $.Deferred();
-        //     var field=['id', 'name'];
-        //     var ResStore = new instance.web.Model('res.store');
-        //     ResStore.query(field).all().then(function(results){
-        //         defer.resolve(results);
-        //     });
-        //     return defer;
-        // },
+        fetchBankPayment: function () {
+            var self = this;
+            var field = ['id', 'create_date', 'number', 'name_holder', 'state', 'number_cta', 'currency_id', 'bank_id','date','partner_id','amount_payment','amount_receipt','amount_total','bank_payments_type_id'];
+            var defer = $.Deferred();
+            var BankPayment = new instance.web.Model('res.bank.payments');
+            BankPayment.query(field).filter().all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
 
-        fecthAccountJournal: function(){
+        fecthResBank: function() {
             var self = this;
             var defer = $.Deferred();
-            var field = ['id', 'name'];
-            var domain = [['active','=',true],['type','in',['sale','purchase']]];
-            var AccountJournal = new instance.web.Model('account.journal');
-            AccountJournal.query(field).filter(domain).all().then(function(results){
+            var ResBank = new instance.web.Model('res.bank');
+            ResBank.query(['id', 'name', 'ruc', 'active']).filter([['active', '=', true]]).all().then(function (results) {
                 defer.resolve(results);
             });
             return defer;
         },
 
-        fetchAccountInvoice: function () {
+        searchBank: function () {
+            var self = this;
+            var results = self.ResBank;
+            results = _.map(results, function (item) {
+                return {
+                        label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
+                        value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
+                }
+            });
+            self.$('#bank').autocomplete({
+                source: results,
+                minLength:0,
+                search: function(event, ui) {
+                    if (!(self.$('#bank').val())){
+                        self.factSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.factSearch();
+                },
+                select: function(event, ui) {
+                    self.factSearch();
+                }
+            });
+        },
+
+        fetchResBankPaymentsType: function() {
             var self = this;
-            var filter = [['type','not in',['in_refund','out_refund']],['state','in',['open','paid']]];
-            var field = ['id', 'type', 'number', 'origin', 'state', 'journal_id', 'currency_id', 'supplier_invoice_number','date_invoice','partner_id','amount_total','user_id','type','residual'];
             var defer = $.Deferred();
-            var AccountInvoice = new instance.web.Model('account.invoice');
-            AccountInvoice.query(field).filter(filter).all().then(function (results) {
+            var ResBankPaymentsType = new instance.web.Model('res.bank.payments.type');
+            ResBankPaymentsType.query(['id', 'name', 'code', 'is_receipt', 'is_payment']).filter().all().then(function (results) {
                 defer.resolve(results);
             });
             return defer;
         },
 
+        searchBankPaymentsType: function () {
+            var self = this;
+            var results = self.ResBankPaymentsType;
+            results = _.map(results, function (item) {
+                return {
+                        label: item.id + '-'+ item.name + ' ' + self.valorNull(item.code),
+                        value: item.id + '-'+ item.name + ' ' + self.valorNull(item.code)
+                }
+            });
+            self.$('#bankPaymentsType').autocomplete({
+                source: results,
+                minLength:0,
+                search: function(event, ui) {
+                    if (!(self.$('#bankPaymentsType').val())){
+                        self.factSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.factSearch();
+                },
+                select: function(event, ui) {
+                    self.factSearch();
+                }
+            });
+        },
+
         fetchResPartner: function() {
             var self = this;
             var defer = $.Deferred();
@@ -207,72 +263,41 @@ function report_bank_movements (reporting){
             });
         },
 
-        getAccountJournal: function (id) {
-            var self = this;
-            return _.filter(self.AccountJournal,function (item) {
-                return item.id === id;
-            });
-        },
+        // getAccountJournal: function (id) {
+        //     var self = this;
+        //     return _.filter(self.AccountJournal,function (item) {
+        //         return item.id === id;
+        //     });
+        // },
 
         BuildTable: function(){
             var self = this;
             var data = [];
-            var AccountInvoice = self.AccountInvoice;
+            var BankPayment = self.BankPayment;
             var amount_total_num;
-            var entry;
-            var egress;
-            var to_receive;
-            var to_pay;
-            var entry_num;
-            var egress_num;
-            var to_receive_num;
-            var to_pay_num;
-            var invoice_type;
-            _.each(AccountInvoice, function(item){
-                if (item.type == 'out_invoice') {
-                    entry = item.amount_total - item.residual;
-                    egress = 0;
-                    to_receive = item.residual;
-                    to_pay = 0;
-                    invoice_type = 'sale';
-                } else {
-                    entry = 0;
-                    egress = item.amount_total - item.residual;
-                    to_receive = 0;
-                    to_pay = item.residual;
-                    if (item.origin == false) {
-                        invoice_type = 'expense';
-                    } else {
-                        invoice_type = 'purchase';
-                    }
-                }
-                // var store_id = self.getAccountJournal(item.journal_id[0]);
-                // if(store_id.length > 0){
+            _.each(BankPayment, function(item){
                     data.push({
                         id : item.id,
                         number: item.number,
+                        titular: item.name_holder,
                         partner: item.partner_id[1],
-                        date_invoice: moment(item.date_invoice).format("DD/MM/YYYY"),
-                        user: item.user_id[1],
+                        create_date: moment(item.create_date).format("DD/MM/YYYY"),
+                        number_cta: item.number_cta,
+                        amount_payment: accounting.formatNumber(item.amount_payment,0,".",","),
+                        amount_receipt: accounting.formatNumber(item.amount_receipt,0,".",","),
                         amount_total: accounting.formatNumber(item.amount_total,0,".",","),
-                        entry: accounting.formatNumber(entry,0,".",","),
-                        egress: accounting.formatNumber(egress,0,".",","),
-                        to_receive: accounting.formatNumber(to_receive,0,".",","),
-                        to_pay: accounting.formatNumber(to_pay,0,".",","),
+                        date_maturity: moment(item.date_maturity).format("DD/MM/YYYY"),
+                        type_bank: item.bank_payments_type_id[1],
+                        bank: item.bank_id[1],
                         state: item.state,
-                        invoice_type: invoice_type,
-                        date: item.date_invoice,
-                        journal_id : item.journal_id[0],
-                        currency_id : item.currency_id[0],
+                        date: item.create_date,
                         partner_id : item.partner_id[0],
+                        bank_id : item.bank_id[0],
+                        bank_payments_type_id: item.bank_payments_type_id[0],
                         amount_total_num: item.amount_total,
-                        entry_num: entry,
-                        egress_num: egress,
-                        to_receive_num: to_receive,
-                        to_pay_num: to_pay,
-                        // store_id: store_id[0].store_ids[0],
+                        amount_payment_num: item.amount_payment,
+                        amount_receipt_num: item.amount_receipt,
                     });
-                // }
             });
             self.content = data;
             this.loadTable(data);
@@ -284,7 +309,9 @@ function report_bank_movements (reporting){
             var desde = this.$el.find('#from').val();
             var hasta = this.$el.find('#to').val();
             var partner = this.$el.find('#partner').val().split('-');
-            // var store = this.$el.find('#current-store').val();
+
+            var bank = this.$el.find('#current-bank').val().split('-');
+            var bankPaymentsType = this.$el.find('#bankPaymentsType').val();
             var content = self.content;
 
             if ($('#A').is(":checked")){
@@ -352,75 +379,62 @@ function report_bank_movements (reporting){
                 $('#datepicker').css('display','none');
             }
 
-            if ($('#sale').is(":checked")){
-                content = _.filter(content, function (inv){
-                    return inv.invoice_type == 'sale';
+            if (partner != ""){
+                content = _.filter(content, function(inv){
+                    return inv.partner_id == partner[0];
                 });
             }
-            if ($('#purchase').is(":checked")){
+            if ($('#available').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return inv.invoice_type == 'purchase';
+                    return inv.state == 'available';
                 });
             }
-            if ($('#expense').is(":checked")){
+            if ($('#cashed').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return inv.invoice_type == 'expense';
+                    return inv.state == 'cashed';
                 });
             }
-            if ($('#open').is(":checked")){
+            if ($('#negotiated').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return inv.state == 'open';
+                    return inv.state == 'negotiated';
                 });
             }
-            if ($('#paid').is(":checked")){
+            if ($('#renegotiated').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return inv.state == 'paid';
+                    return inv.state == 'renegotiated';
                 });
             }
-            if (partner != ""){
-                content = _.filter(content, function(inv){
-                    return inv.partner_id == partner[0];
+            if(bank != 9999999){
+                content=_.filter(content, function (inv){
+                    return inv.bank_id == bank[0];
                 });
             }
-            // if(store != 9999999){
-            //     content=_.filter(content, function (inv){
-            //         return inv.store_id == store
-            //     });
-            // }
-
-            var amount_entry_num = _.reduce(_.map(content,function(map){
-                return(map.entry_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
 
             var amount_egress_num = _.reduce(_.map(content,function(map){
-                return(map.egress_num);
+                return(map.amount_payment_num);
             }),function(memo, num){
                 return memo + num;
             },0);
 
             var amount_to_receive_num = _.reduce(_.map(content,function(map){
-                return(map.to_receive_num);
+                return(map.amount_receipt_num);
             }),function(memo, num){
                 return memo + num;
             },0);
 
-            var amount_to_pay_num = _.reduce(_.map(content,function(map){
-                return(map.to_pay_num);
+            var amount_entry_num = _.reduce(_.map(content,function(map){
+                return(map.amount_total_num);
             }),function(memo, num){
                 return memo + num;
             },0);
 
             content.push({
-                number: "Total",
-                entry: accounting.formatNumber(amount_entry_num,0,".",","),
-                egress: accounting.formatNumber(amount_egress_num,0,".",","),
-                to_receive: accounting.formatNumber(amount_to_receive_num,0,".",","),
-                to_pay: accounting.formatNumber(amount_to_pay_num,0,".",","),
+                create_date: "Totales",
+                amount_payment: accounting.formatNumber(amount_egress_num,0,".",","),
+                amount_receipt: accounting.formatNumber(amount_to_receive_num,0,".",","),
+                amount_total: accounting.formatNumber(amount_entry_num,0,".",","),
             });
 
-
             self.loadTable(content)
         },
 
@@ -436,49 +450,6 @@ function report_bank_movements (reporting){
             var rowsPdf=[];
             var rows=[];
             var rows = self.rowsData;
-
-            var amount_total_num = _.reduce(_.map(rows,function(map){
-                return(map.amount_total_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
-
-
-            var entry_num = _.reduce(_.map(rows,function(map){
-                return(map.entry_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
-
-            var egress_num = _.reduce(_.map(rows,function(map){
-                return(map.egress_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
-            var to_receive_num = _.reduce(_.map(rows,function(map){
-                return(map.to_receive_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
-            var to_pay_num = _.reduce(_.map(rows,function(map){
-                return(map.to_pay_num);
-            }),function(memo, num){
-                return memo + num;
-            },0);
-            if (rows.length > 0){
-                rows.push({
-                    number : 'Totales',
-                    partner : '',
-                    date : '',
-                    user : '',
-                    amount_total: accounting.formatNumber(amount_total_num,0,".",","),
-                    entry: accounting.formatNumber(entry_num,0,".",","),
-                    egress: accounting.formatNumber(egress_num,0,".",","),
-                    to_receive: accounting.formatNumber(to_receive_num,0,".",","),
-                    to_pay: accounting.formatNumber(to_pay_num,0,".",","),
-                });
-            }
-
             return rows;
         },
 
@@ -522,14 +493,16 @@ function report_bank_movements (reporting){
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
                     number : {columnWidth: '8px'},
-                    partner : {columnWidth: '8px'},
-                    date : {columnWidth: '8px'},
-                    user : {columnWidth: '6px'},
-                    entry: {halign:'right',columnWidth: '11px'},
-                    egress: {halign:'right',columnWidth: '9px'},
-                    to_receive: {halign:'right',columnWidth: '9px'},
-                    to_pay: {halign:'right',columnWidth: '8px'},
-                    amount_total: {halign:'right',columnWidth: '11px'},
+                    create_date : {columnWidth: '8px'},
+                    titular : {columnWidth: '8px'},
+                    number_cta : {columnWidth: '6px'},
+                    type_bank : {columnWidth: '6px'},
+                    amount_payment: {halign:'right',columnWidth: '8px'},
+                    amount_receipt: {halign:'right',columnWidth: '8px'},
+                    amount_total: {halign:'right',columnWidth: '8px'},
+                    date_maturity: {halign:'right',columnWidth: '8px'},
+                    bank_id: {halign:'right',columnWidth: '8px'},
+                    state: {halign:'right',columnWidth: '8px'}
                 },
                 margin: { top: 20, horizontal: 7},
 
@@ -537,61 +510,21 @@ function report_bank_movements (reporting){
                     pdfDoc.setFontSize(12);
                     pdfDoc.setFontStyle('bold');
                     pdfDoc.setTextColor(40);
-                    pdfDoc.text('Histórico de Facturas', 80, 10);
+                    pdfDoc.text('Histórico de Movimiento de Banco', 80, 10);
 
-                    var tipo = '';
-                    if ($('#Y').is(":checked")){
-                        tipo = tipo.concat(' Tipo de factura : Todas las facturas' );
-                    }
-                    if ($('#sale').is(":checked")){
-                        tipo = tipo.concat(' Tipo de factura : Ventas' );
-                    }
-                    if ($('#purchase').is(":checked")){
-                        tipo = tipo.concat(' Tipo de factura : Compras' );
-                    }
-                    if ($('#expense').is(":checked")){
-                        tipo = tipo.concat(' Tipo de factura : Gastos' );
-                    }
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('normal');
-                    pdfDoc.setTextColor(40)
-                    pdfDoc.text(6,14,tipo);
-
-                    var fecha = '';
-                    if ($('#X').is(":checked")){
-                        fecha = fecha.concat(' Filtro de fecha : Sin Filtros' );
-                    }
-                    if ($('#A').is(":checked")){
-                        fecha = fecha.concat(' Filtro de fecha : Hoy' );
-                    }
-                    if ($('#B').is(":checked")){
-                        fecha = fecha.concat(' Filtro de fecha : Ayer' );
-                    }
-                    if ($('#C').is(":checked")){
-                        fecha = fecha.concat(' Filtro de fecha : Mes Actual' );
-                    }
-                    if ($('#D').is(":checked")){
-                        fecha = fecha.concat(' Filtro de fecha : Mes Pasado' );
-                    }
-                    if ($('#Z').is(":checked")){
-                        if(desde.length > 0 || hasta.length > 0){
-                            if(desde){
-                                fecha=fecha.concat(' Desde: '+ desde);
-                            }
-                            if (hasta){
-                                fecha=fecha.concat(' Hasta: '+ hasta);
-                            }
+                    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);
                     }
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('normal');
-                    pdfDoc.setTextColor(40)
-                    pdfDoc.text(6,18,fecha);
-
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('normal');
-                    pdfDoc.setTextColor(40)
-                    pdfDoc.text(150,14," Fecha de Expedición: " + hoy);
 
                     var str = " Pagina  " + data.pageCount;
                     if (typeof pdfDoc.putTotalPages === 'function') {

+ 1 - 2
static/src/js/reports/report_invoice_balance.js

@@ -220,7 +220,6 @@ function report_invoice_balance (reporting){
         BuildTable: function(){
             var self = this;
             var data = [];
-            console.log(self);
             var AccountInvoice = self.AccountInvoice;
             var amount_total_num;
             var entry;
@@ -387,7 +386,7 @@ function report_invoice_balance (reporting){
                 });
             }
             if(store != 9999999){
-                content=_.filter(content, function (inv){ 
+                content=_.filter(content, function (inv){
                     return inv.store_id == store
                 });
             }

+ 8 - 34
static/src/js/reports/report_phonecall.js

@@ -311,56 +311,30 @@ function report_phonecall(reporting){
 
          factSearch: function(){
              var self = this;
-             var hoy = moment().format('YYYY-MM-DD');
-             var desde = this.$el.find('#from').val();
-             var hasta = this.$el.find('#to').val();
+             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 partner= this.$el.find('#partner').val().split('-');
              var content = self.content;
              if ($('#A').is(":checked")){
                  content = _.filter(content, function (inv){
-                     return inv.date == hoy;
+                     return moment(inv.date).format('YYYY-MM-DD') == today;
                  });
              }
              if ($('#B').is(":checked")){
-                 var date = hoy.split('-');
-                 var ayer = date[2] - 1;
-                 date.splice(2,0);
-                 if(date[2] < 10){
-                     date[2] = '0'+ayer;
-                 }else{
-                     date[2] = ayer;
-                 }
                  content = _.filter(content, function (inv){
-                     return inv.date == date[0]+'-'+date[1]+'-'+date[2];
+                     return moment(inv.date).format('YYYY-MM-DD') == yesterday;
                  });
              }
              if ($('#C').is(":checked")){
-                 var date = hoy.split('-');
                  content = _.filter(content, function (inv){
-                     var mes = inv.date.split('-');
-                     return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                     return moment(inv.date).format('YYYY-MM') == month;
                  });
              }
              if ($('#D').is(":checked")){
-                 var date = hoy.split('-');
-                 var mes = date[1] - 1;
-                 var year;
-                 date.splice(1,0);
-                if(date[1] == 1){
-                    date[1] = '12';
-                    year = date[0] - 1;
-                    date[0] = year;
-                }else{
-
-                 if(date[1] < 10){
-                     date[1] = '0'+mes;
-                 }else{
-                     date[1] = mes;
-                 }
-                }
                  content = _.filter(content, function (inv){
-                     var mes = inv.date.split('-');
-                     return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                     return moment(inv.date).format('YYYY-MM') == last_month;
                  });
              }
              if ($('#Z').is(":checked")){

+ 23 - 31
static/src/js/reports/report_pos.js

@@ -20,6 +20,7 @@ function report_pos(reporting){
             'click #Z' : 'factSearch',
             'change #from' : 'factSearch',
             'change #current-store' : 'factSearch',
+            'change #current-journal' : 'factSearch',
             'change #to' : 'factSearch',
             'click-row.bs.table #table ' : 'ckickAnalysisDetail',
         },
@@ -118,6 +119,12 @@ function report_pos(reporting){
                  return self.fecthAccountJournal();
             }).then(function(AccountJournal){
                 self.AccountJournal = AccountJournal;
+                self.$el.find('#current-journal').append('<option value="9999999">Todas los metodos de pago.</option>');
+                _.each(AccountJournal,function(item){
+                    if(item.type == 'cash' || item.type == 'bank'){
+                        self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
                 return self.fetchResPartner();
             }).then(function(ResPartner){
                 self.ResPartner = ResPartner;
@@ -188,8 +195,8 @@ function report_pos(reporting){
         fecthAccountJournal: function(){
             var self = this;
             var defer = $.Deferred();
-            var field = ['id', 'name','store_ids'];
-            var domain = [['active','=',true],['type','in',['sale','purchase']]];
+            var field = ['id', 'name','store_ids','type'];
+            var domain = [['active','=',true],['type','in',['sale','bank','cash']]];
             var AccountJournal = new instance.web.Model('account.journal');
             AccountJournal.query(field).filter(domain).all().then(function(results){
                 defer.resolve(results);
@@ -294,7 +301,6 @@ function report_pos(reporting){
             var order = [];
             var store = [];
             var amount_total_total = 0;
-            console.log(self);
             _.each(PosOrder, function(item){
                 order = self.getStatementLine(item.id);
                 store = self.getAccountJournal(item.sale_journal[0]);
@@ -322,8 +328,12 @@ function report_pos(reporting){
 
         factSearch: function(){
             var self = this;
-            var hoy = moment().format('YYYY-MM-DD');
+            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 store = this.$el.find('#current-store').val();
+            var journal = this.$el.find('#current-journal').val();
             var desde =this.$el.find('#from').val();
             var hasta =this.$el.find('#to').val();
             var partner= this.$el.find('#partner').val().split('-');
@@ -331,45 +341,22 @@ function report_pos(reporting){
 
             if ($('#A').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return inv.date == hoy;
+                    return moment(inv.date).format('YYYY-MM-DD') == today;
                 });
             }
             if ($('#B').is(":checked")){
-                var date = hoy.split('-');
-                var ayer = date[2] - 1;
-                date.splice(2,0);
-                date[2] = '0'+ayer;
                 content = _.filter(content, function (inv){
-                    return inv.date == date[0]+'-'+date[1]+'-'+date[2];
+                    return moment(inv.date).format('YYYY-MM-DD') == yesterday;
                 });
             }
             if ($('#C').is(":checked")){
-                var date = hoy.split('-');
                 content = _.filter(content, function (inv){
-                    var mes = inv.date.split('-');
-                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                    return moment(inv.date).format('YYYY-MM') == month;
                 });
             }
             if ($('#D').is(":checked")){
-                var date = hoy.split('-');
-                var mes = date[1] - 1;
-                var year;
-                date.splice(1,0);
-                if(date[1] == 1){
-                    date[1] = '12';
-                    year = date[0] - 1;
-                    date[0] = year;
-                }else{
-
-                 if(date[1] < 10){
-                     date[1] = '0'+mes;
-                 }else{
-                     date[1] = mes;
-                 }
-                }
                 content = _.filter(content, function (inv){
-                    var mes = inv.date.split('-');
-                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                    return moment(inv.date).format('YYYY-MM') == last_month;
                 });
             }
             if ($('#Z').is(":checked")){
@@ -399,6 +386,11 @@ function report_pos(reporting){
                     return inv.partner_id == partner[0];
                 });
             }
+            if (journal != 9999999){
+                content = _.filter(content,function(inv){
+                    return inv.journal_id == journal;
+                });
+            }
 
             var amount_total_total = _.reduce(_.map(content,function(map){
                 return(map.amount);

+ 162 - 72
static/src/js/reports/report_pos_orders.js

@@ -6,6 +6,7 @@ function report_pos_orders(reporting){
     reporting.ReportPosOrdersWidget = reporting.Base.extend({
         template: 'ReportPosOrders',
         rowsData :[],
+        PosOrderLine: [],
         content:[],
 
         events:{
@@ -36,6 +37,53 @@ function report_pos_orders(reporting){
             this.submitForm();
         },
 
+        // 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
+        },
+
         clickAnalysisDetail: function(e, row, $element, field){
             if (field == 'order_name'){
                 this.do_action({
@@ -110,19 +158,24 @@ function report_pos_orders(reporting){
         // Consultar
         submitForm: function () {
             var self = this;
-            this.fetchPosOrder().then(function(PosOrder) {
+            self.fecthIrModuleModule().then(function(modules){
+                self.modules = modules;
+                return modules;
+            }).then(function(modules){
+                return self.fetchPosOrder()
+            }).then(function(PosOrder) {
                 self.PosOrder = PosOrder;
                 return PosOrder;
             }).then(function (PosOrder) {
-                return self.fetchPosOrderLine();
+                return self.fetchPosOrderLine(PosOrder);
             }).then(function (PosOrderLine) {
                 self.PosOrderLine = PosOrderLine;
+                return self.fetchProductProduct(PosOrderLine);
+            }).then(function (ProductProduct) {
+                self.ProductProduct = ProductProduct;
                 return self.fetchResPartner();
             }).then(function (ResPartner){
                 self.ResPartner = ResPartner;
-                return self.fetchProductProduct();
-            }).then(function (ProductProduct) {
-                self.ProductProduct = ProductProduct;
                 return self.fecthPosCategory();
             }).then(function(PosCategory){
                 self.PosCategory = PosCategory;
@@ -159,6 +212,20 @@ function report_pos_orders(reporting){
             });
         },
 
+        // Modelos instalados
+        fecthIrModuleModule: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['name','id'];
+            var domain=[['state','=','installed']];
+            var irModule = new model.web.Model('ir.module.module');
+
+            irModule.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
         fecthResStore: function(){
             var self = this;
             var defer = $.Deferred();
@@ -186,6 +253,12 @@ function report_pos_orders(reporting){
         fetchPosOrder: function () {
             var self = this;
             var defer = $.Deferred();
+            var modules = self.checkModel('point_of_sale');
+
+            if (modules.length <= 0){
+                self.showMensaje('point_of_sale');
+                return defer;
+            }
             var fields = ['id','name','date_order','lines','table_id','sale_journal'];
             var domain = [['state', 'not in', ['draft','cancel']]];
             var PosOrder = new model.web.Model('pos.order');
@@ -200,7 +273,7 @@ function report_pos_orders(reporting){
             var self = this;
             var defer = $.Deferred();
             var ids = _.flatten(_.map(self.PosOrder, function (item) {
-                return item.id;
+                return item.lines;
             }));
             var fields = ['id', 'name', 'order_id', 'product_id', 'qty', 'price_unit', 'price_subtotal_incl']
             var domain = [['order_id', 'in', ids]];
@@ -231,7 +304,7 @@ function report_pos_orders(reporting){
             var porduct_ids = _.flatten(_.map(self.PosOrderLine, function (item) {
                 return item.product_id[0];
             }));
-            var fields = ['id','name', 'default_code', 'name_template','pos_categ_id', 'ean13', 'standard_price','type','attribute_str'];
+            var fields = ['id','name', 'default_code', 'name_template','ean13','lst_price','pos_categ_id', 'standard_price','type','attribute_str'];
             var domain = [['id', 'in', porduct_ids]];
             var ProductProduct =  new model.web.Model('product.product');
             ProductProduct.query(fields).filter(domain).all().then(function (results) {
@@ -289,10 +362,14 @@ function report_pos_orders(reporting){
             });
         },
 
+        // Obtener las lineas de las Facturas
         getProductProduct: function(id){
             var self = this;
-            return _.filter(self.ProductProduct,function (item) {
-                return item.id == id;
+            //return _.find(self.ProductProduct, function(item){
+            //    return item.id == id;
+            //});
+            return _.filter(self.ProductProduct, function(item){
+                return item.id === id;
             });
         },
 
@@ -312,17 +389,18 @@ function report_pos_orders(reporting){
 
         BuildTable: function(){
             var self = this;
-            var PosOrderLine = self.PosOrderLine;
             var data = [];
             var order;
-            var product;
+            var producto = [];
             var category;
+            var item;
             var category_name;
             var category_id;
             var store;
 
-            _.each(PosOrderLine, function(item){
-                product = self.getProductProduct(item.product_id[0]);
+            for (var i = 0; i < this.PosOrderLine.length; i++) {
+                item = this.PosOrderLine[i];
+                producto = self.getProductProduct(item.product_id[0]);
                 order = self.getPosOrder(item.order_id[0]).shift();
                 store = self.getAccountJournal(order.sale_journal[0]);
                 category = self.getPosCategory(item.product_id[0]);
@@ -342,35 +420,45 @@ function report_pos_orders(reporting){
                     place_id = order.table_id[0];
                     place_name = order.table_id[1];
                 }
-                if(store.length > 0){
+                if(store.length > 0 && producto.length > 0){
                     data.push({
                         id : item.id,
                         order_id : item.order_id[0],
                         order_name : item.order_id[1],
                         date : order.date_order,
-                        date_order : moment(order.date_order).format("DD/MM/YYYY"),
+                        date_order : moment(order.date_order).format("DD/MM/YYYY HH:mm"),
                         table_id : self.valorNull(place_id),
                         table_name : self.valorNull(place_name),
                         floor_id : floor,
                         product_id : item.product_id[0],
                         product_name : item.product_id[1],
-                        price_unit : accounting.formatNumber(item.price_unit,0,".",","),
                         qty : accounting.formatNumber(item.qty,0,".",","),
-                        price_subtotal_incl : accounting.formatNumber(item.price_subtotal_incl,0,".",","),
-                        price_subtotal_total : item.price_subtotal_incl,
+                        price_unit : accounting.formatNumber(item.price_unit,0,".",","),
+                        standard_price : accounting.formatNumber((producto[0].standard_price),0, ".", ","),
+                        price_tot : accounting.formatNumber((item.qty * item.price_unit),0, ".", ","),
+                        standar_tot : accounting.formatNumber((item.qty * producto[0].standard_price),0, ".", ","),
+                        utility : accounting.formatNumber(((item.qty * item.price_unit) - (item.qty * producto[0].standard_price)),0, ".", ","),
                         store_id : store[0].store_ids[0],
                         qty_total : item.qty,
+                        price_tot_tot : ((item.qty * item.price_unit)),
+                        standar_tot_tot : ((item.qty * producto[0].standard_price)),
+                        utility_tot : (((item.qty * item.price_unit) - (item.qty * producto[0].standard_price))),
                         category_name : category_name,
                         category_id : category_id,
                     });
                 }
-            });
-            self.content = data;
-            self.loadTable(data)
+            }
+            this.rowsData=data;
+            self.content=data;
+            this.loadTable(data)
         },
 
         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 floor =this.$el.find('#current-floor').val();
             var table =this.$el.find('#current-table').val();
             var category = this.$el.find('#current-category').val();
@@ -380,45 +468,38 @@ function report_pos_orders(reporting){
             var product = this.$el.find('#product').val().split('-');
             var content = self.content;
 
-            // Hoy
             if ($('#A').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return moment(inv.date_order).format("YYYY-MM-DD") == moment().format("YYYY-MM-DD");
+                    return moment(inv.date).format('YYYY-MM-DD') == today;
                 });
             }
-
-            // Ayer
             if ($('#B').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return moment(inv.date_order).format("YYYY-MM-DD") == moment().add(-1,"days").format("YYYY-MM-DD");
+                    return moment(inv.date).format('YYYY-MM-DD') == yesterday;
                 });
             }
-
-            // Mes Actual
             if ($('#C').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return moment(inv.date_order).format("YYYY-MM") == moment().format("YYYY-MM");
+                    return moment(inv.date).format('YYYY-MM') == month;
                 });
             }
-
-            //  Mes Pasado
             if ($('#D').is(":checked")){
                 content = _.filter(content, function (inv){
-                    return moment(inv.date_order).format("YYYY-MM") == moment().add(-1,'months').format("YYYY-MM");
+                    return moment(inv.date).format('YYYY-MM') == last_month;
                 });
             }
-
-            // Rango de fechas
             if ($('#Z').is(":checked")){
                 $('#datepicker').css('display','block');
                 if (desde.length > 0){
+                    var date= desde.split('/');
                     content = _.filter(content, function (inv){
-                        return moment(inv.date_order).format("YYYY-MM-DD") >= moment(desde).format("YYYY-MM-DD");
+                        return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
                 if (hasta.length > 0){
+                    var date= hasta.split('/');
                     content = _.filter(content, function (inv){
-                        return moment(inv.date_order).format("YYYY-MM-DD") <= moment(hasta).format("YYYY-MM-DD");
+                        return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
             }else{
@@ -464,8 +545,20 @@ function report_pos_orders(reporting){
                 return memo + num;
             },0);
 
-            var amount_total_total = _.reduce(_.map(content,function(map){
-                return(map.price_subtotal_total);
+            var price_total_total = _.reduce(_.map(content,function(map){
+                return(map.price_tot_tot);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var standar_total_total = _.reduce(_.map(content,function(map){
+                return(map.standar_tot_tot);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var utilidad_total_total = _.reduce(_.map(content,function(map){
+                return(map.utility_tot);
             }),function(memo, num){
                 return memo + num;
             },0);
@@ -473,10 +566,12 @@ function report_pos_orders(reporting){
             content.push({
                 order_name: "Total",
                 qty: accounting.formatNumber((qty_total_total),0,".",","),
-                price_subtotal_incl: accounting.formatNumber((amount_total_total),0,".",","),
+                price_tot: accounting.formatNumber((price_total_total),0,".",","),
+                standar_tot: accounting.formatNumber((standar_total_total),0,".",","),
+                utility: accounting.formatNumber((utilidad_total_total),0,".",","),
             });
 
-            self.loadTable(content);
+            self.loadTable(content)
         },
 
         searchProduct: function () {
@@ -512,16 +607,25 @@ function report_pos_orders(reporting){
             table.bootstrapTable('load',rowsTable);
         },
 
+        getObjetPdf: function(rowsTable){
+            var self = this;
+            var rows = self.rowsData;
+            return rows;
+        },
+
         clickOnAction: function (e) {
-            var action = this.$el.find(e.target).val();
             var self = this;
-            var getColumns=[];
-            var rows=[];
+            var rowsNew;
+            var action = this.$el.find(e.target).val();
             var table = this.$el.find("#table");
             var data2 = table.bootstrapTable('getVisibleColumns');
+            var getColumns=[];
+            var rows=[];
+            rowsNew = self.getObjetPdf();
+
             if (action === 'pdf') {
                 var dataNEW = _.map(data2, function (val){ return val.field});
-                _.each(this.rowsData,function (item){
+                _.each(rowsNew,function (item){
                     rows.push(_.pick(item, dataNEW));
                 });
                 // Obtener los nombre de la Cabezera
@@ -539,40 +643,26 @@ function report_pos_orders(reporting){
 
         drawPDF: function (getColumns,rows) {
             var self = this;
-            var rowsPdf=[];
             var desde =(this.$el.find('#from').val());
             var hasta =(this.$el.find('#to').val());
             var totalPagesExp = "{total_pages_count_string}";
-            var pdfDoc = new jsPDF();
-
-            // Cantidad
-            var qty =_.reduce(_.map(rows,function(item){
-                var valor=0;
-                if (item.qty){valor = parseFloat(((item.qty.replace(".","")).replace(",",".")))}return valor}), function(memo, num){ return memo + num; },0);
-
-            var price_subtotal_incl =_.reduce(_.map(rows,function(item){
-                var valor =0;
-                if (item.price_subtotal_incl){valor=parseFloat(((item.price_subtotal_incl.replace(".","")).replace(",",".")))} return valor}), function(memo, num){ return memo + num; },0);
+            var pdfDoc = new jsPDF('l');
 
-            rowsPdf = rows;
-
-            // rowsPdf.push({
-            //     qty : accounting.formatNumber(qty,0,".",","),
-            //     price_subtotal_incl : accounting.formatNumber(price_subtotal_incl,0,".",","),
-            // });
-
-            pdfDoc.autoTable(getColumns, rowsPdf, {
+            pdfDoc.autoTable(getColumns, rows, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
-                    order_name: {halign:'left', fontStyle: 'bold'},
-                    date_order :{halign:'left'},
-                    category_name :{halign:'left', columnWidth: '8px'},
-                    table_id :{halign:'left'},
-                    product_name :{halign:'left' },
-                    price_unit : {halign:'right' },
-                    qty : {halign:'right' },
-                    price_subtotal_incl : {halign:'right'},
-                },
+                        order_name: {halign:'left', fontStyle: 'bold'},
+                        date_order :{halign:'left' , columnWidth: '8px'},
+                        category_name :{halign:'left', columnWidth: '8px'},
+                        table_name :{halign:'left', columnWidth: '7px'},
+                        product_name :{halign:'left' },
+                        qty :{halign:'right' },
+                        price_unit : {halign:'right' },
+                        standard_price : {halign:'right' },
+                        price_tot : {halign:'right' },
+                        standar_tot : {halign:'right' },
+                        utility : {halign:'right'},
+                    },
                 margin: { top: 16, horizontal: 7},
                 addPageContent: function (data) {
                     pdfDoc.setFontSize(12);

+ 537 - 0
static/src/js/reports/report_sale_cab.js

@@ -0,0 +1,537 @@
+function report_sale_cab(reporting){
+    "use strict";
+
+    var instance = openerp;
+
+    reporting.ReportSaleCabWidget = reporting.Base.extend({
+        template: 'ReportSaleCab',
+        content: [],
+        rowsData :[],
+        invoices: [],
+        accountJournal:[],
+        modules:[],
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #X' : 'factSearch',
+            'click #A' : 'factSearch',
+            'click #B' : 'factSearch',
+            'click #C' : 'factSearch',
+            'click #D' : 'factSearch',
+            'click #Z' : 'factSearch',
+            'change #from' : 'factSearch',
+            'change #to' : 'factSearch',
+            'change #user' : 'factSearch',
+            'change #current-journal' : 'factSearch',
+            'change #current-store' : 'factSearch',
+            'click-row.bs.table #table ' : 'ckickAnalysisDetail',
+        },
+        init : function(parent){
+            this._super(parent);
+        },
+        start: function () {
+            var self = this;
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowsData});
+            this.fecthFecha();
+            this.submitForm();
+        },
+
+        // 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
+        },
+
+        ckickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'number'){
+                this.do_action({
+                    name:"Factura de cliente",
+                    type: 'ir.actions.act_window',
+                    res_model: "account.invoice",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['type', '=', 'out_invoice'],['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+        submitForm: function () {
+            var self = this;
+            self.fecthIrModuleModule().then(function(modules){
+                self.modules = modules;
+                return modules;
+            }).then(function(modules){
+                return self.fecthResStore();
+             }).then(function(ResStore){
+                 self.ResStore = ResStore;
+                 self.$el.find('#current-store').append('<option value="9999999">Todas las SUC.</option>');
+                 _.each(ResStore,function(item){
+                     self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                 });
+                  return self.fecthAccountJournal();
+             }).then(function(AccountJournal){
+                 self.AccountJournal = AccountJournal;
+                 return self.fetchInvoiceV2();
+             }).then(function (invoices){
+                 self.invoices = invoices;
+                return self.fetchResPartner();
+            }).then(function(ResPartner){
+                self.ResPartner = ResPartner;
+                return self.fecthResUser();
+            }).then(function (ResUser) {
+                self.ResUser = ResUser;
+                self.search();
+                self.searchUser();
+                return self.BuildTable();
+            });
+        },
+
+        // 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;
+        },
+
+        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;
+            }
+        },
+
+        fecthResStore: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field=['id', 'name'];
+            var ResStore = new instance.web.Model('res.store');
+            ResStore.query(field).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fecthAccountJournal: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field = ['id', 'name','store_ids'];
+            var domain = [['active','=',true],['type','in',['sale','purchase']]];
+            var AccountJournal = new instance.web.Model('account.journal');
+            AccountJournal.query(field).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', 'state', 'journal_id', 'currency_id', 'user_id','date_invoice','amount_total','partner_id'];
+            var defer = $.Deferred();
+            var Invoice = new instance.web.Model('account.invoice');
+            Invoice.query(field).filter(filter).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchResPartner: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var ResPartner = new instance.web.Model('res.partner');
+            ResPartner.query(['id', 'name', 'ruc']).filter([['active', '=', true], ['customer', '=', true]]).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        search: function () {
+            var self = this;
+            var results = self.ResPartner;
+            results = _.map(results, function (item) {
+                return {
+                        label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
+                        value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
+                }
+            });
+            self.$('#partner').autocomplete({
+                source: results,
+                minLength:0,
+                search: function(event, ui) {
+                    if (!(self.$('#partner').val())){
+                        self.factSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.factSearch();
+                },
+                select: function(event, ui) {
+                    self.factSearch();
+                }
+            });
+        },
+
+        // Consultar Usuario
+        fecthResUser: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var user_ids = _.map(self.invoices,function(map){
+                return map.user_id[0];
+            });
+            var fields = ['id', 'name'];
+            var domain = [['id', 'in', user_ids]];
+            var ResUsers = new instance.web.Model('res.users');
+            ResUsers.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        searchUser: function () {
+            var self = this;
+            var results = self.ResUser;
+            results = _.map(results, function (item) {
+                return {
+                        label: item.id + '-'+ item.name,
+                        value: item.id + '-'+ item.name
+                }
+            });
+            self.$('#user').autocomplete({
+                source: results,
+                minLength:0,
+                searchUser: function(event, ui) {
+                    if (!(self.$('#user').val())){
+                        self.factSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.factSearch();
+                },
+                select: function(event, ui) {
+                    self.factSearch();
+                }
+            });
+        },
+
+        getAccountJournal: function (id) {
+            var self = this;
+            return _.filter(self.AccountJournal,function (item) {
+                return item.id === id;
+            });
+        },
+
+        getSaleOrder:function(partner_id) {
+            var self = this;
+            return _.flatten(_.filter(self.invoices,function (inv) {
+                return inv.user_id[0] === partner_id;
+            }));
+        },
+
+        BuildTable: function(){
+            var self = this;
+            var invoices = self.invoices;
+            var order = [];
+            var data = [];
+            var store = [];
+            var amount_total_total = 0;
+            _.each(invoices, function(item){
+                order = self.getSaleOrder(item.user_id[0]);
+                store= self.getAccountJournal(item.journal_id[0]);
+                if(order.length > 0 & store.length > 0){
+                    data.push({
+                        id : item.id,
+                        number: item.number,
+                        partner: item.partner_id[1],
+                        date_invoice: moment(item.date_invoice).format("DD/MM/YYYY"),
+                        amount_total: accounting.formatNumber(item.amount_total,0,".",","),
+                        date: item.date_invoice,
+                        partner_id : item.partner_id[0],
+                        amount : item.amount_total,
+                        journal_id: item.journal_id[0],
+                        journal_name: item.journal_id[1],
+                        user_id : item.user_id[0],
+                        user: item.user_id[1],
+                        store_id : store[0].store_ids[0]
+                    });
+                }
+            });
+            self.content = data;
+            this.loadTable(data);
+        },
+
+        factSearch: 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 user= this.$el.find('#user').val();
+            var desde =this.$el.find('#from').val();
+            var hasta =this.$el.find('#to').val();
+            var partner= this.$el.find('#partner').val().split('-');
+            var store = this.$el.find('#current-store').val();
+            var content = self.content;
+
+
+            if ($('#A').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return moment(inv.date).format('YYYY-MM-DD') == today;
+                });
+            }
+            if ($('#B').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return moment(inv.date).format('YYYY-MM-DD') == yesterday;
+                });
+            }
+            if ($('#C').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return moment(inv.date).format('YYYY-MM') == month;
+                });
+            }
+            if ($('#D').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return moment(inv.date).format('YYYY-MM') == last_month;
+                });
+            }
+            if ($('#Z').is(":checked")){
+                $('#datepicker').css('display','block');
+                if (desde.length > 0){
+                    var date= desde.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+                if (hasta.length > 0){
+                    var date= hasta.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+            }else{
+                $('#datepicker').css('display','none');
+            }
+
+            if (partner != ""){
+                content = _.filter(content, function(inv){
+                    return inv.partner_id == partner[0];
+                });
+            }
+            if (user != ""){
+                content = _.filter(content,function(inv){
+                    return inv.user_id == user[0];
+                });
+            }
+            if (store != 9999999){
+                content =_.filter(content, function (inv){
+                    return inv.store_id == store;
+                });
+            }
+
+            var amount_total_total = _.reduce(_.map(content,function(map){
+                return(map.amount);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            content.push({
+                number: "Total",
+                amount_total: accounting.formatNumber((amount_total_total),0,".",","),
+            });
+
+            self.loadTable(content)
+        },
+
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load',rowsTable);
+        },
+
+        getObjetPdf: function(rowsTable){
+            var self = this;
+            var rows=self.rowsData;
+
+            return rows;
+        },
+
+        clickOnAction: function (e) {
+            var self = this;
+            var rowsNew;
+            var action = self.$el.find(e.target).val();
+            var table = self.$el.find("#table");
+            var data2 = table.bootstrapTable('getVisibleColumns');
+            var getColumns=[];
+            var rows=[];
+            rowsNew = self.getObjetPdf();
+            if (action === 'pdf') {
+                var dataNEW = _.map(data2, function (val){
+                    return val.field;
+                });
+                _.each(rowsNew,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
+                                    }]);
+                });
+                this.drawPDF(_.flatten(getColumns),rows);
+            }
+        },
+
+        drawPDF: function (getColumns,rows) {
+            var self = this;
+            var desde =(this.$el.find('#from').val());
+            var hasta =(this.$el.find('#to').val());
+            var totalPagesExp = "{total_pages_count_string}";
+            var pdfDoc = new jsPDF();
+
+            pdfDoc.autoTable(getColumns, rows, {
+                styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
+                columnStyles: {
+                    number : {columnWidth: '8px'},
+                    partner : {columnWidth: '8px'},
+                    date_invoice : {columnWidth: '8px'},
+                    amount_total : {halign:'right',columnWidth: '8px'},
+                    namejournal : {columnWidth: '6px'},
+                    user : {halign:'left',columnWidth: '8px'},
+                },
+                margin: { top: 16, horizontal: 7},
+                addPageContent: function (data) {
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text('Histórico de Venta ', 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;
+                    }
+                    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('Histórico de Venta.pdf')
+        },
+    });
+}

+ 12 - 11
static/src/js/reports/report_sales_invoice_analysis.js

@@ -31,6 +31,7 @@ function report_sales_invoice_analysis (reporting){
           this._super(parent);
         },
         start: function () {
+
             var table = this.$el.find('#table');
             table.bootstrapTable({data : self.rowOrigin});
             this.fecthFecha();
@@ -331,8 +332,8 @@ function report_sales_invoice_analysis (reporting){
                         quantity_tot : (item.quantity),
                         price_tot_tot : ((item.quantity * (item.price_unit / invoice.rate))),
                         standar_tot_tot : ((item.quantity * producto.standard_price)),
-                        utility : (((item.quantity * (item.price_unit / invoice.rate)) - (item.quantity * producto.standard_price))),
-                        date_create :moment(invoice.date_invoice).format("DD/MM/YYYY"),
+                        utility_tot : (((item.quantity * (item.price_unit / invoice.rate)) - (item.quantity * producto.standard_price))),
+                        date_create :moment(invoice.date_invoice).format("DD/MM/YYYY HH:mm"),
                         date_invoice : (invoice.date_invoice),
                         partner_id : invoice.partner_id[0],
                         partner_name : invoice.partner_id[1],
@@ -429,7 +430,7 @@ function report_sales_invoice_analysis (reporting){
 
             if(store != 9999999){
                 self.rowsData =_.filter(self.rowsData, function (inv){
-                    return inv.store_id == store
+                    return inv.store_id == store;
                 });
             }
 
@@ -557,7 +558,7 @@ function report_sales_invoice_analysis (reporting){
                 this.drawPDF(_.flatten(getColumns),rows)
             }
             if (action === 'chart'){
-                var suc =this.$el.find('#current-journal').val();
+                var suc = this.$el.find('#current-journal').val();
                 if (suc == 9999999){
                     self.fectCharFilter();
                 }else{
@@ -594,7 +595,7 @@ function report_sales_invoice_analysis (reporting){
             var desde =(this.$el.find('#from').val());
             var hasta =(this.$el.find('#to').val());
             var totalPagesExp = "{total_pages_count_string}";
-            var pdfDoc = new jsPDF();
+            var pdfDoc = new jsPDF('l');
 
             // rows=this.rowsData;
             var quantity=_.reduce(_.map(rows,function(item){
@@ -648,12 +649,12 @@ function report_sales_invoice_analysis (reporting){
             pdfDoc.autoTable(getColumns, rowsPdf, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
-                              number: {fontStyle: 'bold'},
-                              date_create :{columnWidth: '12px'},
-                              name :{columnWidth: '10px'},
-                              quantity :{halign:'right' },
-                              price_unity : {halign:'right' },
-                              standar_price : {halign:'right' },
+                              number: {fontStyle: 'bold',columnWidth: '8px'},
+                              date_create :{columnWidth: '14px'},
+                              name :{columnWidth: '12px'},
+                              quantity :{halign:'right',columnWidth: '8px'},
+                              price_unity : {halign:'right',columnWidth: '8px'},
+                              standar_price : {halign:'right',columnWidth: '8px'},
                               price_tot : {halign:'right' },
                               standar_tot : {halign:'right' },
                               utility : {halign:'right'},

+ 733 - 0
static/src/js/reports/report_ventas_pos_orders.js

@@ -0,0 +1,733 @@
+function report_ventas_pos_orders(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportVentasPosOrdersWidget = reporting.Base.extend({
+        template: 'ReportVentasPosOrders',
+        rowsData :[],
+        PosOrderLine: [],
+        content:[],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #X' : 'fectSearch',
+            'click #A' : 'fectSearch',
+            'click #B' : 'fectSearch',
+            'click #C' : 'fectSearch',
+            'click #D' : 'fectSearch',
+            'click #Z' : 'fectSearch',
+            'change #from' : 'fectSearch',
+            'change #to': 'fectSearch',
+            'change #current-category' : 'fectSearch',
+            'change #current-floor': 'fectSearch',
+            'change #current-table': 'fectSearch',
+            'change #current-store': 'fectSearch',
+            'click-row.bs.table #table' : 'clickAnalysisDetail',
+        },
+
+        init : function(parent){
+          this._super(parent);
+        },
+
+        start: function () {
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowData});
+            this.fecthFecha();
+            this.submitForm();
+        },
+
+        clickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'order_name'){
+                this.do_action({
+                    name : "Pedido",
+                    type : 'ir.actions.act_window',
+                    res_model : "pos.order",
+                    views : [[false,'form']],
+                    target : 'new',
+                    domain : [['id','=', row.order_id]],
+                    context : {},
+                    flags : {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id : row.order_id,
+                });
+            }
+            if (field == 'product_name'){
+                this.do_action({
+                    name : "Productos",
+                    type : 'ir.actions.act_window',
+                    res_model : "product.product",
+                    views : [[false,'form']],
+                    target : 'new',
+                    domain : [['id','=', row.product_id]],
+                    context : {},
+                    flags : {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id : row.product_id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+
+        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;
+            }
+        },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        // Consultar
+        submitForm: function () {
+            var self = this;
+            this.fetchPosOrder().then(function(PosOrder) {
+                self.PosOrder = PosOrder;
+                return PosOrder;
+            }).then(function (PosOrder) {
+                return self.fetchPosOrderLine(PosOrder);
+            }).then(function (PosOrderLine) {
+                self.PosOrderLine = PosOrderLine;
+                return self.fetchProductProduct(PosOrderLine);
+            }).then(function (ProductProduct) {
+                self.ProductProduct = ProductProduct;
+                return self.fecthSalesOrder();
+            }).then(function (SalesOrder) {
+                self.SalesOrder = SalesOrder;
+                return self.fecthSalesOrderLine(SalesOrder);
+            }).then(function (SalesOrderLine) {
+                self.SalesOrderLine = SalesOrderLine;
+                return self.fetchResPartner();
+            }).then(function (ResPartner){
+                self.ResPartner = ResPartner;
+                self.searchProduct();
+                return self.BuildTable();
+            });
+        },
+
+        // fecthResStore: function(){
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var field=['id', 'name'];
+        //     var ResStore = new model.web.Model('res.store');
+        //     ResStore.query(field).all().then(function(results){
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+
+        // fecthAccountJournal: function(){
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var field = ['id', 'name','store_ids'];
+        //     var domain = [['active','=',true],['type','in',['sale','purchase']]];
+        //     var AccountJournal = new model.web.Model('account.journal');
+        //     AccountJournal.query(field).filter(domain).all().then(function(results){
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+
+        // Ventas (Point Of Sale)
+        fetchPosOrder: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','date_order','lines','table_id','sale_journal'];
+            var domain = [['state', 'not in', ['draft','cancel']]];
+            var PosOrder = new model.web.Model('pos.order');
+            PosOrder.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // Lineas de venta (Point Of Sale)
+        fetchPosOrderLine: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var ids = _.flatten(_.map(self.PosOrder, function (item) {
+                return item.lines;
+            }));
+            var fields = ['id', 'name', 'order_id', 'product_id', 'qty', 'price_unit', 'price_subtotal_incl']
+            var domain = [['order_id', 'in', ids]];
+            var PosOrderLine = new model.web.Model('pos.order.line');
+            PosOrderLine.query().filter(domain).all().then(function (results) {
+                defer.resolve(results)
+            });
+            return defer;
+        },
+
+        // clientes
+        fetchResPartner: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','ruc'];
+            var domain = [['active', '=', true],['customer', '=', true]];
+            var ResPartner = new model.web.Model('res.partner');
+            ResPartner.query(fields).filter(domain).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // Productos
+        fetchProductProduct: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var porduct_ids = _.flatten(_.map(self.PosOrderLine, function (item) {
+                return item.product_id[0];
+            }));
+            var fields = ['id','name', 'default_code', 'name_template','ean13','lst_price','pos_categ_id', 'standard_price','type','attribute_str'];
+            var domain = [['id', 'in', porduct_ids]];
+            var ProductProduct =  new model.web.Model('product.product');
+            ProductProduct.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // fecthPosCategory: function(){
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var fields = ['id','name'];
+        //     var PosCategory =  new model.web.Model('pos.category');
+        //     PosCategory.query(fields).filter().all().then(function (results) {
+        //         defer.resolve(results)
+        //     });
+        //     return defer;
+        // },
+
+        // Mesa o delivery
+        // fetchPosTable: function(){
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var fields = ['id','name', 'floor_id'];
+        //     var ProductProduct =  new model.web.Model('pos.table');
+        //     ProductProduct.query(fields).filter().all().then(function (results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+
+        // Salon o Delivery
+        // fetchPosFloor: function(){
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var fields = ['id','name', 'table_ids'];
+        //     var ProductProduct =  new model.web.Model('pos.floor');
+        //     ProductProduct.query(fields).filter().all().then(function (results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+
+        getPosOrder: function(id){
+            var self = this;
+            return _.filter(self.PosOrder,function (item) {
+                return item.id == id;
+            });
+        },
+
+        getSaleOrder: function(id){
+            var self = this;
+            return _.filter(self.SaleOrder,function (item) {
+                return item.id == id;
+            });
+        },
+
+        // getPosTable: function(id){
+        //     var self = this;
+        //     return _.filter(self.PosTable,function (item) {
+        //         return item.id == id;
+        //     });
+        // },
+
+        // Obtener las lineas de las Facturas
+        getProductProduct: function(id){
+            var self = this;
+            //return _.find(self.ProductProduct, function(item){
+            //    return item.id == id;
+            //});
+            return _.filter(self.ProductProduct, function(item){
+                return item.id === id;
+            });
+        },
+
+        // getPosCategory: function(id){
+        //     var self = this;
+        //     return _.filter(self.PosCategory, function(item){
+        //         return item.id == id;
+        //     });
+        // },
+
+        // getAccountJournal: function (id) {
+        //     var self = this;
+        //     return _.filter(self.AccountJournal,function (item) {
+        //         return item.id === id;
+        //     });
+        // },
+
+        // Obtener Pedido
+        fecthSalesOrder: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var modules = self.checkModel('sale');
+
+            if (modules.length <= 0){
+                self.showMensaje('sale');
+                return defer;
+            }
+
+            var fields = ['id', 'order_line', 'date_order'];
+            // var domain = [['date_order', '>=', desde], ['date_order', '<', hasta], ['state', 'in', ['paid','done','invoiced']]];
+            var domain = [ ['state', 'in', ['done', 'progress']]];
+            var SalesOrder = new instance.web.Model('sale.order');
+            SalesOrder.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+        // Obtener linea de la factura
+        fecthSalesOrderLine: function(SalesOrder) {
+            var self = this;
+            var defer = $.Deferred();
+            var order_line = _.flatten(_.map(SalesOrder, function (item) {
+                return item.order_line;
+            }));
+            var fields = ['id', 'product_id', 'create_date', 'product_uom_qty', 'price_unit'];
+            var domain = [['id','in', order_line]];
+            var SalesOrderLine = new instance.web.Model('sale.order.line');
+            SalesOrderLine.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        BuildTable: function(){
+            var self = this;
+            var data = [];
+            var order;
+            var sale;
+            var itemsale;
+            var producto = [];
+            var saleproducto = [];
+            var category;
+            var item;
+            var category_name;
+            var category_id;
+            var store;
+
+            for (var i = 0; i < this.PosOrderLine.length; i++) {
+                item = this.PosOrderLine[i];
+                producto = self.getProductProduct(item.product_id[0]);
+                order = self.getPosOrder(item.order_id[0]).shift();
+                if(producto.length > 0){
+                    data.push({
+                        id : item.id,
+                        order_id : item.order_id[0],
+                        order_name : item.order_id[1],
+                        date : order.date_order,
+                        date_order : moment(order.date_order).format("DD/MM/YYYY"),
+                        product_id : item.product_id[0],
+                        product_name : item.product_id[1],
+                        qty : accounting.formatNumber(item.qty,0,".",","),
+                        price_unit : accounting.formatNumber(item.price_unit,0,".",","),
+                        standard_price : accounting.formatNumber((producto[0].standard_price),0, ".", ","),
+                        price_tot : accounting.formatNumber((item.qty * item.price_unit),0, ".", ","),
+                        standar_tot : accounting.formatNumber((item.qty * producto[0].standard_price),0, ".", ","),
+                        utility : accounting.formatNumber(((item.qty * item.price_unit) - (item.qty * producto[0].standard_price)),0, ".", ","),
+                        qty_total : item.qty,
+                        price_tot_tot : ((item.qty * item.price_unit)),
+                        standar_tot_tot : ((item.qty * producto[0].standard_price)),
+                        utility_tot : (((item.qty * item.price_unit) - (item.qty * producto[0].standard_price))),
+                    });
+                }
+            }
+
+            // for (var k = 0; k < this.SaleOrderLine.length; k++) {
+            //     itemsale = this.SaleOrderLine[k];
+            //     console.log(itemsale);
+            //     saleproducto = self.getProductProduct(itemsale.product_id[0]);
+            //     sale = self.getSaleOrder(itemsale.order_id[0]).shift();
+                // store = self.getAccountJournal(order.sale_journal[0]);
+                // category = self.getPosCategory(item.product_id[0]);
+                // if(category.length > 0){
+                //     category_name = category[0].name;
+                //     category_id = category[0].id;
+                // }else {
+                //     category_name = '';
+                //     category_id = '';
+                // }
+                // var place_id;
+                // var place_name;
+                // var floor;
+                // if(order.table_id){
+                //     floor = self.getPosTable(order.table_id[0]).shift();
+                //     floor = floor.floor_id[0];
+                //     place_id = order.table_id[0];
+                //     place_name = order.table_id[1];
+                // }
+            // }
+                // if(saleproducto.length > 0){
+                //     data.push({
+                //         id : itemsale.id,
+                //         order_id : itemsale.order_id[0],
+                //         order_name : itemsale.order_id[1],
+                //         date : sale.create_date,
+                //         date_order : moment(sale.create_date).format("DD/MM/YYYY"),
+                //         product_id : itemsale.product_id[0],
+                //         product_name : itemsale.product_id[1],
+                //         qty : accounting.formatNumber(itemsale.product_uom_qty,0,".",","),
+                //         price_unit : accounting.formatNumber(itemsale.price_unit,0,".",","),
+                //         standard_price : accounting.formatNumber((saleproducto[0].standard_price),0, ".", ","),
+                //         price_tot : accounting.formatNumber((itemsale.product_uom_qty * itemsale.price_unit),0, ".", ","),
+                //         standar_tot : accounting.formatNumber((itemsale.product_uom_qty * saleproducto[0].standard_price),0, ".", ","),
+                //         utility : accounting.formatNumber(((itemsale.product_uom_qty * itemsale.price_unit) - (itemsale.product_uom_qty * saleproducto[0].standard_price)),0, ".", ","),
+                //         qty_total : itemsale.product_uom_qty,
+                //         price_tot_tot : ((itemsale.product_uom_qty * itemsale.price_unit)),
+                //         standar_tot_tot : ((itemsale.product_uom_qty * saleproducto[0].standard_price)),
+                //         utility_tot : (((itemsale.product_uom_qty * itemsale.price_unit) - (itemsale.product_uom_qty * saleproducto[0].standard_price))),
+                //     });
+                // }
+            // }
+            this.rowsData=data;
+            self.content=data;
+            this.loadTable(data)
+        },
+
+        fectSearch: function(){
+            var self = this;
+            var hoy = moment().format('YYYY-MM-DD');
+            var floor =this.$el.find('#current-floor').val();
+            var table =this.$el.find('#current-table').val();
+            var category = this.$el.find('#current-category').val();
+            var store =this.$el.find('#current-store').val();
+            var desde =this.$el.find('#from').val();
+            var hasta =this.$el.find('#to').val();
+            var product = this.$el.find('#product').val().split('-');
+            var content = self.content;
+
+            // Hoy
+            if ($('#A').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.date == hoy;
+                });
+            }
+            if ($('#B').is(":checked")){
+                var date = hoy.split('-');
+                var ayer = date[2] - 1;
+                date.splice(2,0);
+                date[2] = '0'+ayer;
+                content = _.filter(content, function (inv){
+                    return inv.date == date[0]+'-'+date[1]+'-'+date[2];
+                });
+            }
+            if ($('#C').is(":checked")){
+                var date = hoy.split('-');
+                content = _.filter(content, function (inv){
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                });
+            }
+            if ($('#D').is(":checked")){
+                var date = hoy.split('-');
+                var mes = date[1] - 1;
+                var year;
+                date.splice(1,0);
+                if(date[1] == 1){
+                    date[1] = '12';
+                    year = date[0] - 1;
+                    date[0] = year;
+                }else{
+
+                 if(date[1] < 10){
+                     date[1] = '0'+mes;
+                 }else{
+                     date[1] = mes;
+                 }
+                }
+                content = _.filter(content, function (inv){
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                });
+            }
+            if ($('#Z').is(":checked")){
+                $('#datepicker').css('display','block');
+                if (desde.length > 0){
+                    var date= desde.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+                if (hasta.length > 0){
+                    var date= hasta.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+            }else{
+                $('#datepicker').css('display','none');
+            }
+
+            // Filtrar por piso o delivery
+            // if (floor != 9999999){
+            //     content=_.filter(content, function (inv){
+            //         return inv.floor_id == floor;
+            //     });
+            // }
+
+            // Filtrar por mesa o delivery
+            // if (table != 9999999){
+            //     content=_.filter(content, function (inv){
+            //         return inv.table_id == table;
+            //     });
+            // }
+
+            // Buscar Producto
+            if (product != ""){
+                content = _.filter(content, function(inv){
+                    return inv.product_id == product[0];
+                });
+            }
+
+            // if(category != 9999999){
+            //     content = _.filter(content,function(inv){
+            //         return inv.category_id == category;
+            //     });
+            // }
+
+            // if (store != 9999999){
+            //     content=_.filter(content, function (inv){
+            //         return inv.store_id == store;
+            //     });
+            // }
+
+            var qty_total_total = _.reduce(_.map(content,function(map){
+                return(map.qty_total);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var price_total_total = _.reduce(_.map(content,function(map){
+                return(map.price_tot_tot);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var standar_total_total = _.reduce(_.map(content,function(map){
+                return(map.standar_tot_tot);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            var utilidad_total_total = _.reduce(_.map(content,function(map){
+                return(map.utility_tot);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+
+            content.push({
+                order_name: "Total",
+                qty: accounting.formatNumber((qty_total_total),0,".",","),
+                price_tot: accounting.formatNumber((price_total_total),0,".",","),
+                standar_tot: accounting.formatNumber((standar_total_total),0,".",","),
+                utility: accounting.formatNumber((utilidad_total_total),0,".",","),
+            });
+
+            self.loadTable(content)
+        },
+
+        searchProduct: function () {
+            var self = this;
+            var results = self.ProductProduct;
+            results = _.map(results, function (item) {
+                return {
+                    label: item.id + '- '+ ' [ ' + self.valorNull(item.default_code) + ' - ' + self.valorNull(item.ean13) + ' ] ' + item.name + ' ( ' +  self.valorNull(item.attribute_str) + ' ) ' ,
+                    value: item.id + '- '+ ' [ ' + self.valorNull(item.default_code) + ' - ' + self.valorNull(item.ean13) + ' ] ' + item.name + ' ( ' +  self.valorNull(item.attribute_str) + ' ) '
+                }
+            });
+            self.$('#product').autocomplete({
+                source: results,
+                minLength:0,
+                search: function(event, ui) {
+                    if (!(self.$('#product').val())){
+                        self.fectSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.fectSearch();
+                },
+                select: function(event, ui) {
+                    self.fectSearch();
+                }
+            });
+        },
+
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load',rowsTable);
+        },
+
+        getObjetPdf: function(rowsTable){
+            var self = this;
+            var rows=[];
+            var rows = self.rowsData;
+
+            // var qty =_.reduce(_.map(rows,function(map){
+            //     return(map.qty_total);
+            // }),function(memo, num){
+            //     return memo + num;
+            // },0);
+            //
+            // var price_tot =_.reduce(_.map(rows,function(map){
+            //     return(map.price_tot_tot);
+            // }),function(memo, num){
+            //     return memo + num;
+            // },0);
+            //
+            // var standar_tot =_.reduce(_.map(rows,function(map){
+            //     return(map.standar_tot_tot);
+            // }),function(memo, num){
+            //     return memo + num;
+            // },0);
+            //
+            // var utility =_.reduce(_.map(rows,function(map){
+            //     return(map.utility_tot);
+            // }),function(memo, num){
+            //     return memo + num;
+            // },0);
+            //
+            // if (rows.length > 0){
+            //     rows.push({
+            //             order_name : "Totales ",
+            //             qty : accounting.formatNumber(qty,0,".",","),
+            //             price_tot : accounting.formatNumber(price_tot,0,".",","),
+            //             standar_tot : accounting.formatNumber(standar_tot,0,".",","),
+            //             utility : accounting.formatNumber(utility,0,".",","),
+            //     });
+            // }
+            return rows;
+        },
+
+        clickOnAction: function (e) {
+            var self = this;
+            var rowsNew;
+            var action = this.$el.find(e.target).val();
+            var table = this.$el.find("#table");
+            var data2 = table.bootstrapTable('getVisibleColumns');
+            var getColumns=[];
+            var rows=[];
+            rowsNew = self.getObjetPdf();
+
+            if (action === 'pdf') {
+                var dataNEW = _.map(data2, function (val){ return val.field});
+                _.each(rowsNew,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)
+            }
+        },
+
+        drawPDF: function (getColumns,rows) {
+            var self = this;
+            var desde =(this.$el.find('#from').val());
+            var hasta =(this.$el.find('#to').val());
+            var totalPagesExp = "{total_pages_count_string}";
+            var pdfDoc = new jsPDF('l');
+
+            pdfDoc.autoTable(getColumns, rows, {
+                styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
+                columnStyles: {
+                        order_name: {halign:'left', fontStyle: 'bold'},
+                        date_order :{halign:'left'},
+                        product_name :{halign:'left' },
+                        qty :{halign:'right' },
+                        price_unit : {halign:'right' },
+                        standard_price : {halign:'right' },
+                        price_tot : {halign:'right' },
+                        standar_tot : {halign:'right' },
+                        utility : {halign:'right'}
+                    },
+                margin: { top: 16, horizontal: 7},
+                addPageContent: function (data) {
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text('Análisis de Ventas generales', 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;
+                    }
+                    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('Análisis de ventas generales.pdf')
+        },
+    });
+}

+ 1 - 0
static/src/js/reports/report_vouchers.js

@@ -130,6 +130,7 @@ function report_vouchers (reporting){
                 return date;
             }
         },
+
         fetchAccountVoucher: function () {
             var self = this;
             var defer = $.Deferred();

+ 133 - 0
static/src/reports/report_bank_gral.xml

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportBankGral">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1>Histórico de Movimiento de Banco</h1>
+            </div>
+            <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
+            </button>
+            <div class="collapse" id="collapseExample">
+                <br/>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Fechas</div>
+                            <div class="panel-body">
+                                <ul class="list-unstyled">
+                                    <li>
+                                        <input type="radio" name="valores" id="X" value="X" checked="checked"/>
+                                        <label for="X">Sin Filtro</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="A" value="A"/>
+                                        <label for="A">Hoy</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="B" value="B"/>
+                                        <label for="B">Ayer</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="C" value="C"/>
+                                        <label for="C">Mes Actual</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="D" value="D"/>
+                                        <label for="D">Mes Pasado</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="Z" value="Z"/>
+                                        <label for="Z">Busqueda Avanzada</label>
+                                    </li>
+                                </ul>
+                                <div id="datepicker" style="display:none;" class="container">
+                                    <label for="from">Desde: </label>
+                                    <input type="text"  id="from" name="from"/>
+                                    <label for="to" >Hasta: </label>
+                                    <input type="text"  id="to" name="to" />
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Características</div>
+                            <div class="panel-body">
+                                <div class="col-xs-6">
+                                    <h3>Estado</h3>
+                                    <ul class="list-unstyled">
+                                        <li>
+                                            <input type="radio" name="estado" id="W" value="W" checked="checked"/>
+                                            <label for="W">Sin Filtro</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="estado" id="available" value="available"/>
+                                            <label for="available">Disponible</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="estado" id="cashed" value="cashed"/>
+                                            <label for="cashed">Pagado</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="estado" id="negotiated" value="negotiated"/>
+                                            <label for="negotiated">Negociado</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="estado" id="renegotiated" value="renegotiated"/>
+                                            <label for="renegotiated">Renegociado</label>
+                                        </li>
+                                    </ul>
+                                </div>
+                                <div class="col-xs-12">
+                                    <div class="form-group">
+                                        <label for="current-bank">Banco: </label>
+                                        <select id="current-bank" class="form-control ui-autocomplete-input" name="bank"></select>
+                                    </div>
+                                </div>
+                                <div class="col-xs-12">
+                                    <div class="form-group">
+                                        <label for="partner">Buscar Cliente / Proveedor:</label>
+                                        <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div id="toolbar">
+                <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+            </div>
+            <table id="table" class="table_paint_first_row"
+                data-pagination="true"
+                data-toggle="table"
+                data-reorderable-columns="true"
+                data-toolbar="#toolbar"
+                data-show-columns="true"
+                data-buttons-class="oe_button oe_form_button oe_highlight"
+                data-height="auto"
+                data-classes="table table-hover table-condensed"
+                data-row-style="rowStyle"
+                data-search="true">
+                <thead>
+                    <tr>
+                        <th data-field="create_date">Fecha</th>
+                        <th data-field="titular">Titular</th>
+                        <th data-field="number_cta">Nro Cuenta</th>
+                        <th data-field="type_bank">Tipo</th>
+                        <th data-field="number">N Cheque/Boleta</th>
+                        <th data-field="amount_payment" data-sortable="true" data-align="right">Salida</th>
+                        <th data-field="amount_receipt" data-sortable="true" data-align="right">Entrada</th>
+                        <th data-field="amount_total" data-sortable="true" data-align="right">Valor</th>
+                        <th data-field="date_maturity" data-sortable="true">Vence</th>
+                        <th data-field="state" data-sortable="true" data-align="right">Estado</th>
+                    </tr>
+                </thead>
+            </table>
+            <canvas></canvas>
+            <div id="dialog"></div>
+        </div>
+    </t>
+</template>

+ 26 - 38
static/src/reports/report_bank_movements.xml

@@ -4,7 +4,6 @@
         <div class="report_view">
             <div class="reporting_page_header">
                 <h1>Histórico de Movimiento de Banco</h1>
-                <div id="volver"></div>
             </div>
             <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
             </button>
@@ -51,58 +50,46 @@
                             </div>
                         </div>
                     </div>
+
                     <div class="col-xs-6">
                         <div class="panel panel-default">
                             <div class="panel-heading">Características</div>
                             <div class="panel-body">
                                 <div class="col-xs-6">
-                                    <h3>Tipo</h3>
+                                    <h3>Estado</h3>
                                     <ul class="list-unstyled">
                                         <li>
-                                            <input type="radio" name="cateritica" id="Y" value="Y" checked="checked"/>
-                                            <label for="Y">Sin Filtro</label>
+                                            <input type="radio" name="estado" id="W" value="W" checked="checked"/>
+                                            <label for="W">Sin Filtro</label>
                                         </li>
                                         <li>
-                                            <input type="radio" name="cateritica" id="sale" value="sale"/>
-                                            <label for="sale">Factura de venta</label>
+                                            <input type="radio" name="estado" id="available" value="available"/>
+                                            <label for="available">Disponible</label>
                                         </li>
                                         <li>
-                                            <input type="radio" name="cateritica" id="purchase" value="purchase"/>
-                                            <label for="purchase">Factura de compra</label>
+                                            <input type="radio" name="estado" id="cashed" value="cashed"/>
+                                            <label for="cashed">Pagado</label>
                                         </li>
                                         <li>
-                                            <input type="radio" name="cateritica" id="expense" value="expense"/>
-                                            <label for="expense">Factura de gasto</label>
+                                            <input type="radio" name="estado" id="negotiated" value="negotiated"/>
+                                            <label for="negotiated">Negociado</label>
                                         </li>
-                                    </ul>
-                                </div>
-                                <div class="col-xs-6">
-                                    <h3>Estado</h3>
-                                    <ul class="list-unstyled">
                                         <li>
-                                            <input type="radio" name="estado" id="W" value="W" checked="checked"/>
-                                            <label for="W">Sin Filtro</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="estado" id="open" value="open"/>
-                                            <label for="open">Abierto</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="estado" id="paid" value="paid"/>
-                                            <label for="paid">Pagado</label>
+                                            <input type="radio" name="estado" id="renegotiated" value="renegotiated"/>
+                                            <label for="renegotiated">Renegociado</label>
                                         </li>
                                     </ul>
                                 </div>
                                 <div class="col-xs-12">
                                     <div class="form-group">
-                                        <label for="partner">Buscar Cliente / Proveedor:</label>
-                                        <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
+                                        <label for="current-bank">Banco: </label>
+                                        <select id="current-bank" class="form-control ui-autocomplete-input" name="bank"></select>
                                     </div>
                                 </div>
                                 <div class="col-xs-12">
                                     <div class="form-group">
-                                         <label for="current-store">Sucursal: </label>
-                                        <select id="current-store" class="form-control ui-autocomplete-input" name="store"></select>
+                                        <label for="partner">Buscar Cliente / Proveedor:</label>
+                                        <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
                                     </div>
                                 </div>
                             </div>
@@ -111,7 +98,7 @@
                 </div>
             </div>
             <div id="toolbar">
-                <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">PDF</button>
+                <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
             </div>
             <table id="table" class="table_paint_first_row"
                 data-pagination="true"
@@ -126,15 +113,16 @@
                 data-search="true">
                 <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="create_date">Fecha</th>
+                        <th data-field="titular">Titular</th>
+                        <th data-field="number_cta">Nro Cuenta</th>
+                        <th data-field="type_bank">Tipo</th>
+                        <th data-field="number">N Cheque/Boleta</th>
+                        <th data-field="amount_payment" data-sortable="true" data-align="right">Salida</th>
+                        <th data-field="amount_receipt" data-sortable="true" data-align="right">Entrada</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>
-                        <th data-field="to_receive" data-sortable="true" data-align="right">A Cobrar</th>
-                        <th data-field="to_pay" data-sortable="true" data-align="right">Por Pagar</th>
+                        <th data-field="date_maturity" data-sortable="true">Vence</th>
+                        <th data-field="state" data-sortable="true" data-align="right">Estado</th>
                     </tr>
                 </thead>
             </table>

+ 53 - 57
static/src/reports/report_pos.xml

@@ -8,65 +8,61 @@
             <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
             </button>
             <div class="collapse" id="collapseExample">
-                <div class="card card-body">
-                    <br/>
-                    <div class="row">
-                        <div class="col-xs-6">
-                            <div class="panel panel-default">
-                                <div class="panel-heading">Fechas</div>
-                                <div class="panel-body">
-                                    <ul>
-                                        <li>
-                                            <input type="radio" name="valores" id="X" value="X" checked="checked"/>
-                                            <label for="X">Sin Filtro</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="valores" id="A" value="A"/>
-                                            <label for="A">Hoy</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="valores" id="B" value="B"/>
-                                            <label for="B">Ayer</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="valores" id="C" value="C"/>
-                                            <label for="C">Mes Actual</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="valores" id="D" value="D"/>
-                                            <label for="D">Mes Pasado</label>
-                                        </li>
-                                        <li>
-                                            <input type="radio" name="valores" id="Z" value="Z"/>
-                                            <label for="Z">Busqueda Avanzada</label>
-                                        </li>
-                                    </ul>
-                                    <div id="datepicker" style="display:none;" class="container">
-                                        <label for="from">Desde: </label>
-                                        <input type="text"  id="from" name="from"/>
-                                        <label for="to" >Hasta: </label>
-                                        <input type="text"  id="to" name="to" />
-                                    </div>
-
+                <br/>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Fechas</div>
+                            <div class="panel-body">
+                                <ul class="list-unstyled">
+                                    <li>
+                                        <input type="radio" name="valores" id="X" value="X" checked="checked"/>
+                                        <label for="X">Sin Filtro</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="A" value="A"/>
+                                        <label for="A">Hoy</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="B" value="B"/>
+                                        <label for="B">Ayer</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="C" value="C"/>
+                                        <label for="C">Mes Actual</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="D" value="D"/>
+                                        <label for="D">Mes Pasado</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="Z" value="Z"/>
+                                        <label for="Z">Busqueda Avanzada</label>
+                                    </li>
+                                </ul>
+                                <div id="datepicker" style="display:none;" class="container">
+                                    <label for="from">Desde: </label>
+                                    <input type="text"  id="from" name="from"/>
+                                    <label for="to" >Hasta: </label>
+                                    <input type="text"  id="to" name="to" />
                                 </div>
                             </div>
                         </div>
-                        <div class="col-xs-6">
-                            <div class="panel panel-default">
-                                <div class="panel-heading">Características</div>
-                                <div class="panel-body">
-                                    <div class="form-group">
-                                        <label for="current-journal">Metodo de pago: </label>
-                                        <select id="current-journal" class="form-control ui-autocomplete-input"  name="current-journal"></select>
-                                    </div>
-                                    <div class="form-group">
-                                        <label for="partner">Buscar Cliente:</label>
-                                        <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
-                                    </div>
-                                    <div class="form-group">
-                                        <label for="current-store">Sucursal: </label>
-                                        <select id="current-store" class="form-control ui-autocomplete-input" name="store"></select>
-                                    </div>
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Características</div>
+                            <div class="panel-body">
+                                <div class="form-group">
+                                    <label for="current-journal">Metodo de pago: </label>
+                                    <select id="current-journal" class="form-control ui-autocomplete-input"  name="journal"></select>
+                                </div>
+                                <div class="form-group">
+                                    <label for="partner">Buscar Cliente:</label>
+                                    <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
+
+                                    <label for="current-store">Sucursal: </label>
+                                    <select id="current-store" class="form-control ui-autocomplete-input" name="store"></select>
                                 </div>
                             </div>
                         </div>
@@ -99,7 +95,7 @@
                     </tr>
                 </thead>
             </table>
-            <canvas></canvas>
+            <!-- <canvas></canvas> -->
             <div id="dialog"></div>
         </div>
     </t>

+ 41 - 39
static/src/reports/report_pos_orders.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-  <template xml:space="preserve">
-      <t t-name="ReportPosOrders">
+<template xml:space="preserve">
+    <t t-name="ReportPosOrders">
         <div class="report_view">
-          <div class="reporting_page_header">
-            <h1>Análisis de Ventas</h1>
-            <div id="volver"></div>
-          </div>
-          <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
+            <div class="reporting_page_header">
+                <h1>Análisis de Ventas</h1>
+                <div id="volver"></div>
+            </div>
+            <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
             </button>
             <div class="collapse" id="collapseExample">
                 <br/>
@@ -47,7 +47,6 @@
                                     <label for="to" >Hasta: </label>
                                     <input type="text"  id="to" name="to" />
                                 </div>
-
                             </div>
                         </div>
                     </div>
@@ -74,35 +73,38 @@
                     </div>
                 </div>
             </div>
-          <div id="toolbar">
-            <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+            <div id="toolbar">
+                <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+            </div>
+            <table id="table" class="table_paint_first_row"
+                data-pagination="true"
+                data-toggle="table"
+                data-reorderable-columns="true"
+                data-toolbar="#toolbar"
+                data-show-columns="true"
+                data-buttons-class="oe_button oe_form_button oe_highlight"
+                data-height="auto"
+                data-classes="table table-hover table-condensed"
+                data-row-style="rowStyle"
+                data-search="true">
+                <thead>
+                    <tr>
+                        <th data-field="order_name" data-sortable="true">Pedido</th>
+                        <th data-field="date_order" data-sortable="true">Fecha</th>
+                        <th data-field="category_name" data-sortable="true" >Categoria</th>
+                        <th data-field="table_name">Lugar</th>
+                        <th data-field="product_name" data-sortable="true">Productos</th>
+                        <th data-field="qty" data-sortable="true" data-align="right">Cantidad</th>
+                        <th data-field="price_unit" data-sortable="true" data-align="right">Precio Venta</th>
+                        <th data-field="standard_price" data-sortable="true" data-align="right">Precio de Costo</th>
+                        <th data-field="price_tot" data-sortable="true" data-align="right">Total Venta</th>
+                        <th data-field="standar_tot" data-sortable="true" data-align="right">Total Costo</th>
+                        <th data-field="utility" data-sortable="true"  data-align="right">Utilidad</th>
+                    </tr>
+                </thead>
+            </table>
+            <div class="widget-content" id="grafico"></div>
+            <div id="dialog"></div>
         </div>
-        <table id="table" class="table_paint_first_row"
-            data-pagination="true"
-            data-toggle="table"
-            data-reorderable-columns="true"
-            data-toolbar="#toolbar"
-            data-show-columns="true"
-            data-buttons-class="oe_button oe_form_button oe_highlight"
-            data-height="auto"
-            data-classes="table table-hover table-condensed"
-            data-row-style="rowStyle"
-            data-search="true">
-            <thead>
-              <tr>
-                <th data-field="order_name" data-sortable="true">Pedido</th>
-                <th data-field="date_order" data-sortable="true">Fecha</th>
-                <th data-field="category_name" data-sortable="true" >Categoria</th>
-                <th data-field="table_name">Lugar</th>
-                <th data-field="product_name" data-sortable="true">Productos</th>
-                <th data-field="price_unit" data-align="right">Precio Unitario</th>
-                <th data-field="qty" data-sortable="true" data-align="right">Cantidad</th>
-                <th data-field="price_subtotal_incl" data-sortable="true" data-align="right">Total</th>
-              </tr>
-            </thead>
-        </table>
-        <div class="widget-content" id="grafico"></div>
-        <div id="dialog"></div>
-      </div>
-      </t>
-  </template>
+    </t>
+</template>

+ 101 - 0
static/src/reports/report_sale_cab.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportSaleCab">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1>Histórico de Ventas</h1>
+            </div>
+            <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
+            </button>
+            <div class="collapse" id="collapseExample">
+                <br/>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Fechas</div>
+                            <div class="panel-body">
+                                <ul class="list-unstyled">
+                                    <li>
+                                        <input type="radio" name="valores" id="X" value="X" checked="checked"/>
+                                        <label for="X">Sin Filtro</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="A" value="A"/>
+                                        <label for="A">Hoy</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="B" value="B"/>
+                                        <label for="B">Ayer</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="C" value="C"/>
+                                        <label for="C">Mes Actual</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="D" value="D"/>
+                                        <label for="D">Mes Pasado</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="Z" value="Z"/>
+                                        <label for="Z">Busqueda Avanzada</label>
+                                    </li>
+                                </ul>
+                                <div id="datepicker" style="display:none;" class="container">
+                                    <label for="from">Desde: </label>
+                                    <input type="text"  id="from" name="from"/>
+                                    <label for="to" >Hasta: </label>
+                                    <input type="text"  id="to" name="to" />
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Características</div>
+                            <div class="panel-body">
+                                <div class="form-group">
+                                    <label for="user">Vendedor: </label>
+                                    <input id="user" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
+                                </div>
+                                <div class="form-group">
+                                    <label for="partner">Buscar Cliente:</label>
+                                    <input id="partner" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
+                                </div>
+                                <div class="form-group">
+                                    <label for="current-store">Sucursal: </label>
+                                    <select id="current-store" class="form-control ui-autocomplete-input" name="store"></select>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div id="toolbar">
+                <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">PDF</button>
+            </div>
+            <table id="table" class="table_paint_first_row"
+                data-pagination="true"
+                data-toggle="table"
+                data-reorderable-columns="true"
+                data-toolbar="#toolbar"
+                data-show-columns="true"
+                data-buttons-class="oe_button oe_form_button oe_highlight"
+                data-height="auto"
+                data-classes="table table-hover table-condensed"
+                data-row-style="rowStyle"
+                data-search="true">
+                <thead>
+                    <tr>
+                        <th data-field="number" data-sortable="true">Orden</th>
+                        <th data-field="partner">Cliente</th>
+                        <th data-field="date_invoice" data-sortable="true">Fecha</th>
+                        <th data-field="amount_total" data-sortable="true" data-align="right">Total</th>
+                        <th data-field="user" data-sortable="true">Vendedor</th>
+                    </tr>
+                </thead>
+            </table>
+            <!-- <canvas></canvas> -->
+            <div id="dialog"></div>
+        </div>
+    </t>
+</template>

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

@@ -93,8 +93,8 @@
                 <th data-field="partner_name" >Cliente</th>
                 <th data-field="name" >Producto</th>
                 <th data-field="quantity" data-sortable="true" data-align="right">Cantidad</th>
-                <th data-field="price_unity" data-sortable="true" data-align="right">Precio Unitario</th>
-                <th data-field="standar_price" data-sortable="true" data-align="right">Precio de Costo</th>
+                <th data-field="price_unity" data-sortable="true" data-align="right">Precio Venta</th>
+                <th data-field="standar_price" data-sortable="true" data-align="right">Precio Costo</th>
                 <th data-field="price_tot" data-sortable="true" data-align="right">Total Venta</th>
                 <th data-field="standar_tot" data-sortable="true" data-align="right">Total Costo</th>
                 <th data-field="utility" data-sortable="true"  data-align="right">Utilidad</th>

+ 111 - 0
static/src/reports/report_ventas_pos_orders.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+  <template xml:space="preserve">
+      <t t-name="ReportVentasPosOrders">
+        <div class="report_view">
+          <div class="reporting_page_header">
+            <h1>Análisis de Ventas Generales</h1>
+            <div id="volver"></div>
+          </div>
+          <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
+            </button>
+            <div class="collapse" id="collapseExample">
+                <br/>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Fechas</div>
+                            <div class="panel-body">
+                                <ul class="list-unstyled">
+                                    <li>
+                                        <input type="radio" name="valores" id="X" value="X" checked="checked"/>
+                                        <label for="X">Sin Filtro</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="A" value="A"/>
+                                        <label for="A">Hoy</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="B" value="B"/>
+                                        <label for="B">Ayer</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="C" value="C"/>
+                                        <label for="C">Mes Actual</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="D" value="D"/>
+                                        <label for="D">Mes Pasado</label>
+                                    </li>
+                                    <li>
+                                        <input type="radio" name="valores" id="Z" value="Z"/>
+                                        <label for="Z">Busqueda Avanzada</label>
+                                    </li>
+                                </ul>
+                                <div id="datepicker" style="display:none;" class="container">
+                                    <label for="from">Desde: </label>
+                                    <input type="text"  id="from" name="from"/>
+                                    <label for="to" >Hasta: </label>
+                                    <input type="text"  id="to" name="to" />
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="panel panel-default">
+                            <div class="panel-heading">Características</div>
+                            <div class="panel-body">
+                                <div class="form-group">
+                                    <!-- <label for="current-category">Todas las categorias: </label>
+                                    <select id="current-category" class="form-control ui-autocomplete-input"  name="current-category"></select>
+                                    <label for="current-floor">Ubicacion: </label>
+                                    <select id="current-floor" class="form-control ui-autocomplete-input"  name="floor"></select>
+                                    <label for="current-table">Lugar: </label>
+                                    <select id="current-table" class="form-control ui-autocomplete-input"  name="table"></select> -->
+                                    <label for="product">Buscar Producto</label>
+                                    <input id="product" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ Referencia/ Codigo de barras"/>
+                                </div>
+                                <!-- <div class="form-group">
+                                    <label for="current-store">Sucursal: </label>
+                                    <select id="current-store" class="form-control ui-autocomplete-input" name="store"></select>
+                                </div> -->
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+          <div id="toolbar">
+            <button class="oe_button oe_form_button oe_highlight" value="pdf">PDF</button>
+        </div>
+        <table id="table" class="table_paint_first_row"
+            data-pagination="true"
+            data-toggle="table"
+            data-reorderable-columns="true"
+            data-toolbar="#toolbar"
+            data-show-columns="true"
+            data-buttons-class="oe_button oe_form_button oe_highlight"
+            data-height="auto"
+            data-classes="table table-hover table-condensed"
+            data-row-style="rowStyle"
+            data-search="true">
+            <thead>
+              <tr>
+                <th data-field="order_name" data-sortable="true">Pedido</th>
+                <th data-field="date_order" data-sortable="true">Fecha</th>
+                <!-- <th data-field="category_name" data-sortable="true" >Categoria</th>
+                <th data-field="table_name">Lugar</th> -->
+                <th data-field="product_name" data-sortable="true">Productos</th>
+                <th data-field="qty" data-sortable="true" data-align="right">Cantidad</th>
+                <th data-field="price_unit" data-sortable="true" data-align="right">Precio Venta</th>
+                <th data-field="standard_price" data-sortable="true" data-align="right">Precio de Costo</th>
+                <th data-field="price_tot" data-sortable="true" data-align="right">Total Venta</th>
+                <th data-field="standar_tot" data-sortable="true" data-align="right">Total Costo</th>
+                <th data-field="utility" data-sortable="true"  data-align="right">Utilidad</th>
+              </tr>
+            </thead>
+        </table>
+        <div class="widget-content" id="grafico"></div>
+        <div id="dialog"></div>
+      </div>
+      </t>
+  </template>

+ 7 - 1
templates.xml

@@ -27,6 +27,9 @@
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_product_pack.js"/>
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_product_pack_utilidad.js"/>
 
+                <!-- Historico de ventas -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_sale_cab.js" />
+
                 <!-- Analisis de ventas -->
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_sales_invoice_analysis.js" />
                 <!-- Ranking ventas -->
@@ -69,12 +72,15 @@
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_ranking_pos_orders_customer.js"/>
                  <!-- Analisis Pos -->
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_pos_orders.js"/>
+                 <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_ventas_pos_orders.js"/> -->
                  <!-- Ranking Customers (Sale)-->
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_ranking_sales_orders_customer.js"/>
                  <!-- Ranking Supplier (Purchase)-->
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_ranking_purchases_orders_supplier.js"/>
                  <!-- Analisis de bank movements  -->
-                 <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_bank_movements.js" /> -->
+                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_bank_movements.js" />
+                 <!-- Analisis de bank gral  -->
+                 <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_bank_gral.js" /> -->
                  <!-- Utilidad de facturas detalladas -->
                  <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_invoice_utility.js" /> -->
                  <!-- Listado de utilidad por producto -->

+ 19 - 1
views/actions.xml

@@ -34,9 +34,15 @@
         </record>
 
 		<!-- Historico de Movimiento de Banco -->
-	<!--	<record id="bank_movements_report_action" model="ir.actions.client">
+		<record id="bank_movements_report_action" model="ir.actions.client">
 			<field name="name">Historico de Movimiento de Banco</field>
 			<field name="tag">eiru_reporting.bank_movements_action_report</field>
+		</record>
+
+		<!-- Historico de Movimiento de Banco -->
+		<!-- <record id="bank_gral_report_action" model="ir.actions.client">
+			<field name="name">Historico de General por Banco</field>
+			<field name="tag">eiru_reporting.bank_gral_action_report</field>
 		</record> -->
 
         <!-- Historico de pagos -->
@@ -59,6 +65,12 @@
 
         <!-- *************************** Ventas *************************** -->
 
+		<!-- Historico de ventas -->
+		<record id="sale_order_report_action" model="ir.actions.client">
+			<field name="name">Historico de Ventas</field>
+			<field name="tag">eiru_reporting.sale_order_action_report</field>
+		</record>
+
         <!-- Analisis de facturas de ventas -->
         <record id="sale_report_action" model="ir.actions.client">
             <field name="name">Analisis de facturas de ventas</field>
@@ -91,6 +103,12 @@
             <field name="tag">eiru_reporting.point_of_sale_detail_action_report</field>
         </record>
 
+		<!-- Analisis de ventas y pos -->
+		<!-- <record id="point_venta_report_action" model="ir.actions.client">
+			<field name="name">Analisis de Ventas Generales</field>
+			<field name="tag">eiru_reporting.point_venta_action_report</field>
+		</record> -->
+
         <!-- Ranking de productos mas vendidos -->
         <record id="point_sale_ranking_report_action" model="ir.actions.client">
             <field name="name">Ranking de Productos</field>

+ 18 - 8
views/menus.xml

@@ -25,28 +25,34 @@
 	        <menuitem id="invoice_report_menu_submenu" parent="account_report_parent_menu" name="Historico de Facturas" action="invoice_report_action" sequence="2"/>
 
             <!-- Historico de Movimiento de Bancos-->
-            <!-- <menuitem id="bank_movements_report_menu_submenu" parent="account_report_parent_menu" name="Historico de Movimiento de Banco" action="bank_movements_report_action" sequence="3"/> -->
+            <menuitem id="bank_movements_report_menu_submenu" parent="account_report_parent_menu" name="Historico de Movimiento de Banco" action="bank_movements_report_action" sequence="3"/>
+
+            <!-- Historico de Movimiento de Bancos-->
+            <!-- <menuitem id="bank_gral_report_menu_submenu" parent="account_report_parent_menu" name="Listado de Movimiento Generales de Banco" action="bank_gral_report_action" sequence="4"/> -->
 
 	        <!-- Historico de pagos -->
-	        <menuitem id="voucher_report_menu_submenu" parent="account_report_parent_menu" name="Historico de Pagos" action="voucher_report_action" sequence="4"/>
+	        <menuitem id="voucher_report_menu_submenu" parent="account_report_parent_menu" name="Historico de Pagos" action="voucher_report_action" sequence="5"/>
 
 	        <!-- Listado de cuentas a cobrar-->
-	        <menuitem id="account_pending_menu_submenu" parent="account_report_parent_menu" name="Cuentas a cobrar" action="account_pending_report_action" sequence="5"/>
+	        <menuitem id="account_pending_menu_submenu" parent="account_report_parent_menu" name="Cuentas a cobrar" action="account_pending_report_action" sequence="6"/>
 
 	        <!-- Listado de cuentas a cobrar (vencidos)-->
-	        <menuitem id="account_report_menu_submenu" parent="account_report_parent_menu" name="Cuentas a cobrar (Vencidos)" action="account_report_action" sequence="6"/>
+	        <menuitem id="account_report_menu_submenu" parent="account_report_parent_menu" name="Cuentas a cobrar (Vencidos)" action="account_report_action" sequence="7"/>
 
 	    <!-- Ventas Submenu -->
         <menuitem id="sale_report_parent_menu" name="Ventas" parent="eiru_report_main_menu" sequence="3"/>
 
+            <!-- Historico de ventas -->
+            <menuitem id="sale_order_menu_submenu" parent="sale_report_parent_menu" name="Historico de Ventas" action="sale_order_report_action" sequence="0"/>
+
 	        <!-- Analisis de facturas de ventas -->
-	        <menuitem id="sale_report_menu_submenu" parent="sale_report_parent_menu" name="Analisis Ventas" action="sale_report_action" sequence="0"/>
+	        <menuitem id="sale_report_menu_submenu" parent="sale_report_parent_menu" name="Analisis Ventas" action="sale_report_action" sequence="1"/>
 
             <!-- Ranking de clientes con mas compras -->
-            <menuitem id="saleranking_report_menu_submenu" parent="sale_report_parent_menu" name="Ranking de clientes con mas compras" action="sale_customer_ranking_report_action" sequence="1"/>
+            <menuitem id="saleranking_report_menu_submenu" parent="sale_report_parent_menu" name="Ranking de clientes con mas compras" action="sale_customer_ranking_report_action" sequence="2"/>
 
             <!-- Ranking de productos mas vendidos -->
-            <menuitem id="productranking_report_menu_submenu" parent="sale_report_parent_menu" name="Ranking de productos mas vendidos" action="productranking_report_action" sequence="2"/>
+            <menuitem id="productranking_report_menu_submenu" parent="sale_report_parent_menu" name="Ranking de productos mas vendidos" action="productranking_report_action" sequence="3"/>
 
 	    <!-- POS Submenu -->
         <menuitem id="point_of_sale_report_parent_menu" name="Terminal de Ventas" parent="eiru_report_main_menu" sequence="4"/>
@@ -56,7 +62,11 @@
 
 	        <!-- Historico de ventas -->
 	        <menuitem id="point_of_sale_report_menu_submenu" parent="point_of_sale_report_parent_menu" name="Historico de Ventas" action="point_sale_report_action" />
-	        <!-- Ranking de productos -->
+
+            <!-- Analisis de ventas -->
+            <!-- <menuitem id="point_of_sale_venta_menu_submenu" parent="point_of_sale_report_parent_menu" name="Analisis de Ventas Generales" action="point_venta_report_action"/> -->
+
+            <!-- Ranking de productos -->
 	        <menuitem id="point_of_sale_ranking_report_menu_submenu" parent="point_of_sale_report_parent_menu" name="Ranking de productos" action="point_sale_ranking_report_action"/>
 
 	        <!-- Ranking de clientes -->