Correzioni per test sulle rate = 0 e sull' importo della prima riga quando ho le imposte
git-svn-id: svn://10.65.10.50/trunk@2389 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
df36f2cc2b
commit
4b020940c7
@ -587,12 +587,20 @@ word TPagamento::validate() const
|
|||||||
|
|
||||||
if (_inited)
|
if (_inited)
|
||||||
{
|
{
|
||||||
real tot;
|
real tot;
|
||||||
|
|
||||||
for (int i = 0; i < n_rate(); i++)
|
for (int i = 0; i < n_rate(); i++)
|
||||||
tot += tpay_rata(i);
|
{
|
||||||
|
const real tpay(tpay_rata(i));
|
||||||
|
|
||||||
|
if (tpay.is_zero())
|
||||||
|
res |= P_ZERO;
|
||||||
|
tot += tpay;
|
||||||
|
}
|
||||||
|
|
||||||
if (tot != _firstr+_secndr)
|
if (tot != _firstr+_secndr)
|
||||||
res |= P_TOTNC;
|
res |= P_TOTNC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// check errori date scadenze (se istanziate)
|
// check errori date scadenze (se istanziate)
|
||||||
@ -637,6 +645,8 @@ void TPagamento::strerr(word err, TString& s)
|
|||||||
}
|
}
|
||||||
if (err & P_MCOMM)
|
if (err & P_MCOMM)
|
||||||
s << "Scadenze incompatibili con il mese commerciale\n";
|
s << "Scadenze incompatibili con il mese commerciale\n";
|
||||||
|
if (err & P_ZERO)
|
||||||
|
s << "Almeno una rata ha importo zero\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TPagamento::desc_tpr() const
|
const char* TPagamento::desc_tpr() const
|
||||||
@ -737,10 +747,11 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
{
|
{
|
||||||
newv = new_value;
|
newv = new_value;
|
||||||
rmax = is_perc_modified ? real(100.0) : (_tpr < 4 ? _firstr : _secndr);
|
rmax = is_perc_modified ? real(100.0) : (_tpr < 4 ? _firstr : _secndr);
|
||||||
real max_value(rmax);
|
real test_value(newv);
|
||||||
if (_tpr > 0 && _tpr < 4 && row == 0)
|
if (_tpr > 0 && _tpr < 4 && row == 0)
|
||||||
max_value += _secndr;
|
test_value -= _secndr;
|
||||||
if (newv > max_value) return P_RSUM;
|
if (test_value < ZERO) return P_NEG;
|
||||||
|
if (test_value > rmax) return P_TROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exhausted = FALSE;
|
bool exhausted = FALSE;
|
||||||
|
@ -23,6 +23,7 @@ const word P_NEG = 0x0010; // importo specificato < minimo possibile
|
|||||||
const word P_TROP = 0x0020; // importo specificato > massimo possibile
|
const word P_TROP = 0x0020; // importo specificato > massimo possibile
|
||||||
const word P_TOTNC = 0x0040; // totale importi != totale pagamento
|
const word P_TOTNC = 0x0040; // totale importi != totale pagamento
|
||||||
const word P_MCOMM = 0x0080; // inconsistenza mese commerciale/scadenze
|
const word P_MCOMM = 0x0080; // inconsistenza mese commerciale/scadenze
|
||||||
|
const word P_ZERO = 0x0100; // importo di una rata uguale a zero
|
||||||
|
|
||||||
class TPagamento : public TObject
|
class TPagamento : public TObject
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user