Patch level : 12.0 1232

Files correlati     : cg5.exe

Commento :
Aggiunto controllo per evitare crediti negativi
This commit is contained in:
Alessandro Bonazzi 2023-01-13 23:43:17 +01:00
parent 2cb3fc90aa
commit f45a946ed0
2 changed files with 24 additions and 3 deletions

@ -455,9 +455,16 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k)
return true;
}
bool Visliq_app::check_neg(TMask_field& f, KEY k)
{
if (k == K_ENTER && f.dirty() && f.get_real() < ZERO)
return f.error_box(TR("il credito deve essere positivo"));
return true;
}
bool Visliq_app::enable_date(TMask_field& f, KEY k)
{
if (k == K_TAB && (f.focusdirty()|| !f.mask().is_running()))
if (k == K_TAB && (f.focusdirty() || !f.mask().is_running()))
{
const bool enable = f.mask().get(S_RIMBORSO).full() || f.mask().get(S_CREDF24).full();
@ -465,6 +472,8 @@ bool Visliq_app::enable_date(TMask_field& f, KEY k)
if (!enable)
f.mask().set(S_DATAAUT, "");
}
if (f.dlg() == S_CREDF24)
return check_neg(f, k);
return true;
}
@ -647,7 +656,9 @@ bool Visliq_app::vis_all()
_mask->set_handler(DLG_PRINT, print_handler);
sh.sheet_mask().set_handler(100, sel_mese_sh1);
sh.sheet_mask().set_handler(S_RIMBORSO, enable_date);
sh.sheet_mask().set_handler(S_CREDF24, enable_date);
sh.sheet_mask().set_handler(S_CREDIVA, check_neg);
sh.sheet_mask().set_handler(S_CREDF24, enable_date);
sh.sheet_mask().set_handler(S_CREDF24PRE, check_neg);
sh.sheet_mask().set_handler(S_DATAAUT, check_date);
sv.sheet_mask().set_handler(100, sel_mese_sh2);
@ -684,6 +695,7 @@ bool Visliq_app::vis_all()
if (_mask->dirty())
{
KEY k = yesnocancel_box(TR("Registrare le modifiche effettuate?"));
if (k == K_YES)
write_general(*_mask);
else
@ -929,6 +941,7 @@ bool Visliq_app::vis_one(int m)
if (!recorded)
{
KEY kk = yesnocancel_box(TR("Modifiche non registrate: salvare?"));
if (kk == K_YES)
{
if (l_mod) { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); }
@ -1869,6 +1882,10 @@ void Visliq_app::write_general(TMask& m)
if (odbcr == "C") orett = -orett;
if (ndbcr == "C") nrett = -nrett;
if (crf24 < ZERO)
crf24 = ZERO;
if (autf24 < ZERO)
autf24 = ZERO;
// acconto (si considererà solo a dicembre)
// crea/aggiorna le deleghe
if (nvers != overs || nint != oint || ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
@ -2026,7 +2043,10 @@ void Visliq_app::write_general(TMask& m)
if (row == 3)
int i = 1;
const real criva(sh.get_real_row_cell(row, S_CREDIVA));
real criva(sh.get_real_row_cell(row, S_CREDIVA));
if (criva < ZERO)
criva = ZERO;
cr_res += autf24;
cr_res -= crf24;

@ -58,6 +58,7 @@ protected:
static bool set_ragsoc(TMask_field&, KEY);
static bool print_handler(TMask_field&, KEY);
static bool sel_mese_sh1 (TMask_field&, KEY);
static bool check_neg(TMask_field& f, KEY k);
static bool enable_date (TMask_field&, KEY);
static bool check_date (TMask_field&, KEY);
static bool sel_mese_sh2(TMask_field&, KEY);