|
@@ -246,7 +246,7 @@ function report_amortization_and_interest(reporting){
|
|
|
var AccountInvoice = self.getContent();
|
|
|
var CurrencyBase = self.ResCompany[0].currency_id;
|
|
|
_.each(AccountInvoice,function(item) {
|
|
|
- if(item.is_interest == null){
|
|
|
+ if(item.is_interest != true){
|
|
|
var pagado = self.getAccountVoucher(item.number);
|
|
|
var AccountInvoiceLine = self.getAccountInvoiceLine(item.invoice_id);
|
|
|
var capital = _.reduce(_.map(AccountInvoiceLine, function (map) {
|
|
@@ -327,6 +327,7 @@ function report_amortization_and_interest(reporting){
|
|
|
var columns = [];
|
|
|
var data = [];
|
|
|
var CurrencyBase = self.ResCompany[0].currency_id;
|
|
|
+
|
|
|
columns.push({
|
|
|
field:'description',
|
|
|
title:'Descripcion',
|
|
@@ -341,10 +342,11 @@ function report_amortization_and_interest(reporting){
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
|
- field:'capital',
|
|
|
- title:'Saldo del Capital',
|
|
|
+ field:'capital_residual',
|
|
|
+ title:'Saldo del Prestamo',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
+ footerFormatter:'0'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
@@ -352,6 +354,7 @@ function report_amortization_and_interest(reporting){
|
|
|
title:'Interes',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
+ footerFormatter:'InterestAmountFormatter'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
@@ -359,38 +362,39 @@ function report_amortization_and_interest(reporting){
|
|
|
title:'Amortizacion',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
+ footerFormatter:'CapitalAmountFormatter'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
|
- field:'amount',
|
|
|
+ field:'quota',
|
|
|
title:'Monto de la cuota',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
- footerFormatter:'TotalFormatter'
|
|
|
+ footerFormatter:'QuotaFormatter'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
|
- field:'residual',
|
|
|
+ field:'quota_residual',
|
|
|
title:'Saldo de la cuota',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
- footerFormatter:'ResidualFormatter'
|
|
|
+ footerFormatter:'QuotaResidualFormatter'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
|
- field:'capital_receive',
|
|
|
- title:'Capital Recuperado',
|
|
|
+ field:'interest_receive',
|
|
|
+ title:'Interes Cobrado',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
- footerFormatter:'CapitalReceiveFormatter'
|
|
|
+ footerFormatter:'InterestReceiveFormatter'
|
|
|
});
|
|
|
|
|
|
columns.push({
|
|
|
- field:'interest_receive',
|
|
|
- title:'Interes Cobrado',
|
|
|
+ field:'capital_receive',
|
|
|
+ title:'Capital Recuperado',
|
|
|
align:'right',
|
|
|
with:'12%',
|
|
|
- footerFormatter:'InterestReceiveFormatter'
|
|
|
+ footerFormatter:'CapitalReceiveFormatter'
|
|
|
});
|
|
|
|
|
|
var AccountMoveLine = self.getAccountMoveLine(number);
|
|
@@ -425,6 +429,8 @@ function report_amortization_and_interest(reporting){
|
|
|
var capital_amount = amortizacion / cant_cuota;
|
|
|
var capital_receive = 0;
|
|
|
var interest_receive = 0;
|
|
|
+ var razon_capital = (capital - interes) / capital;
|
|
|
+ var razon_interes = interes / capital;
|
|
|
_.each(AccountMoveLine,function(item) {
|
|
|
if(item.number == number){
|
|
|
capital_receive = 0;
|
|
@@ -445,11 +451,11 @@ function report_amortization_and_interest(reporting){
|
|
|
}
|
|
|
if(saldo < i.debit && band == true){
|
|
|
residual = i.debit - saldo;
|
|
|
- if(interest_amount >= saldo){
|
|
|
+ if((razon_interes * item.debit) >= saldo){
|
|
|
interest_receive = saldo;
|
|
|
}else{
|
|
|
- interest_receive = interest_amount;
|
|
|
- capital_receive = saldo - interest_amount;
|
|
|
+ interest_receive = razon_interes * item.debit;
|
|
|
+ capital_receive = saldo - (razon_interes * item.debit);
|
|
|
}
|
|
|
band = false;
|
|
|
}
|
|
@@ -457,10 +463,10 @@ function report_amortization_and_interest(reporting){
|
|
|
}
|
|
|
if(item.reconcile_id != null){
|
|
|
residual = 0;
|
|
|
- capital_receive = capital_amount;
|
|
|
- interest_receive = interest_amount;
|
|
|
+ interest_receive = razon_interes * item.debit;
|
|
|
+ capital_receive = razon_capital * item.debit;
|
|
|
}
|
|
|
- capital = capital - item.debit;
|
|
|
+
|
|
|
data.push({
|
|
|
/*
|
|
|
########################
|
|
@@ -470,24 +476,27 @@ function report_amortization_and_interest(reporting){
|
|
|
description:item.description,
|
|
|
date:item.date_maturity,
|
|
|
date_maturity: moment(item.date_maturity).format('DD/MM/YYYY'),
|
|
|
- capital: accounting.formatMoney(capital,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
- capital_amount: accounting.formatMoney(capital_amount,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
- interest_amount: accounting.formatMoney(interest_amount,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
- residual: accounting.formatMoney(residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
- amount: accounting.formatMoney(item.debit,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
- capital_receive:accounting.formatMoney(capital_receive,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
+ capital_residual: accounting.formatMoney(capital,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
+ interest_amount: accounting.formatMoney(razon_interes * item.debit,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
+ capital_amount: accounting.formatMoney(razon_capital * item.debit,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
+ quota: accounting.formatMoney(item.debit,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
+ quota_residual: accounting.formatMoney(residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
interest_receive:accounting.formatMoney(interest_receive,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
-
|
|
|
+ capital_receive:accounting.formatMoney(capital_receive,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
|
|
|
/*
|
|
|
########################
|
|
|
DATOS FORMATADOS
|
|
|
########################
|
|
|
*/
|
|
|
- residual_value:residual,
|
|
|
- amount_value:item.debit,
|
|
|
- capital_receive_value:capital_receive,
|
|
|
+
|
|
|
+ interest_amount_value:razon_interes * item.debit,
|
|
|
+ capital_amount_value:razon_capital * item.debit,
|
|
|
+ quota_value:item.debit,
|
|
|
+ quota_residual_value:residual,
|
|
|
interest_receive_value:interest_receive,
|
|
|
+ capital_receive_value:capital_receive,
|
|
|
});
|
|
|
+ capital = capital - item.debit;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -533,10 +542,10 @@ function report_amortization_and_interest(reporting){
|
|
|
var column = table.bootstrapTable('getVisibleColumns');
|
|
|
var row = table.bootstrapTable('getData');
|
|
|
|
|
|
- var capital_amount = CapitalAmountFormatter(row);
|
|
|
- var interest_amount = InterestAmountFormatter(row);
|
|
|
- var amount = AmountFormatter(row);
|
|
|
- var residual = ResidualAmountFormatter(row);
|
|
|
+ var capital_amount = InvoiceCapitalFormatter(row);
|
|
|
+ var interest_amount = InvoiceInterestFormatter(row);
|
|
|
+ var amount = InvoiceAmountFormatter(row);
|
|
|
+ var residual = InvoiceResidualFormatter(row);
|
|
|
|
|
|
row.push({
|
|
|
number:'Totales',
|