Patch level : 12.0 1236

Files correlati     : cg5.exe

Commento :
Aggiunto controllo per evitare crediti negativi
Sistemato il salvataggio dei dati di dicembre e 13a
This commit is contained in:
Alessandro Bonazzi 2023-01-24 23:13:58 +01:00
parent 00d649f14e
commit 92a1e8b26f

View File

@ -483,19 +483,27 @@ bool Visliq_app::check_date(TMask_field& f, KEY k)
{
const TDate d(f.get());
const int row = f.mask().get_sheet()->selected();
const bool mensile = app()._freqviva == "M";
int m = row + 1;
int year = app().year();
if (d.year() != app().year())
return f.error_box(FR("L'anno deve essere %d"), app().year());
if (app()._freqviva == "M")
if (!mensile)
{
if (d.month() != row + 1)
return f.error_box(FR("Il mese deve essere %s"), itom(row + 1));
m *= 3;
if (m > 12)
m = 13;
}
else
if (m == 13)
{
if (d.month() != (row + 1) * 3)
return f.error_box(FR("Il mese deve essere %s"), itom((row + 1) * 3));
year++;
m = 2;
}
if (d.year() != year)
return f.error_box(FR("L'anno deve essere %d"), year);
if (d.month() != m)
return f.error_box(FR("Il mese deve essere %s"), itom(m));
}
return true;
}
@ -1619,6 +1627,7 @@ void Visliq_app::read_general(TMask& m)
TString4 cnc;
const int step = _freqviva == "M" ? 1 : 3;
const bool compensabile = _lia->get("S9") == "CM";
TSheet_field& sh = m.sfield(F_VISLIQ1);
TSheet_field& sv = m.sfield(F_VISLIQ2);
@ -1826,7 +1835,7 @@ void Visliq_app::write_general(TMask& m)
for (int i = step; i < last_month; i += step)
{
int m = (i > 12) ? 12 : i;
int m = (i > 12) ? 13 : i;
// this is a true bordel
const int row = (i/step) - 1;
@ -1890,7 +1899,7 @@ void Visliq_app::write_general(TMask& m)
// crea/aggiorna le deleghe
if (nvers != overs || nint != oint || ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
write_del(m, i == 12 ? 7 : 1, nabi, ncab, ncon, ndate, nvers, nint, nsta);
was_lim = look_lim(m);
was_lim = look_lim(m);
if (!was_lim)
carry = false; // blocca riporto crediti e debiti