Browse Source

ADD FIX Actualización de eiru reporting filtros y nuevos reportes

Sebas 7 years ago
parent
commit
f88f63d54c

+ 19 - 1
__openerp__.py

@@ -10,6 +10,24 @@
     ],
     'qweb': [
         'static/src/xml/*.xml',
-        'static/src/reports/*.xml'
+        'static/src/reports/report_resumen_ingresos.xml',
+        'static/src/reports/report_resumen_egresos.xml',
+        'static/src/reports/report_crm.xml',
+        'static/src/reports/report_balance.xml',
+        'static/src/reports/report_mensajecrm.xml',
+        'static/src/reports/report_phonecall.xml',
+        'static/src/reports/report_pos.xml',
+        'static/src/reports/report_stock_move.xml',
+        'static/src/reports/report_project.xml',
+        'static/src/reports/report_works.xml',
+        'static/src/reports/report_invoice_balance.xml',
+        'static/src/reports/report_vouchers.xml',
+        'static/src/reports/report_mrp.xml',
+        'static/src/reports/reporting_accountpending.xml',
+        'static/src/reports/reporting_account.xml',
+        'static/src/reports/report_sales_invoice_analysis.xml',
+        'static/src/reports/report_purchases_invoice_analysis.xml',
+        'static/src/reports/report_product_utility.xml',
+        'static/src/reports/report_stock.xml'
     ]
 }

+ 10 - 0
static/src/js/configuration_reporting.js

@@ -38,6 +38,11 @@ function configuration_reporting (instance, widget) {
                 description: 'Permite realizar un analisis de las facturas de venta.',
                 action: 'ReportSaleInvoiceAnalysis'
             },
+            {
+                title: 'Análisis de Punto de Venta',
+                description: 'Permite realizar un analisis de las venta en punto de venta.',
+                action: 'ReportPos'
+            },
             {
                 title: 'Informe de Trabajos',
                 description: 'Permite visualizar los trabajos facturados y no facturados.',
@@ -83,6 +88,11 @@ function configuration_reporting (instance, widget) {
                 description: 'Permite visualizar un listado de cuentas a cobrar.',
                 action: 'ReportingAccountPending'
             },
+            {
+                title: 'Listado de Producción',
+                description: 'Permite visualizar un listado de producción.',
+                action: 'ReportMrp'
+            },
             {
                 title: 'Listado de Proyectos',
                 description: 'Permite visualizar un listado de proyectos.',

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

@@ -27,6 +27,8 @@ openerp.eiru_reporting = function (instance) {
         reporting_accountpending(reporting);
         report_balance(reporting);
         report_works(reporting);
+        report_pos(reporting);
+        report_mrp(reporting);
 
     } catch (e) {
 

+ 12 - 12
static/src/js/reports/report_balance.js

@@ -64,10 +64,10 @@ function report_balance (reporting){
                 self.AccountInvoice = AccountInvoice;
                 return self.fetchResPartner();
             }).then(function(ResPartner){
-                self.ResPartner = ResPartner; 
+                self.ResPartner = ResPartner;
                 self.search();
                 return self.buildTable();
-                
+
             });
         },
         // Fecha
@@ -129,7 +129,7 @@ function report_balance (reporting){
             }
             return valor;
         },
