Selaa lähdekoodia

FIX ADD Agregado en report nomina

Sebas 6 vuotta sitten
vanhempi
commit
a2c6adffa0

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

@@ -29,6 +29,7 @@ openerp.eiru_reporting = function (instance) {
         reporting_accountpending(reporting);
         report_works(reporting);
         report_pos(reporting);
+        report_rrhh(reporting);
         report_mrp(reporting);
 	    report_ranking_pos_orders_customer(reporting);
         report_ranking_sales_orders_customer(reporting);
@@ -153,4 +154,7 @@ openerp.eiru_reporting = function (instance) {
     // Listado de produccion de pack utilidad
     instance.web.client_actions.add('eiru_reporting.mrp_utilidad_action_report', 'instance.eiru_reporting.ReportProductPackUtilidadWidget');
 
+    // ******************************************* RRHH *************************************************************************
+    // Analisis de RRHH
+    instance.web.client_actions.add('eiru_reporting.rrhh_action_report', 'instance.eiru_reporting.ReportRrhhWidget');
 }

+ 42 - 69
static/src/js/reports/report_purchases_invoice_analysis.js

@@ -10,6 +10,7 @@ function report_purchases_invoice_analysis (reporting){
         productProduct:[],
         Currency:[],
         rowsData :[],
+        content :[],
         rowOrigin:[],
         accountJournal:[],
         resCompany:[],
@@ -34,7 +35,7 @@ function report_purchases_invoice_analysis (reporting){
         },
         start: function () {
             var table = this.$el.find('#table');
-            table.bootstrapTable({data : self.rowOrigin});
+            table.bootstrapTable({data : self.rowsData});
             this.fecthFecha();
             this.submitForm();
         },
@@ -315,74 +316,52 @@ function report_purchases_invoice_analysis (reporting){
                 }
             });
 
-            self.rowsData=data;
-            self.rowOrigin=data;
-            self.loadTable(data)
+            self.content = data;
+            this.loadTable(data);
         },
         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 partner = this.$el.find('#partner').val().split('-');
             var product = this.$el.find('#product').val().split('-');
             var store =this.$el.find('#current-store').val();
             var desde =this.$el.find('#from').val();
             var hasta =this.$el.find('#to').val();
