|
@@ -0,0 +1,1014 @@
|
|
|
+function report_account_pay(reporting){
|
|
|
+ "use strict";
|
|
|
+
|
|
|
+ var model = openerp;
|
|
|
+
|
|
|
+ reporting.ReportAccountPayWidget = reporting.Base.extend({
|
|
|
+ template: 'ReportAccountPay',
|
|
|
+ rowsData :[],
|
|
|
+ content :[],
|
|
|
+ modules: [],
|
|
|
+
|
|
|
+ events:{
|
|
|
+ 'click #toolbar > button' : 'clickOnAction',
|
|
|
+ 'click #generate' : 'fetchGenerate',
|
|
|
+ 'change #current-company' : 'updateSelections',
|
|
|
+ 'change #current-store' : 'updateJournalSelections',
|
|
|
+ 'change #current-period' : 'updatePeriodSelections',
|
|
|
+ 'change #current-date' : 'ShowDateRange',
|
|
|
+ },
|
|
|
+
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+
|
|
|
+ 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');
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ fetchInitial: function () {
|
|
|
+ var self = this;
|
|
|
+ self.fecthIrModuleModule().then(function (IrModuleModule) {
|
|
|
+ return IrModuleModule;
|
|
|
+ }).then(function(IrModuleModule) {
|
|
|
+ self.IrModuleModule = IrModuleModule;
|
|
|
+ return self.fetchResUser;
|
|
|
+ }).then(function (ResUser) {
|
|
|
+ self.ResUser = ResUser;
|
|
|
+ return self.fetchResCompany();
|
|
|
+ }).then(function(ResCompany){
|
|
|
+ self.ResCompany = ResCompany;
|
|
|
+ if(ResCompany.length > 1){
|
|
|
+ self.$el.find('#current-company').append('<option value="9999999">Todas las empresas</option>');
|
|
|
+ _.each(ResCompany,function(item){
|
|
|
+ self.$el.find('#current-company').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ self.$el.find('.company').css('display','none');
|
|
|
+ }
|
|
|
+ return self.fetchResStore();
|
|
|
+ }).then(function(ResStore){
|
|
|
+ self.ResStore = ResStore;
|
|
|
+ if(ResStore.length > 1){
|
|
|
+ self.$el.find('#current-store').append('<option value="9999999">Todas las sucursales</option>');
|
|
|
+ _.each(ResStore,function(item){
|
|
|
+ self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ self.$el.find('.store').css('display','none');
|
|
|
+ }
|
|
|
+ return self.fetchAccountJournal();
|
|
|
+ }).then(function(AccountJournal){
|
|
|
+ self.AccountJournal = AccountJournal;
|
|
|
+ if(AccountJournal.length > 1){
|
|
|
+ self.$el.find('#current-journal').append('<option value="9999999">Todas las facturas</option>');
|
|
|
+ _.each(AccountJournal,function(item){
|
|
|
+ self.$el.find('#current-journal').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
+ });
|
|
|
+ }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.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.fetchAccountMoveLine();
|
|
|
+ }).then(function (AccountMoveLine){
|
|
|
+ self.AccountMoveLine = AccountMoveLine;
|
|
|
+ return self.fetchAccountVoucher();
|
|
|
+ }).then(function (AccountVoucher){
|
|
|
+ self.AccountVoucher = AccountVoucher;
|
|
|
+ return self.BuildTable();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*=====================================================================
|
|
|
+ IR MODULE
|
|
|
+ =====================================================================*/
|
|
|
+ fecthIrModuleModule: function(){
|
|
|
+ var self = this;
|
|
|
+ var defer = $.Deferred();
|
|
|
+ var fields = ['name','id'];
|
|
|
+ var domain=[['state','=','installed'],['name','in',self.modules]];
|
|
|
+ var IrModuleModule = new model.web.Model('ir.module.module');
|
|
|
+ IrModuleModule.query(fields).filter(domain).all().then(function(results){
|
|
|
+ defer.resolve(results);
|
|
|
+ })
|
|
|
+ return defer;
|
|
|
+ },
|
|
|
+
|
|
|
+ /*=====================================================================
|
|
|
+ USER
|
|
|
+ =====================================================================*/
|
|
|
+ fetchResUser: function() {
|
|
|
+ var self = this;
|
|
|
+ var defer = $.Deferred();
|
|
|
+ var fields = ['id','name','store_id'];
|
|
|
+ var domain = [['id','=',self.session.uid]];
|
|
|
+ var ResUser = new model.web.Model('res.users');
|
|
|
+ ResUser.query(fields).filter(domain).all().then(function (results) {
|
|
|
+ defer.resolve(results);
|
|
|
+ });
|
|
|
+ return defer;
|
|
|
+ },
|
|
|
+
|
|
|
+ /*=====================================================================
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ ACCOUNT JOURNAL
|
|
|
+ ====================================================================*/
|
|
|
+ fetchAccountJournal: function(){
|
|
|
+ var self = this;
|
|
|
+ var defer = $.Deferred();
|
|
|
+ var company = $('#current-company').val();
|
|
|
+ var store = $('#current-store').val();
|
|
|
+ var domain = [['active','=',true],['type','=','sale']];
|
|
|
+ if(company && company != 9999999){
|
|
|
+ domain.push(['company_id','=',parseFloat(company)]);
|
|
|
+ }
|
|
|
+ if(store && store != 9999999){
|
|
|
+ domain.push(['store_ids','=',parseFloat(store)]);
|
|
|
+ }
|
|
|
+ var field = ['id', 'name','store_ids'];
|
|
|
+ var AccountJournal = new model.web.Model('account.journal');
|
|
|
+ AccountJournal.query(field).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 date = self.$el.find('#current-date').val();
|
|
|
+ var desde = self.$el.find('#from').val();
|
|
|
+ var hasta = self.$el.find('#to').val();
|
|
|
+ var journal = self.$el.find('#current-journal').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', '=', 'out_invoice'],
|
|
|
+ ['journal_id','in',journal_ids],
|
|
|
+ ];
|
|
|
+ if(period != 9999999){
|
|
|
+ domain.push(['period_id','=',parseInt(period)]);
|
|
|
+ }
|
|
|
+ if(journal && journal != 9999999){
|
|
|
+ domain.push(['journal_id','=',parseInt(journal)]);
|
|
|
+ }
|
|
|
+ if(date && date != 9999999){
|
|
|
+ if(date == 'range'){
|
|
|
+ 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('getAccountInvoice',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ ACCOUNT INVOICE LINE
|
|
|
+ ====================================================================*/
|
|
|
+ fetchAccountInvoiceLine: function (){
|
|
|
+ var self = this;
|
|
|
+ var invoice_ids = _.flatten(_.map(self.AccountInvoice, function (item) {
|
|
|
+ return item.id;
|
|
|
+ }));
|
|
|
+ var domain = [
|
|
|
+ ['invoice_id','in',invoice_ids],
|
|
|
+ ];
|
|
|
+ var AccountInvoiceLine = new model.web.Model('account.invoice.line');
|
|
|
+ return AccountInvoiceLine.call('getAccountInvoiceLine',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ ACCOUNT INVOICE LINE
|
|
|
+ ====================================================================*/
|
|
|
+ fetchAccountMoveLine: function (){
|
|
|
+ var self = this;
|
|
|
+ var invoice_numbers = _.flatten(_.map(self.AccountInvoice, function (item) {
|
|
|
+ return item.number;
|
|
|
+ }));
|
|
|
+ var domain = [
|
|
|
+ ['move_id','in',invoice_numbers],
|
|
|
+ ['debit','>',0],
|
|
|
+ ];
|
|
|
+ var AccountMoveLine = new model.web.Model('account.move.line');
|
|
|
+ return AccountMoveLine.call('getAccountMoveLine',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*=====================================================================
|
|
|
+ ACCOUNT VOUCHER
|
|
|
+ =====================================================================*/
|
|
|
+ fetchAccountVoucher: function () {
|
|
|
+ var self = this;
|
|
|
+ var invoice_numbers = _.flatten(_.map(self.AccountInvoice, function (item) {
|
|
|
+ return item.number;
|
|
|
+ }));
|
|
|
+ var domain = [
|
|
|
+ ['state','=','posted'],
|
|
|
+ ['reference','in',invoice_numbers]
|
|
|
+ ];
|
|
|
+ var AccountVoucher = new model.web.Model('account.voucher');
|
|
|
+ return AccountVoucher.call('getAccountVoucher',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ 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 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;
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ 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 sucursales</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 sucursales</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">Todos 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;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ GET RES CURRENCY BASE
|
|
|
+ ====================================================================*/
|
|
|
+ getResCurrency: function (id) {
|
|
|
+ var self = this;
|
|
|
+ return _.filter(self.ResCurrency,function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ GET ACCOUNT INVOICE LINE
|
|
|
+ ====================================================================*/
|
|
|
+ getAccountInvoiceLine: function (id) {
|
|
|
+ var self = this;
|
|
|
+ return _.filter(self.AccountInvoiceLine,function (item) {
|
|
|
+ return item.invoice_id === id;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ GET ACCOUNT MOVE LINE
|
|
|
+ ====================================================================*/
|
|
|
+ getAccountMoveLine: function (number) {
|
|
|
+ var self = this;
|
|
|
+ return _.filter(self.AccountMoveLine,function (item) {
|
|
|
+ return item.move_id[1] == number;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ GET ACCOUNT VOUCHER
|
|
|
+ ====================================================================*/
|
|
|
+ getAccountVoucher: function (number) {
|
|
|
+ var self = this;
|
|
|
+ return _.filter(self.AccountVoucher,function (item) {
|
|
|
+ return item.reference == number;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /*============================
|
|
|
+ ACCOUNT DATA BY MONTH
|
|
|
+ ============================*/
|
|
|
+ getContent:function(mes) {
|
|
|
+ var self = this;
|
|
|
+ return _.flatten(_.filter(self.content,function (inv) {
|
|
|
+ return moment(inv.date).format('YYYY-MM') === moment(mes).format('YYYY-MM');
|
|
|
+ }));
|
|
|
+ },
|
|
|
+
|
|
|
+ /*============================
|
|
|
+ ACCOUNT DATA BY DAY
|
|
|
+ ============================*/
|
|
|
+ getContentByDay:function(date) {
|
|
|
+ var self = this;
|
|
|
+ return _.flatten(_.filter(self.content,function (inv) {
|
|
|
+ return moment(inv.date).format('YYYY-MM-DD') === date;
|
|
|
+ }));
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ BUILD
|
|
|
+ ====================================================================*/
|
|
|
+ BuildTable: function(){
|
|
|
+ var self = this;
|
|
|
+ var data = [];
|
|
|
+ var info = [];
|
|
|
+ var payments = [];
|
|
|
+ var type = $('#current-type').val();
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ ==========================================
|
|
|
+ ACCOUNT INVOICE
|
|
|
+ ==========================================
|
|
|
+ */
|
|
|
+
|
|
|
+ var AccountInvoice = self.AccountInvoice;
|
|
|
+ _.each(AccountInvoice, function(item){
|
|
|
+ info = [];
|
|
|
+ payments = [];
|
|
|
+
|
|
|
+ var AccountInvoiceLine = self.getAccountInvoiceLine(item.id);
|
|
|
+ var AccountMoveLine = self.getAccountMoveLine(item.number);
|
|
|
+
|
|
|
+
|
|
|
+ var Currency = self.getResCurrency(item.invoice_currency[0]).shift();
|
|
|
+ var i = AccountMoveLine.length;
|
|
|
+ var x = AccountMoveLine.length;
|
|
|
+
|
|
|
+ _.each(AccountInvoiceLine, function(index){
|
|
|
+ var price_unit = 0;
|
|
|
+ var amount = 0;
|
|
|
+ if(Currency.id != CurrencyBase.id){
|
|
|
+ price_unit = accounting.formatMoney(index.price_unit_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_unit, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
|
|
|
+ amount = accounting.formatMoney(index.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_subtotal, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
|
|
|
+ }else{
|
|
|
+ price_unit = accounting.formatMoney(index.price_unit_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ amount = accounting.formatMoney(index.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ }
|
|
|
+ info.push({
|
|
|
+ product_name : index.product_id[1],
|
|
|
+ price_unit : price_unit,
|
|
|
+ quantity : index.quantity,
|
|
|
+ amount: amount,
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ _.each(AccountMoveLine, function(index){
|
|
|
+
|
|
|
+ var amount = 0;
|
|
|
+ var date;
|
|
|
+
|
|
|
+ if(Currency.id != CurrencyBase.id){
|
|
|
+ amount = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(index.price_subtotal, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) +')';
|
|
|
+ }else{
|
|
|
+ amount = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ };
|
|
|
+ var state = 'No Pagado';
|
|
|
+ if(index.reconcile_ref){
|
|
|
+ if(index.amount_residual == 0){
|
|
|
+ state = 'Pagado'
|
|
|
+ };
|
|
|
+ if(index.amount_residual > 0){
|
|
|
+ var value = accounting.formatMoney(index.credit, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ state = 'Parcialmente Amortizado de' + ' ( ' + value + ' )';
|
|
|
+ };
|
|
|
+ };
|
|
|
+ date = moment(index.date_maturity).format('DD/MM/YYYY');
|
|
|
+
|
|
|
+ if(state == 'No Pagado'){
|
|
|
+ if(index.date_maturity < moment().format('YYYY-MM-DD')){
|
|
|
+ date = moment(index.date_maturity).format('DD/MM/YYYY') + ' (vencido) ';
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ var AccountVoucher = self.getAccountVoucher(index.move_id[1]);
|
|
|
+
|
|
|
+ if(AccountVoucher.length > 0){
|
|
|
+ _.each(AccountVoucher, function(item2){
|
|
|
+ var CurrencyVoucher = self.getResCurrency(item2.currency_id[0]).shift();
|
|
|
+ var amount_pagado = 0;
|
|
|
+ if(CurrencyVoucher.id != CurrencyBase.id){
|
|
|
+ amount_pagado = accounting.formatMoney(item2.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(item2.amount, '', CurrencyVoucher.decimal_places, CurrencyVoucher.thousands_separator, CurrencyVoucher.decimal_separator) +')';
|
|
|
+ }else{
|
|
|
+ amount_pagado = accounting.formatMoney(item2.amount_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ }
|
|
|
+ payments.push({
|
|
|
+ date_maturity : date,
|
|
|
+ user : item2.create_uid,
|
|
|
+ journal_name : item2.journal_id[1],
|
|
|
+ amount : amount_pagado,
|
|
|
+ amount_saldo: accounting.formatMoney(index.amount_residual, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
+ state : state,
|
|
|
+ date : moment(item2.date).format('DD/MM/YYYY'),
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+
|
|
|
+ payments.push({
|
|
|
+ date_maturity : date,
|
|
|
+ user : "",
|
|
|
+ journal_name : "",
|
|
|
+ amount : 0,
|
|
|
+ amount_saldo: amount,
|
|
|
+ state : state,
|
|
|
+ date : "",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // info.push({
|
|
|
+ // date : date,
|
|
|
+ // name : 'Cuota ' + i +' / ' + x,
|
|
|
+ // state : state,
|
|
|
+ // amount: amount,
|
|
|
+ // });
|
|
|
+ // i--;
|
|
|
+ });
|
|
|
+
|
|
|
+ var residual_total = 0;
|
|
|
+ var amount_untaxed_total = 0;
|
|
|
+ var amount_tax_total = 0;
|
|
|
+ var amount_total = 0;
|
|
|
+ var pasadoMonth;
|
|
|
+
|
|
|
+ pasadoMonth = moment(item.date_due).subtract(1, 'month').format('DD/MM/YYYY');
|
|
|
+
|
|
|
+ if(Currency.id != CurrencyBase.id){
|
|
|
+ residual_total = accounting.formatMoney(item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(item.residual, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) + ')';
|
|
|
+ amount_total = accounting.formatMoney(item.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + ' (' + accounting.formatMoney(item.amount_total, '', Currency.decimal_places, Currency.thousands_separator, Currency.decimal_separator) + ')';
|
|
|
+ }else{
|
|
|
+ residual_total = accounting.formatMoney(item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ amount_total = accounting.formatMoney(item.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
|
|
|
+ }
|
|
|
+
|
|
|
+ data.push({
|
|
|
+ /*=======================
|
|
|
+ IDS
|
|
|
+ =======================*/
|
|
|
+ id : item.id,
|
|
|
+ /*=======================
|
|
|
+ INFO
|
|
|
+ =======================*/
|
|
|
+ number : item.number,
|
|
|
+ date_invoice : moment(item.date_invoice).format('DD/MM/YYYY'),
|
|
|
+ date : moment(item.date_invoice).format('YYYY-MM-DD'),
|
|
|
+ date_past : moment(item.date_due).subtract(1, 'month').format('DD/MM/YYYY'),
|
|
|
+ date_due : moment(item.date_due).format('DD/MM/YYYY'),
|
|
|
+ user_id : item.user_id[1],
|
|
|
+ partner_id : self.valorNull(item.partner_id[1]),
|
|
|
+ residual_total : residual_total,
|
|
|
+ amortized_total: accounting.formatMoney(item.amount_total_currency - item.residual_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
+ amount_total : amount_total,
|
|
|
+ /*=======================
|
|
|
+ VALORES SIN FORMATEAR
|
|
|
+ =======================*/
|
|
|
+ residual : item.residual_currency,
|
|
|
+ amortized: item.amount_total_currency - item.residual_currency,
|
|
|
+ amount : item.amount_total_currency,
|
|
|
+ /*==============================
|
|
|
+ TOTAL FOOTER CONFIGURATION
|
|
|
+ ==============================*/
|
|
|
+ decimal_places : CurrencyBase.decimal_places,
|
|
|
+ thousands_separator: CurrencyBase.thousands_separator,
|
|
|
+ decimal_separator: CurrencyBase.decimal_separator,
|
|
|
+ /*==============================
|
|
|
+ DATA
|
|
|
+ ==============================*/
|
|
|
+ info : info,
|
|
|
+ payments : payments,
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ data.sort(function (a, b) {
|
|
|
+ if (a.date > b.date) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (a.date < b.date) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
+ self.content = data;
|
|
|
+ self.loadTable(data);
|
|
|
+ self.BuildChartByPeriod();
|
|
|
+ },
|
|
|
+
|
|
|
+ /*====================================================================
|
|
|
+ BUILD CHART BY PERIOD
|
|
|
+ ====================================================================*/
|
|
|
+ BuildChartByPeriod: function(){
|
|
|
+ var self = this;
|
|
|
+ var data = [];
|
|
|
+ var label = [];
|
|
|
+ var body = [];
|
|
|
+ var period = self.$el.find('#current-period').val();
|
|
|
+ var date = self.$el.find('#current-date').val();
|
|
|
+ var AccountPeriod = self.AccountPeriod;
|
|
|
+ var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ GRAFICAR TENIENDO EN CUENTA EL PERIODO
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(period != 9999999){
|
|
|
+ var range = _.filter(self.AccountPeriod,function (inv) {
|
|
|
+ return inv.id == parseInt(period);
|
|
|
+ });
|
|
|
+ var date = range[0].date_start;
|
|
|
+ for (var i = 0; i < 32; i++) {
|
|
|
+ if(i > 0){
|
|
|
+ date = moment(date).add(1,'day').format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ if(date > range[0].date_stop){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var data = self.getContentByDay(date);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(moment(date).format('DD/MM/YYYY'));
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ GRAFICAR TENIENDO EN CUENTA EL RANGO DE FECHAS
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(date == 'range'){
|
|
|
+
|
|
|
+ // DESDE
|
|
|
+ var desde = self.$el.find('#from').val();
|
|
|
+ desde = desde.split('/');
|
|
|
+ desde = (desde[2] + "-" + desde[1] + "-" + desde[0]);
|
|
|
+
|
|
|
+ // HASTA
|
|
|
+ var hasta = self.$el.find('#to').val();
|
|
|
+ if(hasta){
|
|
|
+ hasta = hasta.split('/');
|
|
|
+ hasta = (hasta[2] + "-" + hasta[1] + "-" + hasta[0]);
|
|
|
+ }else{
|
|
|
+ hasta = moment().format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ // DETERMINAR RANGO DE FECHAS
|
|
|
+ const diff = moment(hasta).diff(moment(desde),'days');
|
|
|
+
|
|
|
+ if(diff > 0 & diff < 32){
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ var date = desde;
|
|
|
+ for (var i = 0; i < 32; i++) {
|
|
|
+ if(i > 0){
|
|
|
+ date = moment(date).add(1,'day').format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ if(date > hasta){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var data = self.getContentByDay(date);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(moment(date).format('DD/MM/YYYY'));
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+ if(diff > 31){
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ _.each(AccountPeriod, function(item){
|
|
|
+ var data = self.getContent(item.date_start);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(item.name);
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+ if(diff == 0){
|
|
|
+ self.$el.find('.chart-container').css('display','none');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ OCULTAR GRAFICO EN EL CASO DE QUE EL FILTRO SEA AYER U HOY
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(date == 'today' || date == 'yesterday'){
|
|
|
+ self.$el.find('.chart-container').css('display','none');
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ GRAFICAR TENIENDO EN CUENTA EL MES ACTUAL
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(date == 'currentMonth'){
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ var date = moment().startOf('month').format('YYYY-MM-DD');
|
|
|
+ var hasta = moment().endOf('month').format('YYYY-MM-DD');
|
|
|
+ for (var i = 0; i < 32; i++) {
|
|
|
+ if(i > 0){
|
|
|
+ date = moment(date).add(1,'day').format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ if(date > hasta){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var data = self.getContentByDay(date);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(moment(date).format('DD/MM/YYYY'));
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ GRAFICAR TENIENDO EN CUENTA EL MES PASADO
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(date == 'lastMonth'){
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ var date = moment().add(-1,'month').startOf('month').format('YYYY-MM-DD');
|
|
|
+ var hasta = moment().add(-1,'month').endOf('month').format('YYYY-MM-DD');
|
|
|
+ for (var i = 0; i < 32; i++) {
|
|
|
+ if(i > 0){
|
|
|
+ date = moment(date).add(1,'day').format('YYYY-MM-DD');
|
|
|
+ }
|
|
|
+ if(date > hasta){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var data = self.getContentByDay(date);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(moment(date).format('DD/MM/YYYY'));
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ =============================================================================
|
|
|
+ GRAFICAR SIN FILTRO
|
|
|
+ =============================================================================
|
|
|
+ */
|
|
|
+ if(date == 9999999 & period == 9999999){
|
|
|
+ _.each(AccountPeriod, function(item){
|
|
|
+ var data = self.getContent(item.date_start);
|
|
|
+ if(data.length > 0){
|
|
|
+ var total = _.reduce(_.map(data,function(item) {
|
|
|
+ return item.amount;
|
|
|
+ }),function(memo, num) {
|
|
|
+ return memo + num;
|
|
|
+ },0);
|
|
|
+ label.push(item.name);
|
|
|
+ body.push(total);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ self.$el.find('.chart-container').css('display','block');
|
|
|
+ }
|
|
|
+
|
|
|
+ var chart = new model.eiru_reports.ReportChartWidget(self);
|
|
|
+ chart.BuildLineChart(label,body,CurrencyBase);
|
|
|
+ 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 = totalFormatter(row);
|
|
|
+ var amortized = totalAmortizedFormatter(row);
|
|
|
+ var residual = totalResidualFormatter(row);
|
|
|
+
|
|
|
+ row.push({
|
|
|
+ number : 'Totales',
|
|
|
+ amount_total : total,
|
|
|
+ amortized_total : amortized,
|
|
|
+ residual_total : residual,
|
|
|
+ });
|
|
|
+
|
|
|
+ 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 = 'Estado de Clientes.';
|
|
|
+ var pdf_type = '';
|
|
|
+ var pdf_name = 'estado_de_clientes_';
|
|
|
+ var pdf_columnStyles = {
|
|
|
+ number :{columnWidth: 25, halign:'center'},
|
|
|
+ date_past : {columnWidth: 18, halign:'center'},
|
|
|
+ date_due : {columnWidth: 18, halign:'center'},
|
|
|
+ partner_id : {halign:'left'},
|
|
|
+ amount_total : {columnWidth: 20, halign:'right'},
|
|
|
+ amortized_total : {columnWidth: 20, halign:'right'},
|
|
|
+ residual_total : {columnWidth: 20, halign:'right'},
|
|
|
+ };
|
|
|
+ /*
|
|
|
+ ============================================================
|
|
|
+ LLAMAR FUNCION DE IMPRESION
|
|
|
+ ============================================================
|
|
|
+ */
|
|
|
+ var pdf = new model.eiru_reports.ReportPdfWidget(self);
|
|
|
+ pdf.drawPDF(
|
|
|
+ _.flatten(getColumns),
|
|
|
+ row,
|
|
|
+ ResCompany,
|
|
|
+ pdf_title,
|
|
|
+ pdf_type,
|
|
|
+ pdf_name,
|
|
|
+ pdf_columnStyles,
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|