Sistemate collone per il saldaconto

git-svn-id: svn://10.65.10.50/trunk@4319 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-05-05 10:38:42 +00:00
parent 2bbed52028
commit 7ddb551258
2 changed files with 36 additions and 11 deletions

View File

@ -24,6 +24,7 @@ protected:
virtual void init_insert_mode(TMask&); virtual void init_insert_mode(TMask&);
static bool handle_sheet(TMask_field& f, KEY); static bool handle_sheet(TMask_field& f, KEY);
static bool codval_handler(TMask_field& f, KEY k); static bool codval_handler(TMask_field& f, KEY k);
static bool contab_handler(TMask_field& f, KEY k);
static bool impeff_notify(TSheet_field& s, int r, KEY key); static bool impeff_notify(TSheet_field& s, int r, KEY key);
virtual const char* get_next_key(); virtual const char* get_next_key();
TSheet_field& cess_sheet() const; TSheet_field& cess_sheet() const;
@ -256,6 +257,7 @@ bool TVariazione_effetti::user_create()
_com = new TLocalisamfile(LF_COMUNI); _com = new TLocalisamfile(LF_COMUNI);
_effetto = new TEffetto; _effetto = new TEffetto;
_msk->set_handler(F_CODVAL, codval_handler); _msk->set_handler(F_CODVAL, codval_handler);
_msk->set_handler(F_EFFCONT, contab_handler);
_msk->set_handler(F_SHEET_RIGHE, handle_sheet); _msk->set_handler(F_SHEET_RIGHE, handle_sheet);
righe_sheet().set_append(TRUE); righe_sheet().set_append(TRUE);
righe_sheet().set_notify(impeff_notify); righe_sheet().set_notify(impeff_notify);
@ -309,27 +311,49 @@ bool TVariazione_effetti::handle_sheet(TMask_field &f, KEY k)
bool TVariazione_effetti::codval_handler(TMask_field& f, KEY k) bool TVariazione_effetti::codval_handler(TMask_field& f, KEY k)
{ {
TMask &m = f.mask(); TMask &m = f.mask();
TString val(f.get());
if (f.to_check(k, TRUE)) if (f.to_check(k, TRUE))
{ {
const TString & val = f.get();
// se non c'e valuta o se è lire disabilito i campi collegati // se non c'e valuta o se è lire disabilito i campi collegati
const bool condition = (val == "LIT" || val.empty()); const bool valuta = (val.not_empty() && val != "LIT");
m.enable(-1,!condition); m.enable(-1,valuta);
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE); TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
if (condition) if (!valuta)
{ {
m.reset(-1); m.reset(-1);
m.reset(F_TOTIMPVAL); m.reset(F_TOTIMPVAL);
int items = sf.items(); for (int i = sf.items() - 1; i >= 0; i--)
for (int i = 0; i < items; i++)
{ {
TToken_string& row = sf.row(i); TToken_string& row = sf.row(i);
row.add(" ", 2); row.add(" ", sf.cid2index(F_IMPEFFVAL));
row.add(" ", 3); row.add(" ", sf.cid2index(F_IMPFATTVAL));
} }
} }
sf.enable_column(F_IMPFATTVAL, !condition); sf.enable_column(F_IMPFATTVAL, valuta);
sf.enable_column(F_IMPEFFVAL, !condition); sf.enable_column(F_IMPEFFVAL, valuta);
sf.force_update();
}
return TRUE;
}
bool TVariazione_effetti::contab_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask &m = f.mask();
const bool da_contab = f.get().empty();
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
if (da_contab)
{
for (int i = sf.items() - 1; i >= 0; i--)
{
TToken_string& row = sf.row(i);
row.add(" ", sf.cid2index(F_NUMRIGA));
}
}
sf.enable_column(F_ANNO, da_contab);
sf.enable_column(F_NUMPART, da_contab);
sf.force_update(); sf.force_update();
} }
return TRUE; return TRUE;

View File

@ -98,6 +98,7 @@ END
NUMBER F_NUMRIGA 4 NUMBER F_NUMRIGA 4
BEGIN BEGIN
PROMPT 2 12 "Nr. riga " PROMPT 2 12 "Nr. riga "
FLAGS "D"
END END
NUMBER F_NUMRATA 3 NUMBER F_NUMRATA 3