Files correlati : ve6.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 979 git-svn-id: svn://10.65.10.50/trunk@15623 c028cbd2-c16b-5b4b-a496-9718f37d4682
1194 lines
38 KiB
C++
Executable File
1194 lines
38 KiB
C++
Executable File
// 772100.cpp - Stampa schede percipienti
|
|
|
|
#include <printapp.h>
|
|
#include <recarray.h>
|
|
#include <sort.h>
|
|
|
|
#include "perc.h"
|
|
#include "rpag.h"
|
|
#include "rver.h"
|
|
#include "scperc.h"
|
|
|
|
#include <comuni.h>
|
|
#include <nditte.h>
|
|
#include <anagr.h>
|
|
#include <anafis.h>
|
|
#include <mailbox.h>
|
|
#include <execp.h>
|
|
|
|
#include "772.h"
|
|
#include "772100.h"
|
|
#include "77lib.h"
|
|
|
|
//
|
|
// Lista modifiche
|
|
//
|
|
// 23.11.95 Nella stampa a 198 una colonna sola comprendente quote e
|
|
// spese non soggette
|
|
// 27.11.95 Scarta le schede con annodoc MAGGIORE di annodic
|
|
// 27.11.95 Se l'annopag e' successivo mette il pag. nei NON pagati e non lo stampa
|
|
// 7.12.95 Riparte da pag.1 con un nuovo percipiente
|
|
// 11. 1.96 Nel tot_comp_non_pagati somma anche i pagamenti di anni precedenti
|
|
// 11. 1.96 Scarta le schede SOLO SE non hanno NESSUN pag con annopag==annodic
|
|
// non piu' in base al loro annodoc
|
|
//
|
|
|
|
/****************************************************************************
|
|
11.1.96
|
|
Layout della stampa a 198
|
|
I numeri indicati sono gia' calcolati come parametri per set_row() e set_header()
|
|
145
|
|
80 Somme o D
|
|
Cod. 43 60 70 Totale Data 101 115 122 134 quote T C Serie Numero 183
|
|
Caus. Descrizione Data Numero Imponibili Spese Imposte Documento Pagamento Imponibili % Ritenute Compensi non sogg. C B Data ABI CAB Importo versato
|
|
3 8 24 33 41 53 65 77 90 99 112 118 130 142 155 159 168 174 186
|
|
II I__I I_15__________I I______I I_____I I_IMPONIB__II_SPESE____II_IMPOSTE__II_TOTDOC___I I______I I_IMPOPAG__I I___I I_RITPAG___II_COMPENS__II_NSOGG____I I I I______I I___I I_________I I_IMPVERS__I
|
|
157
|
|
|
|
****************************************************************************/
|
|
|
|
HIDDEN TString256 tmp;
|
|
HIDDEN const int RIGHE_FOOTER = 2;
|
|
|
|
// picture standard di stampa
|
|
HIDDEN const char* STD_ALQ_PIC = ".2";
|
|
|
|
// costanti di stampa
|
|
HIDDEN const char* DOC_R1_10 = "@bData docum.@23gN.@34gComp.@48gCompensi@72gSpese@93gImposte@114gTot.@r";
|
|
HIDDEN const char* DOC_R2_10 = "@b@4gCod.caus.@20gCod.quadro@35gTrib.@51gCausale@63gDescrizione caus.@r";
|
|
HIDDEN const char* PAG_R1_10 = "@bData pag.@21gCompensi@45gCPA@62gSpese@82g!@84gEstremi versamento@r";
|
|
HIDDEN const char* PAG_R2_10 = "@b@21gQuote non sogg.(+reg.conv.)@62gImpon.@82g!@84gTC DCB Data@102gId.1@111gId.2@120gImp.versato@r";
|
|
HIDDEN const char* PAG_R3_10 = "@b@21gRit.%%@40gRitenuta@62g%%Imp.C.10%%@82g!@r";
|
|
HIDDEN const char* PAG_R4_10 = "@b@21gC.10%%perc.@46gC.10%%comp.@72gCod.10%%@82g!@r";
|
|
HIDDEN const char* RIE_R1_10 = "@bQ.@3gCau.@8gTrib.@14gLordo corrisp.@31gLordo corrisp.@50gSpese@61gQuote non sogg.@r";
|
|
HIDDEN const char* RIE_R2_10 = "@b@77gImponibile@93gRitenuta@108gCompenso netto@r";
|
|
HIDDEN const char* RIE_R3_10 = "@b@17g(+ CPA)@34g(- CPA)@62g(+ reg.conv.)@r";
|
|
HIDDEN const char* RIE_R4_10 = "@b@16gC.10%% perc.@31gC.10%% comm.@47gTot. C.10%%@r";
|
|
|
|
class TStampa_perc : public TPrintapp
|
|
{
|
|
char _liv; // Se stampa a livello di studio
|
|
int _anno_dic; // Anno dichiarazione nei paramentri utente o studio
|
|
bool _changed_perc; // flag che segnala il passaggio a nuovo perc.
|
|
struct righe_pag
|
|
{
|
|
char codq[3];
|
|
char cauq[2];
|
|
char codc[5];
|
|
char artb[3];
|
|
Pag_struct val;
|
|
};
|
|
|
|
TRelation* _rel;
|
|
TCursor* _cur;
|
|
righe_pag* _bil;
|
|
TSort* _sort;
|
|
TVersamento_stampa _stvers;
|
|
const char* _buf;
|
|
TLocalisamfile *_anag, *_rpag, *_rver, *_comuni;
|
|
TString16 _section;
|
|
TConfig* _cnf;
|
|
TString _ragsocER,_indER,_civER,_capER,_dencomER,_provER,_cofiER;
|
|
TString _ragsocPE,_indPE,_civPE,_capPE,_dencomPE,_provPE,_cofiPE;
|
|
TString _dencomnscER,_provnscER,_dencomnscPE,_provnscPE;
|
|
TString _datanascER,_datanascPE,_desc_cau,_numdoc;
|
|
TDate _datadoc;
|
|
int _nprog;
|
|
int _anno,_numcarat,_codcaus,_codtrib,_tiposel,_artbil;
|
|
long _codditta,_codanagER,_codanagPE;
|
|
char _tipoa, _tipoaER;
|
|
real _impondoc,_spesedoc,_imposdoc,_totaledoc;
|
|
real _tot_comp,_tot_fatt;
|
|
real _tot_somme_non_soggette, _tot_comp_non_pagati; // tot.delle rimanenze di un percipiente
|
|
real _compenso_dovuto, _spese_dovute; // usati per calcolare rimanenza di una scheda
|
|
bool _rifai_sort;
|
|
int _ind,_mesecomp,_annocomp;
|
|
bool _stampa_scheda; // stampo o no la scheda corrente
|
|
bool _almeno_una_scheda; // c'e' almeno una scheda stampabile
|
|
TString16 _codqua,_causqua;
|
|
bool init_print();
|
|
void add(TVersamento& vers);
|
|
bool find(TVersamento& vers);
|
|
TString STD_IMP_PIC;
|
|
|
|
protected:
|
|
virtual void on_config_change();
|
|
virtual bool user_create() ;
|
|
virtual bool user_destroy();
|
|
virtual bool set_print(int m);
|
|
|
|
virtual bool preprocess_page (int,int);
|
|
virtual bool preprocess_print(int,int);
|
|
virtual print_action postprocess_page (int,int);
|
|
virtual void preprocess_header();
|
|
|
|
public:
|
|
void stampa_vers(TVersamento_stampa& vers, int riga, const int numvers, const real& ritenpag);
|
|
void dati_erogante();
|
|
void dati_percipiente();
|
|
int stampa_dati_erog_perc();
|
|
int ricerca_causale(TString&,TString&);
|
|
int setta_righe_documento();
|
|
int setta_righe_pagamenti (TRectype& rpag,int i);
|
|
void setta_righe_versamenti(char luo, char tipo, TDate& dataver, const TString& serie, const TString& numero, const long progbanc, const real& impvers,int j);
|
|
void do_sort(const TString& codqua,const TString& causqua,int codtrib,int artbil,TRectype& rpag);
|
|
void init_sort();
|
|
void set_bil_key(righe_pag* b,const char* codq,const char* cauq,int codc, int artb);
|
|
void set_bil_val(righe_pag* b,TRectype& rpag);
|
|
void intestazione_riepilogo(const bool redo_header=FALSE, const int start_riga=0);
|
|
real fatture();
|
|
static bool codditta_hnd(TMask_field& f, KEY k);
|
|
|
|
// D = stampa ditta, S = stampa a livello di studio
|
|
TStampa_perc(char livello='D') : _liv(toupper(livello)) {}
|
|
};
|
|
|
|
HIDDEN TStampa_perc& app() { return (TStampa_perc&) main_app(); }
|
|
|
|
void TStampa_perc::add(TVersamento& vers)
|
|
{
|
|
_stvers.add(vers);
|
|
}
|
|
|
|
bool TStampa_perc::find(TVersamento& vers)
|
|
{
|
|
return _stvers.find(vers);
|
|
}
|
|
|
|
bool TStampa_perc::codditta_hnd(TMask_field& f, KEY k)
|
|
{
|
|
if (k == K_TAB && !(f.mask().is_running()) )
|
|
{
|
|
TString16 codditta; codditta << app()._codditta;
|
|
if (codditta != "0")
|
|
{
|
|
f.set(codditta);
|
|
f.check();
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
void TStampa_perc::init_sort()
|
|
{
|
|
_sort->reset(sizeof(righe_pag));
|
|
_sort -> addsortkey ((char*)&(_bil->codq) - (char*)&(_bil->codq),2);
|
|
_sort -> addsortkey ((char*)&(_bil->cauq) - (char*)&(_bil->codq),1);
|
|
_sort -> addsortkey ((char*)&(_bil->codc) - (char*)&(_bil->codq),4);
|
|
_sort -> addsortkey ((char*)&(_bil->artb) - (char*)&(_bil->codq),2);
|
|
_sort -> init();
|
|
}
|
|
|
|
void TStampa_perc::set_bil_key(righe_pag* b,const char* codq,const char* cauq,int codc,int artb)
|
|
{
|
|
strcpy (b->codq, codq);
|
|
strcpy (b->cauq, cauq);
|
|
sprintf(b->codc , "%4d", codc);
|
|
sprintf(b->artb , "%2d", artb);
|
|
}
|
|
|
|
void TStampa_perc::set_bil_val(righe_pag* b, TRectype& rpag)
|
|
{
|
|
b->val = rpag;
|
|
}
|
|
|
|
void TStampa_perc::do_sort(const TString& codqua,const TString& causqua,int codtrib,int artbil,TRectype& rpag)
|
|
{
|
|
set_bil_key(_bil, codqua, causqua, codtrib, artbil);
|
|
set_bil_val(_bil, rpag);
|
|
_sort->sort((const char*) _bil);
|
|
}
|
|
|
|
int TStampa_perc::ricerca_causale(TString& desc,TString& codqua)
|
|
{
|
|
int cod = 0;
|
|
TString4 dep; dep.format("%02d", _codcaus);
|
|
const TRectype& ca7 = cache().get("%CA7", dep);
|
|
if (!ca7.empty())
|
|
{
|
|
desc = ca7.get("S0");
|
|
cod = ca7.get_int("I0");
|
|
codqua = ca7.get("S1");
|
|
_artbil = ca7.get_int("I3");
|
|
}
|
|
return cod;
|
|
}
|
|
|
|
bool TStampa_perc::preprocess_print(int file, int counter)
|
|
{
|
|
if (file == LF_SCPERC)
|
|
{
|
|
_tot_somme_non_soggette = _tot_comp_non_pagati = ZERO;
|
|
_almeno_una_scheda = FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
int TStampa_perc::setta_righe_documento()
|
|
{
|
|
reset_print();
|
|
TString spesedoc(20), imposdoc(20), totdoc(20), impondoc(20);
|
|
|
|
spesedoc = _spesedoc.string(STD_IMP_PIC);
|
|
imposdoc = _imposdoc.string(STD_IMP_PIC);
|
|
totdoc = _totaledoc.string(STD_IMP_PIC);
|
|
impondoc = _impondoc.string(STD_IMP_PIC);
|
|
|
|
// inizilizza offset di riga per lasciare una riga bianca
|
|
// tra una scheda e l'altra
|
|
int ofr = 1;
|
|
if (_almeno_una_scheda) ofr++;
|
|
|
|
if (_numcarat == 1)
|
|
{
|
|
// riga 1/2
|
|
set_row(ofr, DOC_R1_10);
|
|
set_row(ofr, "@12g%s", (const char*)_datadoc);
|
|
set_row(ofr, "@26g%s", (const char*)_numdoc);
|
|
set_row(ofr, "@40g%2d/%4d", _mesecomp,_annocomp);
|
|
set_row(ofr, "@57g%12s", _impondoc.string(STD_IMP_PIC));
|
|
set_row(ofr, "@78g%12s", _spesedoc.string(STD_IMP_PIC));
|
|
set_row(ofr, "@101g%12s", _imposdoc.string(STD_IMP_PIC));
|
|
set_row(ofr, "@119g%12s", _totaledoc.string(STD_IMP_PIC));
|
|
|
|
// riga 2/2
|
|
set_row(ofr+1, DOC_R2_10);
|
|
set_row(ofr+1, "@14g%02d", _codcaus);
|
|
set_row(ofr+1, "@31g%s", (const char*)_codqua);
|
|
set_row(ofr+1, "@41g%04d/%02d", _codtrib,_artbil);
|
|
set_row(ofr+1, "@59g%s", (const char*)_causqua);
|
|
set_row(ofr+1, "@81g%35s", (const char*)_desc_cau);
|
|
|
|
// aggiorno offset per restituzione
|
|
ofr += 2;
|
|
}
|
|
else
|
|
{
|
|
reset_row(1);
|
|
set_row (1, "@0g%02d", _codcaus);
|
|
set_row (1, "@3g%4d", _codtrib);
|
|
set_row (1, "@8g%.15s", (const char*) _desc_cau);
|
|
TString16 dep(_datadoc.string(brief));
|
|
set_row (1, "@24g%8s", (const char*) dep);
|
|
set_row (1, "@33g%-7s", (const char*) _numdoc);
|
|
set_row (1, "@41g%12s", (const char*)impondoc);
|
|
set_row (1, "@53g%12s", (const char*)spesedoc);
|
|
set_row (1, "@65g%12s", (const char*)imposdoc);
|
|
set_row (1, "@77g%12s", (const char*)totdoc);
|
|
}
|
|
|
|
return ofr;
|
|
}
|
|
|
|
int TStampa_perc::setta_righe_pagamenti(TRectype& rpag,int i)
|
|
{
|
|
// istanza struttura pagamenti
|
|
Pag_struct s;
|
|
// riempe struttura con valori del record
|
|
s = rpag;
|
|
|
|
// set riga corrente
|
|
int riga = i;
|
|
|
|
if (_numcarat == 1)
|
|
{
|
|
// riga 1/4
|
|
set_row(riga, PAG_R1_10);
|
|
// data pagamento
|
|
set_row(riga, "@10g%s", (const char*)s.datapag);
|
|
// compenso
|
|
set_row(riga, "@30g%12s", s.compenso.string(STD_IMP_PIC));
|
|
// CPA
|
|
set_row(riga, "@49g%12s", s.impcpa.string(STD_IMP_PIC));
|
|
// spese
|
|
set_row(riga, "@68g%12s", s.spesa.string(STD_IMP_PIC));
|
|
|
|
// riga 2/4
|
|
set_row(riga+1, PAG_R2_10);
|
|
// quote non soggette (+reg.conv.)
|
|
real quotenonsogg = s.quotaprov+s.somregconv;
|
|
set_row(riga+1, "@49g%12s", quotenonsogg.string(STD_IMP_PIC));
|
|
// spese
|
|
set_row(riga+1, "@68g%12s", s.imponibile.string(STD_IMP_PIC));
|
|
|
|
// riga 3/4
|
|
set_row(riga+2, PAG_R3_10);
|
|
// percentuale ritenuta
|
|
set_row(riga+2, "@27g%6s", s.perc.string(STD_ALQ_PIC));
|
|
// ritenuta
|
|
set_row(riga+2, "@49g%12s", s.ritenuta.string(STD_IMP_PIC));
|
|
// percentuale assogg.imponibile Inps
|
|
set_row(riga+2, "@73g%s", s.alqimp10.string(STD_ALQ_PIC));
|
|
|
|
// riga 4/4
|
|
set_row(riga+3, PAG_R4_10);
|
|
// contributo Inps percipiente
|
|
set_row(riga+3, "@32g%12s", s.ctssnperc.string(STD_IMP_PIC));
|
|
// contributo Inps complessivo
|
|
set_row(riga+3, "@58g%12s", s.ctssncomp.string(STD_IMP_PIC));
|
|
// codice contributo Inps
|
|
set_row(riga+3, "@80g%s", (const char *)s.cod10);
|
|
} /*
|
|
else
|
|
if (_numcarat == 2)
|
|
{
|
|
TString16 dep(datapag.string(brief));
|
|
real quotepag198 = ZERO;
|
|
set_row (i, "@90g%8s", (const char*) dep);
|
|
set_row (i, "@99g%12r", &imponpag);
|
|
set_row (i, "@112g%s", (const char*)percent);
|
|
set_row (i, "@118g%12r", &ritenpag);
|
|
set_row (i, "@130g%12r", &compenpag);
|
|
// 23.11.95
|
|
// Nella stampa a 198 una colonna sola comprendente quote e spese non soggette
|
|
quotepag198 = compenpag - imponpag + spesepag;
|
|
set_row (i, "@142g%12r", "epag198);
|
|
} */
|
|
|
|
return riga+2;
|
|
}
|
|
|
|
void TStampa_perc::setta_righe_versamenti(char luovers,char tipovers, TDate& dataver,
|
|
const TString& serie,const TString& numero,
|
|
const long progbanc, const real& impvers,int j)
|
|
{
|
|
|
|
|
|
if (_numcarat == 1)
|
|
{
|
|
set_row(j, "@84g%c", luovers);
|
|
set_row(j, "@88g%c", tipovers);
|
|
set_row(j, "@91g%s", (const char*)dataver);
|
|
set_row(j, "@102g%s", (const char*)serie);
|
|
set_row(j, "@108g%s", (const char*)numero);
|
|
set_row(j, "@120g%12r", &impvers);
|
|
// aggiungo progressivo banca al numero di versamento
|
|
if (tipovers == 'B' && progbanc != 0L)
|
|
set_row(j, "@113g%06d", progbanc);
|
|
}
|
|
else
|
|
if (_numcarat == 2)
|
|
{
|
|
set_row (j, "@155g%c", luovers);
|
|
set_row (j, "@157g%c", tipovers);
|
|
TString16 dep(dataver.string(brief));
|
|
set_row (j, "@159g%8s", (const char*) dep);
|
|
set_row (j, "@168g%5s", (const char*) serie);
|
|
set_row (j, "@174g%-11s", (const char*)numero);
|
|
set_row (j, "@186g%12r", &impvers);
|
|
}
|
|
}
|
|
|
|
void TStampa_perc::stampa_vers(TVersamento_stampa& ve, int nriga, const int numvers, const real& ritenpag)
|
|
{
|
|
TString16 serie, numero;
|
|
real vers_stampa = ZERO;
|
|
long progbanc;
|
|
|
|
_rver->setkey(1);
|
|
_rver->zero();
|
|
_rver->put(SPR_CODDITTA, _codditta);
|
|
_rver->put(SPR_TIPOA, _tipoa);
|
|
_rver->put(SPR_CODANAGR, _codanagPE);
|
|
_rver->put(SPR_NPROG, _nprog);
|
|
_rver->put(VER_NRIGA, numvers);
|
|
|
|
if (_rver->read(_isequal) == NOERR)
|
|
{
|
|
char luovers = _rver->get(VER_LUOVERS)[0];
|
|
char tipovers = _rver->get(VER_TIPOVERS)[0];
|
|
TDate dataver(_rver->get_date(VER_DATAVERS));
|
|
serie = _rver->get(VER_SERIE);
|
|
numero = _rver->get(VER_NUMERO);
|
|
progbanc = _rver->get_long("PROGBANC");
|
|
real impvers = _rver->get_real(VER_IMPVERS);
|
|
|
|
ve.set(_codditta, _tipoa, _codanagPE, _nprog, numvers, impvers);
|
|
|
|
const bool gia_visto = find(ve);
|
|
|
|
if (gia_visto)
|
|
{
|
|
real vvee = ve.importo_versato_residuo();
|
|
impvers = vvee;
|
|
}
|
|
|
|
vers_stampa = ve.vers_stampa(_rpag, numvers, impvers, ritenpag);
|
|
setta_righe_versamenti(luovers,tipovers,dataver,serie,numero,progbanc,vers_stampa,nriga);
|
|
}
|
|
}
|
|
|
|
bool TStampa_perc::preprocess_page(int file, int counter)
|
|
{
|
|
TString16 datapag,dataver,codqua;
|
|
real ritenpag,compenpag,spesepag;
|
|
int i, rigaver, numvers, anno_doc, rigapag;
|
|
bool pagato_anno_in_corso = FALSE;
|
|
|
|
if (counter)
|
|
return TRUE;
|
|
|
|
if (file == LF_SCPERC)
|
|
{
|
|
reset_print();
|
|
TRectype sch_curr(current_cursor()->curr(LF_SCPERC));
|
|
_tipoa = current_cursor()->curr(LF_SCPERC).get(SPR_TIPOA)[0];
|
|
_codanagPE = current_cursor()->curr(LF_SCPERC).get_long(SPR_CODANAGR);
|
|
_nprog = current_cursor()->curr(LF_SCPERC).get_int(SPR_NPROG);
|
|
_codcaus = current_cursor()->curr(LF_SCPERC).get_int(SPR_CODCAUS);
|
|
_codtrib = ricerca_causale(_desc_cau,codqua);
|
|
_codqua = codqua;
|
|
_datadoc = current_cursor()->curr(LF_SCPERC).get_date(SPR_DATADOC);
|
|
_numdoc = current_cursor()->curr(LF_SCPERC).get(SPR_NUMDOC);
|
|
_impondoc = current_cursor()->curr(LF_SCPERC).get_real(SPR_COMPENSO);
|
|
_spesedoc = current_cursor()->curr(LF_SCPERC).get_real(SPR_SPESE);
|
|
_imposdoc = current_cursor()->curr(LF_SCPERC).get_real(SPR_IVA);
|
|
_totaledoc = current_cursor()->curr(LF_SCPERC).get_real(SPR_TOTALE);
|
|
_mesecomp = current_cursor()->curr(LF_SCPERC).get_int (SPR_MESEC);
|
|
_annocomp = current_cursor()->curr(LF_SCPERC).get_int (SPR_ANNOC);
|
|
_causqua = current_cursor()->curr(LF_SCPERC).get("CAUSQUA");
|
|
|
|
anno_doc = _datadoc.year();
|
|
|
|
_compenso_dovuto = _impondoc;
|
|
_spese_dovute = _spesedoc;
|
|
|
|
TSchedaP scheda(sch_curr);
|
|
bool esiste_pag_anno_in_corso;
|
|
if (_tiposel == 1)
|
|
esiste_pag_anno_in_corso = esiste_pag_in_anno(scheda, _anno_dic);
|
|
else
|
|
esiste_pag_anno_in_corso = esiste_pag_in_anno(scheda, _anno_dic, NULLDATE, NULLDATE, _annocomp);
|
|
|
|
_stampa_scheda = anno_doc <= _anno_dic && esiste_pag_anno_in_corso;
|
|
|
|
TSchedaP sch_corr(_codditta, _tipoa, _codanagPE, _nprog);
|
|
|
|
if (_stampa_scheda)
|
|
{
|
|
_tot_fatt += _totaledoc;
|
|
|
|
rigapag = setta_righe_documento();
|
|
|
|
_almeno_una_scheda = TRUE;
|
|
}
|
|
|
|
// inizializza offset riga per pagamenti
|
|
|
|
if (_numcarat == 1)
|
|
i = rigapag;
|
|
else
|
|
i = 1;
|
|
|
|
if (_rifai_sort)
|
|
{
|
|
init_sort();
|
|
_rifai_sort = FALSE;
|
|
}
|
|
|
|
TRectype recpag(_rpag->curr());
|
|
recpag.zero();
|
|
recpag.put(SPR_CODDITTA, _codditta);
|
|
recpag.put(SPR_TIPOA, _tipoa);
|
|
recpag.put(SPR_CODANAGR, _codanagPE);
|
|
recpag.put(SPR_NPROG, _nprog);
|
|
|
|
_rpag->setkey(1);
|
|
_rpag->zero();
|
|
_rpag->curr() = recpag;
|
|
|
|
TDate datapag;
|
|
TVersamento_stampa ve;
|
|
bool aggiorna_totali = FALSE;
|
|
for (_rpag->read(_isgteq); _rpag->good(); _rpag->next())
|
|
{
|
|
if (_rpag->curr() > recpag)
|
|
break;
|
|
|
|
datapag = _rpag->get_date(PAG_DATAPAG);
|
|
int anno_pag = datapag.year();
|
|
|
|
// per tipo selezione 2 (per data competenza),
|
|
// uso l'anno di competenza per i controlli (se indicato)
|
|
if (_tiposel == 2 && _annocomp)
|
|
anno_pag = _annocomp;
|
|
|
|
compenpag = _rpag->get_real(PAG_COMPENSO);
|
|
spesepag = _rpag->get_real(PAG_SPESA);
|
|
|
|
// Aggiorna i tot. per questa scheda
|
|
if (anno_pag <= _anno_dic)
|
|
{
|
|
_compenso_dovuto -= compenpag;
|
|
_spese_dovute -= spesepag;
|
|
aggiorna_totali = TRUE;
|
|
}
|
|
|
|
// 28.11.95 Se sono di anni precedenti non li stampo
|
|
// (v. prospetto di Omero)
|
|
// 10.1.96 pero' sommo compenso e spese nei non pagati
|
|
if (anno_pag < _anno_dic)
|
|
continue;
|
|
|
|
// Non devo stampare nulla, si resta nel ciclo solo per aggiornare i totali
|
|
if (!_stampa_scheda)
|
|
continue;
|
|
|
|
pagato_anno_in_corso = anno_pag == _anno_dic;
|
|
|
|
real r_perc;
|
|
r_perc = _rpag->get_real(PAG_PERC);
|
|
TString16 st_perc(r_perc.string("###,@@"));
|
|
ritenpag = _rpag->get_real(PAG_RITENUTA);
|
|
numvers = _rpag->get_int(PAG_NUMVERS);
|
|
|
|
// 27.11.95 se l'anno e' successivo deve restare nei NON pagati
|
|
// e non si stampa
|
|
if (pagato_anno_in_corso)
|
|
{
|
|
rigaver = setta_righe_pagamenti(_rpag->curr(),i);
|
|
i += 4;
|
|
do_sort(_codqua,_causqua,_codtrib,_artbil,_rpag->curr());
|
|
|
|
if (numvers > 0)
|
|
stampa_vers(ve, rigaver, numvers, ritenpag);
|
|
}
|
|
} // for (rpag.. legge pagamento successivo
|
|
|
|
// Aggiorna i totali delle spese e comp. ancora da pagare
|
|
if (aggiorna_totali)
|
|
{
|
|
_tot_comp_non_pagati += _compenso_dovuto;
|
|
_tot_somme_non_soggette += _spese_dovute;
|
|
}
|
|
|
|
// Determina se questa e' l'ultima scheda di questo percipiente
|
|
current_cursor()->save_status();
|
|
++(*current_cursor());
|
|
char tipoa = current_cursor()->curr(LF_SCPERC).get_char(SPR_TIPOA);
|
|
long codanag = current_cursor()->curr(LF_SCPERC).get_long(SPR_CODANAGR);
|
|
--(*current_cursor());
|
|
current_cursor()->restore_status();
|
|
|
|
// Se e' l'ultima chiude il sort (cioe' il riepilogo)
|
|
if (_tipoa != tipoa || _codanagPE != codanag)
|
|
_sort->endsort();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
real TStampa_perc::fatture()
|
|
{
|
|
TLocalisamfile perc (LF_PERC);
|
|
real fatt_bil;
|
|
|
|
fatt_bil = ZERO;
|
|
|
|
perc.setkey(1);
|
|
perc.zero();
|
|
perc.put(PRC_CODDITTA, _codditta);
|
|
perc.put(PRC_TIPOA, _tipoa);
|
|
perc.put(PRC_CODANAGR, _codanagPE);
|
|
if (perc.read() == NOERR)
|
|
fatt_bil = perc.get_real(PRC_FATTBIL);
|
|
|
|
return fatt_bil;
|
|
}
|
|
|
|
print_action TStampa_perc::postprocess_page(int file, int counter)
|
|
{
|
|
char tipoa;
|
|
long codanag;
|
|
bool intesta_sort = TRUE;
|
|
|
|
if (counter)
|
|
{
|
|
printer().formfeed();
|
|
reset_print(); // per evitare che stampi di nuovo il totale prec.
|
|
|
|
// 7.12.95 Riparto da pag.1 con un nuovo percipiente
|
|
if (_changed_perc)
|
|
{
|
|
printer().setcurrentpage(1);
|
|
_changed_perc = FALSE;
|
|
}
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
if (file == LF_SCPERC)
|
|
{
|
|
if (!_stampa_scheda && !_almeno_una_scheda)
|
|
return NEXT_PAGE;
|
|
|
|
current_cursor()->save_status();
|
|
++(*current_cursor());
|
|
tipoa = current_cursor()->curr(LF_SCPERC).get_char(SPR_TIPOA);
|
|
codanag = current_cursor()->curr(LF_SCPERC).get_long(SPR_CODANAGR);
|
|
--(*current_cursor());
|
|
current_cursor()->restore_status();
|
|
_changed_perc = _tipoa != tipoa || _codanagPE != codanag;
|
|
|
|
if (_changed_perc)
|
|
{
|
|
TString16 codqua,causqua,codqua_t,causqua_t;
|
|
int codtrib,artbil,codtrib_t,artbil_t;
|
|
Pag_struct tot;
|
|
TString key(20),keyp(20);
|
|
|
|
_almeno_una_scheda = FALSE;
|
|
reset_print();
|
|
if (_tot_fatt != ZERO)
|
|
{
|
|
set_row(2, "@b@21gTotale documenti (comprensivo d'IVA) %12r@r", &_tot_fatt);
|
|
_ind = 4;
|
|
}
|
|
else
|
|
_ind = 3;
|
|
|
|
righe_pag* bil = (righe_pag*) _buf;
|
|
|
|
_buf = _sort->retrieve();
|
|
|
|
int righe_libbere = printer().rows_left();
|
|
|
|
if (_buf != NULL)
|
|
{
|
|
do
|
|
{
|
|
bil = (righe_pag*) _buf;
|
|
codqua = bil->codq;
|
|
causqua = bil->cauq;
|
|
codtrib = atoi(bil->codc);
|
|
artbil = atoi(bil->artb);
|
|
|
|
key.format("%2s%1s%4d%2d", (const char*)codqua,(const char*)causqua,codtrib,artbil);
|
|
|
|
if (intesta_sort)
|
|
{
|
|
intestazione_riepilogo();
|
|
righe_libbere -= 7;
|
|
intesta_sort = FALSE;
|
|
keyp = key;
|
|
}
|
|
|
|
if (key == keyp)
|
|
{
|
|
codqua_t = codqua;
|
|
causqua_t = causqua;
|
|
codtrib_t = codtrib;
|
|
artbil_t = artbil;
|
|
tot += bil->val;
|
|
}
|
|
else
|
|
{
|
|
if (righe_libbere <= 1)
|
|
{
|
|
intestazione_riepilogo();
|
|
righe_libbere = printer().formlen() - printer().headersize();
|
|
}
|
|
// valori calcolati
|
|
real tmp_lordocorr = tot.ammlordo+tot.impcpa;
|
|
real tmp_quotenonsog = tot.quotaprov+tot.somregconv;
|
|
real tmp_inpscommit = tot.ctssncomp-tot.ctssnperc;
|
|
// prima riga
|
|
set_row(_ind, "@b%2s", (const char*)codqua_t);
|
|
set_row(_ind, "@4g%1s", (const char*)causqua_t);
|
|
set_row(_ind, "@7g%4d/%2d@r", codtrib_t,artbil_t);
|
|
set_row(_ind, "@15g%12s", tmp_lordocorr.string(STD_IMP_PIC));
|
|
set_row(_ind, "@31g%12s", tot.ammlordo.string(STD_IMP_PIC));
|
|
set_row(_ind, "@46g%12s", tot.spesa.string(STD_IMP_PIC));
|
|
set_row(_ind, "@61g%12s", tmp_quotenonsog.string(STD_IMP_PIC));
|
|
set_row(_ind, "@76g%12s", tot.imponibile.string(STD_IMP_PIC));
|
|
set_row(_ind, "@92g%12s", tot.ritenuta.string(STD_IMP_PIC));
|
|
set_row(_ind, "@107g%12s", tot.netto.string(STD_IMP_PIC));
|
|
_ind++;
|
|
righe_libbere--;
|
|
// seconda riga
|
|
set_row(_ind, "@15g%12s", tot.ctssnperc.string(STD_IMP_PIC));
|
|
set_row(_ind, "@31g%12s", tmp_inpscommit.string(STD_IMP_PIC));
|
|
set_row(_ind, "@46g%12s", tot.ctssncomp.string(STD_IMP_PIC));
|
|
_ind++;
|
|
righe_libbere--;
|
|
// reimposta valori prossima riga
|
|
codqua_t = codqua;
|
|
causqua_t = causqua;
|
|
codtrib_t = codtrib;
|
|
artbil_t = artbil;
|
|
tot = bil->val;
|
|
}
|
|
keyp = key;
|
|
_buf = _sort->retrieve();
|
|
}
|
|
while ( _buf != NULL);
|
|
}
|
|
|
|
// stampo ultima riga
|
|
real tmp_lordocorr = tot.ammlordo+tot.impcpa;
|
|
real tmp_quotenonsog = tot.quotaprov+tot.somregconv;
|
|
real tmp_inpscommit = tot.ctssncomp-tot.ctssnperc;
|
|
set_row(_ind, "@b%2s", (const char*)codqua_t);
|
|
set_row(_ind, "@4g%1s", (const char*)causqua_t);
|
|
set_row(_ind, "@7g%4d/%2d@r", codtrib_t,artbil_t);
|
|
set_row(_ind, "@15g%12s", tmp_lordocorr.string(STD_IMP_PIC));
|
|
set_row(_ind, "@31g%12s", tot.ammlordo.string(STD_IMP_PIC));
|
|
set_row(_ind, "@46g%12s", tot.spesa.string(STD_IMP_PIC));
|
|
set_row(_ind, "@61g%12s", tmp_quotenonsog.string(STD_IMP_PIC));
|
|
set_row(_ind, "@76g%12s", tot.imponibile.string(STD_IMP_PIC));
|
|
set_row(_ind, "@92g%12s", tot.ritenuta.string(STD_IMP_PIC));
|
|
set_row(_ind, "@107g%12s", tot.netto.string(STD_IMP_PIC));
|
|
_ind++;
|
|
set_row(_ind, "@15g%12s", tot.ctssnperc.string(STD_IMP_PIC));
|
|
set_row(_ind, "@31g%12s", tmp_inpscommit.string(STD_IMP_PIC));
|
|
set_row(_ind, "@46g%12s", tot.ctssncomp.string(STD_IMP_PIC));
|
|
_ind++;
|
|
|
|
real fatt_bil, totale_non_pagate;
|
|
|
|
fatt_bil = fatture();
|
|
totale_non_pagate = _tot_comp_non_pagati + _tot_somme_non_soggette;
|
|
|
|
set_row (_ind++, "");
|
|
|
|
if (fatt_bil != ZERO)
|
|
{
|
|
set_row (_ind++, "***************************");
|
|
set_row (_ind++, "*** FATTURE DA RICEVERE ***@30g%12.0r", &fatt_bil);
|
|
set_row (_ind++, "***************************");
|
|
set_row (_ind++, "");
|
|
}
|
|
|
|
set_row (_ind++, "************** Compensi@42g%12s@56g+", _tot_comp_non_pagati.string(STD_IMP_PIC));
|
|
set_row (_ind++, "* NON PAGATE * Spese@42g%12s@56g=", _tot_somme_non_soggette.string(STD_IMP_PIC));
|
|
set_row (_ind++, "**************@42g----------------");
|
|
set_row (_ind , " Totale@42g%12s", totale_non_pagate.string(STD_IMP_PIC));
|
|
|
|
_rifai_sort = TRUE;
|
|
_tot_comp = ZERO;
|
|
_tot_fatt = ZERO;
|
|
_tot_somme_non_soggette = _tot_comp_non_pagati = ZERO;
|
|
|
|
return REPEAT_PAGE;
|
|
}
|
|
}
|
|
return NEXT_PAGE;
|
|
}
|
|
|
|
void TStampa_perc::intestazione_riepilogo(const bool redo_header, const int start_riga)
|
|
{
|
|
TString sep(100);
|
|
sep.fill('_');
|
|
if (redo_header)
|
|
{
|
|
int ind = start_riga;
|
|
set_header(ind, (const char*)sep);
|
|
set_header(ind++, "@32g%s", (const char*)sep);
|
|
set_header(ind, RIE_R1_10);
|
|
set_header(ind++, RIE_R2_10);
|
|
set_header(ind++, RIE_R3_10);
|
|
set_header(ind++, RIE_R4_10);
|
|
set_header(ind, (const char*)sep);
|
|
set_header(ind++, "@32g%s", (const char*)sep);
|
|
}
|
|
else
|
|
{
|
|
set_row(_ind, (const char*)sep);
|
|
set_row(_ind++, "@32g%s", (const char*)sep);
|
|
set_row(_ind, RIE_R1_10);
|
|
set_row(_ind++, RIE_R2_10);
|
|
set_row(_ind++, RIE_R3_10);
|
|
set_row(_ind++, RIE_R4_10);
|
|
set_row(_ind, (const char*)sep);
|
|
set_row(_ind++, "@32g%s", (const char*)sep);
|
|
}
|
|
}
|
|
|
|
void TStampa_perc::on_config_change()
|
|
{
|
|
TConfig conf(_liv == 'S' ? CONFIG_USER : CONFIG_STUDIO);
|
|
_anno_dic = (int)conf.get_long(ANNO_SEL, _section);
|
|
}
|
|
|
|
bool TStampa_perc::init_print()
|
|
{
|
|
KEY tasto;
|
|
TLocalisamfile* fl;
|
|
TMask msk ("772100a");
|
|
|
|
_changed_perc = FALSE;
|
|
printer().footerlen(RIGHE_FOOTER);
|
|
msk.set_handler (F_CODDITTA, codditta_hnd);
|
|
|
|
tasto = msk.run();
|
|
|
|
if (tasto == K_ENTER)
|
|
{
|
|
char tipoa_da = msk.get(F_TIPODA)[0];
|
|
long cod_da = msk.get_long(F_CODDA);
|
|
char tipoa_a = msk.get(F_TIPOA)[0];
|
|
long cod_a = msk.get_long(F_CODA);
|
|
_numcarat = msk.get_int (F_CARATTERE);
|
|
_tiposel = msk.get_int (F_TIPOSEL);
|
|
|
|
//Crea il cursore su gruppo, conto e sottoconto del file RMOV
|
|
reset_files(); //resetta l'albero di stampa
|
|
add_file(LF_SCPERC);
|
|
|
|
fl = &(current_cursor()->file(LF_SCPERC));
|
|
TRectype da (fl->curr());
|
|
TRectype a (fl->curr());
|
|
|
|
da.zero();
|
|
a.zero();
|
|
|
|
da.put(SPR_CODDITTA, _codditta);
|
|
da.put(SPR_TIPOA, tipoa_da);
|
|
da.put(SPR_CODANAGR, cod_da);
|
|
|
|
a.put(SPR_CODDITTA, _codditta);
|
|
a.put(SPR_TIPOA, tipoa_a);
|
|
a.put(SPR_CODANAGR, cod_a);
|
|
|
|
current_cursor()->setregion(da, a);
|
|
|
|
_anno = _anno_dic;
|
|
|
|
dati_erogante();
|
|
_rifai_sort = TRUE;
|
|
}
|
|
return tasto == K_ENTER;
|
|
}
|
|
|
|
bool TStampa_perc::set_print(int)
|
|
{
|
|
STD_IMP_PIC = "############";
|
|
int fd = TCurrency::get_firm_dec();
|
|
if (fd > 0)
|
|
{
|
|
int i;
|
|
for (i = STD_IMP_PIC.len()-1; fd > 0; i--, fd--)
|
|
STD_IMP_PIC[i] = '@';
|
|
|
|
STD_IMP_PIC[i] = ',';
|
|
}
|
|
|
|
if (_liv == 'S')
|
|
{
|
|
const long codditta_prec = get_firm_770();
|
|
for (int i = 0; (_codditta = _cnf->get_long(DITTE_SEL, _section, i)) != 0L; i++)
|
|
{
|
|
set_firm_770(_codditta);
|
|
// init_print ritorna TRUE solo se K_ENTER
|
|
if (init_print())
|
|
print();
|
|
else
|
|
break;
|
|
}
|
|
set_firm_770(codditta_prec);
|
|
// Non richiamare di nuovo print()!
|
|
return FALSE;
|
|
}
|
|
else
|
|
return init_print();
|
|
}
|
|
|
|
void TStampa_perc::preprocess_header()
|
|
{
|
|
int riga;
|
|
dati_percipiente();
|
|
riga = stampa_dati_erog_perc();
|
|
}
|
|
|
|
void TStampa_perc::dati_erogante()
|
|
{
|
|
TString4 com,comnasc;
|
|
// TDate data;
|
|
|
|
const TRectype& nditte = cache().get(LF_NDITTE, _codditta);
|
|
if (!nditte.empty())
|
|
{
|
|
_tipoaER = nditte.get_char(NDT_TIPOA);
|
|
_codanagER = nditte.get_long(NDT_CODANAGR);
|
|
}
|
|
|
|
_anag->setkey(1);
|
|
_anag->zero();
|
|
_anag->put(ANA_TIPOA, _tipoaER);
|
|
_anag->put(ANA_CODANAGR, _codanagER);
|
|
if (_anag->read() == NOERR)
|
|
{
|
|
_ragsocER = _anag->get(ANA_RAGSOC);
|
|
_cofiER = _anag->get(ANA_COFI);
|
|
|
|
if (_tipoaER == 'F')
|
|
{
|
|
TString80 nome = _ragsocER.mid(30);
|
|
_ragsocER.cut(30);
|
|
_ragsocER.trim(); nome.trim();
|
|
_ragsocER << ' ' << nome;
|
|
}
|
|
|
|
com = _anag->get(ANA_COMRF);
|
|
|
|
if (com != "")
|
|
{
|
|
_indER = _anag->get(ANA_INDRF);
|
|
_civER = _anag->get(ANA_CIVRF);
|
|
_capER = _anag->get(ANA_CAPRF);
|
|
}
|
|
else
|
|
{
|
|
_indER = _anag->get(ANA_INDRES);
|
|
_civER = _anag->get(ANA_CIVRES);
|
|
_capER = _anag->get(ANA_CAPRES);
|
|
com = _anag->get(ANA_COMRES);
|
|
}
|
|
}
|
|
|
|
_comuni->setkey(1);
|
|
_comuni->zero();
|
|
_comuni->put(COM_COM,com);
|
|
if (_comuni->read() == NOERR)
|
|
{
|
|
_dencomER = _comuni->get(COM_DENCOM);
|
|
_provER = _comuni->get(COM_PROVCOM);
|
|
}
|
|
|
|
if (_tipoaER == 'F')
|
|
{
|
|
TLocalisamfile anagfis(LF_ANAGFIS);
|
|
|
|
anagfis.setkey(1);
|
|
anagfis.zero();
|
|
anagfis.put(ANF_CODANAGR, _codanagER);
|
|
if (anagfis.read() == NOERR)
|
|
{
|
|
const TDate data = anagfis.get(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 TStampa_perc::dati_percipiente()
|
|
{
|
|
TString com;
|
|
TDate data;
|
|
TString comnasc;
|
|
|
|
_anag->setkey(1);
|
|
_anag->zero();
|
|
_anag->put(ANA_TIPOA, _tipoa);
|
|
_anag->put(ANA_CODANAGR, _codanagPE);
|
|
if (_anag->read() == NOERR)
|
|
{
|
|
_ragsocPE = _anag->get(ANA_RAGSOC);
|
|
_cofiPE = _anag->get(ANA_COFI);
|
|
|
|
if (_tipoa == 'F')
|
|
{
|
|
TString80 nome = _ragsocPE.mid(30);
|
|
_ragsocPE.cut(30);
|
|
_ragsocPE.trim(); nome.trim();
|
|
_ragsocPE << ' ' << nome;
|
|
}
|
|
|
|
com = _anag->get(ANA_COMRF);
|
|
|
|
if (com != "")
|
|
{
|
|
_indPE = _anag->get(ANA_INDRF);
|
|
_civPE = _anag->get(ANA_CIVRF);
|
|
_capPE = _anag->get(ANA_CAPRF);
|
|
}
|
|
else
|
|
{
|
|
_indPE = _anag->get(ANA_INDRES);
|
|
_civPE = _anag->get(ANA_CIVRES);
|
|
_capPE = _anag->get(ANA_CAPRES);
|
|
com = _anag->get(ANA_COMRES);
|
|
}
|
|
}
|
|
|
|
_comuni->setkey(1);
|
|
_comuni->zero();
|
|
_comuni->put(COM_COM,com);
|
|
if (_comuni->read() == NOERR)
|
|
{
|
|
_dencomPE = _comuni->get(COM_DENCOM);
|
|
_provPE = _comuni->get(COM_PROVCOM);
|
|
}
|
|
|
|
if (_tipoa == 'F')
|
|
{
|
|
TLocalisamfile anagfis(LF_ANAGFIS);
|
|
|
|
anagfis.setkey(1);
|
|
anagfis.zero();
|
|
anagfis.put(ANF_CODANAGR, _codanagPE);
|
|
if (anagfis.read() == NOERR)
|
|
{
|
|
data = anagfis.get_date(ANF_DATANASC);
|
|
_datanascPE = data.string();
|
|
comnasc = anagfis.get (ANF_COMNASC);
|
|
}
|
|
|
|
_comuni->setkey(1);
|
|
_comuni->zero();
|
|
_comuni->put(COM_COM,comnasc);
|
|
if (_comuni->read() == NOERR)
|
|
{
|
|
_dencomnscPE = _comuni->get(COM_DENCOM);
|
|
_provnscPE = _comuni->get(COM_PROVCOM);
|
|
}
|
|
_dencomnscPE.rtrim();
|
|
_provnscPE.rtrim();
|
|
}
|
|
else
|
|
{
|
|
_dencomnscPE = "";
|
|
_provnscPE = "";
|
|
}
|
|
_indPE.rtrim();
|
|
_dencomPE.rtrim();
|
|
}
|
|
|
|
int TStampa_perc::stampa_dati_erog_perc()
|
|
{
|
|
int riga, riga2;
|
|
TString sep(200);
|
|
|
|
reset_header();
|
|
|
|
// Dati del soggetto erogante
|
|
|
|
// 7.12.95 Numeri di pagina qui!
|
|
riga = 1;
|
|
set_header (riga++, _numcarat == 1 ? "@bSOGGETTO EROGANTE@r @122gPag. @#" : "@bSOGGETTO EROGANTE@r @188gPag. @#");
|
|
set_header (riga++, "Codice@15g%5d", _codditta);
|
|
set_header (riga++, "Denominazione@15g%s", (const char*) _ragsocER);
|
|
set_header (riga++, "Domicilio in@15g%s %s", (const char*) _indER, (const char*) _civER);
|
|
set_header (riga, "@15g%5s", (const char*) _capER);
|
|
set_header (riga++, "@21g%s %s", (const char*) _dencomER, (const char*) _provER);
|
|
set_header (riga++, "Codice fiscale@15g%-16s",(const char*) _cofiER);
|
|
if (_tipoaER == 'F')
|
|
set_header (riga++, "Luogo data di nascita@22g%s %s %10s", (const char*) _dencomnscER, (const char*) _provnscER, (const char*) _datanascER);
|
|
|
|
// Dati del soggetto percipiente
|
|
if (_numcarat == 1)
|
|
{
|
|
riga2 = 1;
|
|
set_header (riga2++, "@b@66gSOGGETTO PERCIPIENTE@r");
|
|
set_header (riga2++, "@66gCodice@81g%c %5d", _tipoa, _codanagPE);
|
|
set_header (riga2++, "@66gDenominazione@81g%s", (const char*) _ragsocPE);
|
|
set_header (riga2++, "@66gDomicilio in@81g%s %s", (const char*) _indPE, (const char*) _civPE);
|
|
set_header (riga2, "@81g%5s", (const char*) _capPE);
|
|
set_header (riga2++, "@87g%s %s", (const char*) _dencomPE, (const char*) _provPE);
|
|
set_header (riga2++, "@66gCodice fiscale@81g%-16s",(const char*) _cofiPE);
|
|
if (_tipoa == 'F')
|
|
set_header (riga2++, "@66gLuogo data di nascita@88g%s %s %s", (const char*) _dencomnscPE, (const char*) _provnscPE, (const char*) _datanascPE);
|
|
else
|
|
riga2++;
|
|
set_header(riga2, "@bConto individuale percipiente anno %4d@r", _anno);
|
|
if (_tiposel == 2)
|
|
set_header(riga2, "@b@40gcomprensivo di schede aventi medesimo periodo di competenza@r");
|
|
riga2++;
|
|
TString app(132);
|
|
app.fill('_');
|
|
set_header(riga2++, (const char*) app);
|
|
}
|
|
else
|
|
{
|
|
TString app(198);
|
|
app.fill('_');
|
|
riga2=1;
|
|
set_header (riga2++, "@b@110gSOGGETTO PERCIPIENTE@r");
|
|
set_header (riga2++, "@110gCodice@125g%c %5d", _tipoa, _codanagPE);
|
|
set_header (riga2++, "@110gDenominazione@125g%s", (const char*) _ragsocPE);
|
|
set_header (riga2++, "@110gDomicilio in@125g%s %s", (const char*) _indPE, (const char*) _civPE);
|
|
set_header (riga2 /*5*/, "@125g%5s", (const char*) _capPE);
|
|
set_header (riga2++ /*5*/, "@131g%s %s", (const char*) _dencomPE, (const char*) _provPE);
|
|
set_header (riga2++, "@110gCodice fiscale@125g%-16s",(const char*) _cofiPE);
|
|
if (_tipoa == 'F')
|
|
set_header (riga2++, "@110gLuogo data di nascita@132g%s %s %s", (const char*) _dencomnscPE, (const char*) _provnscPE, (const char*) _datanascPE);
|
|
else
|
|
riga2++;
|
|
set_header (riga2, "@bConto individuale percipiente anno %4d@r", _anno);
|
|
if (_tiposel == 2)
|
|
set_header(riga2, "@b@40gcomprensivo di schede aventi medesimo periodo di competenza@r");
|
|
riga2++;
|
|
set_header (riga2++, (const char*) app);
|
|
set_header (riga2++, "@50gESTREMI DOCUMENTO @101gESTREMI PAGAMENTO @145gSomme e@157gD@165gESTREMI VERSAMENTO");
|
|
set_header (riga2++, "Cod.@80gTotale@90gData@145gquote@155gT@157gC@168gSerie@174gNumero");
|
|
set_header (riga2 /*13*/, "Caus.@8gDescrizione@24gData@33gNumero@43gImponibili@60gSpese@70gImposte@80gDocumento@90gPagamento@101gImponibili@115g%%@122gRitenute");
|
|
set_header (riga2++ /*13*/, "@134gCompensi@145gnon sogg.@155gC@157gB@159gData@168gABI @174gCAB @183gImporto versato");
|
|
set_header (riga2++, (const char*) app);
|
|
}
|
|
|
|
// ritorna la prima riga libera
|
|
return riga > riga2 ? riga : riga2;
|
|
}
|
|
|
|
bool TStampa_perc::user_create()
|
|
{
|
|
TToken_string exp;
|
|
|
|
// Parametri configurazione
|
|
_section = name();
|
|
_section.cut(2);
|
|
_cnf = new TConfig(CONFIG_USER, _section);
|
|
_rel = new TRelation (LF_SCPERC);
|
|
_cur = new TCursor(_rel,"",2);
|
|
add_cursor(_cur);
|
|
|
|
_comuni = new TLocalisamfile (LF_COMUNI);
|
|
_anag = new TLocalisamfile (LF_ANAG);
|
|
_rpag = new TLocalisamfile (LF_RPAG);
|
|
_rver = new TLocalisamfile (LF_RVER);
|
|
_bil = new righe_pag;
|
|
_sort = new TSort();
|
|
|
|
_codditta = get_firm_770();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool TStampa_perc::user_destroy()
|
|
{
|
|
delete _rel;
|
|
// delete _cur; // Gia' distrutto dalla printapp!!
|
|
delete _anag;
|
|
delete _comuni;
|
|
delete _rpag;
|
|
delete _rver;
|
|
delete _bil;
|
|
delete _sort;
|
|
delete _cnf;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
int m72100(int argc, char* argv[])
|
|
{
|
|
TStampa_perc a(*argv[2]);
|
|
a.run(argc, argv, "Stampa schede percipienti");
|
|
return 0;
|
|
}
|