campo-sirio/sc/sc2102.cpp

59 lines
1.4 KiB
C++
Raw Normal View History

#include <currency.h>
#include "sc2102.h"
///////////////////////////////////////////////////////////
// Totalizzatore
///////////////////////////////////////////////////////////
TTotal::TTotal(const TImporto& imp, const real& sca,
const real& esp, const real& eur)
: _importo(imp), _scaduto(sca), _esposto(esp), _importo_euro(eur)
{ }
TTotal::TTotal(const TImporto& uns)
: _unassigned(uns)
{ }
void TTotalizer::add(const TImporto& imp, const real& sca,
const real& esp, const real& lit, const TString& val)
{
TString16 codice(val);
if (codice == TCurrency::get_firm_val())
codice.cut(0);
TObject* obj = objptr(codice);
if (obj != NULL)
{
TTotal& tot = (TTotal&)*obj;
tot.importo() += imp;
tot.scaduto() += sca;
tot.esposto() += esp;
tot.importo_euro() += lit;
}
else
{
obj = new TTotal(imp, sca, esp, lit);
TAssoc_array::add(codice, obj);
}
}
void TTotalizer::add(const TImporto& uns, const TString& val)
{
TString16 codice(val);
if (codice == TCurrency::get_firm_val())
codice.cut(0);
TObject* obj = objptr(codice);
if (obj != NULL)
{
TTotal& tot = (TTotal&)*obj;
tot.unassigned() += uns;
}
else
{
obj = new TTotal(uns);
TAssoc_array::add(codice, obj);
}
}