Corretto quadro N/L/Base

git-svn-id: svn://10.65.10.50/trunk@3786 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1996-10-17 13:38:34 +00:00
parent cd9dd604e6
commit 8c6887be82
2 changed files with 64 additions and 30 deletions

View File

@ -142,7 +142,7 @@ void TBase1::stampa_soci(TPrinter& pr)
sDataNa=c->file(LF_ANAGFIS).get("DATANASC"); sDataNa=c->file(LF_ANAGFIS).get("DATANASC");
sSesso=c->file(LF_ANAGFIS).get("SESSO"); sSesso=c->file(LF_ANAGFIS).get("SESSO");
sComuneNa=c->file(LF_COMUNI).get("DENCOM"); sComuneNa=c->file(LF_COMUNI).get("DENCOM");
sComuneNa.cut(28); sComuneNa.cut(23);
sProvNa=c->file(LF_COMUNI).get("PROVCOM"); sProvNa=c->file(LF_COMUNI).get("PROVCOM");
if (sRagsoc.len() > 30 && sRagsoc[30] != ' ') if (sRagsoc.len() > 30 && sRagsoc[30] != ' ')
{ {
@ -153,6 +153,7 @@ void TBase1::stampa_soci(TPrinter& pr)
sRagsoc = sCognome; sRagsoc = sCognome;
sRagsoc << " " << sNome; sRagsoc << " " << sNome;
} }
sRagsoc.cut(28);
rg.put(sRagsoc,fut.field(0).x()-1); rg.put(sRagsoc,fut.field(0).x()-1);
fut.field(1).set(sSesso); fut.field(1).set(sSesso);
rg.put(sSesso,fut.field(1).x()-1); rg.put(sSesso,fut.field(1).x()-1);
@ -258,20 +259,20 @@ void TBase3::stampa_testata(TPrinter& pr)
progind()->addstatus(1); progind()->addstatus(1);
} }
int TBase3::stampa_L(TPrinter& pr,const int iChiaveL) int TBase3::stampa_L(TPrinter& pr)
{ {
long codit=0L; long codit=0L;
TPrint_section& body = section('B', odd_page); TPrint_section& body = section('B', odd_page);
body.reset(); body.reset();
TCursor& cur = *cursor(); TCursor& cur = *cursor();
// Le chiavi nel file e nel .ini sono saggiamente scambiate
if (iChiaveL==2) /* if (iChiaveL==2)
cur.setkey(1); cur.setkey(1);
else else
cur.setkey(2); cur.setkey(2);
// filtra(_codditta); filtra(_codditta); */
bool finito=FALSE; bool finito=FALSE;
int righe=0; int righe=0;
@ -299,6 +300,15 @@ int TBase3::stampa_L(TPrinter& pr,const int iChiaveL)
return righe; return righe;
} }
void TBase3::reset_totali_L()
{
TPrint_section& hh = section('F', last_page);
TForm_item& t1 = hh.find_field(1);
TForm_item& t2 = hh.find_field(2);
t1.set("");
t2.set("");
}
void TBase3::stampa_totali_L(TPrinter& pr) void TBase3::stampa_totali_L(TPrinter& pr)
{ {
// La sezione f last contiene solo due totali aggiornati con add nel form // La sezione f last contiene solo due totali aggiornati con add nel form
@ -321,16 +331,26 @@ bool TBase3::print(const long codditta, const long NumFis, const long NumNoFis)
TCursor* cur = cursor(); TCursor* cur = cursor();
TPrinter& pr = printer(); TPrinter& pr = printer();
_codditta=codditta; _codditta=codditta;
filtra(codditta); // filtra(codditta);
reset_totali_L();
_RigaCorr=0; _RigaCorr=0;
(*cur)=0L;
jump_to_line(pr, prima_riga(PRIMA)); jump_to_line(pr, prima_riga(PRIMA));
// Stampa i codici concessione e tesoreria // Stampa i codici concessione e tesoreria
stampa_testata(pr); stampa_testata(pr);
// Legge dai par.studio l'ordinamento da usare per L // Legge dai par.studio l'ordinamento da usare per L
TConfig conf(CONFIG_STUDIO); TConfig conf(CONFIG_STUDIO);
const int iChiaveL = (int)conf.get_long("FlStQl", "77"); const int iChiaveL = (int)conf.get_long("FlStQl", "77");
const int righe_stampate=stampa_L(pr,iChiaveL); // Le chiavi nel file e nel .ini sono saggiamente scambiate
if (iChiaveL==2)
cur->setkey(1);
else
cur->setkey(2);
filtra(_codditta);
(*cur)=0L;
const int righe_stampate=stampa_L(pr);
// Se la stampa prosegue i totali vanno sull'aggiuntivo NON qui // Se la stampa prosegue i totali vanno sull'aggiuntivo NON qui
if (!_bAggiuntivoL) if (!_bAggiuntivoL)
{ {
@ -1048,10 +1068,12 @@ bool TQuadroL::stampa_L(TPrinter& pr,const long lStartRec,const int iRecL)
return TRUE; return TRUE;
else else
cur=lStartRec; cur=lStartRec;
bool finito=FALSE; bool bFinitaPagina=FALSE;
int righe=0; int righe=0;
const long items = cur.items();
while (!finito)
// while (!finito && !eof)
while ( (cur.pos() < items) && !bFinitaPagina )
{ {
body.update(); body.update();
const int body_righe = body.height(); const int body_righe = body.height();
@ -1066,9 +1088,10 @@ bool TQuadroL::stampa_L(TPrinter& pr,const long lStartRec,const int iRecL)
progind()->addstatus(1); progind()->addstatus(1);
righe++; righe++;
++cur; ++cur;
eof=cur.pos()==cur.items()-1; // eof=cur.pos()==cur.items();
finito = (righe==iRecL) || eof; bFinitaPagina = (righe==iRecL);
} }
eof=cur.pos() >= items-1;
return eof; return eof;
} }
@ -1103,8 +1126,10 @@ void TQuadroL::stampa_totali_L(TPrinter& pr)
real rTotVer(totVer.get()); real rTotVer(totVer.get());
rTotEff += _rTotEff; rTotEff += _rTotEff;
rTotVer += _rTotVer; rTotVer += _rTotVer;
totEff.set(_rTotEff.string()); totEff.set(rTotEff.string());
totVer.set(_rTotVer.string()); totVer.set(rTotVer.string());
totEff.update();
totVer.update();
const int lasty = calcola_firma(); const int lasty = calcola_firma();
const int hhr = hh.height(); const int hhr = hh.height();
for (int i = 0; i < hhr; i++) for (int i = 0; i < hhr; i++)
@ -1116,7 +1141,8 @@ void TQuadroL::stampa_totali_L(TPrinter& pr)
progind()->addstatus(1); progind()->addstatus(1);
} }
const int _START_AGG_L=17; const int _START_AGG_L=16;
const int _REC_PRIMA_AGG_L=12; const int _REC_PRIMA_AGG_L=12;
const int _REC_SECONDA_AGG_L=14; const int _REC_SECONDA_AGG_L=14;
const int _RIGA_TOTALI_AGG_L=60; const int _RIGA_TOTALI_AGG_L=60;
@ -1125,13 +1151,19 @@ void TQuadroL::calcola_totali_precedenti()
{ {
TCursor* cur = cursor(); TCursor* cur = cursor();
_rTotEff = _rTotVer = ZERO; _rTotEff = _rTotVer = ZERO;
for ((*cur)=0L; cur->pos() < _START_AGG_L-1; ++(*cur) ) for ((*cur)=0L; cur->pos() < _START_AGG_L; ++(*cur) )
{ {
_rTotEff += cur->curr().get_real("QLRITEFF"); _rTotEff += cur->curr().get_real("QLRITEFF");
_rTotVer += cur->curr().get_real("QLRITVER"); _rTotVer += cur->curr().get_real("QLRITVER");
} }
} }
void TQuadroL::reset_totali_L()
{
TPrint_section& hh = section('F', last_page);
hh.reset();
}
bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis) bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis)
{ {
TCursor* cur = cursor(); TCursor* cur = cursor();
@ -1141,11 +1173,9 @@ bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis
return FALSE; return FALSE;
// Non stampare se non ci sono record // Non stampare se non ci sono record
if (cur->items() < _START_AGG_L-1) if (cur->items() < _START_AGG_L)
return FALSE; return FALSE;
calcola_totali_precedenti();
// Legge dai par.studio l'ordinamento da usare per L // Legge dai par.studio l'ordinamento da usare per L
TConfig conf(CONFIG_STUDIO); TConfig conf(CONFIG_STUDIO);
const int iChiaveL = (int)conf.get_long("FlStQl", "77"); const int iChiaveL = (int)conf.get_long("FlStQl", "77");
@ -1154,9 +1184,11 @@ bool TQuadroL::print(const long codditta, const long NumFis, const long NumNoFis
else else
cur->setkey(2); cur->setkey(2);
calcola_totali_precedenti();
pr.formlen(dic_form_len()); pr.formlen(dic_form_len());
// int lOffsetL=_START_AGG_L; int lOffsetL=_START_AGG_L-1;
int lOffsetL=15; // int lOffsetL=15;
(*cur)=lOffsetL; (*cur)=lOffsetL;
bool finito=FALSE; bool finito=FALSE;
while (!finito) while (!finito)
@ -1564,12 +1596,12 @@ bool TQuadroN::print(const long codditta, const long NumFis, const long NumNoFis
_PaginaPosizionamento=FALSE; _PaginaPosizionamento=FALSE;
next_page(pr); next_page(pr);
pr.formlen(TDicForm::dic_form_len()); pr.formlen(TDicForm::dic_form_len());
bool FinitoN = ptrN == _righeN.items(); bool FinitoN = ptrN >= _righeN.items();
bool FinitoP = ptrP == _righeP.items(); bool FinitoP = ptrP >= _righeP.items();
bool FinitoQ = ptrQ == _righeQ.items(); bool FinitoQ = ptrQ >= _righeQ.items();
bool FinitoR = ptrR == _righeR.items(); bool FinitoR = ptrR >= _righeR.items();
bool FinitoS = ptrS == _righeS.items(); bool FinitoS = ptrS >= _righeS.items();
bool FinitoT = ptrT == _righeT.items(); bool FinitoT = ptrT >= _righeT.items();
done = FinitoN && FinitoP && FinitoQ && FinitoR && FinitoS && FinitoT; done = FinitoN && FinitoP && FinitoQ && FinitoR && FinitoS && FinitoT;
} }
close_print(); close_print();

View File

@ -56,8 +56,9 @@ class TBase3 : public TDicForm
protected: protected:
void stampa_testata(TPrinter& pr); void stampa_testata(TPrinter& pr);
void stampa_totali_L(TPrinter& pr); void stampa_totali_L(TPrinter& pr);
void reset_totali_L();
bool aggiuntivoL() const { return _bAggiuntivoL; } bool aggiuntivoL() const { return _bAggiuntivoL; }
int stampa_L(TPrinter& pr,const int iChiaveL); int stampa_L(TPrinter& pr);
virtual int dic_form_len() const { return BASE_FORMLEN; } virtual int dic_form_len() const { return BASE_FORMLEN; }
virtual void next_page(TPrinter& pr) { fill_page(pr, -1); } virtual void next_page(TPrinter& pr) { fill_page(pr, -1); }
virtual void set_body(TPrinter& pr, const char tipo) {} virtual void set_body(TPrinter& pr, const char tipo) {}
@ -255,6 +256,7 @@ class TQuadroL : public TDicForm
long _codditta; long _codditta;
real _rTotEff, _rTotVer; real _rTotEff, _rTotVer;
int _num_foglio; int _num_foglio;
void reset_totali_L();
void calcola_totali_precedenti(); void calcola_totali_precedenti();
protected: protected:
void stampa_testata(TPrinter& pr); void stampa_testata(TPrinter& pr);