Patch level :4.0 /10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :real calc_conai_qta(int type) const;
metodo aggiunto alla TRiga_documento


git-svn-id: svn://10.65.10.50/trunk@16216 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-02-25 10:27:45 +00:00
parent b06248e0e7
commit adbf06d2d0
3 changed files with 37 additions and 24 deletions

View File

@ -536,6 +536,8 @@ public:
real quantita() const;
real qtaevasa() const;
real qtaresidua() const;
real calc_conai_qta(int type) const;
real valore(bool totale, int ndec) const;
const TString & codice_costo() const;
const TString & codice_commessa() const;

View File

@ -770,6 +770,38 @@ real TRiga_documento::qtaresidua() const
return ZERO;
}
real TRiga_documento::calc_conai_qta(int type) const
{
const char* const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
real row_qta;
if (is_merce())
{
const bool has_formula = ((TTipo_riga_documento &)tipo()).has_formula(__conai_art_names[type]);
TArticolo_giacenza* art = articolo();
if (art != NULL)
{
const TString4 um = get(RDOC_UMQTA);
row_qta = art->convert_to_um(get_real(RDOC_QTA), NULL, um);
if (has_formula)
row_qta *= get_real(__conai_art_names[type]);
else
row_qta *= art->get_real(__conai_art_names[type]);
}
else
{
if (has_formula)
{
row_qta = get_real(RDOC_QTA);
row_qta *= get_real(__conai_art_names[type]);
}
}
}
return row_qta;
}
bool TRiga_documento::is_evasa() const
{
return qtaresidua().is_zero();

View File

@ -2418,8 +2418,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
}
real TDocumento::calc_conai_qta(int type)
{
const char* const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
{
real qta;
for (int i = physical_rows(); i > 0; i--)
@ -2427,29 +2426,9 @@ real TDocumento::calc_conai_qta(int type)
const TRiga_documento& r = row(i);
if (r.is_merce())
{
const bool has_formula = ((TTipo_riga_documento &)r.tipo()).has_formula(__conai_art_names[type]);
TArticolo_giacenza* art = r.articolo();
real row_qta;
if (art != NULL)
{
const TString4 um = r.get(RDOC_UMQTA);
row_qta = art->convert_to_um(r.get_real(RDOC_QTA), NULL, um);
const real row_qta = r.calc_conai_qta(type);
if (has_formula)
row_qta *= r.get_real(__conai_art_names[type]);
else
row_qta *= art->get_real(__conai_art_names[type]);
}
else
{
if (has_formula)
{
row_qta = r.get_real(RDOC_QTA);
row_qta *= r.get_real(__conai_art_names[type]);
}
}
if (row_qta > ZERO)
qta += row_qta;
qta += row_qta;
}
}
return qta;