Patch level : 2.0 602

Files correlati     : ef0.exe ef0300c.msk
Ricompilazione Demo : [ ]
Commento            :

GF20109
Quando, nella pagina della selezione, spunto sulle riba per selezionarle
alla prima selezione l'importo sotto non viene aggiornato, alla seconda spunta,
viene messo l'importo della  prima ri.ba e così via; succede la stessa cosa
anche quando da una distinta creata cerco di sottrarre delle riba che in
quella distinta per errore sono state selzionate.


git-svn-id: svn://10.65.10.50/trunk@11503 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-10-16 08:38:04 +00:00
parent 23efd93d02
commit 237316d334
2 changed files with 56 additions and 41 deletions

View File

@ -36,9 +36,10 @@ protected:
virtual bool has_filtered_cursor() const { return true; } virtual bool has_filtered_cursor() const { return true; }
static bool tipodist_handler(TMask_field& f, KEY k); static bool tipodist_handler(TMask_field& f, KEY k);
static bool importo_handler(TMask_field& f, KEY k); static bool importo_handler(TMask_field& f, KEY k);
static bool imp_aut_handler(TMask_field& f, KEY k); static bool imp_sel_handler(TMask_field& f, KEY k);
static bool check_handler(TMask_field& f, KEY k);
static bool imp_notify(TSheet_field& s, int r, KEY key);
static bool impdist_notify(TSheet_field& s, int r, KEY key); static bool impdist_notify(TSheet_field& s, int r, KEY key);
static bool imp_notify(TSheet_field& s, int r, KEY key);
static bool conferma_handler(TMask_field& f, KEY k); static bool conferma_handler(TMask_field& f, KEY k);
static bool annulla_handler(TMask_field& f, KEY k); static bool annulla_handler(TMask_field& f, KEY k);
static bool data_handler(TMask_field& f, KEY k); static bool data_handler(TMask_field& f, KEY k);
@ -53,9 +54,9 @@ protected:
static void ord_fatt(); static void ord_fatt();
// ritorna un riferimento allo sheet degli effetti (righe) nella // ritorna un riferimento allo sheet degli effetti (righe) nella
// distinta // distinta
TSheet_field& righe_sheet() const { return (TSheet_field&)_msk->field(F_SHEET_RIBA); } TSheet_field& righe_sheet() const { return _msk->sfield(F_SHEET_RIBA); }
// ritorna un riferimento allo sheet delle righe // ritorna un riferimento allo sheet delle righe
TSheet_field& righe_sel_sheet() const { return (TSheet_field&)_m2->field(F_SHEET); } TSheet_field& righe_sel_sheet() const { return _m2->sfield(F_SHEET); }
bool cerca(long num); bool cerca(long num);
bool user_create(); bool user_create();
bool user_destroy(); bool user_destroy();
@ -231,9 +232,9 @@ int TVariazione_distinte::read(TMask& m)
riga.add(cache().get(LF_CLIFO, codice, CLI_RAGSOC)); riga.add(cache().get(LF_CLIFO, codice, CLI_RAGSOC));
codice = eff.get(EFF_CODABI); codice = eff.get(EFF_CODABI);
TString desc(cache().get("%BAN", codice, "S0")); TString desc = cache().get("%BAN", codice, "S0");
codice << eff.get(EFF_CODCAB); codice << eff.get(EFF_CODCAB);
desc << " " << cache().get("%BAN", codice, "S0"); desc << ' ' << cache().get("%BAN", codice, "S0");
desc.cut(50); desc.cut(50);
riga.add(desc); riga.add(desc);
@ -398,17 +399,20 @@ bool TVariazione_distinte::user_create()
_distinta = new TDistinta; _distinta = new TDistinta;
set_search_field(F_NUMBER);//setto il campo di ricerca della distinta set_search_field(F_NUMBER);//setto il campo di ricerca della distinta
_msk->set_handler(F_TIPODIST, tipodist_handler); _msk->set_handler(F_TIPODIST, tipodist_handler);
_msk->set_handler(F_IMPBUTTON, importo_handler); _msk->set_handler(F_IMPBUTTON, importo_handler);
_msk->set_handler(F_UNCONTABIL, uncontabilize_handler); _msk->set_handler(F_UNCONTABIL, uncontabilize_handler);
_m2->set_handler(F_TOTIMPDIST, imp_aut_handler); righe_sheet().set_notify(impdist_notify);
_m2->set_handler(F_IMPSEL, imp_sel_handler);
_m2->set_handler(DLG_OK, conferma_handler); _m2->set_handler(DLG_OK, conferma_handler);
_m2->set_handler(DLG_CANCEL, annulla_handler); _m2->set_handler(DLG_CANCEL, annulla_handler);
_m2->set_handler(F_DADATA, data_handler); _m2->set_handler(F_DADATA, data_handler);
_m2->set_handler(F_ADATA, data_handler); _m2->set_handler(F_ADATA, data_handler);
_m2->set_handler(F_TIPORD, ordina_handler); _m2->set_handler(F_TIPORD, ordina_handler);
righe_sheet().set_notify(impdist_notify); righe_sel_sheet().set_notify(imp_notify);
righe_sel_sheet().set_notify(imp_notify); righe_sel_sheet().sheet_mask().set_handler(FIRST_FIELD, check_handler);
return TRUE; return TRUE;
} }
@ -575,7 +579,7 @@ bool TVariazione_distinte::importo_handler(TMask_field& f, KEY k)
// Handler per gestire il caricamento degli effetti nella distinta in // Handler per gestire il caricamento degli effetti nella distinta in
// automatico relativamente ad un importo fissato (per la maschera // automatico relativamente ad un importo fissato (per la maschera
// secondaria) // secondaria)
bool TVariazione_distinte::imp_aut_handler(TMask_field& f, KEY k) bool TVariazione_distinte::imp_sel_handler(TMask_field& f, KEY k)
{ {
TMask& m2 = f.mask(); TMask& m2 = f.mask();
// se quando si entra nell maschera il campo contiene un valore // se quando si entra nell maschera il campo contiene un valore
@ -586,7 +590,7 @@ bool TVariazione_distinte::imp_aut_handler(TMask_field& f, KEY k)
TMask* m = app()._msk; TMask* m = app()._msk;
TSheet_field& sf = (TSheet_field&)m2.field(F_SHEET); TSheet_field& sf = (TSheet_field&)m2.field(F_SHEET);
TSheet_field& sf_riba = (TSheet_field&)m->field(F_SHEET_RIBA); TSheet_field& sf_riba = (TSheet_field&)m->field(F_SHEET_RIBA);
real res = m2.get_real(F_TOTIMPDIST); real res = m2.get_real(F_IMPSEL);
if (res > ZERO) if (res > ZERO)
{ // se i due importi sono diversi da zero { // se i due importi sono diversi da zero
TString16 val = m->get(F_CODVAL); TString16 val = m->get(F_CODVAL);
@ -855,36 +859,40 @@ void TVariazione_distinte::calcola_totale()
// distinta nella maschera di scelta delle riba (ef0300c) // distinta nella maschera di scelta delle riba (ef0300c)
void TVariazione_distinte::calcola() void TVariazione_distinte::calcola()
{ {
TMask* m2 = app()._m2; TMask& m2 = *app()._m2;
TMask* m = app()._msk; TSheet_field& sf = m2.sfield(F_SHEET);
TSheet_field& sf = (TSheet_field&)m2->field(F_SHEET); const bool valuta = ::is_true_value(m2.get(F_CODVALS));
const int items = sf.items(); const int imp_col = sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO); // Colonna con importo
real impsel; real impsel;
const real imp_pres = m->get_real(F_TOTIMP); for (int i = 0; i < sf.items(); i++)
const TString16 codval = m->get(F_CODVAL);
const bool valuta = ::is_true_value(codval);
for (int i = 0; i < items; i++)
{ {
TToken_string& row = sf.row(i); TToken_string& row = sf.row(i);
// se l'effetto è selezionato aggiungo il suo importo al totale importo // se l'effetto è selezionato aggiungo il suo importo al totale importo
// selezionato // selezionato
if (*row.get(0) == 'X') if (row.get_char(0) == 'X')
{ {
const real imp = row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO)); const real imp = row.get(imp_col);
impsel += imp; impsel += imp;
} }
} }
m2->set(F_IMPSEL, impsel); m2.set(F_IMPSEL, impsel);
m2->set(F_TOTIMPDIST, impsel);
const real imp_pres = app()._msk->get_real(F_TOTIMP);
m2.set(F_TOTIMPDIST, real(imp_pres+impsel));
} }
// Notify per il calcolo dei totali relativi alla selezione effetti // Notify per il calcolo dei totali relativi alla selezione effetti
// per la distinta nella maschera di scelta delle riba (ef0300c) // per la distinta nella maschera di scelta delle riba (ef0300c)
bool TVariazione_distinte::imp_notify(TSheet_field& s, int r, KEY key) bool TVariazione_distinte::check_handler(TMask_field& f, KEY key)
{ {
if (s.to_check(key, TRUE)) if (key == K_SPACE)
calcola(); {
TSheet_field& s = app().righe_sel_sheet();
TToken_string& row = s.row(s.selected());
const bool checked = f.get().not_empty();
row.add(checked ? "X" : "", 0);
app().calcola();
}
return TRUE; return TRUE;
} }
@ -901,10 +909,8 @@ void TVariazione_distinte::aggiungi()
TWait_cursor hourglass; TWait_cursor hourglass;
carica_riba(tipopag); carica_riba(tipopag);
} }
m2->reset(F_TOTIMPDIST); m2->set(F_CODVALS, m->get(F_CODVAL));
m2->reset(F_IMPSEL); calcola();
const TString16 codval = m->get(F_CODVAL);
m2->set(F_CODVALS, codval);
m2->run(); m2->run();
calcola_totale(); calcola_totale();
} }
@ -924,6 +930,13 @@ bool TVariazione_distinte::impdist_notify(TSheet_field& s, int r, KEY key)
return TRUE; return TRUE;
} }
bool TVariazione_distinte::imp_notify(TSheet_field& s, int r, KEY key)
{
if (key == K_DEL || key == K_INS)
return false;
return true;
}
int ef0300(int argc, char* argv[]) int ef0300(int argc, char* argv[])
{ {
TVariazione_distinte a ; TVariazione_distinte a ;

View File

@ -26,7 +26,7 @@ BEGIN
ITEM "F|Fattura " ITEM "F|Fattura "
END END
SPREADSHEET F_SHEET 74 9 SPREADSHEET F_SHEET 74 10
BEGIN BEGIN
PROMPT 2 6 "EFFETTI SELEZIONABILI" PROMPT 2 6 "EFFETTI SELEZIONABILI"
ITEM "Sel." ITEM "Sel."
@ -48,24 +48,26 @@ BEGIN
FLAGS "H" FLAGS "H"
END END
CURRENCY F_TOTIMPDIST 18
BEGIN
PROMPT 2 17 "Importo "
DRIVENBY F_CODVALS
END
CURRENCY F_IMPSEL 18 CURRENCY F_IMPSEL 18
BEGIN BEGIN
PROMPT 37 17 "Importo Selezionato " PROMPT 2 17 "Imp. selezionato "
DRIVENBY F_CODVALS DRIVENBY F_CODVALS
END END
BUTTON DLG_OK 9 2 CURRENCY F_TOTIMPDIST 18
BEGIN
PROMPT 40 17 "Imp. presentazione "
DRIVENBY F_CODVALS
FLAGS "D"
END
BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 9 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END