-            self.rowsData=self.rowOrigin;
+            var content = self.content;
 
             if ($('#A').is(":checked")){
-                self.rowsData = _.filter(self.rowsData, function (inv){
-                    return inv.date_invoice == hoy;
+                content = _.filter(content, function (inv){
+                    return moment(inv.date_invoice).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;
-                self.rowsData = _.filter(self.rowsData, function (inv){
-                    return inv.date_invoice == date[0]+'-'+date[1]+'-'+date[2];
+                content = _.filter(content, function (inv){
+                    return moment(inv.date_invoice).format('YYYY-MM-DD') == yesterday;
                 });
             }
             if ($('#C').is(":checked")){
-                var date = hoy.split('-');
-                self.rowsData = _.filter(self.rowsData, function (inv){
-                    var mes = inv.date_invoice.split('-');
-                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                content = _.filter(content, function (inv){
+                    return moment(inv.date_invoice).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;
-                    }
-                }
-                self.rowsData = _.filter(self.rowsData, function (inv){
-                    var mes = inv.date_invoice.split('-');
-                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
-                });
+                content = _.filter(content, function (inv){
+                    return moment(inv.date_invoice).format('YYYY-MM') == last_month;                });
             }
             if ($('#Z').is(":checked")){
                 $('#datepicker').css('display','block');
                 if (desde.length > 0){
                     var date= desde.split('/');
-                    self.rowsData = _.filter(self.rowsData, function (inv){
+                    content = _.filter(content, function (inv){
                         return inv.date_invoice >= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
                 if (hasta.length > 0){
                     var date= hasta.split('/');
-                    self.rowsData = _.filter(self.rowsData, function (inv){
+                    content = _.filter(content, function (inv){
                         return inv.date_invoice <= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
@@ -391,47 +370,47 @@ function report_purchases_invoice_analysis (reporting){
             }
 
             if ($('#purchase').is(":checked")){
-                self.rowsData = _.filter(self.rowsData, function (inv){
+                content = _.filter(content, function (inv){
                     return inv.invoice_type == 'purchase';
                 });
             }
             if ($('#expense').is(":checked")){
-                self.rowsData = _.filter(self.rowsData, function (inv){
+                content = _.filter(content, function (inv){
                     return inv.invoice_type == 'expense';
                 });
             }
 
             if (partner != ""){
-                self.rowsData = _.filter(self.rowsData, function(inv){
+                content = _.filter(content, function(inv){
                     return inv.partner_id == partner[0];
                 });
             }
 
             if (product != ""){
-                self.rowsData = _.filter(self.rowsData, function(inv){
+                content = _.filter(content, function(inv){
 
                     return inv.id_product == product[0];
                 });
             }
 
             if (store != 9999999){
-                self.rowsData =_.filter(self.rowsData, function (inv){
+                content =_.filter(content, function (inv){
                     return inv.store_id == store;
                 });
             }
 
-            var amount_total_total = _.reduce(_.map(self.rowsData,function(map){
+            var amount_total_total = _.reduce(_.map(content,function(map){
                 return(map.amount);
             }),function(memo, num){
                 return memo + num;
             },0);
 
-            self.rowsData.push({
+            content.push({
                 number: "Totales:",
                 standar_tot: accounting.formatNumber((amount_total_total),2,".",","),
             });
 
-            self.loadTable(self.rowsData);
+            self.loadTable(content);
         },
         search: function () {
             var self = this;
@@ -484,19 +463,31 @@ function report_purchases_invoice_analysis (reporting){
             });
         },
         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 action = this.$el.find(e.target).val();
             var self = this;
+            var rowsNew;
             var getColumns=[];
+            var action = this.$el.find(e.target).val();
             var rows=[];
+            rowsNew = self.getObjetPdf();
             var table = this.$el.find("#table");
             var data2 = table.bootstrapTable('getVisibleColumns');
             if (action === 'pdf') {
                 var dataNEW = _.map(data2, function (val){ return val.field});
-                _.each(this.rowsData,function (item){
+                _.each(rowsNew,function (item){
                     rows.push(_.pick(item, dataNEW));
                 });
                 _.each(_.map(data2,function(val){
@@ -522,25 +513,7 @@ function report_purchases_invoice_analysis (reporting){
 
             var pdfDoc = new jsPDF();
 
-            // var quantity=_.reduce(_.map(rows,function(item){
-            //     var valor=0;
-            //     if (item.quantity){valor = parseFloat(((item.quantity.replace(".","")).replace(",",".")))}return valor}), function(memo, num){ return memo + num; },0);
-            // var price_unity=_.reduce(_.map(rows,function(item){
-            //     var valor =0;
-            //     if (item.price_unity){valor=parseFloat(((item.price_unity.replace(".","")).replace(",",".")))} return valor}), function(memo, num){ return memo + num; },0);
-            // var standar_tot=_.reduce(_.map(rows,function(item){
-            //     var valor=0;
-            //     if (item.standar_tot){valor=parseFloat(((item.standar_tot.replace(".","")).replace(",",".")))} return valor }), function(memo, num){ return memo + num; },0);
-
-            // rowsPdf=rows;
-            //
-            // rowsPdf.push({
-            //     number : "TOTAL "+ company,
-            //     quantity: accounting.formatNumber(quantity,0, ".", ","),
-            //     standar_tot : accounting.formatNumber(standar_tot,2, ".", ","),
-            // });
-
-            pdfDoc.autoTable(getColumns, rowsPdf, {
+            pdfDoc.autoTable(getColumns, rows, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
                     number: {fontStyle: 'bold'},

+ 524 - 0
static/src/js/reports/report_rrhh.js

@@ -0,0 +1,524 @@
+function report_rrhh(reporting){
+    "use strict";
+
+    var instance = openerp;
+
+    reporting.ReportRrhhWidget = reporting.Base.extend({
+        template:'ReportRrhh',
+        resInvoice:[],
+        resPersonal:[],
+        personal:[],
+        pagare:[],
+        invoiceLines:[],
+        content:[],
+        rowsData :[],
+        modules:[],
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #X' : 'factSearch',
+            'click #A' : 'factSearch',
+            'click #B' : 'factSearch',
+            'click #C' : 'factSearch',
+            'click #D' : 'factSearch',
+            'click #opportunity' : 'factSearch',
+            'click #lead' : 'factSearch',
+            'click #Z' : 'factSearch',
+
+            'click #Y' : 'factSearch',
+            'click #customer' : '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
+        },
+
+        clickAnalysisDetail: function(e, row, $element, field){
+            if (field == 'number'){
+                this.do_action({
+                    name:"Nómina",
+                    type: 'ir.actions.act_window',
+                    res_model: "hr.payslip",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.id,
+                });
+            }
+            if (field === 'personal'){
+                this.do_action({
+                    name:"Registro",
+                    type: 'ir.actions.act_window',
+                    res_model: "hr.employee",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.employee_id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.employee_id,
+                });
+            }
+
+             e.stopImmediatePropagation();
+        },
+
+        submitForm: function () {
+            var self = this;
+            self.fecthIrModuleModule().then(function(modules){
+                self.modules = modules;
+                return modules;
+            }).then(function(modules){
+                return self.fecthInvoice();
+            }).then(function(invoice){
+               self.resInvoice = invoice;
+               return self.fetchInvoiceLine();
+            }).then(function(invoiceLine){
+               self.invoiceLines = invoiceLine;
+               return self.fetchPersonal();
+            }).then(function(personal){
+               self.resPersonal = personal;
+                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;
+            }
+        },
+
+        // Consultar Pagos
+        fecthInvoice: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var modules = self.checkModel('hr');
+            //
+            if (modules.length <= 0){
+                self.showMensaje('hr');
+                return defer;
+            }
+            var fields =['id', 'name', 'number', 'employee_id', 'line_ids', 'create_date', 'date_from','date_to','state'];
+            // var domain=[['id', '=', id]];
+            var Invoice = new instance.web.Model('hr.payslip');
+            Invoice.query(fields).filter().order_by('id').all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+        // Invoice line (Linea de Factura)
+        fetchInvoiceLine: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var id = _.flatten(_.map(self.resInvoice,function(map){
+                return map.id;
+            }));
+            var domain=[['slip_id','in', id],['salary_rule_id', '=', 2]];
+            var InvoiceLine = new instance.web.Model('hr.payslip.line');
+            InvoiceLine.query(['id', 'name', 'slip_id', 'total']).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // Consultar Personal
+        fetchPersonal: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var fields=['id','name_related','address_home_id','identification_id','job_id', 'address_id'];
+            // var domain=[['id','=', employee_id]];
+            var Personal = new instance.web.Model('hr.employee');
+
+            Personal.query(fields).filter().order_by('id').all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        // getPartner: function(id){
+        //     var self = this;
+        //     return _.filter(self.resPersonal,function(item){
+        //         return item.id == id;
+        //     });
+        // },
+
+        getPartner: function(employee_id){
+            var self = this;
+            return _.filter(self.resPersonal,function(item){
+                return item.id === employee_id;
+            }).shift();
+        },
+
+        // Verificar si los Valores no son nulos
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                valor=dato;
+            }
+            return valor;
+        },
+
+        getPaySlip: function(slip_id){
+            var self = this;
+            return _.find(this.resInvoice,function (inv) {
+                return _.contains(inv.line_ids, slip_id);
+            });
+        },
+
+        search: function () {
+            var self = this;
+            var results = self.resPersonal;
+            results = _.map(results, function (item) {
+                return {
+                        label: item.id + '-'+ item.name_related,
+                        value: item.id + '-'+ item.name_related
+                }
+            });
+            self.$('#personal').autocomplete({
+                source: results,
+                minLength:0,
+                search: function(event, ui) {
+                    if (!(self.$('#personal').val())){
+                        self.factSearch();
+                    }
+                },
+                close: function( event, ui ) {
+                        self.factSearch();
+                },
+                select: function(event, ui) {
+                    self.factSearch();
+                }
+            });
+        },
+
+        BuildTable: function(){
+            var self = this;
+            var data=[];
+            var getColumns=[];
+            var employee;
+            var item;
+            var state;
+            var invoice;
+
+            for (var i = 0; i < this.invoiceLines.length; i++) {
+                item = this.invoiceLines[i];
+                invoice = this.getPaySlip(item.id);
+                if(invoice.state=='done'){
+                    state = 'Realizado'
+                }else{
+                    state = 'Pagado'
+                }
+                employee = self.getPartner(invoice.employee_id[0]);
+
+                if (!employee){
+                    employee={};
+                    employee.identification_id="";
+                }
+
+                data.push({
+                    id : invoice.id,
+                    number : self.valorNull(invoice.number),
+                    name : self.valorNull(invoice.name),
+                    date: moment(invoice.create_date).format("YYYY-MM-DD"),
+                    reference : invoice.name,
+                    date_from : moment(invoice.date_from).format("DD[/]MM[/]YYYY"),
+                    date_to : moment(invoice.date_to).format("DD[/]MM[/]YYYY"),
+                    employee_id : self.valorNull(invoice.employee_id[0]),
+                    employee_name : self.valorNull(invoice.employee_id[1]),
+                    amount : accounting.formatNumber(self.valorNull(item.total),0, ".", ","),
+                    amount_total: self.valorNull(item.total),
+                    identification : self.valorNull(employee.identification_id),
+                    state : state
+                    // job_id : self.valorNull(employee.job_id[1])
+                });
+            }
+            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 desde = this.$el.find('#from').val();
+            var hasta = this.$el.find('#to').val();
+            var personal= this.$el.find('#personal').val().split('-');
+            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 ($('#lead').is(":checked")){
+            //     content = _.filter(content, function (inv){
+            //         return inv.crm_type == 'lead';
+            //     });
+            // }
+            // if ($('#opportunity').is(":checked")){
+            //     content = _.filter(content, function (inv){
+            //         return inv.crm_type == 'opportunity';
+            //     });
+            // }
+
+             if (personal != ""){
+                 content = _.filter(content, function(inv){
+                     return inv.employee_id == personal[0];
+                 });
+             }
+
+             var amount_total_total = _.reduce(_.map(content,function(map){
+                 return(map.amount_total);
+             }),function(memo, num){
+                 return memo + num;
+             },0);
+
+             content.push({
+                 name: "Total:",
+                 amount: 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 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('l');
+
+            pdfDoc.autoTable(getColumns, rows, {
+                styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
+                columnStyles: {
+                  number : {columnWidth: '5px'},
+                  identification : {columnWidth: '8px'},
+                  employee_name : {columnWidth: '7px'},
+                  reference : {columnWidth: '8px'},
+                  date_from : {columnWidth: '10px'},
+                  date_to: {columnWidth: '10px'},
+                  amount : {columnWidth: '10px'},
+                  state : {columnWidth: '11px'}
+                },
+                margin: { top: 16, horizontal: 7},
+
+                addPageContent: function (data) {
+                    pdfDoc.setFontSize(12);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(40);
+                    pdfDoc.text('Histórico de pago al personal', data.settings.margin.left, 10);
+
+
+                    pdfDoc.setFontSize(9);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(40)
+
+                    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 pagos al personal.pdf')
+        },
+    });
+}

+ 7 - 7
static/src/js/reports/report_sales_invoice_analysis.js

@@ -597,14 +597,14 @@ function report_sales_invoice_analysis (reporting){
             pdfDoc.autoTable(getColumns, rows, {
                 styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
                 columnStyles: {
-                              number: {fontStyle: 'bold',columnWidth: '9px'},
-                              date_create :{columnWidth: '14px'},
-                              name :{columnWidth: '10px'},
-                              quantity :{halign:'right',columnWidth: '8px'},
-                              price_unity : {halign:'right',columnWidth: '8px'},
+                              number: {columnWidth: '13px'},
+                              date_create :{columnWidth: '13px'},
+                              name :{columnWidth: '8px'},
+                              quantity :{halign:'right',columnWidth: '5px'},
+                              price_unity : {halign:'right',columnWidth: '16px'},
                               standar_price : {halign:'right',columnWidth: '8px'},
-                              price_tot : {halign:'right' ,columnWidth: '9px'},
-                              standar_tot : {halign:'right' ,columnWidth: '9px'},
+                              price_tot : {halign:'right' ,columnWidth: '16px'},
+                              standar_tot : {halign:'right' ,columnWidth: '11px'},
                               utility : {halign:'right',columnWidth: '9px'},
                           },
                 margin: { top: 16, horizontal: 7},

+ 114 - 0
static/src/reports/report_rrhh.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportRrhh">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1>Histórico de Pagos al Personal</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">
+                                <h3>Tipo</h3>
+                                <!-- <ul class="list-unstyled">
+                                    <li>
+                                        <input type="radio" name="tipo" id="Y" value="Y" checked="checked"/>
+                                        <label for="Y">Sin Filtro</label>
+                                        <li>
+                                            <input type="radio" name="tipo" id="lead" value="lead"/>
+                                            <label for="lead">Iniciativa</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="tipo" id="opportunity" value="opportunity"/>
+                                            <label for="opportunity">Oportunidad</label>
+                                        </li>
+                                    </li>
+
+                                </ul> -->
+
+                                <div class="form-group">
+                                    <label for="personal">Buscar Personal:</label>
+                                    <input id="personal" 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="number" data-sortable="true">Asunto</th>
+                        <th data-field="identification">C.I.N°</th>
+                        <th data-field="employee_name">Personal</th>
+                        <th data-field="reference" data-sortable="true">Descripcion</th>
+                        <th data-field="date_from">Desde</th>
+                        <th data-field="date_to">Hasta</th>
+                        <th data-field="amount">Monto</th>
+                        <th data-field="state">Estado</th>
+                    </tr>
+                </thead>
+            </table>
+            <canvas></canvas>
+            <div id="dialog"></div>
+        </div>
+    </t>
+    </template>

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

@@ -92,7 +92,7 @@
                 <th data-field="date_create" data-sortable="true">Fecha</th>
                 <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="quantity" data-sortable="true" data-align="right">Cant.</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>

+ 2 - 0
templates.xml

@@ -88,6 +88,8 @@
                  <!-- <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_invoice_utility.js" /> -->
                  <!-- Listado de utilidad por producto -->
                  <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_utilidad_producto.js" />
+                 <!-- Listado de rrhh por producto -->
+                 <script type="text/javascript" src="/eiru_reporting/static/src/js/reports/report_rrhh.js" />
             </xpath>
         </template>
 

+ 7 - 0
views/actions.xml

@@ -230,5 +230,12 @@
 			<field name="tag">eiru_reporting.mrp_utilidad_action_report</field>
 		</record>
 
+		    <!-- *************************** RRHH *************************** -->
+
+			<record id="rrhh_report_action" model="ir.actions.client">
+				<field name="name">Analisis de pagos al Personal</field>
+				<field name="tag">eiru_reporting.rrhh_action_report</field>
+			</record>
+
     </data>
 </openerp>

+ 6 - 0
views/menus.xml

@@ -137,5 +137,11 @@
             <!-- Historico de mensajes -->
             <menuitem id="crm_messages_report_menu_submenu" parent="crm_report_parent_menu" name="Historico de mensajes" action="crm_messages_report_action" />
 
+        <!-- Noveno Submenu -->
+        <menuitem id="rrhh_report_parent_menu" name="Recursos Humanos" parent="eiru_report_main_menu" sequence="8"/>
+
+                <!-- RRHH -->
+                <menuitem id="rrhh_report_menu_submenu" parent="rrhh_report_parent_menu" name="Historico RRHH" action="rrhh_report_action" />
+
     </data>
 </openerp>