Patch level :10.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Questo sorgente NON è più usato!!!
Infatti la stampa (vecchia printapp) è stata sostituita con 2 report, che vengono stampati normalmente dallo stampatore standard dei report (ba8).
Il sorgente viene comunque committato con le ultime modifiche che si erano provate a fare per ottemperare alcune richieste poi soddisfatte con i report in 1/10 del tempo.
Il file andrebbe comunque rimosso in via definitiva, sia perchè inutile sia, soprattutto, perchè fulgido esempio di pessima programmazione!


git-svn-id: svn://10.65.10.50/trunk@18856 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2009-05-12 08:50:14 +00:00
parent c754dc7617
commit d7b0a8f5f7

View File

@ -58,13 +58,13 @@ class TSt_certif : public TPrintapp
TString16 _key1p, _key2p, _perc_p;
TDate _data;
char _tipoa_p, _tipoa;
int _mese_da, _mese_a, _codc_p;
int _mese_da, _mese_a, _codc_p, _codc;
int _riga, _off_lung, _conta;
long _num_att, _codanagER, _codanagPE_p, _codanagPE;
real _tot_corr, _tot_somme, _tot_quote, _tot_impo, _tot_rite, _tot_netto, _tot_inps;
real _t_corr, _t_somme, _t_quote, _t_impo, _t_rite, _t_netto, _t_inps;
real _corr, _quote, _impo, _rite, _netto, _somme, _inps;
bool _intesta, _stampa, _settato_totale, _fai_footer;
bool _intesta, _stampa, _settato_totale, _fai_footer, _stampa_righe_pagamenti;
bool _st_modulo, _st_data;
protected:
@ -85,7 +85,7 @@ protected:
bool init_print();
public:
const TRectype& look_causali();
const TRectype& look_causali(int codc) const;
TRectype& look_schperc(long,char,long,int);
void crea_sort();
void init_sort();
@ -93,7 +93,8 @@ public:
void stampa_su_modulo();
void stampa_totale(int);
void salva_totale();
int stampa_riga(int,int,const char*);
int stampa_riga(int i);
int stampa_riga_pagamento(int i);
void dati_erogante();
void dati_percipiente();
void riempi_record(long,char,long,const real&,int,const real&,const real&,const real&,const real&,const real&,const real&,const real&);
@ -160,9 +161,9 @@ TRectype& TSt_certif::look_schperc (long cod, char t, long codan, int np)
return schede.curr();
}
const TRectype& TSt_certif::look_causali()
const TRectype& TSt_certif::look_causali(int codc) const
{
TString4 dep; dep.format("%02d", _codc_p);
TString4 dep; dep.format("%02d", codc);
return cache().get("%CA7", dep);
}
@ -269,8 +270,16 @@ void TSt_certif::riempi_record(long d,char t,long ca,const real& p,int c,
_sort->sort((const char*)&rig);
}
int TSt_certif::stampa_riga(int i, int ct, const char* d)
int TSt_certif::stampa_riga(int i)
{
const TRectype& cau = look_causali(_codc_p);
const char* d = cau.get("S0");
const int ct = cau.get_int("I0");
//nel caso si scelga di dettagliare i pagamenti, conviene metterci una riga vuota di stacco
if (_stampa_righe_pagamenti)
set_row(i++, "");
if (!_st_modulo)
{
TString16 app (_perc_p.left(3)); //stampo solo la parte intera
@ -279,8 +288,8 @@ int TSt_certif::stampa_riga(int i, int ct, const char* d)
real lordo_netto_iva = _tot_corr + _tot_somme;
real somme_quote = _tot_somme + _tot_quote;
set_row(i,"%02d %4d %-.25s @34g%r@50g%r@66g%r",_codc_p,ct,d,&lordo_netto_iva,&somme_quote,&_tot_impo);
set_row(i++,"@83g%s@86g%r@101g%r@117g%r",(const char*)app,&_tot_rite,&_tot_inps,&_tot_netto);
set_row(i, "%02d %4d %-.25s @34g%r@50g%r@66g%r", _codc_p, ct, d, &lordo_netto_iva, &somme_quote, &_tot_impo);
set_row(i++, "@83g%s@86g%r@101g%r@117g%r", (const char*)app, &_tot_rite, &_tot_inps, &_tot_netto);
}
else
{
@ -289,12 +298,43 @@ int TSt_certif::stampa_riga(int i, int ct, const char* d)
TString16 app (_perc_p.left(3));
app.ltrim();
set_row(i++, "@3g%4d@11g%-.28s@43g%12.0r@57g%12.0r@71g%12.0r@85g%s@89g%12.0r@104g%12.0r",
ct,d,&_tot_corr,&non_sogg,&_tot_impo,(const char*)app,&_tot_rite,&imp_netto);
ct, d, &_tot_corr, &non_sogg, &_tot_impo, (const char*)app, &_tot_rite, &imp_netto);
set_row(i, "");
}
return i;
}
//stampa delle righe di pagamento
int TSt_certif::stampa_riga_pagamento(int i)
{
const TRectype& cau = look_causali(_codc);
const char* d = cau.get("S0");
const int ct = cau.get_int("I0");
if (!_st_modulo)
{
TString16 app (_perc_p.left(3)); //stampo solo la parte intera
app.ltrim();
real lordo_netto_iva = _corr + _somme;
real somme_quote = _somme + _quote;
set_row(i, "%02d %4d %-.25s @34g%r@50g%r@66g%r", _codc, ct, d, &lordo_netto_iva, &somme_quote, &_impo);
set_row(i++, "@83g%s@86g%r@101g%r@117g%r", (const char*)app, &_rite, &_inps, &_netto);
}
else
{
real non_sogg = _corr - _impo + _somme;
real imp_netto = _impo - _rite;
TString16 app (_perc_p.left(3));
app.ltrim();
set_row(i++, "@3g%4d@11g%-.28s@43g%12.0r@57g%12.0r@71g%12.0r@85g%s@89g%12.0r@104g%12.0r",
ct, d, &_corr, &non_sogg, &_impo, (const char*)app, &_rite, &imp_netto);
set_row(i, "");
}
return i;
}
// Totale su carta bianca
void TSt_certif::stampa_totale(int i)
{
@ -306,7 +346,7 @@ void TSt_certif::stampa_totale(int i)
real somme_quote = _t_somme + _t_quote;
set_row(i, "@15gTOTALE@34g%r@50g%r@66g%r@86g%r@101g%r@117g%r",
&lordo_netto_iva,&somme_quote,&_t_impo,&_t_rite,&_t_inps,&_t_netto);
&lordo_netto_iva, &somme_quote, &_t_impo, &_t_rite, &_t_inps, &_t_netto);
}
void TSt_certif::salva_totale()
@ -341,8 +381,9 @@ void TSt_certif::leggi_sort()
_codanagPE_p = _codanagPE;
}
//valori del singolo record di pagamento (vengono stampati solo se richiesto il dettaglio delle righe di pagamento)
TString16 perc = rp->perc;
int codc = atoi(rp->codc);
_codc = atoi(rp->codc);
_corr = rp->corr;
_somme = rp->somme;
_quote = rp->quote;
@ -352,15 +393,14 @@ void TSt_certif::leggi_sort()
_inps = rp->inps;
key1.format("%c%5ld", _tipoa, _codanagPE);
key2.format("%s%02d", (const char*)perc, codc);
key2.format("%s%02d", (const char*)perc, _codc);
if (key1 != _key1p && _key1p != "") //e' cambiato il percipiente
{
const TRectype& cau = look_causali();
const TString& descr = cau.get("S0");
const int codtrib = cau.get_int("I0");
i = stampa_riga(i, codtrib, descr);
//se si vuole il dettaglio dei pagamenti si deve rinunciare al totale di causale (sennò ci vien su un casino..
//..mondiale)
if (!_stampa_righe_pagamenti)
i = stampa_riga(i);
//aggiornamento totale finale
_t_corr += _tot_corr;
@ -373,23 +413,23 @@ void TSt_certif::leggi_sort()
if (!_st_modulo)
{
//questo va stampato in ogni modo
stampa_totale(i);
_tot_corr=_tot_somme=_tot_quote=_tot_impo=_tot_rite=_tot_netto=_tot_inps=ZERO; //sono i totali relativi ad ogni singola riga di stampa
_t_corr = _t_somme = _t_quote = _t_impo = _t_rite =_t_netto = _t_inps=ZERO; //sono i totali finali (relativi cioe' al percipiente)
//è nel caso di cambiamento percipiente (e quindi anche di causale)
//azzera i totali per causale
_tot_corr = _tot_somme = _tot_quote = _tot_impo = _tot_rite = _tot_netto = _tot_inps = ZERO;
//azzera i totali per percipiente
_t_corr = _t_somme = _t_quote = _t_impo = _t_rite =_t_netto = _t_inps = ZERO;
}
//salvo gli importi del record che sto leggendo
//salva_totale();
_settato_totale = TRUE;
_settato_totale = true;
}
else if (key2 != _key2p && _key2p != "")
else if (key2 != _key2p && _key2p != "") //è cambiata la causale del pagamento all'interno dello stesso percipiente
{
const TRectype& cau = look_causali();
const TString& descr = cau.get("S0");
const int codtrib = cau.get_int("I0");
stampa_riga(i, codtrib, descr);
//se si vuole il dettaglio dei pagamenti si deve rinunciare al totale di causale (sennò ci vien su un casino..
//..mondiale)
if (!_stampa_righe_pagamenti)
stampa_riga(i);
_t_corr += _tot_corr;
_t_somme += _tot_somme;
@ -399,24 +439,18 @@ void TSt_certif::leggi_sort()
_t_netto += _tot_netto;
_t_inps += _tot_inps;
_tot_corr=_tot_somme=_tot_quote=_tot_impo=_tot_rite=_tot_netto=_tot_inps=ZERO;
//azzera i totali per causale (è nel caso in cui cambia la causale ma non il percipiente)
_tot_corr = _tot_somme = _tot_quote = _tot_impo = _tot_rite = _tot_netto = _tot_inps = ZERO;
if (_st_modulo)
_conta += 1;
//salvo gli importi del record che sto leggendo
//spostato in postprocess_page
//salva_totale();
}
//else //non e' cambiato il percipiente e non sono cambiate ne' la causale ne' la percentuale
//salva_totale();
//spostato nella postprocess_page
/*
_tipoa_p = _tipoa; //serve alla preprocess_header
_codanagPE_p = _codanagPE; //idem
*/
_codc_p = codc;
//stampa i dettagli di tutte le righe di pagamento
if (_stampa_righe_pagamenti && (key1 == _key1p || _key1p.empty()))
i = stampa_riga_pagamento(i);
_codc_p = _codc;
_perc_p = perc;
_key1p = key1,
_key2p = key2;
@ -424,16 +458,10 @@ void TSt_certif::leggi_sort()
}
else if (_stampa) //sono finiti i record ma c'e' ancora un record da stampare
{
const TRectype& cau = look_causali();
const TString& descr = cau.get("S0");
const int codtrib = cau.get_int("I0");
/*
_tipoa_p = _tipoa;
_codanagPE_p = _codanagPE;
*/
stampa_riga(i, codtrib, descr);
//se si vuole il dettaglio dei pagamenti si deve rinunciare al totale di causale (sennò ci vien su un casino..
//..mondiale)
if (!_stampa_righe_pagamenti)
stampa_riga(i);
_t_corr += _tot_corr;
_t_somme += _tot_somme;
@ -456,7 +484,7 @@ void TSt_certif::preprocess_footer()
{
//riga totale
real t_non_sogg = _t_corr - _t_impo + _t_somme;
real t_imp_netto = _t_impo - _t_rite /* - _t_inps */;
real t_imp_netto = _t_impo - _t_rite;
reset_footer();
@ -630,8 +658,11 @@ bool TSt_certif::init_print()
_mese_a = msk.get_int(F_A);
_luogo = msk.get(F_LUOGO);
_data = msk.get(F_DATA);
//aggiunta fatta il 16/03/2009, dopo soli 14 anni che il file non veniva cambiato
_stampa_righe_pagamenti = msk.get_bool(F_DETTAGLIO);
_st_modulo = msk.get_bool(F_MODULO);
_off_lung = msk.get_int(F_LUNG);
TLocalisamfile& fl = _cur->file(LF_RPAG);
@ -853,41 +884,6 @@ void TSt_certif::dati_erogante()
_dencomER = _comuni->get(COM_DENCOM);
_provER = _comuni->get(COM_PROVCOM);
}
/* dati riguardanti il luogo e la data di nascita
if (tipoa == 'F')
{
TLocalisamfile anagfis(LF_ANAGFIS);
anagfis.setkey(1);
anagfis.zero();
anagfis.put(ANF_CODANAGR, _codanagER);
if (anagfis.read() == NOERR)
{
data = anagfis.get_date(ANF_DATANASC);
_datanascER = data.string();
comnasc = anagfis.get (ANF_COMNASC);
}
_comuni->setkey(1);
_comuni->zero();
_comuni->put(COM_COM,comnasc);
if (_comuni->read() == NOERR)
{
_dencomnscER = _comuni->get(COM_DENCOM);
_provnscER = _comuni->get(COM_PROVCOM);
}
_dencomnscER.rtrim();
_provnscER.rtrim();
}
else
{
_dencomnscER = "";
_provnscER = "";
}
_indER.rtrim();
_dencomER.rtrim();
*/
}
void TSt_certif::dati_percipiente()