Nuovo calcolo rate uguali se sono uguali tutte quante
git-svn-id: svn://10.65.10.50/trunk@2636 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3ea8c74b38
commit
fd2a2c2303
@ -1602,18 +1602,28 @@ void TPagamento::set_rate_auto()
|
||||
|
||||
real r1(0.0), ro(0.0);
|
||||
if (!_rdiff)
|
||||
{
|
||||
{
|
||||
const int rut = _tpr > 3 ? n_rate() - 1 : n_rate();
|
||||
if (rut > 1) // Guy was here! Don't kill me for this
|
||||
{
|
||||
// usa la percentuale per la prima rata
|
||||
r1 = (toslice * perc_rata(first))/real(100.0);
|
||||
|
||||
const real reminder = toslice - r1;
|
||||
if (!reminder.is_zero())
|
||||
real refrata = real(100.0)/real(rut); refrata.round(2);
|
||||
if (perc_rata(first+1) == refrata) // tutte uguali nonostante perc arrotondate
|
||||
{
|
||||
ro = reminder/real(rut-1); ro.round(round(v));
|
||||
r1 = (toslice - (ro*real(rut-1)));
|
||||
ro = toslice / real(rut);
|
||||
ro.round(round(v));
|
||||
r1 = toslice - (ro * real(rut-1));
|
||||
}
|
||||
else // la prima e' diversa
|
||||
{
|
||||
// usa la percentuale per la prima rata
|
||||
r1 = (toslice * perc_rata(first))/real(100.0);
|
||||
|
||||
const real reminder = toslice - r1;
|
||||
if (!reminder.is_zero())
|
||||
{
|
||||
ro = reminder/real(rut-1); ro.round(round(v));
|
||||
r1 = (toslice - (ro*real(rut-1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user