Explorar el Código

Informe de resumen de venta y cuenta

root hace 3 años
padre
commit
aaaca5c180

BIN
__init__.pyc


BIN
controllers.pyc


+ 4 - 0
models.py

@@ -38,6 +38,9 @@ class AccountInvoice(models.Model):
 				'partner_id': [
 					invoice.partner_id.id,
 					invoice.partner_id.name,
+					invoice.partner_id.ruc,
+					invoice.partner_id.email,
+					invoice.partner_id.mobile,
 				],
 				'supplier_invoice_number': invoice.supplier_invoice_number,
 				'user_id': [
@@ -92,6 +95,7 @@ class AccountInvoiceLine(models.Model):
 					'product_brand_id' : line.product_id.product_brand_id.name,
 					'ean13' : line.product_id.ean13,
 					'categ_id' : line.product_id.categ_id.name,
+					'qty_available' : line.product_id.qty_available,
 				},
 				'quantity' : line.quantity,
 				'price_unit' : line.price_unit,

BIN
models.pyc


+ 3 - 3
static/src/js/reports/report_cuenta_resumen_dna.js

@@ -491,9 +491,9 @@ function report_cuenta_resumen_dna(reporting){
                   date_invoice: moment(item2.date_invoice).format('DD/MM/YYYY'),
                   partner_id : item2.partner_id[0],
                   partner_name : item2.partner_id[1],
-                  ruc: self.valorNull(partner[0].ruc),
-                  partner_email: self.valorNull(partner[0].email),
-                  partner_mobile: self.valorNull(partner[0].mobile),
+                  ruc: self.valorNull(item2.partner_id[2]),
+                  partner_email: self.valorNull(item2.partner_id[3]),
+                  partner_mobile: self.valorNull(item2.partner_id[4]),
                   invoice_name : item2.number,
                   supplier_invoice_number: self.valorNull(item2.supplier_invoice_number),
                   date_due:  moment(item2.date_due).format('DD/MM/YYYY'),

+ 5 - 5
static/src/js/reports/report_sale_resumen_dna.js

@@ -557,6 +557,7 @@ function report_sale_resumen_dna(reporting){
         ====================================================================*/
         BuildTable: function(){
           var self = this;
+
           var data = [];
           var company = $('#current-company').val();
 
@@ -577,7 +578,6 @@ function report_sale_resumen_dna(reporting){
 
             var AccountInvoice = self.getAccountInvoice(item.id);
             _.each(AccountInvoice,function(item2) {
-
               var total_sale = 0;
               var partner= self.getResPartner(item2.partner_id[0]);
               var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
@@ -610,11 +610,11 @@ function report_sale_resumen_dna(reporting){
 
                   //DATAS
                   product_brand_id : self.valorNull(line_item.product_id.product_brand_id),
-                  date_invoice: moment(item2.date_invoice).format('YYYY-MM-DD'),
+                  date_invoice: moment(item2.date_invoice).format('DD/MM/YYYY'),
                   partner_id : item2.partner_id[0],
-                  ruc: partner[0].ruc,
-                  partner_email: partner[0].email,
-                  partner_mobile: partner[0].mobile,
+                  ruc: self.valorNull(item2.partner_id[2]),
+                  partner_email: self.valorNull(item2.partner_id[3]),
+                  partner_mobile: self.valorNull(item2.partner_id[4]),
                   invoice_name : item2.number,
                   supplier_invoice_number: item2.supplier_invoice_number,
                   product_code : self.valorNull(line_item.product_id.default_code),

+ 843 - 0
static/src/js/reports/report_stock_resumen_dna.js

@@ -0,0 +1,843 @@
+// return self.fetchProductBrand();
+// }).then(function(ProductBrand){
+// self.ProductBrand = ProductBrand;
+
+function report_stock_resumen_dna(reporting){
+    "use strict";
+
+    var model = openerp;
+
+    reporting.ReportStockResumenDnaWidget = reporting.Base.extend({
+        template: 'ReportStockResumenDna',
+        rowsData :[],
+        content :[],
+        modules: ['product_brand'],
+
+        events:{
+            'click #toolbar > button' : 'clickOnAction',
+            'click #generate' : 'fetchGenerate',
+            'click-row.bs.table #table' : 'clickAnalysisDetail',
+            'change #current-company' : 'updateSelections',
+            'change #current-store' : 'updateJournalSelections',
+            'change #current-date' : 'ShowDateRange',
+            'change #current-period': 'updatePeriodSelections',
+        },
+
+        init : function(parent){
+            this._super(parent);
+        },
+
+        start: function () {
+            var table = this.$el.find('#table');
+            table.bootstrapTable({data : self.rowsData});
+            var date = new model.eiru_reports.ReportDatePickerWidget(self);
+            date.fecthFecha();
+            this.fetchInitial();
+        },
+
+        valorNull:function(dato){
+            var valor = "";
+            if (dato){
+                valor = dato;
+            }
+            return valor;
+        },
+
+
+        checkModule : function(model){
+            var self = this;
+            return _.filter(self.IrModuleModule,function(item){
+                return item.name === model;
+            });
+        },
+
+        ShowDateRange : function(){
+            var self = this;
+            var date = self.$el.find('#current-date').val();
+            if(date == 'range'){
+                self.$el.find('.datepicker').css('display','block');
+            }
+            if(date != 'range'){
+                self.$el.find('.datepicker').css('display','none');
+            }
+
+        },
+
+        clickAnalysisDetail: function(e, row, $element,field){
+            if (field == 'product_name'){
+                this.do_action({
+                    name:"Producto",
+                    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,
+                });
+            }
+
+            if (field == 'invoice_name'){
+                this.do_action({
+                    name:"Factura",
+                    type: 'ir.actions.act_window',
+                    res_model: "account.invoice",
+                    views: [[false,'form']],
+                    target: 'new',
+                    domain: [['id','=', row.invoice_id]],
+                    context: {},
+                    flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
+                    res_id: row.invoice_id,
+                });
+            }
+            e.stopImmediatePropagation();
+        },
+
+        fetchInitial: function () {
+            var self = this;
+            self.fetchResCompany().then(function (ResCompany) {
+                return ResCompany;
+            }).then(function(ResCompany){
+                self.ResCompany = ResCompany;
+                if(ResCompany.length > 1){
+                    self.$el.find('#current-company').append('<option value="9999999">Todas las empresas</option>');
+                    _.each(ResCompany,function(item){
+                        self.$el.find('#current-company').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.company').css('display','none');
+                }
+                return self.fetchResStore();
+            }).then(function(ResStore){
+                self.ResStore = ResStore;
+                if(ResStore.length > 1){
+                    self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
+                    _.each(ResStore,function(item){
+                        self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.store').css('display','none');
+                }
+                return self.fetchAccountJournal();
+            }).then(function(AccountJournal){
+                self.AccountJournal = AccountJournal;
+                if(AccountJournal.length > 0){
+                    self.$el.find('#current-journal').append('<option value="9999999">Todos los vendedores</option>');
+                    _.each(AccountJournal,function(item){
+                        self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    });
+                }else{
+                    self.$el.find('.journal').css('display','none');
+                }
+                return self.fetchAccountPeriod();
+            }).then(function(AccountPeriod){
+                self.AccountPeriod = AccountPeriod;
+                self.$el.find('#current-period').append('<option value="9999999">Todos los periodos</option>');
+                _.each(AccountPeriod,function(item){
+                    self.$el.find('#current-period').append('<option value="' +  item.id + '">' + item.name + '</option>');
+                });
+                return self.fetchResPartner();
+          }).then(function(ResPartner){
+                self.ResPartner = ResPartner;
+
+                return self.fetchProductCategory();
+          }).then(function(ProductCategory){
+              self.ProductCategory = ProductCategory;
+              if(ProductCategory.length > 1){
+                  self.$el.find('#current-category').append('<option value="9999999">Todas las categorias</option>');
+                  _.each(ProductCategory,function(item){
+                      self.$el.find('#current-category').append('<option value="' + item.id + '">' + item.name + '</option>');
+                  });
+              }else{
+                  self.$el.find('.category').css('display','none');
+              }
+                return self.fetchResCurrency();
+            }).then(function(ResCurrency){
+                self.ResCurrency = ResCurrency;
+            });
+            self.$el.find('#generate').css('display','inline');
+            return;
+        },
+
+        fetchGenerate: function () {
+            var self = this;
+            self.$el.find('.search-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.report-form').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+
+            this.fetchAccountInvoice().then(function(AccountInvoice) {
+                return AccountInvoice;
+            }).then(function (AccountInvoice){
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchAccountInvoiceLine();
+            }).then(function (AccountInvoiceLine){
+                self.AccountInvoiceLine = AccountInvoiceLine;
+                return self.BuildTable();
+            });
+        },
+
+
+
+        /*====================================================================
+            RES COMPANY
+        ====================================================================*/
+        fetchResCompany: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var currency = new model.web.Model('res.company');
+            var field=['id','name','currency_id','logo'];
+            currency.query(field).filter().all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            RES STORE
+        ====================================================================*/
+        fetchResStore: function(){
+            var self = this;
+            var defer = $.Deferred();
+            var field = ['id','name','company_id'];
+            var ResStore = new model.web.Model('res.store');
+            ResStore.query(field).all().then(function(results){
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+
+        fetchResPartner: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var ResPartner = new model.web.Model('res.partner');
+            ResPartner.query(['id', 'name', 'ruc', 'mobile', 'email']).filter([['active', '=', true], ['customer', '=', true]]).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            ACCOUNT JOURNAL
+        ====================================================================*/
+        fetchAccountJournal: function(){
+            var self = this;
+            var domain = [['active','=',true],['type','in',['sale','sale_refund']]];
+            var AccountJournal = new model.web.Model('account.journal');
+            return AccountJournal.call('getAccountJournal',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        /*=====================================================================
+            ACCOUNT PERIOD
+        =====================================================================*/
+        fetchAccountPeriod: function () {
+            var self = this;
+            var defer = $.Deferred();
+            var domain = [['special','=',false]];
+            var field =['id', 'name', 'date_start','date_stop','company_id'];
+            var AccountPeriod = new model.web.Model('account.period');
+            AccountPeriod.query(field).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+        PRODUCT CATEGORY
+    ====================================================================*/
+    fetchProductCategory: function () {
+        var self = this;
+        var domain = [];
+        var ProductCategory = new model.web.Model('product.category');
+        return ProductCategory.call('getProductCategory',[domain], {
+            context: new model.web.CompoundContext()
+        });
+    },
+
+    /*====================================================================
+    PRODUCT CATEGORY
+    ====================================================================*/
+    // fetchProductBrand: function () {
+    //     var self = this;
+    //     var domain = [];
+    //     var ProductBrand = new model.web.Model('product.brand');
+    //     return ProductBrand.call('getProductBrand',[domain], {
+    //         context: new model.web.CompoundContext()
+    //     });
+    // },
+
+
+        /*====================================================================
+            RES CURRENCY
+        ====================================================================*/
+        fetchResCurrency : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrency = new model.web.Model('res.currency');
+            ResCurrency.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        /*====================================================================
+            ACCOUNT INVOICE
+        ====================================================================*/
+        fetchAccountInvoice: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            var period = self.$el.find('#current-period').val();
+            var company = self.$el.find('#current-company').val();
+            var journal = self.$el.find('#current-journal').val();
+            var date = self.$el.find('#current-date').val();
+            var desde = self.$el.find('#from').val();
+            var hasta = self.$el.find('#to').val();
+
+            if(store && store != 9999999){
+                var journal_ids = _.map(_.filter(self.AccountJournal,function (item) {
+                    return item.store_ids == store;
+                }), function(map){
+                    return map.id;
+                });
+            }else{
+                var journal_ids = _.flatten(_.map(self.AccountJournal, function (item) {
+                    return item.id;
+                }));
+            }
+
+            var domain = [
+                ['state', 'in',['open','paid']],
+                ['type', 'in', ['out_invoice','out_refund']],
+                ['journal_id','in',journal_ids],
+            ];
+
+            if(journal && journal != 9999999){
+                domain.push(['journal_id','=',parseInt(journal)]);
+            }
+
+            if(company && company != 9999999){
+                domain.push(['company_id','=',parseInt(company)]);
+            }
+
+            if(period && period != 9999999){
+                domain.push(['period_id','=',parseInt(period)]);
+            }
+
+            if(date && date != 9999999){
+
+                if(desde){
+                    var date = desde.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date_invoice','>=',date]);
+                }
+
+                if(hasta){
+                    var date = hasta.split('/')
+                    date = (date[2]+"-"+date[1]+"-"+date[0]);
+                    domain.push(['date_invoice','<=',date]);
+                }
+
+                if(date == 'today'){
+                    var today = moment().format('YYYY-MM-DD');
+                    domain.push(['date_invoice','=',today]);
+                }
+
+                if(date == 'yesterday'){
+                    var yesterday = moment().add(-1,'days').format('YYYY-MM-DD');
+                    domain.push(['date_invoice','=',yesterday]);
+                }
+
+                if(date == 'currentMonth'){
+                    var currentMonth = moment().format('YYYY-MM');
+                    domain.push(['date_invoice','like',currentMonth]);
+                }
+
+                if(date == 'lastMonth'){
+                    var lastMonth = moment().add(-1,'months').format('YYYY-MM');
+                    domain.push(['date_invoice','like',lastMonth]);
+                }
+            }
+
+            var AccountInvoice = new model.web.Model('account.invoice');
+            return AccountInvoice.call('getAccountInvoiceDental',[domain], {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+
+              /*====================================================================
+                  ACCOUNT INVOICE LINE
+              ====================================================================*/
+              fetchAccountInvoiceLine: function () {
+                  var self = this;
+                  var categ_ids = [];
+                  var category = self.$el.find('#current-category').val();
+                  var invoice_ids = _.flatten(_.map(self.AccountInvoice, function (item) {
+                      return item.id;
+                  }));
+                  var domain = [
+                      ['invoice_id','in',invoice_ids],
+                  ];
+
+                  if(category){
+                      var category_ids = _.map(_.filter(self.ProductCategory,function (item) {
+                          return item.id == category;
+                      }), function(map){
+                          return map.id;
+                      });
+
+
+                      categ_ids =  _.map(_.filter(self.ProductCategory,function (item) {
+                          return _.contains(category_ids, item.parent_id[0]) || item.id == category;
+                      }), function(map){
+                          return map.id;
+                      });
+                  };
+
+                  if(category && category != 9999999){
+                      domain.push(['product_id.categ_id','in',categ_ids]);
+                  }
+
+                  var AccountInvoiceLine = new model.web.Model('account.invoice.line');
+                  return AccountInvoiceLine.call('getAccountInvoiceLineDental',[domain], {
+                      context: new model.web.CompoundContext()
+                  });
+              },
+
+
+        /*====================================================================
+            UPDATE SELECTIONS
+        ====================================================================*/
+        updateSelections: function () {
+            var self = this;
+            var company = self.$el.find('#current-company').val();
+            if(company != 9999999){
+                /*===================
+                    STORE SELECTION
+                ===================*/
+                var store = self.$el.find('#current-store').empty();
+                self.$el.find('#current-store').append('<option value="9999999">Todas las sucursellers</option>');
+                _.each(self.ResStore,function(item){
+                    if(parseFloat(company) == item.company_id[0]){
+                        self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+                /*====================
+                    PERIOD SELECTION
+                ====================*/
+                var period = self.$el.find('#current-period').empty();
+                self.$el.find('#current-period').append('<option value="9999999">Todos los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    if(parseFloat(company) == item.company_id[0]){
+                        self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*===================
+                    STORE SELECTION
+                ===================*/
+                var store = self.$el.find('#current-store').empty();
+                self.$el.find('#current-store').append('<option value="9999999">Todas las sucursellers</option>');
+                _.each(self.ResStore,function(item){
+                    self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+                /*====================
+                    PERIOD SELECTION
+                ====================*/
+                var period = self.$el.find('#current-period').empty();
+                self.$el.find('#current-period').append('<option value="9999999">Todas los periodos</option>');
+                _.each(self.AccountPeriod,function(item){
+                    self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        updateJournalSelections: function () {
+            var self = this;
+            var store = self.$el.find('#current-store').val();
+            if(store != 9999999){
+                /*=============================
+                    ACCOUNT JOURNAL SELECTION
+                =============================*/
+                var journal = self.$el.find('#current-journal').empty();
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                _.each(self.AccountJournal,function(item){
+                    if(parseFloat(store) == item.store_ids){
+                        self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                    }
+                });
+            }else{
+                /*=============================
+                    ACCOUNT JOURNAL SELECTION
+                =============================*/
+                var journal = self.$el.find('#current-journal').empty();
+                self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
+                _.each(self.AccountJournal,function(item){
+                    self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
+                });
+            }
+        },
+
+        updatePeriodSelections: function () {
+            var self = this;
+            var period = self.$el.find('#current-period').val();
+            if(period != 9999999){
+                self.$el.find('#current-date').val(9999999);
+                self.$el.find('#current-date').prop('disabled','disabled');
+                self.$el.find('.datepicker').css('display','none');
+            }else{
+                self.$el.find('#current-date').prop('disabled',false);
+            }
+        },
+
+        /*====================================================================
+            GET RES COMPANY
+        ====================================================================*/
+        getResCompany: function (id) {
+            var self = this;
+            return _.filter(self.ResCompany,function (item) {
+                return item.id == id;
+            })
+        },
+
+        getResPartner: function (id) {
+            var self = this;
+            return _.filter(self.ResPartner,function (item) {
+                return item.id === id;
+            });
+        },
+
+        /*====================================================================
+            GET RES CURRENCY BASE
+        ====================================================================*/
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrency,function (item) {
+                return item.id === id;
+            })
+        },
+
+
+        /*====================================================================
+            GET ACCOUNT INVOICE
+        ====================================================================*/
+        getAccountInvoice: function (id) {
+          var self = this;
+          return _.filter(self.AccountInvoice,function (item) {
+            return item.journal_id[0] === id;
+          });
+        },
+
+      /*====================================================================
+           GET ACCOUNT INVOICE LINE
+       ====================================================================*/
+       getAccountInvoiceLine: function (id) {
+         var self = this;
+         return _.filter(self.AccountInvoiceLine, function(item){
+             return item.invoice_id === id;
+         });
+       },
+
+        /*====================================================================
+            BUILD
+        ====================================================================*/
+        BuildTable: function(){
+          var self = this;
+          var data = [];
+          var company = $('#current-company').val();
+
+          if(company && company != 9999999){
+            var ResCompany = self.getResCompany(company).shift();
+            var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+          }else{
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+          };
+
+          var AccountJournal = self.AccountJournal;
+          _.each(AccountJournal,function(item) {
+
+            var total_price = 0;
+            var price_unit = 0;
+
+            var payment_type = '';
+
+            var AccountInvoice = self.getAccountInvoice(item.id);
+            _.each(AccountInvoice,function(item2) {
+
+              var total_sale = 0;
+              var partner= self.getResPartner(item2.partner_id[0]);
+              var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
+              _.each(AccountInvoiceLine, function(line_item){
+
+                if(item2.type == 'out_invoice'){
+                    if(line_item.product_id.standard_price >= 0){
+                            total_sale = (line_item.price_unit);
+                            total_price = total_sale * line_item.quantity;
+                    }else{
+                      price_unit = 0;
+                      total_sale = (line_item.price_unit);
+                      total_price = total_sale * line_item.quantity;
+                    }
+                }
+                if(item2.type == 'out_refund'){
+                    if(line_item.product_id.standard_price >= 0){
+                        total_sale = (line_item.price_unit);
+                        total_price = -(total_sale * line_item.quantity);
+                    }else{
+                      total_sale = (line_item.price_unit);
+                      total_price = -(total_sale * line_item.quantity);
+                    }
+                }
+                data.push({
+                  //IDS
+                  id: line_item.id,
+                  product_id : line_item.product_id.id,
+                  invoice_id : item2.id,
+
+                  //DATAS
+                  product_brand_id : self.valorNull(line_item.product_id.product_brand_id),
+                  date_invoice: moment(item2.date_invoice).format('YYYY-MM-DD'),
+                  partner_id : item2.partner_id[0],
+                  ruc: partner[0].ruc,
+                  partner_email: partner[0].email,
+                  partner_mobile: partner[0].mobile,
+                  invoice_name : item2.number,
+                  supplier_invoice_number: item2.supplier_invoice_number,
+                  product_code : self.valorNull(line_item.product_id.default_code),
+                  barcode : self.valorNull(line_item.product_id.ean13),
+                  product_name : line_item.product_id.name,
+                  item_price : accounting.formatMoney(total_sale,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                  qty : line_item.quantity,
+                  total_price : accounting.formatMoney(total_price,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                  user_id : self.valorNull(item2.user_id[0]),
+                  user_name : item2.user_id[1],
+
+                  //VALORES SIN FORMATEAR
+                  item_price_no_format : total_sale,
+                  total_price_no_format : total_price,
+
+                  //TOTAL FOOTER CONFIGURATION
+                  decimal_places : CurrencyBase.decimal_places,
+                  thousands_separator: CurrencyBase.thousands_separator,
+                  decimal_separator: CurrencyBase.decimal_separator,
+
+                });
+              });
+            });
+          });
+
+          self.content = data;
+          self.loadTable(data);
+
+          self.$el.find('.report-form').css('display','block');
+          self.$el.find('.search-form').unblock();
+          self.$el.find('.report-form').unblock();
+        },
+
+        /*====================================================================
+            LOAD BOOTSTRAP TABLE
+        ====================================================================*/
+        loadTable:function(rowsTable){
+            var self = this;
+            self.rowsData = rowsTable;
+            var table = this.$el.find('#table');
+            table.bootstrapTable('load', rowsTable);
+        },
+
+        /*====================================================================
+            PRINT PDF
+        ====================================================================*/
+        clickOnAction: function (e) {
+            var self = this;
+            var ResCompany;
+            var action = this.$el.find(e.target).val();
+            var company = $('#current-company').val();
+            if(company && company != 9999999){
+                ResCompany = self.getResCompany(company).shift();
+                var CurrencyBase = self.getResCurrency(ResCompany.currency_id[0]).shift();
+            }else{
+                ResCompany = self.ResCompany[0];
+                var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            }
+            var getColumns=[];
+            var rows=[];
+            var table = this.$el.find("#table");
+            var column = table.bootstrapTable('getVisibleColumns');
+            var row = table.bootstrapTable('getData');
+
+            var total_price = totalPriceFormatter(row);
+
+            row.push({
+                date_invoice: 'Totales',
+                total_price: total_price,
+            })
+
+            if (action === 'pdf') {
+                var data = _.map(column, function (val){ return val.field});
+                _.each(_.map(column,function(val){
+                    return val}), function(item){
+                    getColumns.push([{
+                        title: item.title,
+                        dataKey: item.field
+                    }]);
+                });
+                /*
+                ============================================================
+                    CONFIGURACION DEL PDF
+                ============================================================
+                */
+                var pdf_title = 'Resumen de venta';
+                var pdf_type = 'l';
+                var pdf_name = 'resumen_venta_venta';
+                var pdf_columnStyles =  {
+
+                  date_invoice: {columnWidth: 21, halign:'center'},
+                  invoice_name : {columnWidth: 28, halign:'center'},
+                  supplier_invoice_number : {columnWidth: 28, halign:'center'},
+                  product_brand_id : {columnWidth: 21, halign:'center'},
+                  barcode : {columnWidth: 23, halign:'center'},
+                  product_code : {columnWidth: 21, halign:'center'},
+                  product_name : {columnWidth: 40, halign:'center'},
+                  item_price : {columnWidth: 21, halign:'right'},
+                  qty : {columnWidth: 16, halign:'center'},
+                  total_price : {columnWidth: 21, halign:'right'},
+                  user_name : {columnWidth: 23, halign:'center'},
+
+                };
+                /*
+                ============================================================
+                    LLAMAR FUNCION DE IMPRESION
+                ============================================================
+                */
+                var filter = self.getFilter();
+                var pdf = new reporting.ReportPdfWidget(self);
+                pdf.drawPDF(
+                    _.flatten(getColumns),
+                    row,
+                    ResCompany,
+                    pdf_title,
+                    pdf_type,
+                    pdf_name,
+                    pdf_columnStyles,
+                    filter,
+                );
+            }
+        },
+        getFilter: function(){
+          var self = this;
+          var company = self.$el.find('#current-company').val();
+          var store = self.$el.find('#current-store').val();
+          var journal = self.$el.find('#current-journal').val();
+          var category = self.$el.find('#current-category').val();
+          var period = self.$el.find('#current-period').val();
+          var date = self.$el.find('#current-date').val();
+          var desde = self.$el.find('#from').val();
+          var hasta = self.$el.find('#to').val();
+
+          var filter = [];
+
+          if(company && company){
+            var ResCompany = _.filter(self.ResCompany, function(item){
+              return item.id == company;
+            });
+            filter.push({
+              title:'Empresa',
+              value: ResCompany[0].name,
+            });
+          }
+
+          if(store && store != 9999999){
+            var ResStore =  _.filter(self.ResStore,function (item) {
+                return item.id == store;
+            });
+
+            filter.push({
+                title: 'Sucursal',
+                value:  ResStore[0].name,
+            });
+
+          }
+
+          if(journal && journal != 9999999){
+            var AccountJournal =  _.filter(self.AccountJournal,function (item) {
+                return item.id == journal;
+            });
+            filter.push({
+                 title: 'Vendedor',
+                 value: AccountJournal[0].name,
+               });
+          }
+
+          if(category && category != 9999999){
+            var ProductCategory = _.filter(self.ProductCategory, function(item){
+              return item.id == category;
+            })
+            filter.push({
+                title: 'Categoría',
+                value:  ProductCategory[0].name,
+            });
+          }
+
+          if(period && period != 9999999){
+
+            var AccountPeriod =  _.filter(self.AccountPeriod,function (item) {
+                return item.id == period;
+            });
+            filter.push({
+                 title: 'Periodo',
+                 value:  AccountPeriod[0].name,
+               });
+          }
+
+          if(date && date != 9999999){
+            moment.locale('es', {
+              months: 'Enero_Febrero_Marzo_Abril_Mayo_Junio_Julio_Agosto_Septiembre_Octubre_Noviembre_Diciembre'.split('_'),
+            });
+
+            if(date == 'range'){
+              filter.push({
+                  title: 'Fecha',
+                  value:  desde +' al '+hasta,
+              });
+
+            }
+            else {
+              if(date == 'today'){
+                  var fecha = moment().format('DD/MM/YYYY');
+              }
+
+              if(date == 'yesterday'){
+                  var fecha = moment().add(-1,'days').format('DD/MM/YYYY');
+              }
+              if(date == 'currentMonth'){
+                  var fecha = moment().format('MMMM/YYYY');
+              }
+              if(date == 'lastMonth'){
+                  var fecha = moment().add(-1,'months').format('MMMM/YYYY');
+              }
+
+              filter.push({
+                  title: 'Fecha',
+                  value:  fecha,
+              });
+            }
+          }
+          return filter;
+        },
+
+    });
+}

+ 171 - 0
static/src/reports/report_stock_resumen_dna.xml

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="ReportSaleResumenDna">
+        <div class="report_view">
+            <div class="reporting_page_header">
+                <h1 class="report_title">Resumen de ventas</h1>
+            </div>
+            <div class="container search-form" style="border-bottom:1px solid #eee; width:95%;">
+                <div class="row">
+                    <div class="col-lg-3 company filter-style">
+                        <label>Empresa</label>
+                        <select id="current-company" class="form-control form-control-sm"></select>
+                    </div>
+                    <div class="col-lg-3 store filter-style">
+                        <label>Sucursal</label>
+                        <select id="current-store" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <!-- <div class="col-lg-3 journal filter-style">
+                        <label>Vendedor</label>
+                        <select id="current-journal" class="form-control form-control-sm">
+                        </select>
+                    </div> -->
+                    <div class="col-lg-3 category filter-style">
+                        <label>Categoría</label>
+                        <select id="current-category" class="form-control form-control-sm">
+                        </select>
+                    </div>
+
+                    <div class="col-lg-3 filter-style">
+                        <label>Periodo</label>
+                        <select id="current-period" class="form-control form-control-sm">
+                        </select>
+                    </div>
+                    <div class="col-lg-3 filter-style">
+                        <label>Fechas</label>
+                        <select id="current-date" class="form-control form-control-sm">
+                            <option value="9999999">Sin fechas</option>
+                            <option value="today">Hoy</option>
+                            <option value="yesterday">Ayer</option>
+                            <option value="currentMonth">Mes Actual</option>
+                            <option value="lastMonth">Mes Pasado</option>
+                            <option value="range">Busqueda Avanzada</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="row" >
+                    <div class="datepicker" style="display:none;">
+                        <div class="col-lg-3 filter-style col-md-offset-3">
+                            <div class="input-group">
+                                <span class="input-group-addon" id="basic-addon1">Desde</span>
+                                <input type="text" id="from" class="form-control" aria-describedby="basic-addon1"/>
+                            </div>
+                        </div>
+                        <div class="col-lg-3 filter-style">
+                            <div class="input-group">
+                                <span class="input-group-addon" id="basic-addon1">Hasta</span>
+                                <input type="text" id="to" class="form-control" aria-describedby="basic-addon1"/>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row">
+                  <div class="text-center" style="padding-top:20px;">
+                      <button id="generate" class="myButton" aria-label="Left Align" style="color:#fff;display:none;">
+                        Generar
+                    </button>
+                  </div>
+                  <br/>
+                </div>
+            </div>
+
+            <div class="report-form" style="display:none;">
+                <div id="toolbar">
+                    <button class="oe_button oe_form_button myButton" value="pdf">Imprimir Informe</button>
+                </div>
+                <div class="container" style="width:100%;">
+                  <table id="table"
+                    data-search="true"
+                    data-show-columns="true"
+                    data-pagination="true"
+                    data-page-size="10"
+                    data-toggle="table"
+                    data-toolbar="#toolbar"
+                    data-classes="table table-condensed table-no-bordered"
+                    data-row-style="rowStyle"
+                    data-show-export="true"
+                    data-show-toggle="true"
+                    data-pagination-detail-h-align="left"
+                    data-show-footer="true"
+                    data-footer-style="footerStyle"
+                    data-buttons-class="oe_button oe_form_button myButton"
+                    data-show-pagination-switch="true"
+                    data-search-on-enter-key="true"
+                    data-undefined-text=" "
+                    >
+                    <thead style="background:none;">
+                       <tr>
+                          <th data-field="date_invoice" data-align="center" data-footer-formatter="Totales">Fecha</th>
+                          <th data-field="invoice_name" data-align="center">Referencia</th>
+                          <th data-field="supplier_invoice_number" data-align="center">Factura</th>
+                          <th data-field="product_brand_id" data-align="center">Marca</th>
+                          <th data-field="product_code" data-align="center">Cod. Producto</th>
+                          <th data-field="barcode" data-align="center">Cod.Barra</th>
+                          <th data-field="product_name" data-align="center" data-cell-style="cellStyle" data-row-style="rowStyle">Producto</th>
+                          <th data-field="item_price" data-align="right">Venta Unit.</th>
+                          <th data-field="qty" data-align="center">Cant.</th>
+                          <th data-field="total_price" data-footer-formatter="totalPriceFormatter" data-align="right">Total Venta</th>
+                          <th data-field="user_name" data-align="left">Vendedor</th>
+                        </tr>
+                      </thead>
+
+                    </table>
+                </div>
+            </div>
+            <script>
+              <!-- function cellStyle(value, row, index,field) {
+                  if (row.key === 'categoria') {
+                      return {
+                          css: {"background": "#bbdefb",  "font-weight": "bold",},
+                      };
+                  }
+                  return false;
+              }
+
+              function rowStyle(row, index) {
+                  if (row.key === 'categoria') {
+                      return {
+                          css: {"background": "#bbdefb",  "font-weight": "bold",},
+                      };
+                  }
+                  return false;
+              } -->
+
+                <!--
+                    TOTAL PRICE
+                -->
+                function totalPriceFormatter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total_price =  _.reduce(_.map(rowsTable,function(item){
+                        return (item.total_price_no_format);
+                    }), function(memo, num){
+                    return memo + num; },0)
+
+                    return accounting.formatNumber(total_price,decimal_places,thousands_separator,decimal_separator);
+                }
+
+
+                <!--
+                    FOOTER STYLE
+                -->
+                function footerStyle(row, index) {
+                    return {
+                        css: {
+                          "font-weight": "bold",
+                        }
+                    };
+                };
+
+
+            </script>
+        </div>
+    </t>
+</template>