Stampa EC: corretta gestione riporti
git-svn-id: svn://10.65.10.50/trunk@2279 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fb74dc3723
commit
82fccf970c
192
sc/sc2100.cpp
192
sc/sc2100.cpp
@ -35,9 +35,12 @@ class TEC_form : public TForm
|
|||||||
TDate _dlo, _dls, _dir; // Data limite operazione, scaduto e inizio rischio
|
TDate _dlo, _dls, _dir; // Data limite operazione, scaduto e inizio rischio
|
||||||
int _giorni_rischio; // Numero giorni rischio nella maschera di selezione
|
int _giorni_rischio; // Numero giorni rischio nella maschera di selezione
|
||||||
bool _in_valuta; // Il form e' in valuta
|
bool _in_valuta; // Il form e' in valuta
|
||||||
int _footer_used; // Numero di righe per ogni valuta del footer
|
word _num_rip; // Numero di righe usate per i riporti
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void stampa_testata(TPrinter& p);
|
||||||
|
void stampa_riporti(TPrinter& p);
|
||||||
|
|
||||||
static void ec_header_handler(TPrinter& p);
|
static void ec_header_handler(TPrinter& p);
|
||||||
static void ec_footer_handler(TPrinter& p);
|
static void ec_footer_handler(TPrinter& p);
|
||||||
|
|
||||||
@ -54,9 +57,10 @@ public:
|
|||||||
bool in_valuta() const { return _in_valuta; }
|
bool in_valuta() const { return _in_valuta; }
|
||||||
const TString& describe(short id, char sez = 'B') const;
|
const TString& describe(short id, char sez = 'B') const;
|
||||||
|
|
||||||
|
void azzera_totali();
|
||||||
bool print_game(const TPartita& game);
|
bool print_game(const TPartita& game);
|
||||||
|
|
||||||
TEC_form(const TEC_mask& m);
|
TEC_form(const TEC_mask& m, bool gesval);
|
||||||
virtual ~TEC_form();
|
virtual ~TEC_form();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -81,7 +85,7 @@ class TEC_row : public TSortable
|
|||||||
TString _num_doc; // Numero documento
|
TString _num_doc; // Numero documento
|
||||||
long _num_prot; // Protocollo IVA
|
long _num_prot; // Protocollo IVA
|
||||||
TImporto _importo; // Importo in valuta
|
TImporto _importo; // Importo in valuta
|
||||||
TImporto _importo_lire; // Importo in lire
|
real _importo_lire; // Importo in lire
|
||||||
real _scaduto; // Importo scaduto
|
real _scaduto; // Importo scaduto
|
||||||
real _esposto; // Importo esposto
|
real _esposto; // Importo esposto
|
||||||
bool _salvo_buon_fine; // Importo esposto salvo buon fine
|
bool _salvo_buon_fine; // Importo esposto salvo buon fine
|
||||||
@ -99,12 +103,14 @@ public:
|
|||||||
void reset_causale() { _causale.cut(0); _descrizione.cut(0); }
|
void reset_causale() { _causale.cut(0); _descrizione.cut(0); }
|
||||||
void descrizione(const char* s) { _descrizione = s; }
|
void descrizione(const char* s) { _descrizione = s; }
|
||||||
void importo(const TImporto& i) { _importo = i; }
|
void importo(const TImporto& i) { _importo = i; }
|
||||||
|
void importo_lire(const real& i) { _importo_lire = i; }
|
||||||
void scaduto(const real& s) { _scaduto = s; }
|
void scaduto(const real& s) { _scaduto = s; }
|
||||||
void esposto(const real& e) { _esposto = e; }
|
void esposto(const real& e) { _esposto = e; }
|
||||||
void salvo_buon_fine(bool sbf) { _salvo_buon_fine = sbf; }
|
void salvo_buon_fine(bool sbf) { _salvo_buon_fine = sbf; }
|
||||||
|
|
||||||
const TDate& data() const { return _data; }
|
const TDate& data() const { return _data; }
|
||||||
const TImporto& importo() const { return _importo; }
|
const TImporto& importo() const { return _importo; }
|
||||||
|
const real& importo_lire() const { return _importo_lire; }
|
||||||
real scaduto() const { return _scaduto; }
|
real scaduto() const { return _scaduto; }
|
||||||
real esposto() const { return _esposto; }
|
real esposto() const { return _esposto; }
|
||||||
const TValuta& valuta() const { return _valuta; }
|
const TValuta& valuta() const { return _valuta; }
|
||||||
@ -233,6 +239,9 @@ void TEC_row::print_on(TPrint_section& body)
|
|||||||
TForm_item& esposto = body.find_field(PEC_ESPOSTO);
|
TForm_item& esposto = body.find_field(PEC_ESPOSTO);
|
||||||
set_imp(esposto, _esposto, valuta);
|
set_imp(esposto, _esposto, valuta);
|
||||||
|
|
||||||
|
TForm_item& lire = body.find_field(PEC_IMPLIRE);
|
||||||
|
lire.set(_importo_lire.string());
|
||||||
|
|
||||||
TForm_item& sbf = body.find_field(PEC_SBF);
|
TForm_item& sbf = body.find_field(PEC_SBF);
|
||||||
sbf.set(_salvo_buon_fine ? "*" : " ");
|
sbf.set(_salvo_buon_fine ? "*" : " ");
|
||||||
|
|
||||||
@ -393,6 +402,7 @@ TEC_row& TEC_array::new_row(const TRiga_partite& row, const TDate& data,
|
|||||||
void TEC_array::add_row(const TRiga_partite& row)
|
void TEC_array::add_row(const TRiga_partite& row)
|
||||||
{
|
{
|
||||||
const bool in_valuta = form().in_valuta() && row.in_valuta();
|
const bool in_valuta = form().in_valuta() && row.in_valuta();
|
||||||
|
const char sezione = row.get_char(PART_TIPOCF) == 'C' ? 'D' : 'A';
|
||||||
|
|
||||||
if (row.is_fattura())
|
if (row.is_fattura())
|
||||||
{
|
{
|
||||||
@ -408,6 +418,12 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
const real s = calcola_scaduto(rata, in_valuta);
|
const real s = calcola_scaduto(rata, in_valuta);
|
||||||
rec.scaduto(s);
|
rec.scaduto(s);
|
||||||
}
|
}
|
||||||
|
if (in_valuta)
|
||||||
|
{
|
||||||
|
TImporto il = rata.importo(FALSE);
|
||||||
|
il.normalize(sezione);
|
||||||
|
rec.importo_lire(il.valore());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,7 +432,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
const TDate data(row.get(PART_DATAPAG));
|
const TDate data(row.get(PART_DATAPAG));
|
||||||
if (data <= form().data_limite_operazione())
|
if (data <= form().data_limite_operazione())
|
||||||
{
|
{
|
||||||
const TImporto imp(row.importo(in_valuta, 0x1)); // Importo pulito (senza abbuoni ecc.)
|
const TImporto imp(row.importo(in_valuta, 0x1)); // Importo pulito senza nient'altro
|
||||||
TEC_row& riga = new_row(row, data, imp, 1);
|
TEC_row& riga = new_row(row, data, imp, 1);
|
||||||
|
|
||||||
const int tipo_pag = row.get_int(PART_TIPOPAG);
|
const int tipo_pag = row.get_int(PART_TIPOPAG);
|
||||||
@ -452,15 +468,34 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
const TImporto abbuoni(row.importo(in_valuta, 0x2));
|
const TImporto abbuoni(row.importo(in_valuta, 0x2));
|
||||||
if (!abbuoni.is_zero())
|
if (!abbuoni.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& r = new_row(row, data, abbuoni, 2);
|
TEC_row& rec = new_row(row, data, abbuoni, 2);
|
||||||
r.descrizione(form().describe(302));
|
rec.descrizione(form().describe(302));
|
||||||
|
if (in_valuta)
|
||||||
|
{
|
||||||
|
TImporto il(row.importo(FALSE, 0x2));
|
||||||
|
il.normalize(sezione);
|
||||||
|
rec.importo_lire(il.valore());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TImporto diffcam(row.importo(in_valuta, 0x4));
|
const TImporto diffcam(row.importo(in_valuta, 0x4));
|
||||||
if (!diffcam.is_zero())
|
if (!diffcam.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& r = new_row(row, data, diffcam, 3);
|
TEC_row& rec = new_row(row, data, diffcam, 3);
|
||||||
r.descrizione(form().describe(303));
|
rec.descrizione(form().describe(303));
|
||||||
|
if (in_valuta)
|
||||||
|
{
|
||||||
|
TImporto il(row.importo(FALSE, 0x4));
|
||||||
|
il.normalize(sezione);
|
||||||
|
rec.importo_lire(il.valore());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const TImporto ritenute(row.importo(in_valuta, 0x8));
|
||||||
|
if (!ritenute.is_zero())
|
||||||
|
{
|
||||||
|
TEC_row& r = new_row(row, data, ritenute, 4);
|
||||||
|
r.descrizione(form().describe(304));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,14 +530,28 @@ TEC_array::TEC_array(const TPartita& game, const TEC_form* f)
|
|||||||
// Form speciale per estratti conto
|
// Form speciale per estratti conto
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TEC_form::ec_header_handler(TPrinter& pr)
|
void TEC_form::stampa_testata(TPrinter& pr)
|
||||||
{
|
{
|
||||||
TPrint_section& head = _form->section('H');
|
TPrint_section& head = section('H');
|
||||||
head.reset();
|
|
||||||
pr.resetheader();
|
TForm_item& pagina = head.find_field(PEC_PAGINA);
|
||||||
|
TString16 pg; pg << int(pr.getcurrentpage());
|
||||||
|
pagina.set(pg);
|
||||||
|
|
||||||
head.update();
|
head.update();
|
||||||
for (word j = 0; j < head.height(); j++)
|
|
||||||
|
const word r = head.height()-1;
|
||||||
|
TPrintrow& head_row = head.row(r-1);
|
||||||
|
|
||||||
|
TPrint_section& body = section('B');
|
||||||
|
for (int f = body.fields()-1; f >= 0; f--)
|
||||||
|
{
|
||||||
|
// Leggi lo special e stampalo
|
||||||
|
TForm_item& fi = body.field(f);
|
||||||
|
head_row.put(fi.key(), offset_x() + fi.x());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (word j = 0; j <= r; j++)
|
||||||
pr.setheaderline(j, head.row(j));
|
pr.setheaderline(j, head.row(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,37 +566,34 @@ static int tot_compare(const void* o1, const void* o2)
|
|||||||
return stricmp(h1->key(), h2->key());
|
return stricmp(h1->key(), h2->key());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEC_form::ec_footer_handler(TPrinter& pr)
|
void TEC_form::stampa_riporti(TPrinter& pr)
|
||||||
{
|
{
|
||||||
TPrint_section& foot = _form->section('F');
|
|
||||||
pr.resetfooter();
|
|
||||||
|
|
||||||
const word MAXTOT = 16;
|
const word MAXTOT = 16;
|
||||||
THash_object* tot[MAXTOT];
|
THash_object* tot[MAXTOT];
|
||||||
|
|
||||||
// I totali sono in un assoc array disordinato per cui li copio in un array e li ordino
|
// I totali sono in un assoc array disordinato per cui li copio in un array e li ordino
|
||||||
// alfabeticamente in base al loro codice valuta
|
// alfabeticamente in base al loro codice valuta
|
||||||
TTotalizer& totali = _form->totali();
|
TTotalizer& arr = totali();
|
||||||
totali.restart();
|
arr.restart();
|
||||||
|
|
||||||
word numtot = 0;
|
_num_rip = 0;
|
||||||
for (THash_object* obj = totali.get_hashobj();
|
for (THash_object* obj = arr.get_hashobj();
|
||||||
numtot < MAXTOT && obj != NULL;
|
_num_rip < MAXTOT && obj != NULL;
|
||||||
obj = totali.get_hashobj())
|
obj = arr.get_hashobj())
|
||||||
tot[numtot++] = obj;
|
tot[_num_rip++] = obj;
|
||||||
qsort(tot, numtot, sizeof(THash_object*), tot_compare);
|
qsort(tot, _num_rip, sizeof(THash_object*), tot_compare);
|
||||||
|
|
||||||
|
|
||||||
|
const word maxtot = section('F').height();
|
||||||
|
if (_num_rip > maxtot)
|
||||||
|
_num_rip = maxtot;
|
||||||
|
|
||||||
const word maxtot = foot.height() / _form->_footer_used;
|
const TString& riporto = describe(301, 'F');
|
||||||
if (numtot > maxtot)
|
|
||||||
numtot = maxtot;
|
|
||||||
|
|
||||||
const TString& riporto = _form->describe(301, 'F');
|
|
||||||
|
|
||||||
TString desc(80);
|
TString desc(80);
|
||||||
TPrint_section& body = _form->section('B');
|
TPrint_section& body = section('B');
|
||||||
for (word j = 0; j < numtot; j++)
|
for (word j = 0; j < _num_rip; j++)
|
||||||
{
|
{
|
||||||
const word line = j * _form->_footer_used;
|
|
||||||
const TString& key = tot[j]->key();
|
const TString& key = tot[j]->key();
|
||||||
TTotal& t = (TTotal&)(tot[j]->obj());
|
TTotal& t = (TTotal&)(tot[j]->obj());
|
||||||
|
|
||||||
@ -557,13 +603,30 @@ void TEC_form::ec_footer_handler(TPrinter& pr)
|
|||||||
TEC_row rip(desc, t.importo().normalize());
|
TEC_row rip(desc, t.importo().normalize());
|
||||||
rip.scaduto(t.scaduto());
|
rip.scaduto(t.scaduto());
|
||||||
rip.esposto(t.esposto());
|
rip.esposto(t.esposto());
|
||||||
|
rip.importo_lire(t.importo_lire());
|
||||||
rip.print_on(body);
|
rip.print_on(body);
|
||||||
|
pr.setfooterline(j, body.row(0));
|
||||||
for (int fl = 0; fl < _form->_footer_used; fl++)
|
|
||||||
pr.setfooterline(line, body.row(fl));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TEC_form::ec_header_handler(TPrinter& pr)
|
||||||
|
{
|
||||||
|
pr.resetheader();
|
||||||
|
_form->stampa_testata(pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TEC_form::ec_footer_handler(TPrinter& pr)
|
||||||
|
{
|
||||||
|
pr.resetfooter();
|
||||||
|
if (_form->page(pr) > 0) // Normal page
|
||||||
|
_form->stampa_riporti(pr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TEC_form::azzera_totali()
|
||||||
|
{
|
||||||
|
totali().destroy();
|
||||||
|
_num_rip = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool TEC_form::print_game(const TPartita& game)
|
bool TEC_form::print_game(const TPartita& game)
|
||||||
{
|
{
|
||||||
@ -577,7 +640,7 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
TPrint_section& body = section('B');
|
TPrint_section& body = section('B');
|
||||||
|
|
||||||
TImporto saldo;
|
TImporto saldo;
|
||||||
real scaduto, esposto;
|
real scaduto, esposto, implire;
|
||||||
|
|
||||||
// Stampa le righe di partita
|
// Stampa le righe di partita
|
||||||
|
|
||||||
@ -589,7 +652,15 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
TEC_row& riga = righe.row(r);
|
TEC_row& riga = righe.row(r);
|
||||||
|
|
||||||
if (pr.rows_left() < body.height())
|
if (pr.rows_left() < body.height())
|
||||||
|
{
|
||||||
pr.formfeed();
|
pr.formfeed();
|
||||||
|
for (word nr = 0; nr < _num_rip; nr++)
|
||||||
|
{
|
||||||
|
TPrintrow* fl = pr.getfooterline(nr);
|
||||||
|
CHECKD(fl, "Manca la riga di riporto ", nr);
|
||||||
|
pr.print(*fl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const int ri = riga.riga();
|
const int ri = riga.riga();
|
||||||
const int ra = riga.rata();
|
const int ra = riga.rata();
|
||||||
@ -601,11 +672,13 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
riga.print_on(body);
|
riga.print_on(body);
|
||||||
pr.print(body.row(0));
|
pr.print(body.row(0));
|
||||||
|
|
||||||
totali().add(riga.importo(), riga.scaduto(), riga.esposto(), riga.valuta().codice());
|
totali().add(riga.importo(), riga.scaduto(), riga.esposto(),
|
||||||
|
riga.importo_lire(), riga.valuta().codice());
|
||||||
|
|
||||||
saldo += riga.importo();
|
saldo += riga.importo();
|
||||||
scaduto += riga.scaduto();
|
scaduto += riga.scaduto();
|
||||||
esposto += riga.esposto();
|
esposto += riga.esposto();
|
||||||
|
implire += riga.importo_lire();
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,6 +689,7 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
TEC_row sld(describe(301), saldo);
|
TEC_row sld(describe(301), saldo);
|
||||||
sld.scaduto(scaduto);
|
sld.scaduto(scaduto);
|
||||||
sld.esposto(esposto);
|
sld.esposto(esposto);
|
||||||
|
sld.importo_lire(implire);
|
||||||
sld.print_on(body);
|
sld.print_on(body);
|
||||||
pr.print(body.row(0));
|
pr.print(body.row(0));
|
||||||
|
|
||||||
@ -632,15 +706,15 @@ const TString& TEC_form::describe(short id, char sez) const
|
|||||||
return fi.prompt();
|
return fi.prompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEC_form::TEC_form(const TEC_mask& m)
|
TEC_form::TEC_form(const TEC_mask& m, bool gesval)
|
||||||
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
||||||
_in_valuta(FALSE), _footer_used(1),
|
_in_valuta(FALSE), _num_rip(0),
|
||||||
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
||||||
{
|
{
|
||||||
_form = this;
|
_form = this;
|
||||||
|
|
||||||
TForm_item& imp_lire = find_field('B', odd_page, PEC_IMPLIRE);
|
TForm_item& imp_lire = find_field('B', odd_page, PEC_IMPLIRE);
|
||||||
_in_valuta = imp_lire.shown(); // Il profilo e' in valuta se c'e' la colonna importo in lire
|
_in_valuta = gesval && imp_lire.shown(); // Il profilo e' in valuta se c'e' la colonna importo in lire
|
||||||
|
|
||||||
_lingua = m.get_prof_lang(); // Lingua profilo
|
_lingua = m.get_prof_lang(); // Lingua profilo
|
||||||
|
|
||||||
@ -651,22 +725,25 @@ TEC_form::TEC_form(const TEC_mask& m)
|
|||||||
_dls = m.get(F_DATALIMSC);
|
_dls = m.get(F_DATALIMSC);
|
||||||
_giorni_rischio = m.get_int(F_GIORISCH);
|
_giorni_rischio = m.get_int(F_GIORISCH);
|
||||||
_dir = _dls; _dir -= _giorni_rischio;
|
_dir = _dls; _dir -= _giorni_rischio;
|
||||||
|
|
||||||
TPrinter& pr = printer();
|
TPrinter& pr = printer();
|
||||||
|
|
||||||
pr.setheaderhandler(ec_header_handler);
|
pr.setheaderhandler(ec_header_handler);
|
||||||
|
TPrint_section& head = section('H');
|
||||||
pr.headerlen(section('H').height());
|
pr.headerlen(section('H').height());
|
||||||
|
|
||||||
|
TForm_item& luogo_invio = head.find_field(PEC_LUOGOIN);
|
||||||
|
luogo_invio.set(m.get(F_LUOGOSEND));
|
||||||
|
|
||||||
|
TForm_item& data_invio = head.find_field(PEC_DATAIN);
|
||||||
|
data_invio.set(m.get(F_DATASEND));
|
||||||
|
|
||||||
|
TForm_item& testo_memo = head.find_field(PEC_MEMO);
|
||||||
|
testo_memo.set("Per favore pagatemi che sono alla frutta!");
|
||||||
|
|
||||||
pr.setfooterhandler(ec_footer_handler);
|
pr.setfooterhandler(ec_footer_handler);
|
||||||
const TPrint_section& foot = section('F');
|
const TPrint_section& foot = section('F');
|
||||||
pr.footerlen(foot.height());
|
pr.footerlen(foot.height());
|
||||||
|
|
||||||
for (int i = foot.fields()-1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
TForm_item& fi = foot.field(i);
|
|
||||||
if (fi.y() > _footer_used)
|
|
||||||
_footer_used = fi.y();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEC_form::~TEC_form()
|
TEC_form::~TEC_form()
|
||||||
@ -766,8 +843,8 @@ bool TStampaEC_application::print_ec()
|
|||||||
|
|
||||||
if (!ok) // Cliente analfabeta
|
if (!ok) // Cliente analfabeta
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
f.totali().destroy(); // Azzera totali di fine pagina
|
f.azzera_totali(); // Azzera totali di fine pagina
|
||||||
|
|
||||||
// Filtra solo le partite del cliente selezionato
|
// Filtra solo le partite del cliente selezionato
|
||||||
TLocalisamfile& partite = _file[LF_PARTITE];
|
TLocalisamfile& partite = _file[LF_PARTITE];
|
||||||
@ -816,7 +893,10 @@ bool TStampaEC_application::print_ec()
|
|||||||
one_printed = TRUE;
|
one_printed = TRUE;
|
||||||
|
|
||||||
partite.put(PART_NRIGA, 9999);
|
partite.put(PART_NRIGA, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (one_printed)
|
||||||
|
form().set_last_page(TRUE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -859,7 +939,7 @@ bool TStampaEC_application::menu(MENU_TAG)
|
|||||||
TEC_mask& m = mask();
|
TEC_mask& m = mask();
|
||||||
while (m.run() != K_QUIT)
|
while (m.run() != K_QUIT)
|
||||||
{
|
{
|
||||||
_form = new TEC_form(m);
|
_form = new TEC_form(m, _gesval);
|
||||||
|
|
||||||
print_selected();
|
print_selected();
|
||||||
|
|
||||||
|
110
sc/sc2102.cpp
110
sc/sc2102.cpp
@ -1,54 +1,56 @@
|
|||||||
|
|
||||||
#include "sc2102.h"
|
#include "sc2102.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Totalizzatore
|
// Totalizzatore
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TTotal::TTotal(const TImporto& imp, const real& sca, const real& esp)
|
TTotal::TTotal(const TImporto& imp, const real& sca,
|
||||||
: _importo(imp), _scaduto(sca), _esposto(esp)
|
const real& esp, const real& lit)
|
||||||
{ }
|
: _importo(imp), _scaduto(sca), _esposto(esp), _importo_lire(lit)
|
||||||
|
{ }
|
||||||
void TTotalizer::add(const TImporto& imp, const real& sca,
|
|
||||||
const real& esp, const TString& val)
|
void TTotalizer::add(const TImporto& imp, const real& sca,
|
||||||
{
|
const real& esp, const real& lit, const TString& val)
|
||||||
TString16 codice(val);
|
{
|
||||||
if (codice == "LIT")
|
TString16 codice(val);
|
||||||
codice.cut(0);
|
if (codice == "LIT")
|
||||||
|
codice.cut(0);
|
||||||
TObject* obj = objptr(codice);
|
|
||||||
if (obj != NULL)
|
TObject* obj = objptr(codice);
|
||||||
{
|
if (obj != NULL)
|
||||||
TTotal& tot = (TTotal&)*obj;
|
{
|
||||||
tot.importo() += imp;
|
TTotal& tot = (TTotal&)*obj;
|
||||||
tot.scaduto() += sca;
|
tot.importo() += imp;
|
||||||
tot.esposto() += esp;
|
tot.scaduto() += sca;
|
||||||
}
|
tot.esposto() += esp;
|
||||||
else
|
tot.importo_lire() += lit;
|
||||||
{
|
}
|
||||||
obj = new TTotal(imp, sca, esp);
|
else
|
||||||
TAssoc_array::add(codice, obj);
|
{
|
||||||
}
|
obj = new TTotal(imp, sca, esp, lit);
|
||||||
}
|
TAssoc_array::add(codice, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// TFilearray
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
// TFilearray
|
||||||
void TFile_array::open(int logicnum, ...)
|
///////////////////////////////////////////////////////////
|
||||||
{
|
|
||||||
va_list marker;
|
void TFile_array::open(int logicnum, ...)
|
||||||
va_start(marker, logicnum);
|
{
|
||||||
while (logicnum > 0)
|
va_list marker;
|
||||||
{
|
va_start(marker, logicnum);
|
||||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
while (logicnum > 0)
|
||||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
{
|
||||||
logicnum = va_arg(marker, int);
|
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
||||||
}
|
_file.add(new TLocalisamfile(logicnum), logicnum);
|
||||||
}
|
logicnum = va_arg(marker, int);
|
||||||
|
}
|
||||||
void TFile_array::close()
|
}
|
||||||
{
|
|
||||||
_file.destroy();
|
void TFile_array::close()
|
||||||
}
|
{
|
||||||
|
_file.destroy();
|
||||||
|
}
|
||||||
|
134
sc/sc2102.h
134
sc/sc2102.h
@ -1,65 +1,69 @@
|
|||||||
|
|
||||||
#ifndef __SC2102_H
|
#ifndef __SC2102_H
|
||||||
#define __SC2102_H
|
#define __SC2102_H
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <array.h>
|
#include <array.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Totalizzatore
|
// Totalizzatore
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TTotal : public TObject
|
class TTotal : public TObject
|
||||||
{
|
{
|
||||||
TImporto _importo;
|
TImporto _importo;
|
||||||
real _scaduto;
|
real _scaduto;
|
||||||
real _esposto;
|
real _esposto;
|
||||||
|
real _importo_lire;
|
||||||
public:
|
|
||||||
const TImporto& importo() const { return _importo; }
|
public:
|
||||||
const real& scaduto() const { return _scaduto; }
|
const TImporto& importo() const { return _importo; }
|
||||||
const real& esposto() const { return _esposto; }
|
const real& importo_lire() const { return _importo_lire; }
|
||||||
TImporto& importo() { return _importo; }
|
const real& scaduto() const { return _scaduto; }
|
||||||
real& scaduto() { return _scaduto; }
|
const real& esposto() const { return _esposto; }
|
||||||
real& esposto() { return _esposto; }
|
TImporto& importo() { return _importo; }
|
||||||
|
real& importo_lire() { return _importo_lire; }
|
||||||
TTotal(const TImporto& imp, const real& scaduto, const real& esposto);
|
real& scaduto() { return _scaduto; }
|
||||||
virtual ~TTotal() {}
|
real& esposto() { return _esposto; }
|
||||||
};
|
|
||||||
|
TTotal(const TImporto& imp, const real& scaduto,
|
||||||
class TTotalizer : public TAssoc_array
|
const real& esposto, const real& implire);
|
||||||
{
|
virtual ~TTotal() {}
|
||||||
public:
|
};
|
||||||
void add(const TImporto& imp, const real& scaduto,
|
|
||||||
const real& esposto, const TString& val);
|
class TTotalizer : public TAssoc_array
|
||||||
|
{
|
||||||
TTotalizer() { }
|
public:
|
||||||
virtual ~TTotalizer() { }
|
void add(const TImporto& imp, const real& scaduto,
|
||||||
};
|
const real& esposto, const real& implire, const TString& val);
|
||||||
|
|
||||||
|
TTotalizer() { }
|
||||||
///////////////////////////////////////////////////////////
|
virtual ~TTotalizer() { }
|
||||||
// TFilearray
|
};
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class TFile_array
|
///////////////////////////////////////////////////////////
|
||||||
{
|
// TFilearray
|
||||||
TArray _file;
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public:
|
class TFile_array
|
||||||
void open(int num, ...);
|
{
|
||||||
void close();
|
TArray _file;
|
||||||
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
|
||||||
TLocalisamfile& operator[](int num) const { return file(num); }
|
public:
|
||||||
|
void open(int num, ...);
|
||||||
TFile_array() {}
|
void close();
|
||||||
virtual ~TFile_array() {}
|
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
||||||
};
|
TLocalisamfile& operator[](int num) const { return file(num); }
|
||||||
|
|
||||||
#endif // __SC2102_H
|
TFile_array() {}
|
||||||
|
virtual ~TFile_array() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __SC2102_H
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#ifndef __SC21PEC_H
|
#ifndef __SC21PEC_H
|
||||||
#define __SC21PEC_H
|
#define __SC21PEC_H
|
||||||
|
|
||||||
|
#define PEC_LUOGOIN 101
|
||||||
|
#define PEC_DATAIN 102
|
||||||
|
#define PEC_MEMO 103
|
||||||
|
|
||||||
#define PEC_CODCAUS 201
|
#define PEC_CODCAUS 201
|
||||||
#define PEC_DESCR1 202
|
#define PEC_DESCR1 202
|
||||||
@ -18,5 +22,6 @@
|
|||||||
#define PEC_IMPLIRE 215
|
#define PEC_IMPLIRE 215
|
||||||
#define PEC_CAMBIO 216
|
#define PEC_CAMBIO 216
|
||||||
#define PEC_DATACAM 217
|
#define PEC_DATACAM 217
|
||||||
|
#define PEC_PAGINA 218
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user