Corretta conversione unita' di misura

git-svn-id: svn://10.65.10.50/trunk@5098 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-08-22 14:34:14 +00:00
parent c3d3c765bf
commit 57e462925a
3 changed files with 23 additions and 2 deletions

View File

@ -189,6 +189,10 @@ bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
ss.check_row(r);
ss.select(r);
}
else
if ( key == K_TAB ) // modifica
set_curr_um(ss.sheet_mask());
return TRUE;
}

View File

@ -74,6 +74,7 @@ bool dummy_hndl(TMask_field& field, KEY key);
bool condpag_hndl(TMask_field& field, KEY key);
bool note_hndl(TMask_field& field, KEY key);
bool data_hndl(TMask_field& field, KEY key);
void set_curr_um(const TMask & m);
class TDocumento_variable_field : public TVariable_field
{

View File

@ -387,6 +387,12 @@ bool liv_handler( TMask_field& f, KEY key )
next.on_hit();
}
return TRUE;
}
void set_curr_um(const TMask & m)
{
curr_um = m.get(FR_UMQTA);
curr_fc = -1.0;
}
bool umart_handler( TMask_field& f, KEY key )
@ -404,7 +410,6 @@ bool umart_handler( TMask_field& f, KEY key )
condv.set_riga(&row_mask);
condv.set_anamag(anamag);
condv.set_umart(umart);
condv.ricerca(TRUE);
const TString16 um(f.get());
real fc(1.0);
@ -417,15 +422,26 @@ bool umart_handler( TMask_field& f, KEY key )
if (umart.read() == NOERR)
{
real qta(row_mask.get_real(FR_QTA));
qta *= curr_fc;
fc = umart.get_real(UMART_FC);
if (curr_fc < ZERO)
{
umart.put(UMART_CODART, row_mask.get(FR_CODARTMAG));
umart.put(UMART_UM, curr_um);
if (umart.read() == NOERR)
curr_fc = umart.get_real(UMART_FC);
else
curr_fc = 1.0;
}
qta *= curr_fc;
qta /= fc;
qta.round(5);
row_mask.set(FR_QTA, qta);
}
}
curr_um = um;
curr_fc = fc;
condv.ricerca(TRUE);
}
return TRUE;
}