-        
+
         // Buscador
         search: function () {
             var self = this;
@@ -175,7 +175,7 @@ function report_balance (reporting){
                     egress = item.amount_total - item.residual;
                     to_receive = 0;
                     to_pay = item.residual;
-                }  
+                }
                 data.push({
                     id : item.id,
                     number : item.number,
@@ -188,7 +188,7 @@ function report_balance (reporting){
                     egress : accounting.formatNumber(egress,0,".",","),
                     to_receive : accounting.formatNumber(to_receive,0,".",","),
                     to_pay : accounting.formatNumber(to_pay,0,".",","),
-                    
+
                     intamount_total : item.amount_total,
                     intentry : entry,
                     integress : egress,
@@ -289,24 +289,24 @@ function report_balance (reporting){
                 return(map.intentry);
             }),function(memo, num){
                 return memo + num;
-            },0); 
+            },0);
             // Egreso
             var integress = _.reduce(_.map(rows,function(map){
                 return(map.integress);
             }),function(memo, num){
                 return memo + num;
-            },0); 
+            },0);
             // Monto a Cobrar
             var intreceive = _.reduce(_.map(rows,function(map){
                 return(map.intreceive);
             }),function(memo, num){
                 return memo + num;
-            },0); 
+            },0);
             var intpay = _.reduce(_.map(rows,function(map){
                 return(map.intpay);
             }),function(memo, num){
                 return memo + num;
-            },0); 
+            },0);
             rows.push({
                 id : '',
                 number : 'Totales',
@@ -319,7 +319,7 @@ function report_balance (reporting){
                 egress : accounting.formatNumber(integress,0,".",","),
                 to_receive : accounting.formatNumber(intreceive,0,".",","),
                 to_pay : accounting.formatNumber(intpay,0,".",","),
-                
+
                 intamount_total : 0,
                 intentry : 0,
                 integress : 0,
@@ -372,9 +372,9 @@ function report_balance (reporting){
                     number : {columnWidth: '8px'},
                     partner : {columnWidth: '8px'},
                     partner_id : {columnWidth: '8px'},
-                    date_invoice : {columnWidth: '8px'},
+                    date_invoice : {columnWidth: '7px'},
                     date : {columnWidth: '8px'},
-                    amount_total : {halign:'right',columnWidth: '8px'},
+                    amount_total : {halign:'right',columnWidth: '9px'},
                     entry : {halign:'right',columnWidth: '8px'},
                     egress : {halign:'right',columnWidth: '8px'},
                     to_receive : {halign:'right',columnWidth: '8px'},

+ 47 - 41
static/src/js/reports/report_invoice_balance.js

@@ -174,10 +174,15 @@ function report_invoice_balance (reporting){
             var self = this;
             var data = [];
             var AccountInvoice = self.AccountInvoice;
+            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') {
@@ -214,6 +219,11 @@ function report_invoice_balance (reporting){
                     journal_id : item.journal_id[0],
                     currency_id : item.currency_id[0],
                     partner_id : item.partner_id[0],
+                    amount_total_num: item.amount_total,
+                    entry_num: entry,
+                    egress_num: egress,
+                    to_receive_num: to_receive,
+                    to_pay_num: to_pay,
                 });
             });
             self.content = data;
@@ -332,57 +342,51 @@ function report_invoice_balance (reporting){
         getObjectPdf: function(rowsTable){
             var self = this;
             var rowsPdf=[];
+            var rows=[];
             var rows = self.rowsData;
-            var amount_total =_.reduce(_.map(rows,function(item){
-                var valor = 0;
-                if (item.amount_total){
-                    valor = parseFloat(((item.amount_total.replace(".","")).replace(",",".")))
-                }return valor
-            }), function(memo, num){
+
+            var amount_total_num = _.reduce(_.map(rows,function(map){
+                return(map.amount_total_num);
+            }),function(memo, num){
                 return memo + num;
             },0);
-            var entry =_.reduce(_.map(rows,function(item){
-                var valor = 0;
-                if (item.entry){
-                    valor = parseFloat(((item.entry.replace(".","")).replace(",",".")))
-                }return valor
-            }), function(memo, num){
+
+
+            var entry_num = _.reduce(_.map(rows,function(map){
+                return(map.entry_num);
+            }),function(memo, num){
                 return memo + num;
             },0);
-            var egress =_.reduce(_.map(rows,function(item){
-                var valor = 0;
-                if (item.egress){
-                    valor = parseFloat(((item.egress.replace(".","")).replace(",",".")))
-                }return valor
-            }), function(memo, num){
+
+            var egress_num = _.reduce(_.map(rows,function(map){
+                return(map.egress_num);
+            }),function(memo, num){
                 return memo + num;
             },0);
-            var to_receive =_.reduce(_.map(rows,function(item){
-                var valor = 0;
-                if (item.to_receive){
-                    valor = parseFloat(((item.to_receive.replace(".","")).replace(",",".")))
-                }return valor
-            }), function(memo, num){
+            var to_receive_num = _.reduce(_.map(rows,function(map){
+                return(map.to_receive_num);
+            }),function(memo, num){
                 return memo + num;
             },0);
-            var to_pay =_.reduce(_.map(rows,function(item){
-                var valor = 0;
-                if (item.to_pay){
-                    valor = parseFloat(((item.to_pay.replace(".","")).replace(",",".")))
-                }return valor
-            }), function(memo, num){
+            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 ",
-                    amount_total: accounting.formatNumber(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,".",","),
+                    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;
         },
         clickOnAction: function (e) {
@@ -418,18 +422,20 @@ function report_invoice_balance (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');
 
             pdfDoc.autoTable(getColumns, rows, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
                     number : {columnWidth: '8px'},
-                    supplier_invoice_number : {columnWidth: '8px'},
                     partner : {columnWidth: '8px'},
                     date : {columnWidth: '8px'},
-                    user : {columnWidth: '8px'},
-                    currency : {columnWidth: '8px'},
-                    amount_total: {halign:'right',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'},
                 },
                 margin: { top: 20, horizontal: 7},
 

+ 459 - 0
static/src/js/reports/report_mrp.js

@@ -0,0 +1,459 @@
+function report_mrp(reporting){
+    "use strict";
+
+    var instance = openerp;
+
+    reporting.ReportMrpWidget = reporting.Base.extend({
+        template:'ReportMrp',
+        Mrp: [],
+        content:[],
+        productProduct: [],
+        rowsData :[],
+        modules:[],
+        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 #product' : '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();
+        },
+
+        // 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
+        },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        clickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'name'){
+                 this.do_action({
+                     name:"Producción",
+                     type: 'ir.actions.act_window',
+                     res_model: "mrp.production",
+                     views: [[false,'form']],
+                     target: 'new',
+                     domain: [['id','=', row.id]],
+                     context: {},
+                     flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                     res_id: row.id,
+                 });
+            }
+            if (field === 'product'){
+                this.do_action({
+                    name:"Registro",
+                    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();
+        },
+
+        submitForm: function () {
+            var self = this;
+            self.fecthIrModuleModule().then(function(modules){
+                self.modules = modules;
+                return modules;
+            }).then(function(modules){
+                return self.fetchMrp();
+            }).then(function(Mrp) {
+                self.Mrp = Mrp;
+                return self.fetchProduct();
+            }).then(function(productProduct){
+                self.productProduct = productProduct;
+                self.search();
+                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;
+                    }
+                },
+
+                fetchMrp: function () {
+                    var self = this;
+                    var defer = $.Deferred();
+                    var modules = self.checkModel('mrp');
+
+                    if (modules.length <= 0){
+                        self.showMensaje('mrp');
+                        return defer;
+                    }
+
+                    var Mrp = new instance.web.Model('mrp.production');
+                    Mrp.query(['id', 'name', 'product_id', 'date_planned', 'product_qty', 'create_date', 'state']).filter().all().then(function(results){
+                        defer.resolve(results);
+                    });
+
+                    return defer;
+                },
+
+                // ProductProduct
+                fetchProduct: function() {
+                    var self = this;
+                    var defer = $.Deferred();
+                    var productProduct = new instance.web.Model('product.product');
+                    productProduct.query(['id','name','name_template']).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.productProduct;
+                    results = _.map(results, function (item) {
+                        return {
+                                label: item.id + '-'+ item.name,
+                                value: item.id + '-'+ item.name
+                        }
+                    });
+                    self.$('#product').autocomplete({
+                        source: results,
+                        minLength:0,
+                        search: function(event, ui) {
+                            if (!(self.$('#product').val())){
+                                self.factSearch();
+                            }
+                        },
+                        close: function( event, ui ) {
+                                self.factSearch();
+                        },
+                        select: function(event, ui) {
+                            self.factSearch();
+                        }
+                    });
+                },
+
+                BuildTable: function(){
+                    var self = this;
+                    var Mrp = self.Mrp;
+                    var invoice;
+                    var data = [];
+
+                    _.each(Mrp, function(item){
+
+                        data.push({
+                            id : item.id,
+                            name : item.name,
+                            product: self.valorNull(item.product_id[1]),
+                            create_date: moment(item.create_date).format("DD/MM/YYYY"),
+                            date: moment(item.create_date).format("YYYY-MM-DD"),
+                            product_qty: accounting.formatNumber(self.valorNull(item.product_qty),2, ".", ","),
+                            qty_produced: accounting.formatNumber(self.valorNull(item.qty_produced),2, ".", ","),
+                            state: item.state,
+                            date_planned: moment(item.date_planned).format("YYYY-MM-DD"),
+                            product_id : item.product_id[0]
+                        });
+                    });
+                    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('#product').val().split('-');
+                     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 (product != ""){
+                         content = _.filter(content, function(inv){
+                             return inv.id == product[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 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.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 Cabecera
+                         _.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: {
+                          name : {columnWidth: '4px'},
+                          product : {columnWidth: '6px'},
+                          date : {columnWidth: '9px'},
+                          product_qty : {columnWidth: '5px'},
+                          qty_produced : {columnWidth: '5px'},
+                          date_planned : {columnWidth: '7px'},
+                          state : {columnWidth: '6px'}
+                        },
+                        margin: { top: 16, horizontal: 7},
+
+                        addPageContent: function (data) {
+                            pdfDoc.setFontSize(12);
+                            pdfDoc.setFontStyle('bold');
+                            pdfDoc.setTextColor(40);
+                            pdfDoc.text('Histórico de producción', 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 producción.pdf')
+                },
+            });
+        }

+ 428 - 0
static/src/js/reports/report_pos.js

@@ -0,0 +1,428 @@
+function report_pos(reporting){
+    "use strict";
+
+    var instance = openerp;
+
+    reporting.ReportPosWidget = reporting.Base.extend({
+        template: 'ReportPos',
+        content: [],
+        rowsData :[],
+        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',
+            '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: "pos.order",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['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.fetchAccountInvoice()
+            }).then(function (AccountInvoice){
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchResPartner();
+            }).then(function(ResPartner){
+                self.ResPartner=ResPartner;
+                self.search();
+                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;
+            }
+        },
+        fetchAccountInvoice: function () {
+            var self = this;
+            var filter =[['state', 'in',['done','paid']]];
+            var field =['id', 'name', 'session_id', 'state', 'table_id', 'date_order','partner_id','amount_total','user_id','amount_tax'];
+            var defer = $.Deferred();
+            var modules = self.checkModel('point_of_sale');
+
+            if (modules.length <= 0){
+                self.showMensaje('point_of_sale');
+                return defer;
+            }
+            var AccountInvoice = new instance.web.Model('pos.order');
+            AccountInvoice.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();
+                }
+            });
+        },
+        BuildTable: function(invoices){
+            var self = this;
+            var AccountInvoice = self.AccountInvoice;
+            var data = [];
+            _.each(AccountInvoice, function(item){
+                data.push({
+                    id : item.id,
+                    number: item.name,
+                    origin: item.session_id[1],
+                    partner: item.partner_id[1],
+                    date_invoice: moment(item.date_order).format("DD/MM/YYYY"),
+                    amount_total: accounting.formatNumber(item.amount_total,2,".",","),
+                    date: item.date_order,
+                    partner_id : item.partner_id[0],
+                    amount : item.amount_total,
+                    user: item.user_id[1]
+                });
+            });
+            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 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);
+                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');
+            }
+            if (partner != ""){
+                content = _.filter(content, function(inv){
+                    return inv.partner_id == partner[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;
+            var amount = _.reduce(_.map(rows,function(map){
+                return(map.amount);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+            var total_residual = _.reduce(_.map(rows,function(map){
+                return(map.total_residual);
+            }),function(memo, num){
+                return memo + num;
+            },0);
+            if (rows.length > 0){
+                rows.push({
+                    number: "Total",
+                    amount_total: accounting.formatNumber((amount),2,".",","),
+                    residual: accounting.formatNumber((total_residual),2,".",","),
+
+                });
+            }
+
+            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'},
+                    origin : {columnWidth: '8px'},
+                    partner : {columnWidth: '8px'},
+                    date_invoice : {columnWidth: '8px'},
+                    amount_total : {halign:'right',columnWidth: '8px'},
+                    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 Punto 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 Punto de Venta.pdf')
+        },
+    });
+}

+ 4 - 4
static/src/js/reports/report_vouchers.js

@@ -397,10 +397,10 @@ function report_vouchers (reporting){
             pdfDoc.autoTable(getColumns, rows, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
-                    reference : {columnWidth: '8px'},
-                    number : {columnWidth: '8px'},
-                    journal_id : {columnWidth: '8px'},
-                    date_voucher : {columnWidth: '8px'},
+                    reference : {columnWidth: '10px'},
+                    number : {columnWidth: '7px'},
+                    journal_id : {columnWidth: '6px'},
+                    date_voucher : {columnWidth: '6px'},
                     partner : {columnWidth: '8px'},
                     amount_in : {halign:'right',columnWidth: '8px'},
                     amount_out: {halign:'right',columnWidth: '8px'}

+ 1 - 1
static/src/js/reports/report_works.js

@@ -1,4 +1,4 @@
-function report_works (reporting){
+function report_works(reporting){
     "use strict";
 
     var instance = openerp;

+ 11 - 13
static/src/reports/report_balance.xml

@@ -4,7 +4,6 @@
         <div class="report_view">
             <div class="reporting_page_header">
                 <h1>Balance de Sumas y Saldos</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>
@@ -18,12 +17,12 @@
                                 <div class="panel-body">
                                     <ul>
                                         <li>
-                                            <input type="radio" name="valores" id="X" value="X" checked="checked"/> 
-                                            <label for="X">Sin Filtro</label>  
+                                            <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>  
+                                            <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"/>
@@ -46,30 +45,29 @@
                                         <label for="from">Desde: </label>
                                         <input type="text"  id="from" name="from"/>
                                         <label for="to" >Hasta: </label>
-                                        <input type="text"  id="to" name="to" />    
+                                        <input type="text"  id="to" name="to" />
                                     </div>
-                                    
+
                                 </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">
                                     <label for="customer"> Buscar cliente / proveedor:  </label>
-                                    <input id="customer" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/> 
+                                    <input id="customer" 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 btn-block" value="pdf">PDF</button> 
+                <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"

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

@@ -8,7 +8,7 @@
             </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">  
+            <div class="collapse" id="collapseExample">
                 <br/>
                 <div class="row">
                     <div class="col-xs-6">
@@ -17,12 +17,12 @@
                             <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>  
+                                        <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>  
+                                        <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"/>
@@ -45,11 +45,11 @@
                                     <label for="from">Desde: </label>
                                     <input type="text"  id="from" name="from"/>
                                     <label for="to" >Hasta: </label>
-                                    <input type="text"  id="to" name="to" />    
+                                    <input type="text"  id="to" name="to" />
                                 </div>
-                                
+
                             </div>
-                        </div> 
+                        </div>
                     </div>
                     <div class="col-xs-6">
                         <div class="panel panel-default">
@@ -59,12 +59,12 @@
                                     <h3>Tipo</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="cateritica" id="Y" value="Y" checked="checked"/>
+                                            <label for="Y">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="cateritica" id="sale" value="sale"/>
+                                            <label for="sale">Factura de venta</label>
                                         </li>
                                         <li>
                                             <input type="radio" name="cateritica" id="purchase" value="purchase"/>
@@ -80,12 +80,12 @@
                                     <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>  
+                                            <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>  
+                                            <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"/>
@@ -93,14 +93,14 @@
                                         </li>
                                     </ul>
                                 </div>
-                                <div class="col-xs-12"> 
+                                <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>

+ 97 - 0
static/src/reports/report_mrp.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportMrp">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1>Histórico de Producción</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">Por Producto</div>
+                            <div class="panel-body">
+
+                                <div class="form-group">
+                                    <label for="product">Buscar Producto:</label>
+                                    <input id="product" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI"/>
+                                </div>
+                            </div>
+                        </div>
+                    </div> -->
+                </div>
+            </div>
+            <div id="toolbar">
+                <button class="oe_button oe_form_button oe_highlight" value="pdf" id="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="name" data-sortable="true">Orden</th>
+                        <th data-field="product">Producto</th>
+                        <th data-field="date" data-sortable="true">Fecha Solicitado</th>
+                        <th data-field="product_qty" data-sortable="true" data-align="right">Cant. a Producir</th>
+                        <th data-field="qty_produced" data-sortable="true" data-align="right">Cant. Producido</th>
+                        <th data-field="date_planned" data-sortable="true">Fecha Planeado</th>
+                        <th data-field="state">Estado</th>
+                    </tr>
+                </thead>
+            </table>
+            <canvas></canvas>
+            <div id="dialog"></div>
+        </div>
+    </t>
+</template>

+ 95 - 0
static/src/reports/report_pos.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportPos">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1>Histórico de Ventas Pos</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">
+                <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>
+
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="panel panel-default">
+                                <div class="panel-heading">Características</div>
+                                <div class="panel-body">
+                                    <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>
+                        </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="origin" data-sortable="true">Ref. Venta</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>

+ 0 - 1
static/src/reports/report_works.xml

@@ -4,7 +4,6 @@
         <div class="report_view">
             <div class="reporting_page_header">
                 <h1>Trabajos Realizados</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

+ 0 - 1
static/src/reports/reporting_accountpending.xml

@@ -4,7 +4,6 @@
         <div class="report_view">
             <div class="reporting_page_header">
                 <h1>Listado de cuentas a cobrar no vencidas</h1>
-                <button onclick="window.history.back()">Atrás</button>
             </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>

+ 12 - 13
templates.xml

@@ -20,12 +20,9 @@
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_vouchers.js" />
                 <!-- Historico de facturas -->
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_invoice_balance.js" />
-                <!-- Historico de ventas -->
-                <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_sales.js" /> -->
-                <!-- Historico de compras -->
-                <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_puchases.js" /> -->
-                <!-- Historico de gastos -->
-                <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_expenses.js" /> -->
+                <!-- Historico de punto de ventas -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_pos.js"/>
+
                 <!-- Analisis de ventas -->
                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_sales_invoice_analysis.js" />
                 <!-- Analisis de compras -->
@@ -40,13 +37,15 @@
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_mensajecrm.js"/>
                  <!-- project -->
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_project.js"/>
-                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_balance.js" />
-                 <!-- account -->
-                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/reporting_account.js"/>
-                 <!-- accountpending -->
-                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/reporting_accountpending.js"/>
-                 <!-- work -->
-                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_works.js" />
+                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_balance.js"/>
+                <!-- account -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/reporting_account.js"/>
+                <!-- accountpending -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/reporting_accountpending.js"/>
+                <!-- work -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_works.js"/>
+                <!-- mrp -->
+                <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_mrp.js"/>
                 <!-- Analisis de gastos -->
                 <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_expenses_invoice _analysis.js" /> -->
                 <!-- Utilidad de facturas detalladas -->