|
@@ -169,6 +169,9 @@ function report_cuenta_resumen_dna(reporting){
|
|
return self.fetchAccountInvoiceLine();
|
|
return self.fetchAccountInvoiceLine();
|
|
}).then(function (AccountInvoiceLine){
|
|
}).then(function (AccountInvoiceLine){
|
|
self.AccountInvoiceLine = AccountInvoiceLine;
|
|
self.AccountInvoiceLine = AccountInvoiceLine;
|
|
|
|
+ return self.fetchAccountVoucher();
|
|
|
|
+ }).then(function (AccountVoucher){
|
|
|
|
+ self.AccountVoucher = AccountVoucher;
|
|
return self.BuildTable();
|
|
return self.BuildTable();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -401,6 +404,17 @@ function report_cuenta_resumen_dna(reporting){
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
+ fetchAccountVoucher: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+ var defer = $.Deferred();
|
|
|
|
+ var AccountVoucher = new model.web.Model('account.voucher');
|
|
|
|
+ AccountVoucher.query(['id', 'number','reference','partner_id','date','number','type']).filter([['state', '=', 'posted']]).all().then(function(results){
|
|
|
|
+ defer.resolve(results);
|
|
|
|
+ });
|
|
|
|
+ return defer;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
/*====================================================================
|
|
/*====================================================================
|
|
UPDATE SELECTIONS
|
|
UPDATE SELECTIONS
|
|
====================================================================*/
|
|
====================================================================*/
|
|
@@ -513,6 +527,13 @@ function report_cuenta_resumen_dna(reporting){
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ getAccountVoucher: function (id) {
|
|
|
|
+ var self = this;
|
|
|
|
+ return _.filter(self.AccountVoucher,function (item) {
|
|
|
|
+ return item.reference === id;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
|
|
getAccountInvoice:function() {
|
|
getAccountInvoice:function() {
|
|
var self = this;
|
|
var self = this;
|
|
@@ -665,6 +686,7 @@ function report_cuenta_resumen_dna(reporting){
|
|
_.each(AccountInvoice,function(item2) {
|
|
_.each(AccountInvoice,function(item2) {
|
|
var description_product = '';
|
|
var description_product = '';
|
|
var date_pay = '';
|
|
var date_pay = '';
|
|
|
|
+ var date = '';
|
|
if(item2.is_anticipo == false){
|
|
if(item2.is_anticipo == false){
|
|
var total_sale = 0;
|
|
var total_sale = 0;
|
|
var forma = 'Contado';
|
|
var forma = 'Contado';
|
|
@@ -680,6 +702,15 @@ function report_cuenta_resumen_dna(reporting){
|
|
if (item2.date_pay){
|
|
if (item2.date_pay){
|
|
date_pay = item2.date_pay
|
|
date_pay = item2.date_pay
|
|
};
|
|
};
|
|
|
|
+ var voucher = self.getAccountVoucher(item2.number).shift();
|
|
|
|
+
|
|
|
|
+ if (voucher != null){
|
|
|
|
+ date = voucher.date
|
|
|
|
+ }else{
|
|
|
|
+ date = ''
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
|
|
var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
|
|
_.each(AccountInvoiceLine, function(line_item){
|
|
_.each(AccountInvoiceLine, function(line_item){
|
|
description_product = description_product + " " + line_item.product_id.name
|
|
description_product = description_product + " " + line_item.product_id.name
|
|
@@ -687,6 +718,7 @@ function report_cuenta_resumen_dna(reporting){
|
|
|
|
|
|
var partner= self.getResPartner(item2.partner_id[0]);
|
|
var partner= self.getResPartner(item2.partner_id[0]);
|
|
var currency = self.getResCurrency(item2.company_currency[0]).shift();
|
|
var currency = self.getResCurrency(item2.company_currency[0]).shift();
|
|
|
|
+
|
|
data.push({
|
|
data.push({
|
|
//IDS
|
|
//IDS
|
|
invoice_id : item2.id,
|
|
invoice_id : item2.id,
|
|
@@ -702,6 +734,7 @@ function report_cuenta_resumen_dna(reporting){
|
|
supplier_invoice_number: self.valorNull(item2.supplier_invoice_number),
|
|
supplier_invoice_number: self.valorNull(item2.supplier_invoice_number),
|
|
forma: forma,
|
|
forma: forma,
|
|
date_pay: moment(date_pay).format('DD/MM/YYYY'),
|
|
date_pay: moment(date_pay).format('DD/MM/YYYY'),
|
|
|
|
+ date_pago: moment(date).format('DD/MM/YYYY'),
|
|
product_name: description_product,
|
|
product_name: description_product,
|
|
amount_total: accounting.formatMoney(item2.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
amount_total: accounting.formatMoney(item2.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
amount_pagado:accounting.formatMoney(item2.amount_total - item2.residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
amount_pagado:accounting.formatMoney(item2.amount_total - item2.residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
@@ -720,7 +753,7 @@ function report_cuenta_resumen_dna(reporting){
|
|
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- // });
|
|
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
self.content = data;
|
|
self.content = data;
|
|
@@ -797,12 +830,13 @@ function report_cuenta_resumen_dna(reporting){
|
|
partner_email: {columnWidth: 34, halign:'left'},
|
|
partner_email: {columnWidth: 34, halign:'left'},
|
|
invoice_name : {columnWidth: 25, halign:'center'},
|
|
invoice_name : {columnWidth: 25, halign:'center'},
|
|
supplier_invoice_number : {columnWidth: 24, halign:'center'},
|
|
supplier_invoice_number : {columnWidth: 24, halign:'center'},
|
|
- forma: {columnWidth: 20, halign:'left'},
|
|
|
|
|
|
+ forma: {columnWidth: 19, halign:'left'},
|
|
date_pay: {columnWidth: 23, halign:'center'},
|
|
date_pay: {columnWidth: 23, halign:'center'},
|
|
- product_name: {columnWidth: 23, halign:'left'},
|
|
|
|
|
|
+ product_name: {columnWidth: 22, halign:'left'},
|
|
amount_total: {columnWidth: 20, halign:'right'},
|
|
amount_total: {columnWidth: 20, halign:'right'},
|
|
amount_pagado : {columnWidth: 20, halign:'right'},
|
|
amount_pagado : {columnWidth: 20, halign:'right'},
|
|
amount_residual : {columnWidth: 18, halign:'right'},
|
|
amount_residual : {columnWidth: 18, halign:'right'},
|
|
|
|
+ date_pago: {columnWidth: 22, halign:'center'},
|
|
user_name : {columnWidth: 19, halign:'center'},
|
|
user_name : {columnWidth: 19, halign:'center'},
|
|
|
|
|
|
};
|
|
};
|