Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Migliorato calcolo conversioni tra unita' di misura
utilizzando il nuovo arrtondamento sulla tabella unita' di miusra


git-svn-id: svn://10.65.10.50/trunk@11029 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-04-17 09:28:32 +00:00
parent 256f531d8e
commit a23d06f10a
2 changed files with 9 additions and 9 deletions

View File

@ -1418,7 +1418,7 @@ void TDist2Explode::set(TToken_string& t, const TMask& msk)
_um = t.get(9);
_qta = t.get(10);
_datacons = t.get(12);
_acq_ven = t.get(13)[0] == 'X' ? TRUE : FALSE;
_acq_ven = t.get_char(13) == 'X' ? TRUE : FALSE;
_data_per = app().date_period(_datacons);
set(msk);
}

View File

@ -95,15 +95,13 @@ void TQuantita::convert(real& val, const TCodice_um& from_um,
const TCodice_um& to_um) const
{
CHECK(!from_um.blank() && !to_um.blank(), "Unita' di misura nulla");
if (from_um != to_um)
if (from_um != to_um && !val.is_zero())
{
if (!val.is_zero())
{
const real mul = get_factor(from_um);
const real div = get_factor(to_um);
val *= mul;
val /= div;
}
const real mul = get_factor(from_um);
const real div = get_factor(to_um);
val *= mul;
val /= div;
TArticolo::round_um(val, to_um);
}
}
@ -128,6 +126,7 @@ void TQuantita::convert2umbase()
_val *= _conv;
_um = dummy;
_conv = 1.0;
TArticolo::round_um(_val, _um);
}
}
@ -135,6 +134,7 @@ real TQuantita::base_val() const
{
CHECK(_conv > ZERO, "Invalid conversion factor");
real v = _conv * _val;
TArticolo::round_um(v, _um);
return v;
}