Stampa EC
git-svn-id: svn://10.65.10.50/trunk@2264 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5b82a2a49b
commit
dc1243ae57
244
sc/sc2100.cpp
244
sc/sc2100.cpp
@ -32,7 +32,9 @@ class TEC_form : public TForm
|
|||||||
TDecoder _causali;
|
TDecoder _causali;
|
||||||
|
|
||||||
TString _lingua;
|
TString _lingua;
|
||||||
TDate _dlo, _dls;
|
TDate _dlo, _dls, _dir;
|
||||||
|
int _giorni_rischio;
|
||||||
|
bool _in_valuta;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void ec_header_handler(TPrinter& p);
|
static void ec_header_handler(TPrinter& p);
|
||||||
@ -44,7 +46,12 @@ public:
|
|||||||
|
|
||||||
const TDate& data_limite_operazione() const { return _dlo; }
|
const TDate& data_limite_operazione() const { return _dlo; }
|
||||||
const TDate& data_limite_scaduto() const { return _dls; }
|
const TDate& data_limite_scaduto() const { return _dls; }
|
||||||
|
int giorni_rischio() const { return _giorni_rischio; }
|
||||||
|
const TDate& data_inizio_rischio() const { return _dir; }
|
||||||
|
|
||||||
const TString& lingua() const { return _lingua; }
|
const TString& lingua() const { return _lingua; }
|
||||||
|
bool in_valuta() const { return _in_valuta; }
|
||||||
|
const TString& describe(short id, char sez = 'B') const;
|
||||||
|
|
||||||
bool print_game(const TPartita& game);
|
bool print_game(const TPartita& game);
|
||||||
|
|
||||||
@ -75,6 +82,8 @@ class TEC_row : public TSortable
|
|||||||
TImporto _importo; // Importo in valuta
|
TImporto _importo; // Importo in valuta
|
||||||
TImporto _importo_lire; // Importo in lire
|
TImporto _importo_lire; // Importo in lire
|
||||||
real _scaduto; // Importo scaduto
|
real _scaduto; // Importo scaduto
|
||||||
|
real _esposto; // Importo esposto
|
||||||
|
bool _salvo_buon_fine; // Importo esposto salvo buon fine
|
||||||
real _totale; // Totale documento
|
real _totale; // Totale documento
|
||||||
TValuta _valuta; // Codice valuta, data cambio e cambio
|
TValuta _valuta; // Codice valuta, data cambio e cambio
|
||||||
|
|
||||||
@ -86,11 +95,16 @@ public:
|
|||||||
int rata() const { return _rata; }
|
int rata() const { return _rata; }
|
||||||
|
|
||||||
void descrizione(const char* s) { _descrizione = s; }
|
void descrizione(const char* s) { _descrizione = s; }
|
||||||
|
void importo(const TImporto& i) { _importo = i; }
|
||||||
void scaduto(const real& s) { _scaduto = s; }
|
void scaduto(const real& s) { _scaduto = s; }
|
||||||
|
void esposto(const real& e) { _esposto = e; }
|
||||||
|
void salvo_buon_fine(bool sbf) { _salvo_buon_fine = sbf; }
|
||||||
|
|
||||||
const TValuta& valuta() const { return _valuta; }
|
|
||||||
const TImporto& importo() const { return _importo; }
|
|
||||||
const TDate& data() const { return _data; }
|
const TDate& data() const { return _data; }
|
||||||
|
const TImporto& importo() const { return _importo; }
|
||||||
|
real scaduto() const { return _scaduto; }
|
||||||
|
real esposto() const { return _esposto; }
|
||||||
|
const TValuta& valuta() const { return _valuta; }
|
||||||
|
|
||||||
void print_on(TPrint_section& body);
|
void print_on(TPrint_section& body);
|
||||||
|
|
||||||
@ -100,7 +114,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata)
|
TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata)
|
||||||
: _num_prot(0)
|
: _num_prot(0), _salvo_buon_fine(FALSE)
|
||||||
{
|
{
|
||||||
_riga = row.get_int(PART_NRIGA);
|
_riga = row.get_int(PART_NRIGA);
|
||||||
_rata = rata;
|
_rata = rata;
|
||||||
@ -116,7 +130,7 @@ TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& im
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEC_row::TEC_row(const char* desc, const TImporto& imp)
|
TEC_row::TEC_row(const char* desc, const TImporto& imp)
|
||||||
: _num_prot(0)
|
: _riga(9999), _rata(9999), _num_prot(0), _salvo_buon_fine(FALSE)
|
||||||
{
|
{
|
||||||
_descrizione = desc;
|
_descrizione = desc;
|
||||||
_importo = imp; _importo.normalize();
|
_importo = imp; _importo.normalize();
|
||||||
@ -130,12 +144,12 @@ int TEC_row::compare(const TSortable& s) const
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
if (_data == r._data)
|
if (_data == r._data)
|
||||||
{
|
{
|
||||||
c = r._riga - _riga;
|
c = _riga - r._riga;
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
c = r._rata - _rata;
|
c = _rata - r._rata;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c = _data < r._data ? +1 : -1;
|
c = _data > r._data ? +1 : -1;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,6 +199,12 @@ void TEC_row::print_on(TPrint_section& body)
|
|||||||
TForm_item& scaduto = body.find_field(PEC_SCADUTO);
|
TForm_item& scaduto = body.find_field(PEC_SCADUTO);
|
||||||
scaduto.set(_scaduto.string());
|
scaduto.set(_scaduto.string());
|
||||||
|
|
||||||
|
TForm_item& esposto = body.find_field(PEC_ESPOSTO);
|
||||||
|
esposto.set(_esposto.string());
|
||||||
|
|
||||||
|
TForm_item& sbf = body.find_field(PEC_SBF);
|
||||||
|
sbf.set(_salvo_buon_fine ? "*" : " ");
|
||||||
|
|
||||||
TForm_item& cambio = body.find_field(PEC_CAMBIO);
|
TForm_item& cambio = body.find_field(PEC_CAMBIO);
|
||||||
cambio.set(_valuta.cambio().string());
|
cambio.set(_valuta.cambio().string());
|
||||||
|
|
||||||
@ -255,13 +275,15 @@ TImporto TEC_array::importo(const TPartita& game, const TRectype& pag, bool valu
|
|||||||
return imp;
|
return imp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Certified 100%
|
||||||
TImporto& TEC_array::importo_riga_scaduto(int n)
|
TImporto& TEC_array::importo_riga_scaduto(int n)
|
||||||
{
|
{
|
||||||
|
CHECKD(n > 0 && n < 9999, "Riga scaduto errata ", n);
|
||||||
TImporto* imp = importo_riga_scaduto_ptr(n);
|
TImporto* imp = importo_riga_scaduto_ptr(n);
|
||||||
if (imp == NULL)
|
if (imp == NULL)
|
||||||
{
|
{
|
||||||
imp = new TImporto;
|
imp = new TImporto;
|
||||||
_scaduto.add(imp);
|
_scaduto.add(imp, n);
|
||||||
}
|
}
|
||||||
return *imp;
|
return *imp;
|
||||||
}
|
}
|
||||||
@ -278,13 +300,14 @@ real TEC_array::calcola_scaduto(const TRiga_scadenze& rata, bool valuta)
|
|||||||
for (int p = rata.first(); p <= lastp; p = rata.succ(p)) // Qui bisogna andare in avanti!
|
for (int p = rata.first(); p <= lastp; p = rata.succ(p)) // Qui bisogna andare in avanti!
|
||||||
{
|
{
|
||||||
const TRectype& pag = rata.row(p);
|
const TRectype& pag = rata.row(p);
|
||||||
const TRiga_partite& sum = game.riga(pag.get_int(PAGSCA_NRIGP));
|
const int nrigp = pag.get_int(PAGSCA_NRIGP);
|
||||||
|
const TRiga_partite& sum = game.riga(nrigp);
|
||||||
const tipo_movimento tm = sum.tipo();
|
const tipo_movimento tm = sum.tipo();
|
||||||
const TImporto imp = importo(game, pag, valuta);
|
const TImporto imp = importo(game, pag, valuta);
|
||||||
if (tm == tm_insoluto && tm == tm_pagamento_insoluto)
|
if (tm == tm_insoluto || tm == tm_pagamento_insoluto)
|
||||||
{
|
{
|
||||||
if (tm == tm_insoluto)
|
if (tm == tm_insoluto)
|
||||||
riga_corrente_scaduto = pag.get_int(PAGSCA_NRIGP);
|
riga_corrente_scaduto = nrigp;
|
||||||
else
|
else
|
||||||
CHECKD(riga_corrente_scaduto > 0, "Pagamento insoluto senza insoluto ", p);
|
CHECKD(riga_corrente_scaduto > 0, "Pagamento insoluto senza insoluto ", p);
|
||||||
importo_riga_scaduto(riga_corrente_scaduto) += imp;
|
importo_riga_scaduto(riga_corrente_scaduto) += imp;
|
||||||
@ -303,15 +326,16 @@ real TEC_array::calcola_scaduto(const TRiga_scadenze& rata, bool valuta)
|
|||||||
TEC_row& TEC_array::new_row(const TRiga_partite& row, const TDate& data,
|
TEC_row& TEC_array::new_row(const TRiga_partite& row, const TDate& data,
|
||||||
const TImporto& imp, int n)
|
const TImporto& imp, int n)
|
||||||
{
|
{
|
||||||
if (n == 0)
|
CHECKD(n > 0, "Numero rata errato: ", n);
|
||||||
n = items();
|
|
||||||
TEC_row* riga = new TEC_row(row, data, imp, n);
|
TEC_row* riga = new TEC_row(row, data, imp, n);
|
||||||
add(riga, n);
|
add(riga);
|
||||||
return *riga;
|
return *riga;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
if (row.is_fattura())
|
if (row.is_fattura())
|
||||||
{
|
{
|
||||||
for (int r = 1; r <= row.rate(); r++)
|
for (int r = 1; r <= row.rate(); r++)
|
||||||
@ -320,11 +344,10 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
const TDate data(rata.get(SCAD_DATASCAD));
|
const TDate data(rata.get(SCAD_DATASCAD));
|
||||||
if (data <= form().data_limite_operazione())
|
if (data <= form().data_limite_operazione())
|
||||||
{
|
{
|
||||||
TEC_row& rec = new_row(row, data, rata.importo(TRUE), r);
|
TEC_row& rec = new_row(row, data, rata.importo(in_valuta), r);
|
||||||
if (data <= form().data_limite_scaduto())
|
if (data <= form().data_limite_scaduto())
|
||||||
{
|
{
|
||||||
real s;
|
const real s = calcola_scaduto(rata, in_valuta);
|
||||||
calcola_scaduto(rata, s);
|
|
||||||
rec.scaduto(s);
|
rec.scaduto(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,23 +358,51 @@ 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(FALSE, 0x1));
|
const TImporto imp(row.importo(in_valuta, 0x1));
|
||||||
new_row(row, data, imp);
|
TEC_row& riga = new_row(row, data, imp, 1);
|
||||||
|
|
||||||
const TImporto abbuoni(row.importo(FALSE, 0x2));
|
const int tipo_pag = row.get_int(PART_TIPOPAG);
|
||||||
|
if (tipo_pag >= 2 && tipo_pag <= 7) // Controlla se e' un pagamento con effetti
|
||||||
|
{
|
||||||
|
const TDate data_pag(row.get(PART_DATAPAG));
|
||||||
|
const TDate& dls = form().data_limite_scaduto();
|
||||||
|
const int gr = form().giorni_rischio();
|
||||||
|
|
||||||
|
bool sbf = FALSE;
|
||||||
|
if (gr > 0)
|
||||||
|
{
|
||||||
|
const TDate& dir = form().data_inizio_rischio();
|
||||||
|
sbf = data_pag >= dir && data_pag <= dls;
|
||||||
|
riga.salvo_buon_fine(sbf); // Esposto salvo buon fine
|
||||||
|
}
|
||||||
|
|
||||||
|
bool esp = sbf;
|
||||||
|
if (!esp)
|
||||||
|
{
|
||||||
|
esp = gr > 0 ? data_pag >= dls : data_pag > dls; // Esposto normale
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esp)
|
||||||
|
{
|
||||||
|
TImporto esposto(imp);
|
||||||
|
const char sezione = row.get_char(PART_TIPOCF) == 'C' ? 'D' : 'A';
|
||||||
|
esposto.normalize(sezione);
|
||||||
|
riga.esposto(esposto.valore());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const TImporto abbuoni(row.importo(in_valuta, 0x2));
|
||||||
if (!abbuoni.is_zero())
|
if (!abbuoni.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& r = new_row(row, data, abbuoni);
|
TEC_row& r = new_row(row, data, abbuoni, 2);
|
||||||
const TForm_item& desc_abb = form().find_field('B', odd_page, 302);
|
r.descrizione(form().describe(302));
|
||||||
r.descrizione(desc_abb.prompt());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TImporto diffcam(row.importo(FALSE, 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);
|
TEC_row& r = new_row(row, data, diffcam, 3);
|
||||||
const TForm_item& desc_dif = form().find_field('B', odd_page, 303);
|
r.descrizione(form().describe(303));
|
||||||
r.descrizione(desc_dif.prompt());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,11 +418,14 @@ TEC_array::TEC_array(const TPartita& game, const TEC_form* f)
|
|||||||
for (r = items()-1; r >= 0; r--)
|
for (r = items()-1; r >= 0; r--)
|
||||||
{
|
{
|
||||||
TEC_row& s = row(r);
|
TEC_row& s = row(r);
|
||||||
TImporto* imp = importo_riga_scaduto_ptr(s.riga());
|
if (s.rata() == 1)
|
||||||
if (imp != NULL)
|
|
||||||
{
|
{
|
||||||
imp->normalize(sezione);
|
TImporto* imp = importo_riga_scaduto_ptr(s.riga());
|
||||||
s.scaduto(imp->valore());
|
if (imp != NULL)
|
||||||
|
{
|
||||||
|
imp->normalize(sezione);
|
||||||
|
s.scaduto(imp->valore());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,14 +448,15 @@ void TEC_form::ec_header_handler(TPrinter& pr)
|
|||||||
pr.setheaderline(j, head.row(j));
|
pr.setheaderline(j, head.row(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confronta due valute alfabeticamente
|
// Confronta due totali in valuta alfabeticamente
|
||||||
static int val_compare(const void* o1, const void* o2)
|
static int tot_compare(const void* o1, const void* o2)
|
||||||
{
|
{
|
||||||
|
if (o1 == o2) // Sfrutto una piccola debolezza di qsort:
|
||||||
|
return 0; // ogni tanto confronta oggetti con se stessi
|
||||||
|
|
||||||
const THash_object* h1 = (const THash_object*)o1;
|
const THash_object* h1 = (const THash_object*)o1;
|
||||||
const THash_object* h2 = (const THash_object*)o2;
|
const THash_object* h2 = (const THash_object*)o2;
|
||||||
const TString& s1 = (const TString&)h1->obj();
|
return stricmp(h1->key(), h2->key());
|
||||||
const TString& s2 = (const TString&)h2->obj();
|
|
||||||
return s2.compare(s1, -1, TRUE); // same as stricmp(s1, s2) in reverse order
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEC_form::ec_footer_handler(TPrinter& pr)
|
void TEC_form::ec_footer_handler(TPrinter& pr)
|
||||||
@ -409,7 +464,7 @@ void TEC_form::ec_footer_handler(TPrinter& pr)
|
|||||||
TPrint_section& foot = _form->section('F');
|
TPrint_section& foot = _form->section('F');
|
||||||
pr.resetfooter();
|
pr.resetfooter();
|
||||||
|
|
||||||
const word MAXTOT = 32;
|
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
|
||||||
@ -422,20 +477,41 @@ void TEC_form::ec_footer_handler(TPrinter& pr)
|
|||||||
numtot < MAXTOT && obj != NULL;
|
numtot < MAXTOT && obj != NULL;
|
||||||
obj = totali.get_hashobj())
|
obj = totali.get_hashobj())
|
||||||
tot[numtot++] = obj;
|
tot[numtot++] = obj;
|
||||||
qsort(tot, numtot, sizeof(THash_object*), val_compare);
|
qsort(tot, numtot, sizeof(THash_object*), tot_compare);
|
||||||
|
|
||||||
if (numtot > foot.height())
|
const word maxtot = foot.height() / 3;
|
||||||
numtot = foot.height();
|
if (numtot > maxtot)
|
||||||
|
numtot = maxtot;
|
||||||
|
|
||||||
|
TString desc(80);
|
||||||
TPrint_section& body = _form->section('B');
|
TPrint_section& body = _form->section('B');
|
||||||
for (word j = 0; j < numtot; j++)
|
for (word j = 0; j < numtot; j++)
|
||||||
{
|
{
|
||||||
|
const word line = j*3;
|
||||||
const TString& key = tot[j]->key();
|
const TString& key = tot[j]->key();
|
||||||
TImporto& imp = (TImporto&)tot[j]->obj();
|
TTotal& t = (TTotal&)(tot[j]->obj());
|
||||||
TEC_row r(key, imp.normalize());
|
|
||||||
r.print_on(body);
|
desc = _form->describe(301, 'F');
|
||||||
const TPrintrow& ri = body.row(0);
|
if (key.not_empty())
|
||||||
pr.setfooterline(j, ri);
|
desc << ' ' << key;
|
||||||
|
TEC_row rip(desc, t.importo().normalize());
|
||||||
|
rip.print_on(body);
|
||||||
|
pr.setfooterline(line, body.row(0));
|
||||||
|
|
||||||
|
desc = _form->describe(302, 'F');
|
||||||
|
desc << ' ' << _form->data_limite_scaduto();
|
||||||
|
rip.descrizione(desc);
|
||||||
|
rip.importo(TImporto('D', ZERO));
|
||||||
|
rip.scaduto(t.scaduto());
|
||||||
|
rip.print_on(body);
|
||||||
|
pr.setfooterline(line+1, body.row(0));
|
||||||
|
|
||||||
|
desc = _form->describe(303, 'F');
|
||||||
|
rip.descrizione(desc);
|
||||||
|
rip.scaduto(ZERO);
|
||||||
|
rip.esposto(t.esposto());
|
||||||
|
rip.print_on(body);
|
||||||
|
pr.setfooterline(line+2, body.row(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,6 +528,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;
|
||||||
|
|
||||||
// Stampa le righe di partita
|
// Stampa le righe di partita
|
||||||
for (int r = 0; r < righe.items(); r++)
|
for (int r = 0; r < righe.items(); r++)
|
||||||
@ -464,9 +541,11 @@ 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.valuta().codice());
|
totali().add(riga.importo(), riga.scaduto(), riga.esposto(), riga.valuta().codice());
|
||||||
|
|
||||||
saldo += riga.importo();
|
saldo += riga.importo();
|
||||||
|
scaduto += riga.scaduto();
|
||||||
|
esposto += riga.esposto();
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,9 +553,11 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
{
|
{
|
||||||
saldo.normalize();
|
saldo.normalize();
|
||||||
|
|
||||||
const TForm_item& desc_sld = body.find_field(301);
|
TEC_row sld(describe(301), saldo);
|
||||||
TEC_row sld(desc_sld.prompt(), saldo);
|
sld.scaduto(scaduto);
|
||||||
|
sld.esposto(esposto);
|
||||||
sld.print_on(body);
|
sld.print_on(body);
|
||||||
|
pr.print(body.row(0));
|
||||||
|
|
||||||
// Salta una riga vuota
|
// Salta una riga vuota
|
||||||
TPrintrow vuota;
|
TPrintrow vuota;
|
||||||
@ -485,8 +566,14 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TString& TEC_form::describe(short id, char sez) const
|
||||||
|
{
|
||||||
|
const TForm_item& fi = find_field(sez, odd_page, id);
|
||||||
|
return fi.prompt();
|
||||||
|
}
|
||||||
|
|
||||||
TEC_form::TEC_form(const TEC_mask& m)
|
TEC_form::TEC_form(const TEC_mask& m)
|
||||||
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
: TForm(BASE_EC_PROFILE, m.get_prof_code()), _in_valuta(FALSE),
|
||||||
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
||||||
{
|
{
|
||||||
_form = this;
|
_form = this;
|
||||||
@ -496,8 +583,10 @@ TEC_form::TEC_form(const TEC_mask& m)
|
|||||||
TCursor_sheet& cs = m.cur_sheet();
|
TCursor_sheet& cs = m.cur_sheet();
|
||||||
_cursore = cs.cursor();
|
_cursore = cs.cursor();
|
||||||
|
|
||||||
_dlo = m.get(F_DATALIMOP);
|
_dlo = m.get(F_DATALIMOP);
|
||||||
_dls = m.get(F_DATALIMSC);
|
_dls = m.get(F_DATALIMSC);
|
||||||
|
_giorni_rischio = m.get_int(F_GIORISCH);
|
||||||
|
_dir = _dls; _dir -= _giorni_rischio;
|
||||||
|
|
||||||
TPrinter& pr = printer();
|
TPrinter& pr = printer();
|
||||||
|
|
||||||
@ -545,7 +634,6 @@ public:
|
|||||||
TCursor_sheet& sheet() { return _msk->cur_sheet(); }
|
TCursor_sheet& sheet() { return _msk->cur_sheet(); }
|
||||||
TEC_form& form() { return *_form; }
|
TEC_form& form() { return *_form; }
|
||||||
|
|
||||||
bool select_ec(); // starting point
|
|
||||||
bool print_selected(); // print selected items
|
bool print_selected(); // print selected items
|
||||||
bool print_ec(); // print one item
|
bool print_ec(); // print one item
|
||||||
|
|
||||||
@ -553,21 +641,6 @@ public:
|
|||||||
virtual ~TStampaEC_application() {}
|
virtual ~TStampaEC_application() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TStampaEC_application::select_ec()
|
|
||||||
{
|
|
||||||
TEC_mask& m = mask();
|
|
||||||
while (m.run() != K_ESC)
|
|
||||||
{
|
|
||||||
_form = new TEC_form(m);
|
|
||||||
|
|
||||||
print_selected();
|
|
||||||
|
|
||||||
delete _form;
|
|
||||||
_form = NULL;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TStampaEC_application::print_selected()
|
bool TStampaEC_application::print_selected()
|
||||||
{
|
{
|
||||||
TCursor_sheet& s = sheet();
|
TCursor_sheet& s = sheet();
|
||||||
@ -621,6 +694,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
|
||||||
|
|
||||||
// Filtra solo le partite del cliente selezionato
|
// Filtra solo le partite del cliente selezionato
|
||||||
TLocalisamfile& partite = _file[LF_PARTITE];
|
TLocalisamfile& partite = _file[LF_PARTITE];
|
||||||
@ -631,8 +706,6 @@ bool TStampaEC_application::print_ec()
|
|||||||
|
|
||||||
const bool stampa_chiuse = mask().get_bool(F_STAMPCHIU);
|
const bool stampa_chiuse = mask().get_bool(F_STAMPCHIU);
|
||||||
const TDate data_chiuse = mask().get(F_DATACHIU);
|
const TDate data_chiuse = mask().get(F_DATACHIU);
|
||||||
const TDate data_scaduto = mask().get(F_DATALIMSC);
|
|
||||||
const int giorni_rischio = mask().get_int(F_GIORISCH);
|
|
||||||
|
|
||||||
bool one_printed = FALSE;
|
bool one_printed = FALSE;
|
||||||
for (int err = partite.read(_isgteq);
|
for (int err = partite.read(_isgteq);
|
||||||
@ -642,9 +715,9 @@ bool TStampaEC_application::print_ec()
|
|||||||
TPartita game(partite.curr());
|
TPartita game(partite.curr());
|
||||||
|
|
||||||
if (game.chiusa())
|
if (game.chiusa())
|
||||||
{
|
{
|
||||||
TDate data_rischio = data_scaduto; data_rischio -= giorni_rischio;
|
const TDate& dir = form().data_inizio_rischio();
|
||||||
const TImporto saldo = game.calcola_saldo_al(data_rischio, TRUE);
|
const TImporto saldo = game.calcola_saldo_al(dir, TRUE);
|
||||||
if (saldo.is_zero())
|
if (saldo.is_zero())
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
@ -656,7 +729,7 @@ bool TStampaEC_application::print_ec()
|
|||||||
if (riga.is_fattura())
|
if (riga.is_fattura())
|
||||||
{
|
{
|
||||||
const TDate dd(riga.get(PART_DATADOC));
|
const TDate dd(riga.get(PART_DATADOC));
|
||||||
if (dd > data_rischio)
|
if (dd > dir)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -673,9 +746,6 @@ bool TStampaEC_application::print_ec()
|
|||||||
partite.put(PART_NRIGA, 9999);
|
partite.put(PART_NRIGA, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (one_printed)
|
|
||||||
printer().formfeed();
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,9 +782,19 @@ void TStampaEC_application::on_firm_change()
|
|||||||
_gesval = c.get_bool("GesVal");
|
_gesval = c.get_bool("GesVal");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampaEC_application::menu(MENU_TAG m)
|
bool TStampaEC_application::menu(MENU_TAG)
|
||||||
{
|
{
|
||||||
select_ec();
|
TEC_mask& m = mask();
|
||||||
|
while (m.run() != K_QUIT)
|
||||||
|
{
|
||||||
|
_form = new TEC_form(m);
|
||||||
|
|
||||||
|
print_selected();
|
||||||
|
|
||||||
|
delete _form;
|
||||||
|
_form = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,12 +157,13 @@ BEGIN
|
|||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_PRINT 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -1 ""
|
PROMPT -12 -1 ""
|
||||||
|
MESSAGE EXIT,K_ENTER
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_QUIT 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -22 -1 ""
|
PROMPT -22 -1 ""
|
||||||
END
|
END
|
||||||
|
100
sc/sc2102.cpp
100
sc/sc2102.cpp
@ -1,46 +1,54 @@
|
|||||||
|
|
||||||
#include "sc2102.h"
|
#include "sc2102.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Totalizzatore
|
// Totalizzatore
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TTotalizer::add(const TImporto& imp, const TString& val)
|
TTotal::TTotal(const TImporto& imp, const real& sca, const real& esp)
|
||||||
{
|
: _importo(imp), _scaduto(sca), _esposto(esp)
|
||||||
TString16 codice(val);
|
{ }
|
||||||
if (codice == "LIT")
|
|
||||||
codice.cut(0);
|
void TTotalizer::add(const TImporto& imp, const real& sca,
|
||||||
|
const real& esp, const TString& val)
|
||||||
TObject* obj = objptr(codice);
|
{
|
||||||
if (obj != NULL)
|
TString16 codice(val);
|
||||||
{
|
if (codice == "LIT")
|
||||||
TImporto& tot = (TImporto&)*obj;
|
codice.cut(0);
|
||||||
tot += imp;
|
|
||||||
}
|
TObject* obj = objptr(codice);
|
||||||
else
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
TAssoc_array::add(codice, new TImporto(imp));
|
TTotal& tot = (TTotal&)*obj;
|
||||||
}
|
tot.importo() += imp;
|
||||||
}
|
tot.scaduto() += sca;
|
||||||
|
tot.esposto() += esp;
|
||||||
|
}
|
||||||
///////////////////////////////////////////////////////////
|
else
|
||||||
// TFilearray
|
{
|
||||||
///////////////////////////////////////////////////////////
|
obj = new TTotal(imp, sca, esp);
|
||||||
|
TAssoc_array::add(codice, obj);
|
||||||
void TFile_array::open(int logicnum, ...)
|
}
|
||||||
{
|
}
|
||||||
va_list marker;
|
|
||||||
va_start(marker, logicnum);
|
|
||||||
while (logicnum > 0)
|
///////////////////////////////////////////////////////////
|
||||||
{
|
// TFilearray
|
||||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
///////////////////////////////////////////////////////////
|
||||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
|
||||||
logicnum = va_arg(marker, int);
|
void TFile_array::open(int logicnum, ...)
|
||||||
}
|
{
|
||||||
}
|
va_list marker;
|
||||||
|
va_start(marker, logicnum);
|
||||||
void TFile_array::close()
|
while (logicnum > 0)
|
||||||
{
|
{
|
||||||
_file.destroy();
|
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();
|
||||||
|
}
|
||||||
|
111
sc/sc2102.h
111
sc/sc2102.h
@ -1,46 +1,65 @@
|
|||||||
|
|
||||||
#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 TTotalizer : public TAssoc_array
|
class TTotal : public TObject
|
||||||
{
|
{
|
||||||
public:
|
TImporto _importo;
|
||||||
void add(const TImporto& imp, const TString& val);
|
real _scaduto;
|
||||||
|
real _esposto;
|
||||||
TTotalizer() { }
|
|
||||||
virtual ~TTotalizer() { }
|
public:
|
||||||
};
|
const TImporto& importo() const { return _importo; }
|
||||||
|
const real& scaduto() const { return _scaduto; }
|
||||||
|
const real& esposto() const { return _esposto; }
|
||||||
///////////////////////////////////////////////////////////
|
TImporto& importo() { return _importo; }
|
||||||
// TFilearray
|
real& scaduto() { return _scaduto; }
|
||||||
///////////////////////////////////////////////////////////
|
real& esposto() { return _esposto; }
|
||||||
|
|
||||||
class TFile_array
|
TTotal(const TImporto& imp, const real& scaduto, const real& esposto);
|
||||||
{
|
virtual ~TTotal() {}
|
||||||
TArray _file;
|
};
|
||||||
|
|
||||||
public:
|
class TTotalizer : public TAssoc_array
|
||||||
void open(int num, ...);
|
{
|
||||||
void close();
|
public:
|
||||||
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
void add(const TImporto& imp, const real& scaduto,
|
||||||
TLocalisamfile& operator[](int num) const { return file(num); }
|
const real& esposto, const TString& val);
|
||||||
|
|
||||||
TFile_array() {}
|
TTotalizer() { }
|
||||||
virtual ~TFile_array() {}
|
virtual ~TTotalizer() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SC2102_H
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TFilearray
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TFile_array
|
||||||
|
{
|
||||||
|
TArray _file;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void open(int num, ...);
|
||||||
|
void close();
|
||||||
|
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
||||||
|
TLocalisamfile& operator[](int num) const { return file(num); }
|
||||||
|
|
||||||
|
TFile_array() {}
|
||||||
|
virtual ~TFile_array() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __SC2102_H
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
#define PEC_AVERE 211
|
#define PEC_AVERE 211
|
||||||
#define PEC_SCADUTO 212
|
#define PEC_SCADUTO 212
|
||||||
#define PEC_ESPOSTO 213
|
#define PEC_ESPOSTO 213
|
||||||
#define PEC_IMPLIRE 214
|
#define PEC_SBF 214
|
||||||
#define PEC_CAMBIO 215
|
#define PEC_IMPLIRE 215
|
||||||
#define PEC_DATACAM 216
|
#define PEC_CAMBIO 216
|
||||||
|
#define PEC_DATACAM 217
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
589
sc/sc2402.cpp
589
sc/sc2402.cpp
@ -1,293 +1,296 @@
|
|||||||
|
|
||||||
#include "../cg/saldacon.h"
|
#include "../cg/saldacon.h"
|
||||||
#include <pagsca.h>
|
#include <pagsca.h>
|
||||||
#include <scadenze.h>
|
#include <scadenze.h>
|
||||||
#include <partite.h>
|
#include <partite.h>
|
||||||
|
|
||||||
#include "sc21pec.h"
|
#include "sc21pec.h"
|
||||||
#include "sc2102.h"
|
#include "sc2102.h"
|
||||||
#include "sc2402.h"
|
#include "sc2402.h"
|
||||||
|
|
||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TSol_row
|
// TSol_row
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TSol_row::TSol_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata): _num_prot(0) {
|
TSol_row::TSol_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata): _num_prot(0) {
|
||||||
_riga = row.get_int(PART_NRIGA);
|
_riga = row.get_int(PART_NRIGA);
|
||||||
_rata = rata;
|
_rata = rata;
|
||||||
|
|
||||||
_data = data;
|
_data = data;
|
||||||
_causale = row.get(PART_CODCAUS);
|
_causale = row.get(PART_CODCAUS);
|
||||||
_data_doc = row.get(PART_DATADOC);
|
_data_doc = row.get(PART_DATADOC);
|
||||||
_num_prot = row.get_long(PART_PROTIVA);
|
_num_prot = row.get_long(PART_PROTIVA);
|
||||||
_importo = imp; _importo.normalize();
|
_importo = imp; _importo.normalize();
|
||||||
_totale = row.get_real(PART_IMPTOTPAG);
|
_totale = row.get_real(PART_IMPTOTPAG);
|
||||||
|
|
||||||
_valuta.get(row);
|
_valuta.get(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
TSol_row::TSol_row(const char* desc, const TImporto& imp): _num_prot(0) {
|
TSol_row::TSol_row(const char* desc, const TImporto& imp): _num_prot(0) {
|
||||||
_descrizione = desc;
|
_descrizione = desc;
|
||||||
_importo = imp; _importo.normalize();
|
_importo = imp; _importo.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// le righe dell'estratto conto sono ordinate per data, riga partita, numero rata,
|
// le righe dell'estratto conto sono ordinate per data, riga partita, numero rata,
|
||||||
// posizione iniziale nell'array (in caso di uguaglianza di tutto il resto)
|
// posizione iniziale nell'array (in caso di uguaglianza di tutto il resto)
|
||||||
int TSol_row::compare(const TSortable& s) const {
|
int TSol_row::compare(const TSortable& s) const {
|
||||||
const TSol_row& r = (const TSol_row&)s;
|
const TSol_row& r = (const TSol_row&)s;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
if (_data == r._data) {
|
if (_data == r._data) {
|
||||||
c = r._riga - _riga;
|
c = r._riga - _riga;
|
||||||
if (c == 0) c = r._rata - _rata;
|
if (c == 0) c = r._rata - _rata;
|
||||||
} else c = _data < r._data ? +1 : -1;
|
} else c = _data < r._data ? +1 : -1;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSol_row::print_on(TPrint_section& body) {
|
void TSol_row::print_on(TPrint_section& body) {
|
||||||
TSol_form& form = (TSol_form&)body.form();
|
TSol_form& form = (TSol_form&)body.form();
|
||||||
|
|
||||||
TForm_item& causale = body.find_field(PEC_CODCAUS);
|
TForm_item& causale = body.find_field(PEC_CODCAUS);
|
||||||
causale.set(_causale);
|
causale.set(_causale);
|
||||||
if (_causale.not_empty() && _descrizione.empty()) {
|
if (_causale.not_empty() && _descrizione.empty()) {
|
||||||
TDecoder& causali = form.causali();
|
TDecoder& causali = form.causali();
|
||||||
_descrizione = causali.decode(_causale);
|
_descrizione = causali.decode(_causale);
|
||||||
}
|
}
|
||||||
|
|
||||||
TForm_item& descr = body.find_field(PEC_DESCR1);
|
TForm_item& descr = body.find_field(PEC_DESCR1);
|
||||||
descr.set(_descrizione);
|
descr.set(_descrizione);
|
||||||
|
|
||||||
TForm_item& datadoc = body.find_field(PEC_DATADOC);
|
TForm_item& datadoc = body.find_field(PEC_DATADOC);
|
||||||
datadoc.set(_data_doc.string());
|
datadoc.set(_data_doc.string());
|
||||||
|
|
||||||
TForm_item& numdoc = body.find_field(PEC_NUMDOC);
|
TForm_item& numdoc = body.find_field(PEC_NUMDOC);
|
||||||
numdoc.set(_num_doc);
|
numdoc.set(_num_doc);
|
||||||
|
|
||||||
TForm_item& numprot = body.find_field(PEC_PROTIVA);
|
TForm_item& numprot = body.find_field(PEC_PROTIVA);
|
||||||
TString16 protiva; protiva << _num_prot;
|
TString16 protiva; protiva << _num_prot;
|
||||||
numprot.set(protiva);
|
numprot.set(protiva);
|
||||||
|
|
||||||
TForm_item& datapag = body.find_field(PEC_DATAPAG);
|
TForm_item& datapag = body.find_field(PEC_DATAPAG);
|
||||||
datapag.set(_data.string());
|
datapag.set(_data.string());
|
||||||
|
|
||||||
const real& imp = _importo.valore();
|
const real& imp = _importo.valore();
|
||||||
TForm_item& dare = body.find_field(PEC_DARE);
|
TForm_item& dare = body.find_field(PEC_DARE);
|
||||||
TForm_item& avere = body.find_field(PEC_AVERE);
|
TForm_item& avere = body.find_field(PEC_AVERE);
|
||||||
|
|
||||||
if (_importo.sezione() == 'D') {
|
if (_importo.sezione() == 'D') {
|
||||||
dare.set(imp.string());
|
dare.set(imp.string());
|
||||||
avere.set("");
|
avere.set("");
|
||||||
} else {
|
} else {
|
||||||
avere.set(imp.string());
|
avere.set(imp.string());
|
||||||
dare.set("");
|
dare.set("");
|
||||||
}
|
}
|
||||||
|
|
||||||
TForm_item& scaduto = body.find_field(PEC_SCADUTO);
|
TForm_item& scaduto = body.find_field(PEC_SCADUTO);
|
||||||
scaduto.set(_scaduto.string());
|
scaduto.set(_scaduto.string());
|
||||||
|
|
||||||
TForm_item& cambio = body.find_field(PEC_CAMBIO);
|
TForm_item& cambio = body.find_field(PEC_CAMBIO);
|
||||||
cambio.set(_valuta.cambio().string());
|
cambio.set(_valuta.cambio().string());
|
||||||
|
|
||||||
TForm_item& datacambio = body.find_field(PEC_DATACAM);
|
TForm_item& datacambio = body.find_field(PEC_DATACAM);
|
||||||
datacambio.set(_valuta.data().string());
|
datacambio.set(_valuta.data().string());
|
||||||
|
|
||||||
body.update();
|
body.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int val_compare(const void* o1, const void* o2) {
|
static int val_compare(const void* o1, const void* o2) {
|
||||||
const THash_object* h1 = (const THash_object*)o1;
|
const THash_object* h1 = (const THash_object*)o1;
|
||||||
const THash_object* h2 = (const THash_object*)o2;
|
const THash_object* h2 = (const THash_object*)o2;
|
||||||
const TString& s1 = (const TString&)h1->obj();
|
const TString& s1 = (const TString&)h1->obj();
|
||||||
const TString& s2 = (const TString&)h2->obj();
|
const TString& s2 = (const TString&)h2->obj();
|
||||||
return s2.compare(s1, -1, TRUE); // same as stricmp(s1, s2) in reverse order
|
return s2.compare(s1, -1, TRUE); // same as stricmp(s1, s2) in reverse order
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TSol_array
|
// TSol_array
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TSol_array::calcola_scaduto(const TRiga_scadenze& rata, real& scaduto) const {
|
void TSol_array::calcola_scaduto(const TRiga_scadenze& rata, real& scaduto) const {
|
||||||
const TPartita& game = rata.partita();
|
const TPartita& game = rata.partita();
|
||||||
TImporto imp_scaduto = rata.importo(TRUE);
|
TImporto imp_scaduto = rata.importo(TRUE);
|
||||||
|
|
||||||
const char* const field = rata.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
const char* const field = rata.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
|
|
||||||
for (int p = rata.last(); p > 0; p = rata.pred(p)) {
|
for (int p = rata.last(); p > 0; p = rata.pred(p)) {
|
||||||
const TRectype& pag = rata.row(p);
|
const TRectype& pag = rata.row(p);
|
||||||
const TRiga_partite& sum = game.riga(pag.get_int(PAGSCA_NRIGP));
|
const TRiga_partite& sum = game.riga(pag.get_int(PAGSCA_NRIGP));
|
||||||
const tipo_movimento tm = sum.tipo();
|
const tipo_movimento tm = sum.tipo();
|
||||||
if (tm != tm_insoluto && tm != tm_pagamento_insoluto) {
|
if (tm != tm_insoluto && tm != tm_pagamento_insoluto) {
|
||||||
imp.set(sum.sezione(), pag.get_real(field));
|
imp.set(sum.sezione(), pag.get_real(field));
|
||||||
imp_scaduto += imp;
|
imp_scaduto += imp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const char sezione = game.conto().tipo() == 'C' ? 'D' : 'A';
|
const char sezione = game.conto().tipo() == 'C' ? 'D' : 'A';
|
||||||
imp_scaduto.normalize(sezione);
|
imp_scaduto.normalize(sezione);
|
||||||
scaduto = imp_scaduto.valore();
|
scaduto = imp_scaduto.valore();
|
||||||
}
|
}
|
||||||
|
|
||||||
TSol_row& TSol_array::new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int n) {
|
TSol_row& TSol_array::new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int n) {
|
||||||
if (n == 0) n = items();
|
if (n == 0) n = items();
|
||||||
TSol_row* riga = new TSol_row(row, data, imp, n);
|
TSol_row* riga = new TSol_row(row, data, imp, n);
|
||||||
add(riga, n);
|
add(riga, n);
|
||||||
return *riga;
|
return *riga;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSol_array::add_row(const TRiga_partite& row) {
|
void TSol_array::add_row(const TRiga_partite& row) {
|
||||||
if (row.is_fattura()) {
|
if (row.is_fattura()) {
|
||||||
for (int r = 1; r <= row.rate(); r++) {
|
for (int r = 1; r <= row.rate(); r++) {
|
||||||
const TRiga_scadenze& rata = row.rata(r);
|
const TRiga_scadenze& rata = row.rata(r);
|
||||||
const TDate data(rata.get(SCAD_DATASCAD));
|
const TDate data(rata.get(SCAD_DATASCAD));
|
||||||
if (data <= form().data_limite_operazione()) {
|
if (data <= form().data_limite_operazione()) {
|
||||||
TSol_row& rec = new_row(row, data, rata.importo(TRUE), r);
|
TSol_row& rec = new_row(row, data, rata.importo(TRUE), r);
|
||||||
if (data <= form().data_limite_scaduto()) {
|
if (data <= form().data_limite_scaduto()) {
|
||||||
real s;
|
real s;
|
||||||
calcola_scaduto(rata, s);
|
calcola_scaduto(rata, s);
|
||||||
rec.scaduto(s);
|
rec.scaduto(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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(FALSE, 0x1));
|
const TImporto imp(row.importo(FALSE, 0x1));
|
||||||
new_row(row, data, imp);
|
new_row(row, data, imp);
|
||||||
|
|
||||||
const TImporto abbuoni(row.importo(FALSE, 0x2));
|
const TImporto abbuoni(row.importo(FALSE, 0x2));
|
||||||
if (!abbuoni.is_zero()) {
|
if (!abbuoni.is_zero()) {
|
||||||
TSol_row& r = new_row(row, data, abbuoni);
|
TSol_row& r = new_row(row, data, abbuoni);
|
||||||
const TForm_item& desc_abb = form().find_field('B', odd_page, 302);
|
const TForm_item& desc_abb = form().find_field('B', odd_page, 302);
|
||||||
r.descrizione(desc_abb.prompt());
|
r.descrizione(desc_abb.prompt());
|
||||||
}
|
}
|
||||||
|
|
||||||
const TImporto diffcam(row.importo(FALSE, 0x4));
|
const TImporto diffcam(row.importo(FALSE, 0x4));
|
||||||
if (!diffcam.is_zero()) {
|
if (!diffcam.is_zero()) {
|
||||||
TSol_row& r = new_row(row, data, diffcam);
|
TSol_row& r = new_row(row, data, diffcam);
|
||||||
const TForm_item& desc_dif = form().find_field('B', odd_page, 303);
|
const TForm_item& desc_dif = form().find_field('B', odd_page, 303);
|
||||||
r.descrizione(desc_dif.prompt());
|
r.descrizione(desc_dif.prompt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TSol_array::TSol_array(const TPartita& game, const TSol_form* f): _form(f) {
|
TSol_array::TSol_array(const TPartita& game, const TSol_form* f): _form(f) {
|
||||||
for (int r = game.last(); r > 0; r = game.pred(r)) add_row(game.riga(r));
|
for (int r = game.last(); r > 0; r = game.pred(r)) add_row(game.riga(r));
|
||||||
sort();
|
sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TSol_form: form speciale per solleciti
|
// TSol_form: form speciale per solleciti
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TSol_form* TSol_form::_form = NULL;
|
TSol_form* TSol_form::_form = NULL;
|
||||||
|
|
||||||
void TSol_form::sol_header_handler(TPrinter& pr) {
|
void TSol_form::sol_header_handler(TPrinter& pr) {
|
||||||
TPrint_section& head = _form->section('H');
|
TPrint_section& head = _form->section('H');
|
||||||
head.reset();
|
head.reset();
|
||||||
pr.resetheader();
|
pr.resetheader();
|
||||||
|
|
||||||
head.update();
|
head.update();
|
||||||
for (word j = 0; j < head.height(); j++) pr.setheaderline(j, head.row(j));
|
for (word j = 0; j < head.height(); j++) pr.setheaderline(j, head.row(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSol_form::sol_footer_handler(TPrinter& pr) {
|
void TSol_form::sol_footer_handler(TPrinter& pr) {
|
||||||
TPrint_section& foot = _form->section('F');
|
TPrint_section& foot = _form->section('F');
|
||||||
pr.resetfooter();
|
pr.resetfooter();
|
||||||
|
|
||||||
const word MAXTOT = 32;
|
const word MAXTOT = 32;
|
||||||
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& totali = _form->totali();
|
||||||
totali.restart();
|
totali.restart();
|
||||||
|
|
||||||
word numtot = 0;
|
word numtot = 0;
|
||||||
for (THash_object* obj = totali.get_hashobj(); numtot < MAXTOT && obj != NULL; obj = totali.get_hashobj()) tot[numtot++] = obj;
|
for (THash_object* obj = totali.get_hashobj(); numtot < MAXTOT && obj != NULL; obj = totali.get_hashobj()) tot[numtot++] = obj;
|
||||||
qsort(tot, numtot, sizeof(THash_object*), val_compare);
|
qsort(tot, numtot, sizeof(THash_object*), val_compare);
|
||||||
|
|
||||||
if (numtot > foot.height()) numtot = foot.height();
|
if (numtot > foot.height()) numtot = foot.height();
|
||||||
|
|
||||||
TPrint_section& body = _form->section('B');
|
TPrint_section& body = _form->section('B');
|
||||||
for (word j = 0; j < numtot; j++) {
|
for (word j = 0; j < numtot; j++) {
|
||||||
const TString& key = tot[j]->key();
|
const TString& key = tot[j]->key();
|
||||||
TImporto& imp = (TImporto&)tot[j]->obj();
|
TImporto& imp = (TImporto&)tot[j]->obj();
|
||||||
TSol_row r(key, imp.normalize());
|
TSol_row r(key, imp.normalize());
|
||||||
r.print_on(body);
|
r.print_on(body);
|
||||||
const TPrintrow& ri = body.row(0);
|
const TPrintrow& ri = body.row(0);
|
||||||
pr.setfooterline(j, ri);
|
pr.setfooterline(j, ri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TSol_form::print_game(const TPartita& game) {
|
bool TSol_form::print_game(const TPartita& game)
|
||||||
bool ok = FALSE;
|
{
|
||||||
|
bool ok = FALSE;
|
||||||
TSol_array righe(game, this);
|
|
||||||
|
TSol_array righe(game, this);
|
||||||
TPrinter& pr = printer();
|
|
||||||
TPrintrow prow;
|
TPrinter& pr = printer();
|
||||||
|
TPrintrow prow;
|
||||||
TPrint_section& body = section('B');
|
|
||||||
|
TPrint_section& body = section('B');
|
||||||
TImporto saldo;
|
|
||||||
|
TImporto saldo;
|
||||||
// stampa le righe di partita
|
|
||||||
for (int r = 0; r < righe.items(); r++) {
|
// stampa le righe di partita
|
||||||
TSol_row& riga = righe.row(r);
|
for (int r = 0; r < righe.items(); r++)
|
||||||
|
{
|
||||||
if (pr.rows_left() < body.height()) pr.formfeed();
|
TSol_row& riga = righe.row(r);
|
||||||
|
|
||||||
riga.print_on(body);
|
if (pr.rows_left() < body.height())
|
||||||
pr.print(body.row(0));
|
pr.formfeed();
|
||||||
|
|
||||||
totali().add(riga.importo(), riga.valuta().codice());
|
riga.print_on(body);
|
||||||
|
pr.print(body.row(0));
|
||||||
saldo += riga.importo();
|
|
||||||
ok = TRUE;
|
totali().add(riga.importo(), ZERO, ZERO, riga.valuta().codice());
|
||||||
}
|
|
||||||
|
saldo += riga.importo();
|
||||||
if (ok) {
|
ok = TRUE;
|
||||||
saldo.normalize();
|
}
|
||||||
|
|
||||||
const TForm_item& desc_sld = body.find_field(301);
|
if (ok) {
|
||||||
TSol_row sld(desc_sld.prompt(), saldo);
|
saldo.normalize();
|
||||||
sld.print_on(body);
|
|
||||||
|
const TForm_item& desc_sld = body.find_field(301);
|
||||||
// salta una riga vuota
|
TSol_row sld(desc_sld.prompt(), saldo);
|
||||||
TPrintrow vuota;
|
sld.print_on(body);
|
||||||
pr.print(vuota);
|
|
||||||
}
|
// salta una riga vuota
|
||||||
return ok;
|
TPrintrow vuota;
|
||||||
}
|
pr.print(vuota);
|
||||||
|
}
|
||||||
TSol_form::TSol_form(const TSol_mask& m, short datafld): TForm(BASE_EC_PROFILE, m.get_prof_code()), _causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR) {
|
return ok;
|
||||||
_form = this;
|
}
|
||||||
|
|
||||||
_lingua = m.get_prof_lang();
|
TSol_form::TSol_form(const TSol_mask& m, short datafld): TForm(BASE_EC_PROFILE, m.get_prof_code()), _causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR) {
|
||||||
|
_form = this;
|
||||||
TCursor_sheet& cs = m.cur_sheet();
|
|
||||||
_cursore = cs.cursor();
|
_lingua = m.get_prof_lang();
|
||||||
|
|
||||||
_dlo = _dls = m.get(datafld); // prende il campo con la data limite sollecito
|
TCursor_sheet& cs = m.cur_sheet();
|
||||||
|
_cursore = cs.cursor();
|
||||||
TPrinter& pr = printer();
|
|
||||||
|
_dlo = _dls = m.get(datafld); // prende il campo con la data limite sollecito
|
||||||
pr.setheaderhandler(sol_header_handler);
|
|
||||||
pr.headerlen(section('H').height());
|
TPrinter& pr = printer();
|
||||||
|
|
||||||
pr.setfooterhandler(sol_footer_handler);
|
pr.setheaderhandler(sol_header_handler);
|
||||||
pr.footerlen(section('F').height());
|
pr.headerlen(section('H').height());
|
||||||
}
|
|
||||||
|
pr.setfooterhandler(sol_footer_handler);
|
||||||
TSol_form::~TSol_form() {
|
pr.footerlen(section('F').height());
|
||||||
TPrinter& pr = printer();
|
}
|
||||||
pr.setheaderhandler(NULL);
|
|
||||||
pr.setfooterhandler(NULL);
|
TSol_form::~TSol_form() {
|
||||||
_form = NULL;
|
TPrinter& pr = printer();
|
||||||
}
|
pr.setheaderhandler(NULL);
|
||||||
|
pr.setfooterhandler(NULL);
|
||||||
|
_form = NULL;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user