Modello C.U.
git-svn-id: svn://10.65.10.50/branches/R_10_00@23042 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
83bb071f66
commit
643681129b
@ -10,9 +10,6 @@
|
||||
#include "../cg/cgsaldac.h"
|
||||
|
||||
#include <anagr.h>
|
||||
#include <partite.h>
|
||||
#include <scadenze.h>
|
||||
#include <pagsca.h>
|
||||
// per dinamica non riprendere #include "../ve/velib.h"
|
||||
|
||||
#include "770101.h"
|
||||
@ -2153,17 +2150,17 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
|
||||
// calcolo CPA
|
||||
c.impcpa = s.compenso * h_PercCassaPrev / (CENTO + h_PercCassaPrev);
|
||||
c.impcpa.round(fdec);
|
||||
if (s.impcpa == ZERO || force)
|
||||
if (s.impcpa.is_zero() || force)
|
||||
s.impcpa = c.impcpa;
|
||||
|
||||
// calcolo imponibile
|
||||
c.imponibile = (s.compenso - s.impcpa) * h_PercAssImp / CENTO;
|
||||
c.imponibile.round(fdec);
|
||||
if (s.imponibile == ZERO || force)
|
||||
if (s.imponibile.is_zero() || force)
|
||||
s.imponibile = c.imponibile;
|
||||
|
||||
// percentuale ritenuta acconto
|
||||
if (s.perc == ZERO || force)
|
||||
if (s.perc.is_zero() || force)
|
||||
s.perc = h_PercRitenuta;
|
||||
|
||||
// calcolo ritenuta lorda
|
||||
@ -2179,17 +2176,17 @@ Pag_struct& TSchedaPercipienti::calcola_riga_pag(Pag_struct& s,
|
||||
|
||||
// calcolo ritenuta
|
||||
c.ritenuta = s.ritlorda - s.totdet;
|
||||
if (s.ritenuta == ZERO || force)
|
||||
if (s.ritenuta.is_zero() || force)
|
||||
s.ritenuta = c.ritenuta;
|
||||
|
||||
// percentuale assoggettamento Inps
|
||||
if (s.alqimp10 == ZERO || force)
|
||||
if (s.alqimp10.is_zero() || force)
|
||||
s.alqimp10 = h_PercAssImpInps;
|
||||
|
||||
// calcolo contributo Inps complessivo
|
||||
c.ctssncomp = ((s.compenso * s.alqimp10 / CENTO) * h_PercInps) / CENTO;
|
||||
c.ctssncomp.round(fdec);
|
||||
if (s.ctssncomp == ZERO || force)
|
||||
if (s.ctssncomp.is_zero() || force)
|
||||
s.ctssncomp = c.ctssncomp;
|
||||
|
||||
// calcolo contributo Inps del percipiente
|
||||
|
@ -8,8 +8,7 @@
|
||||
// Scheda Percipiente
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TSchedaPE::TSchedaPE()
|
||||
: TRelation(LF_SCPERC), _old_ver(0), _old_pag(0)
|
||||
TSchedaPE::TSchedaPE() : TRelation(LF_SCPERC), _old_ver(0), _old_pag(0)
|
||||
{
|
||||
add(LF_RVER, "CODDITTA==CODDITTA|TIPOA==TIPOA|CODANAGR==CODANAGR|NPROG==NPROG");
|
||||
add(LF_RPAG, "CODDITTA==CODDITTA|TIPOA==TIPOA|CODANAGR==CODANAGR|NPROG==NPROG");
|
||||
|
@ -98,10 +98,10 @@ bool TSchedaPercipienti::vers_notify(TSheet_field& s, int r, KEY k)
|
||||
// Pulisco descrizioni luogo e tipo versamento (solo se non gia' indicati!)
|
||||
TSheet_field& vers = app().vers();
|
||||
TMask& mp = vers.sheet_mask();
|
||||
TString16 tipo(mp.get(F_TIPOVERS));
|
||||
TString16 luo (mp.get(F_LUOVERS));
|
||||
const TString& tipo = mp.get(F_TIPOVERS);
|
||||
if (tipo.empty())
|
||||
mp.reset(70);
|
||||
const TString& luo = mp.get(F_LUOVERS);
|
||||
if (luo.empty())
|
||||
mp.reset(71);
|
||||
break;
|
||||
@ -827,7 +827,8 @@ bool TSchedaPercipienti::pag_standard_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
|
||||
// non proseguo se riga vuota
|
||||
if (s == nullpag) return TRUE;
|
||||
if (s == nullpag)
|
||||
return true;
|
||||
|
||||
// reperisco nome campo su record
|
||||
const TString& name = f.field()->name();
|
||||
@ -871,19 +872,19 @@ bool TSchedaPercipienti::pag_standard_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
// if ((d_codqua != "SC" && d_codqua != "SE") && s.somregconv != ZERO) nell'ultima versione dei quadri le SOMREGCONV valgono per tutti i tipi di quadro (SC,SE,SF,SG)
|
||||
// return f.error_box("Somme reg.conv. valido solo per causali con quadro SC e SE"); 12/07/2000
|
||||
if (!app()._soggnres && s.somregconv != ZERO)
|
||||
if (!app()._soggnres && !s.somregconv.is_zero())
|
||||
return f.error_box("Somme reg.conv. valido solo se percipiente non residente");
|
||||
}
|
||||
|
||||
// controllo contributo 10% percipiente
|
||||
if (name == "CTSSNPERC" && !d_forzatura)
|
||||
if (s.ctssnperc != c.ctssnperc)
|
||||
return f.error_box("Contributo Inps percipiente diverso da importo calcolato");
|
||||
return f.error_box("Contributo INPS percipiente diverso da importo calcolato");
|
||||
|
||||
// controllo contributo 10% complessivo
|
||||
if (name == "CTSSNCOMP" && !d_forzatura)
|
||||
if (s.ctssncomp != c.ctssncomp)
|
||||
return f.error_box("Contributo Inps complessivo diverso da importo calcolato");
|
||||
return f.error_box("Contributo INPS complessivo diverso da importo calcolato");
|
||||
|
||||
// controllo numero quote
|
||||
if (name == "NQUOTE" && !d_forzatura)
|
||||
@ -892,6 +893,6 @@ bool TSchedaPercipienti::pag_standard_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ const TRectype* TRighe_pagamento::prospetto_e1(char caus)
|
||||
|
||||
void TRighe_pagamento::add_riga(const TRectype& scheda, const TRectype& riga)
|
||||
{
|
||||
TString16 chiave;
|
||||
TString chiave;
|
||||
|
||||
const char causqua = toupper(scheda.get_char(SPR_CAUSQUA));
|
||||
chiave << causqua;
|
||||
@ -98,8 +98,8 @@ void TRighe_pagamento::add_riga(const TRectype& scheda, const TRectype& riga)
|
||||
*rec += riga;
|
||||
if (_quadro == "C") // Nel caso di quadro C somma anche i giorni detr dip.
|
||||
{
|
||||
const int gglav = rec->get_int(PAG_GIOLAVDIP) + riga.get_int(PAG_GIOLAVDIP);
|
||||
rec->put(PAG_GIOLAVDIP,gglav);
|
||||
const real gglav = riga.get(PAG_GIOLAVDIP);
|
||||
rec->add(PAG_GIOLAVDIP, gglav);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -725,8 +725,10 @@ void TQuadroC_E2::genera_e1(TRectype& quadro, const TRectype& riga) const
|
||||
|
||||
void TQuadroC_E2::genera_la(TRectype& quadro, const TRectype& riga) const
|
||||
{
|
||||
const TDate datapag = riga.get(PAG_DATAPAG);
|
||||
const real imponibile = riga.get(PAG_IMPONIBILE);
|
||||
|
||||
quadro.put("ANNO", datapag.year());
|
||||
quadro.put(QUD_PERC, riga.get(PAG_PERC));
|
||||
|
||||
real ammlordo = imponibile;
|
||||
@ -762,7 +764,7 @@ void TQuadroC_E2::genera_la(TRectype& quadro, const TRectype& riga) const
|
||||
|
||||
void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
|
||||
{
|
||||
TLocalisamfile file(_file);
|
||||
TFast_isamfile file(_file);
|
||||
TRectype& curr = file.curr();
|
||||
int nriga = 1;
|
||||
righe.restart();
|
||||
@ -777,7 +779,7 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
|
||||
curr.put(PAG_CODANAGR, riga.get(PAG_CODANAGR));
|
||||
curr.put("NPROG", nriga);
|
||||
curr.put("CAUSALE", chiave[0]);
|
||||
curr.put("GENERATA", bool(TRUE));
|
||||
curr.put("GENERATA", true);
|
||||
|
||||
switch (_quadro[0])
|
||||
{
|
||||
@ -824,10 +826,10 @@ void TQuadroC_E2::genera_righe(TRighe_pagamento& righe) const
|
||||
// genera prospetto e1;
|
||||
if (QuadroE1())
|
||||
{
|
||||
TLocalisamfile prospe1(LF_PROSPE1);
|
||||
TFast_isamfile prospe1(LF_PROSPE1);
|
||||
TRectype& rec = prospe1.curr();
|
||||
|
||||
bool first = TRUE;
|
||||
bool first = true;
|
||||
for (char caus = 'C'; caus <= 'E'; caus++)
|
||||
{
|
||||
const TRectype* riga = righe.prospetto_e1(caus);
|
||||
@ -890,7 +892,7 @@ void TQuadroC_E2::generazione()
|
||||
const TRectype& scheda = cur.curr();
|
||||
const TRectype& riga = cur.curr(LF_RPAG);
|
||||
|
||||
TProgind pi (items, "Generazione da schede.", TRUE, TRUE, 60);
|
||||
TProgress_monitor pi(items, TR("Generazione da schede."));
|
||||
|
||||
distruzione();
|
||||
|
||||
@ -901,8 +903,7 @@ void TQuadroC_E2::generazione()
|
||||
|
||||
for (cur = 0; cur.pos() < items; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled())
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
|
||||
const char tipoa = scheda.get_char(SPR_TIPOA);
|
||||
@ -918,13 +919,11 @@ void TQuadroC_E2::generazione()
|
||||
last_code = codanagr;
|
||||
}
|
||||
|
||||
bool ok = cur.is_first_match(LF_RPAG);
|
||||
while (ok)
|
||||
for (bool ok = cur.is_first_match(LF_RPAG); ok; ok = cur.next_match(LF_RPAG))
|
||||
{
|
||||
const TDate datapag = riga.get(PAG_DATAPAG);
|
||||
if (datapag.year() == anno770)
|
||||
righe.add_riga(scheda, riga);
|
||||
ok = cur.next_match(LF_RPAG);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1221,7 +1220,7 @@ bool TQuadroC_E2::ricalcola_imposte_la(TMask_field& f, KEY key)
|
||||
}
|
||||
}
|
||||
|
||||
const real imposta_v = m.get_real(102) * imponibile / 100.0;
|
||||
const real imposta_v = m.get_real(102) * imponibile / CENTO;
|
||||
real imposta = m.get(109);
|
||||
if (imposta.is_zero())
|
||||
{
|
||||
|
16
m770/774.cpp
16
m770/774.cpp
@ -1,26 +1,16 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "774.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
int n = (argc > 1) ? atoi(argv[1]+1) : -1;
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
m74100(argc,argv) ; break;
|
||||
case 1:
|
||||
riporti_dich(argc,argv) ; break;
|
||||
case 2:
|
||||
azzeramento_archivi(argc,argv) ; break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ;
|
||||
case 1: riporti_dich(argc,argv); break;
|
||||
case 2: azzeramento_archivi(argc,argv); break;
|
||||
default: m74100(argc,argv); break;
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ int main(int argc,char** argv)
|
||||
const int n = (argc > 1) ? atoi(argv[1]+1) : -1;
|
||||
switch(n)
|
||||
{
|
||||
case 0:
|
||||
case 1: m777200(argc, argv); break;
|
||||
default: m777100(argc, argv); break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1 +1,2 @@
|
||||
int m777100(int argc, char* argv[]);
|
||||
int m777200(int argc, char* argv[]);
|
||||
|
804
m770/777100.cpp
804
m770/777100.cpp
@ -7,8 +7,10 @@
|
||||
#include <utility.h>
|
||||
|
||||
#include "777.h"
|
||||
#include "777lib.h"
|
||||
#include "777100a.h"
|
||||
|
||||
|
||||
#include <anagr.h>
|
||||
#include <anafis.h>
|
||||
#include <anagiu.h>
|
||||
@ -25,20 +27,14 @@
|
||||
// Utility
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Codice fiscale di Sirio spa
|
||||
#define CF_PRODUTTORE "04879210963"
|
||||
|
||||
const int ANNO_DIC = 2013;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TForm770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TRecord770;
|
||||
class TTrasferimento770;
|
||||
|
||||
enum M770FieldType { AN, CF, CN, PI, DA, DT, NU, PN, PR, CB, VP, VN };
|
||||
|
||||
class TForm770 : public TForm
|
||||
{
|
||||
TCursor* _sortedcur;
|
||||
@ -71,132 +67,6 @@ public:
|
||||
virtual ~TForm770();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRecord770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
enum { CODE_SIZE = 8, FIELD_SIZE = 16, BLOCK_SIZE = 24, HEADER_SIZE = 89, USEABLE_SIZE = 1800, TOTAL_SIZE = 1900 };
|
||||
|
||||
struct TField770 : public TObject
|
||||
{
|
||||
TString _desc;
|
||||
int _pos; // Base 1
|
||||
int _len;
|
||||
M770FieldType _type; // AN,NU,...
|
||||
};
|
||||
|
||||
class TTracciato770 : public TObject
|
||||
{
|
||||
char _tipo;
|
||||
TArray _fields;
|
||||
|
||||
protected:
|
||||
void add_field(const char* name, M770FieldType tipo, int pos, int len, int filedno = 0);
|
||||
void add_filler(int pos, int len, M770FieldType tipo = AN)
|
||||
{ add_field("Filler", tipo, pos, len); }
|
||||
|
||||
public:
|
||||
const TField770& field(int pos) const;
|
||||
void auto_fill(TString& buffer) const;
|
||||
|
||||
TTracciato770(char tipo);
|
||||
virtual ~TTracciato770();
|
||||
};
|
||||
|
||||
class TTracciati770 : public TObject
|
||||
{
|
||||
TArray _trc;
|
||||
TAssoc_array _form;
|
||||
bool _centesimi; // Salva importi in centesimi invece che in euro
|
||||
|
||||
public:
|
||||
const TTracciato770& tracciato(char tipo);
|
||||
TForm770& form(const char* quadro, char& tipo, int& rpm);
|
||||
|
||||
void destroy();
|
||||
|
||||
void set_cent_mode(bool cb) { _centesimi = cb; }
|
||||
bool importi_in_centesimi() const { return _centesimi; }
|
||||
bool importi_in_euro() const { return !_centesimi; }
|
||||
|
||||
TTracciati770();
|
||||
virtual ~TTracciati770();
|
||||
} _trc770;
|
||||
|
||||
class TCache770 : public TObject
|
||||
{
|
||||
TArray _files;
|
||||
TAssoc_array _tables;
|
||||
|
||||
public:
|
||||
const TRectype& get(int num, const char* key);
|
||||
const TRectype& get(int num, long key);
|
||||
void destroy();
|
||||
} _cache770;
|
||||
|
||||
class TRecord770 : public TObject
|
||||
{
|
||||
TString _buffer;
|
||||
|
||||
protected: // TObject
|
||||
virtual TObject* dup() const { return new TRecord770(*this); }
|
||||
virtual void print_on(ostream& outs) const;
|
||||
virtual void read_from(istream& ins);
|
||||
|
||||
protected: // TObject
|
||||
const TTracciato770& tracciato() const
|
||||
{ return _trc770.tracciato(tipo_record()); }
|
||||
|
||||
const TField770& get_field(int pos) const
|
||||
{ return tracciato().field(pos); }
|
||||
|
||||
void set(const TField770& fld, const char* val);
|
||||
int calculate_blocks(const char* val) const;
|
||||
|
||||
public:
|
||||
void set(int pos, const char* val);
|
||||
void set(int pos, int val);
|
||||
void set(int pos, long val);
|
||||
void set(int pos, const real& val);
|
||||
void set(int pos, const TDate& val);
|
||||
void set(int pos, char val);
|
||||
void set(int pos, bool val);
|
||||
bool np_put(const char* code, const char* val);
|
||||
bool np_put(const char* code, const real& val);
|
||||
bool np_put(const char* code, long val);
|
||||
|
||||
const char* get(int pos, TString& str) const;
|
||||
int get_int(int pos) const;
|
||||
char get_char(int pos) const;
|
||||
|
||||
bool np_get(int pos, TString& key, TString& val) const;
|
||||
bool np_get_real(int pos, TString& key, real& val) const;
|
||||
|
||||
const TRecord770& operator=(const TRecord770& rec)
|
||||
{ _buffer = rec._buffer; return *this; }
|
||||
|
||||
char tipo_record() const { return _buffer[0]; }
|
||||
void tipo_record(char tipo)
|
||||
{ _buffer[0] = tipo; tracciato().auto_fill(_buffer); }
|
||||
|
||||
void azzera_campi_non_posizionali();
|
||||
bool ha_campi_non_posizionali() const { return strchr("DEFGHJ", tipo_record()) != NULL; }
|
||||
bool ha_campi_non_posizionali_compilati() const
|
||||
{ return _buffer[90] > ' '; }
|
||||
|
||||
bool valid() const;
|
||||
|
||||
TRecord770();
|
||||
TRecord770(char tipo);
|
||||
TRecord770(const TRecord770& rec);
|
||||
TRecord770(const TRectype& rec);
|
||||
virtual ~TRecord770();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTrasferimento770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTrasferimento770 : public TObject
|
||||
{
|
||||
TFilename _name;
|
||||
@ -209,19 +79,27 @@ class TTrasferimento770 : public TObject
|
||||
TString16 _codfis_dic;
|
||||
TString _ragsoc_dic;
|
||||
bool _save_headers;
|
||||
bool _centesimi; // Salva importi in centesimi invece che in euro
|
||||
|
||||
TAssoc_array _form;
|
||||
|
||||
protected:
|
||||
void riepiloga_ss(const TRecord770& rec, TArray& riep_ss) const;
|
||||
void riepiloga_sx(const TRecord770& rec, TArray& riep_sx) const;
|
||||
|
||||
TForm770& form(const char* quadro, char& tiporec, int& rpm);
|
||||
|
||||
public:
|
||||
const char* default_name() const;
|
||||
|
||||
bool open(const char* path = "", char mode = 'r', int volume = 0);
|
||||
bool close();
|
||||
bool write(const TRecord770& rec);
|
||||
bool read(TRecord770& rec);
|
||||
bool eof() const { return _in_stream && _in_stream->eof(); }
|
||||
|
||||
const char* default_name() const;
|
||||
void set_cent_mode(bool cb) { _centesimi = cb; }
|
||||
bool importi_in_centesimi() const { return _centesimi; }
|
||||
bool importi_in_euro() const { return !_centesimi; }
|
||||
|
||||
TTrasferimento770& operator<<(const TRecord770& rec)
|
||||
{ write(rec); return *this; }
|
||||
@ -235,7 +113,7 @@ public:
|
||||
bool casella_prospetto_st() const;
|
||||
bool casella_prospetto_sx() const;
|
||||
bool append_record_b();
|
||||
long append_quadro(const char* quadro, long codditta, TProgind& pi);
|
||||
long append_quadro(const char* quadro, long codditta, TProgress_monitor& pi);
|
||||
|
||||
bool split(const char* dest_path);
|
||||
void remove();
|
||||
@ -247,10 +125,6 @@ public:
|
||||
virtual ~TTrasferimento770();
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Implementazioni
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TForm770
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -320,7 +194,7 @@ void TForm770::transfer_section(TPrint_section& body, int rigo,
|
||||
if (xvt_str_compare_ignoring_case(fi.class_name(), "VALUTA") == 0)
|
||||
{
|
||||
real val = str;
|
||||
if (_trc770.importi_in_centesimi())
|
||||
if (file.importi_in_centesimi())
|
||||
{
|
||||
val *= CENTO;
|
||||
str = val.stringa(16, 0);
|
||||
@ -368,7 +242,7 @@ void TForm770::transfer_section(TPrint_section& body, int rigo,
|
||||
if (xvt_str_compare_ignoring_case(fi.class_name(), "VALUTA") == 0)
|
||||
{
|
||||
real val = str;
|
||||
if (_trc770.importi_in_centesimi())
|
||||
if (file.importi_in_centesimi())
|
||||
val *= CENTO;
|
||||
str = val.string(16, 0);
|
||||
}
|
||||
@ -639,335 +513,16 @@ TForm770::~TForm770()
|
||||
delete _sortedcur;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTracciato770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TTracciato770::add_field(const char* name, M770FieldType type, int pos, int len, int fldno)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AN:
|
||||
break;
|
||||
case CB:
|
||||
CHECKD(len == 1, "Booleano di lunghezza sospetta ", len);
|
||||
type = NU;
|
||||
break;
|
||||
case CF:
|
||||
CHECKD(len == 16, "Codice fiscale di lunghezza sospetta ", len);
|
||||
type = AN;
|
||||
break;
|
||||
case CN:
|
||||
CHECKD(len == 11, "Codice fiscale numerico di lunghezza sospetta ", len);
|
||||
type = NU;
|
||||
break;
|
||||
case DA:
|
||||
CHECKD(len == 6, "Mese+Anno di lunghezza sospetta ", len);
|
||||
type = NU;
|
||||
break;
|
||||
case DT:
|
||||
CHECKD(len == 8, "Data di lunghezza sospetta ", len);
|
||||
type = NU;
|
||||
break;
|
||||
case NU:
|
||||
break;
|
||||
case PN:
|
||||
case PR:
|
||||
CHECKD(len == 2, "provincia di lunghezza sospetta ", len);
|
||||
type = AN;
|
||||
break;
|
||||
default:
|
||||
CHECK(false, "tipo campo sospetto");
|
||||
break;
|
||||
}
|
||||
|
||||
TField770* info = new TField770;
|
||||
info->_desc = name;
|
||||
info->_type = type;
|
||||
info->_pos = pos;
|
||||
info->_len = len;
|
||||
|
||||
if (fldno <= 0)
|
||||
fldno = _fields.add(info)+1;
|
||||
else
|
||||
_fields.add(info, fldno-1);
|
||||
}
|
||||
|
||||
const TField770& TTracciato770::field(int pos) const
|
||||
class TCache770 : public TObject
|
||||
{
|
||||
TField770* info = (TField770*)_fields.objptr(pos-1);
|
||||
#ifdef DBG
|
||||
if (info == NULL)
|
||||
fatal_box("Non esiste il campo %d sul tipo record %c", pos, _tipo);
|
||||
#endif
|
||||
return *info;
|
||||
}
|
||||
TArray _files;
|
||||
TAssoc_array _tables;
|
||||
|
||||
void TTracciato770::auto_fill(TString& buffer) const
|
||||
{
|
||||
buffer.fill(' ', TOTAL_SIZE);
|
||||
char* ptr = buffer.get_buffer();
|
||||
for (int f = _fields.last(); f >= 0; f = _fields.pred(f))
|
||||
{
|
||||
const TField770& info = (const TField770&)_fields[f];
|
||||
if (info._type == NU || info._type == CB || info._type == DA || info._type == DT || info._type == CN)
|
||||
memset(ptr + info._pos - 1, '0', info._len);
|
||||
}
|
||||
buffer[0] = _tipo;
|
||||
buffer.overwrite("A\r\n", TOTAL_SIZE-3);
|
||||
}
|
||||
|
||||
TTracciato770::TTracciato770(char tipo) : _tipo(tipo)
|
||||
{
|
||||
if (strchr("ABEFHJZ", tipo) == NULL)
|
||||
NFCHECK("Tipo record non valido: %c", tipo);
|
||||
|
||||
add_field("Tipo record", AN, 1, 1); // 1
|
||||
|
||||
if (tipo == 'A')
|
||||
{
|
||||
add_filler(2, 14); // 2
|
||||
add_field("Codice fornitura", AN, 16, 5); // 3
|
||||
add_field("Tipo fornitore", NU, 21, 2); // 4
|
||||
add_field("Codice fiscale del fornitore", CF, 23, 16);
|
||||
add_filler(39, 483);
|
||||
// Dichiarazione su più invii
|
||||
add_field("Progressivo dell'invio", NU, 522, 4); // 7
|
||||
add_field("Numero totale degli invii", NU, 526, 4);
|
||||
} else
|
||||
if (tipo == 'B')
|
||||
{
|
||||
add_field("Codice fiscale dichiarante", CF, 2, 16); // 2
|
||||
add_field("Progressivo modulo", NU, 18, 8);
|
||||
add_filler( 26, 3);
|
||||
add_filler( 29,25);
|
||||
add_field("Spazio a disposizione", AN, 54, 20);
|
||||
add_field("CF del produttore del software", CF, 74, 16); // 7
|
||||
|
||||
add_field("Flag conferma", CB, 90, 1);
|
||||
|
||||
// Tipo di dichiarazione
|
||||
add_field("Dichiarazione correttiva nei termini", CB, 91, 1); // 9
|
||||
add_field("Dichiarazione correttiva parziale", CB, 92, 1);
|
||||
add_field("Dichiarazione integrativa", CB, 93, 1);
|
||||
add_field("Eventi eccezzziunali veramente", NU, 94, 1); // 12
|
||||
|
||||
// Dati del contribuente
|
||||
add_field("Cognome", AN, 95, 24); // 13
|
||||
add_field("Nome", AN,119, 20);
|
||||
add_field("Denominazione (Alternativo a 25 e 26)",AN,139, 60);
|
||||
add_filler(199,11);
|
||||
add_filler(210, 1);
|
||||
add_filler(211, 1);
|
||||
|
||||
add_field("Codice Attività", NU, 212, 6); // 19
|
||||
add_field("Indirizzo E-mail", AN, 218, 100);
|
||||
add_field("Telefono o Cellulare", AN, 318, 12);
|
||||
add_field("FAX", AN, 330, 12); // 22
|
||||
|
||||
add_field("Data di nascita", DT, 384, 8, 25); // 25
|
||||
add_field("C.a.p. residenza", NU, 435, 5, 29); // 29
|
||||
add_field("Data variazione", DT, 479, 8, 32); // 32
|
||||
|
||||
// Saltiamo a pie' pari i dati delle persone fisiche
|
||||
|
||||
add_field("Natura giuridica", NU, 487, 2, 33); // 33
|
||||
add_field("Data variazione sede legale", DA, 489, 6);
|
||||
add_field("Comune della sede legale", AN, 495,40);
|
||||
add_field("Sigla della provincia sede legale", PR, 535, 2);
|
||||
add_field("CAP del comune della sede legale", NU, 537, 5);
|
||||
add_field("Codice comune", AN, 542, 4);
|
||||
add_field("Indirizzo della sede legale", AN, 546,35);
|
||||
add_field("Data variazione domicilio fiscale", NU, 581, 6); // 40
|
||||
add_field("Comune del domicilio fiscale", AN, 587,40);
|
||||
add_field("Provincia del domicilio fiscale", PR, 627, 2);
|
||||
add_field("CAP del domicilio fiscale", NU, 629, 5);
|
||||
add_field("Codice comune", AN, 634, 5);
|
||||
add_field("Indirizzo del domicilio fiscale", AN, 638,35);
|
||||
add_field("Stato", NU, 673, 1);
|
||||
add_field("Situazione", NU, 674, 1);
|
||||
add_field("Dicastero di appartenenza", CN, 675, 11);
|
||||
|
||||
add_field("Redazione della dichiarazione", NU, 797, 1, 75); // 75
|
||||
add_field("Numero comunicaz. lavoro dipendente", NU, 798, 8);
|
||||
add_field("Numero comunicaz. lavoro autonomo", NU, 806, 8);
|
||||
add_field("Casella prospetto SS", CB, 814, 1); // 78
|
||||
add_field("Casella prospetto ST", CB, 815, 1);
|
||||
add_field("Casella prospetto SV", CB, 816, 1);
|
||||
add_field("Casella prospetto SX", CB, 817, 1); // 81
|
||||
add_field("Casella prospetto SY", CB, 818, 1);
|
||||
add_field("Presenza 770 ordinario 2011", CB, 819, 1);
|
||||
add_field("Codice fiscale parte restante", CF, 820,16);
|
||||
add_field("Protocollo telematico", NU, 836,17); // 85
|
||||
add_field("Progressivo telematico", NU, 853, 6);
|
||||
|
||||
// dichiarazioni integrative o parziali
|
||||
add_field("Casella prospetto SS", CB, 859, 1); // 87
|
||||
add_field("Casella prospetto ST", CB, 860, 1);
|
||||
add_field("Casella prospetto SV", CB, 861, 1);
|
||||
add_field("Casella prospetto SX", CB, 862, 1);
|
||||
add_field("Casella prospetto SY", CB, 863, 1);
|
||||
add_field("Numero comunicaz. lavoro dipendente", NU, 864, 8);
|
||||
add_field("Numero comunicaz. lavoro autonomo", NU, 872, 8); // 93
|
||||
|
||||
add_field("Firma del dichiarante", CB, 880, 1, 94); // 94
|
||||
add_field("Codice fiscale", CF, 881,16);
|
||||
add_field("Soggetto", NU, 897, 1);
|
||||
add_field("Firma", CB, 898, 1); // 97
|
||||
add_field("Codice fiscale", CF, 899,16);
|
||||
add_field("Soggetto", NU, 915, 1);
|
||||
add_field("Firma", CB, 916, 1); // 100
|
||||
add_field("Codice fiscale", CF, 917,16);
|
||||
add_field("Soggetto", NU, 933, 1);
|
||||
add_field("Firma", CB, 934, 1); // 103
|
||||
add_field("Codice fiscale", CF, 935,16);
|
||||
add_field("Soggetto", NU, 951, 1);
|
||||
add_field("Firma", CB, 952, 1); // 106
|
||||
add_field("Codice fiscale", CF, 953,16);
|
||||
add_field("Soggetto", NU, 969, 1);
|
||||
add_field("Firma", CB, 970, 1); // 109
|
||||
add_field("Non trasmissione ST, SV e/o SX", NU, 971, 1);
|
||||
add_field("Casella Attestazione", CB, 972, 1);
|
||||
|
||||
add_field("Situazioni particolari", NU,1180,2, 116); // 116
|
||||
|
||||
add_field("Codice fiscale del rappresentante", CF,1396,16,126); // 126
|
||||
add_field("Codice carica del rappresentante", NU,1412, 2);
|
||||
add_field("Data carica del rappresentante", DT,1414, 8);
|
||||
|
||||
add_field("Cognome", AN,1493,24, 131); // 131
|
||||
add_field("Nome", AN,1517,20);
|
||||
add_field("Sesso", AN,1537, 1);
|
||||
add_field("Data di nascita rappresentante", DT,1538, 8);
|
||||
add_field("Comune di nascita", AN,1546,40); // 135
|
||||
add_field("Provincia di nascita", PN,1586, 2);
|
||||
|
||||
add_field("Codice stato estero", NU,1588, 3); // 137
|
||||
add_field("Stato federato, provincia, contea", AN,1591,24);
|
||||
add_field("Località di residenza", AN,1615,24);
|
||||
add_field("Indirizzo estero", AN,1639,35); // 140
|
||||
|
||||
add_field("Data apertura fallimento", DT,1686, 8, 142); // 142
|
||||
add_field("Codice fiscale societa o dichiarante", NU,1694,11);
|
||||
|
||||
add_field("Invio avviso telematico", CB,1715, 1, 147); // 147
|
||||
add_field("Ricezione avviso telematico", CB,1716, 1);
|
||||
add_field("Codice fiscale intermediario", CF,1717,16);
|
||||
add_field("Numero iscrizione C.A.F.", NU,1733, 5);
|
||||
add_field("Impegno a trasmettere la dichiaraz.", NU,1738, 1); // 151
|
||||
add_field("Data dell'impegno", DT,1739, 8);
|
||||
add_field("Firma dell'intermediario", CB,1747, 1);
|
||||
add_field("Codice fiscale responsabile C.A.F.", CF,1748,16);
|
||||
add_field("Codice fiscale C.A.F.", CN,1764,11);
|
||||
add_field("Codice fiscale professionista", CF,1775,16); // 156
|
||||
add_field("Firma", CB,1791, 1);
|
||||
} else
|
||||
if (tipo == 'E' || tipo == 'F')
|
||||
{
|
||||
add_field("Codice fiscale del dichiarante", CF, 2, 16); // 2
|
||||
add_field("Progressivo modulo", NU, 18, 8);
|
||||
add_field("Spazio a disposizione", AN, 26, 3);
|
||||
add_field("Tipo operazione", AN, 29, 1);
|
||||
add_filler(30, 24);
|
||||
add_field("Spazio a disposizione", AN, 54, 20);
|
||||
add_field("Identificativo produttore software", AN, 74, 16); // 8
|
||||
} else
|
||||
if (tipo == 'H')
|
||||
{
|
||||
add_field("Codice fiscale del dichiarante", CF, 2, 16); // 2
|
||||
add_field("Progressivo comunicazione", NU, 18, 8);
|
||||
add_field("Spazio a disposizione", AN, 26, 3);
|
||||
add_field("Tipo operazione", AN, 29, 1);
|
||||
add_field("Codice fiscale del percipiente", AN, 30, 16); // 6
|
||||
add_filler(46, 8);
|
||||
add_field("Spazio a disposizione", AN, 54, 20);
|
||||
add_field("Identificativo produttore software", AN, 74, 16); // 9
|
||||
} else
|
||||
if (tipo == 'J')
|
||||
{
|
||||
add_field("Codice fiscale del dichiarante", CF, 2, 16); // 2
|
||||
add_field("Progressivo modulo", NU, 18, 8);
|
||||
add_field("Spazio a disposizione", AN, 26, 3);
|
||||
add_field("Tipo operazione", AN, 29, 1);
|
||||
add_filler(30, 24);
|
||||
add_field("Spazio a disposizione", AN, 54, 20);
|
||||
add_field("Identificativo produttore software", AN, 74, 16); // 8
|
||||
} else
|
||||
if (tipo == 'Z')
|
||||
{
|
||||
add_filler(2, 14);
|
||||
add_field("Numero record di tipo 'B'", NU, 16, 9); // 3
|
||||
add_field("Numero record di tipo 'D'", NU, 25, 9);
|
||||
add_field("Numero record di tipo 'E'", NU, 34, 9);
|
||||
add_field("Numero record di tipo 'F'", NU, 43, 9); // 6
|
||||
add_field("Numero record di tipo 'G'", NU, 52, 9);
|
||||
add_field("Numero record di tipo 'H'", NU, 61, 9);
|
||||
add_field("Numero record di tipo 'I'", NU, 70, 9);
|
||||
add_field("Numero record di tipo 'J'", NU, 79, 9); // 10
|
||||
add_filler(88, 1810);
|
||||
}
|
||||
}
|
||||
|
||||
TTracciato770::~TTracciato770()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTracciati770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const TTracciato770& TTracciati770::tracciato(char tipo)
|
||||
{
|
||||
CHECK(tipo >= 'A' && tipo <= 'Z', "Tipo record non valido");
|
||||
const int pos = tipo - 'A';
|
||||
TTracciato770* trc = (TTracciato770*)_trc.objptr(pos);
|
||||
if (trc == NULL)
|
||||
{
|
||||
trc = new TTracciato770(tipo);
|
||||
_trc.add(trc, pos);
|
||||
}
|
||||
return *trc;
|
||||
}
|
||||
|
||||
// Determina a partire dal codice quadro (LA o ST) il tipo record (H o E) ed il numero di record per modulo (1 o 12)
|
||||
// Ritorna il form da cui prelevare i codici (come AUXXX010) da inserire nei tracciati
|
||||
TForm770& TTracciati770::form(const char* quadro, char& tiporec, int& rpm)
|
||||
{
|
||||
CHECK(quadro && *quadro != '\0' && quadro[1] != '\0',
|
||||
"Codice quadro non valido");
|
||||
|
||||
const char* name;
|
||||
switch(quadro[1])
|
||||
{
|
||||
case 'A': name = "77qla"; tiporec = 'H'; rpm = 1; break;
|
||||
case 'T': name = "77qst"; tiporec = 'E'; rpm = 12; break;
|
||||
default : name = NULL; break;
|
||||
}
|
||||
|
||||
TForm770* frm = (TForm770*)_form.objptr(name);
|
||||
if (frm == NULL)
|
||||
{
|
||||
frm = new TForm770(name);
|
||||
_form.add(name, frm);
|
||||
}
|
||||
|
||||
return *frm;
|
||||
}
|
||||
|
||||
void TTracciati770::destroy()
|
||||
{
|
||||
_trc.destroy();
|
||||
_form.destroy();
|
||||
}
|
||||
|
||||
TTracciati770::TTracciati770() : _centesimi(false)
|
||||
{
|
||||
}
|
||||
|
||||
TTracciati770::~TTracciati770()
|
||||
{
|
||||
destroy(); // Non viene mai chiamato!
|
||||
}
|
||||
public:
|
||||
const TRectype& get(int num, const char* key);
|
||||
const TRectype& get(int num, long key);
|
||||
void destroy();
|
||||
} _cache770;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCache770
|
||||
@ -996,252 +551,6 @@ void TCache770::destroy()
|
||||
_tables.destroy();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRecord770
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TRecord770::print_on(ostream& outs) const
|
||||
{
|
||||
outs.write(_buffer, TOTAL_SIZE);
|
||||
}
|
||||
|
||||
void TRecord770::read_from(istream& ins)
|
||||
{
|
||||
_buffer.fill(' ', TOTAL_SIZE);
|
||||
ins.read(_buffer.get_buffer(), TOTAL_SIZE);
|
||||
}
|
||||
|
||||
void TRecord770::set(const TField770& fld, const char* val)
|
||||
{
|
||||
TString80 str(val);
|
||||
if (fld._type == AN)
|
||||
str.upper();
|
||||
int lenstr = str.len();
|
||||
if (lenstr > fld._len)
|
||||
{
|
||||
#ifdef DBG
|
||||
NFCHECK("Campo troppo lungo: '%s' (max. %d)", val, fld._len);
|
||||
#endif
|
||||
str.cut(lenstr = fld._len);
|
||||
}
|
||||
if (lenstr != fld._len)
|
||||
{
|
||||
str.trim();
|
||||
if (fld._type == NU)
|
||||
str.right_just(fld._len, '0');
|
||||
else
|
||||
str.left_just(fld._len);
|
||||
}
|
||||
_buffer.overwrite(str, fld._pos-1);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, const char* val)
|
||||
{
|
||||
const TField770& fld = tracciato().field(pos);
|
||||
set(fld, val);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, int val)
|
||||
{
|
||||
const TField770& fld = tracciato().field(pos);
|
||||
CHECKD(fld._type == NU, "Invalid numeric field ", pos);
|
||||
TString16 str; str.format("%d", val);
|
||||
set(fld, str);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, long val)
|
||||
{
|
||||
const TField770& fld = tracciato().field(pos);
|
||||
CHECKD(fld._type == NU, "Invalid numeric field ", pos);
|
||||
TString16 str; str.format("%ld", val);
|
||||
set(fld, str);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, const real& val)
|
||||
{
|
||||
const TField770& fld = tracciato().field(pos);
|
||||
CHECKD(fld._type == NU, "Invalid numeric field ", pos);
|
||||
const char* str = val.string(fld._len, 0);
|
||||
set(fld, str);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, const TDate& val)
|
||||
{
|
||||
const TField770& fld = tracciato().field(pos);
|
||||
CHECKD(fld._type == NU && (fld._len == 6 || fld._len == 8),
|
||||
"Invalid date field ", pos);
|
||||
const char* str;
|
||||
if (fld._len == 8)
|
||||
str = val.string(full, '\0', full, full, gma_date);
|
||||
else
|
||||
str = val.string(brief, '\0', full, full, gma_date);
|
||||
set(fld, str);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, char val)
|
||||
{
|
||||
const TField770& fld = get_field(pos);
|
||||
CHECKD(fld._type == AN && fld._len == 1, "Invalid char field ", pos);
|
||||
const char str[2] = { val, '\0' };
|
||||
set(fld, str);
|
||||
}
|
||||
|
||||
void TRecord770::set(int pos, bool val)
|
||||
{
|
||||
const TField770& fld = get_field(pos);
|
||||
CHECKD((fld._type == CB || fld._type == NU)&& fld._len == 1, "Invalid boolean field ", pos);
|
||||
set(fld, val ? "1" : "0");
|
||||
}
|
||||
|
||||
const char* TRecord770::get(int pos, TString& str) const
|
||||
{
|
||||
const TField770& fld = get_field(pos);
|
||||
str = _buffer.mid(fld._pos-1, fld._len);
|
||||
return str.trim();
|
||||
}
|
||||
|
||||
int TRecord770::get_int(int pos) const
|
||||
{
|
||||
TString16 str; get(pos, str);
|
||||
return atoi(str);
|
||||
}
|
||||
|
||||
char TRecord770::get_char(int pos) const
|
||||
{
|
||||
const TField770& fld = get_field(pos);
|
||||
CHECKD(fld._type == AN, "Invalid char field ", pos);
|
||||
return _buffer[fld._pos-1];
|
||||
}
|
||||
|
||||
// Calcola i blocchi necessari per contenere la stringa val
|
||||
int TRecord770::calculate_blocks(const char* val) const
|
||||
{
|
||||
// Il primo blocco contiene 16 caratteri, gli altri solo 15 perche' c'e' anche il +
|
||||
int blocks = 1;
|
||||
if (val && *val)
|
||||
{
|
||||
const int len = strlen(val);
|
||||
if (len > FIELD_SIZE)
|
||||
blocks += (len-FIELD_SIZE-1) / (FIELD_SIZE-1) + 1;
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
// Azzera tutti i campi non posizionali dei record di tipo E
|
||||
void TRecord770::azzera_campi_non_posizionali()
|
||||
{
|
||||
CHECK(ha_campi_non_posizionali(), "Impossibile azzerare un record senza campi non posizionali");
|
||||
char* buf = _buffer.get_buffer() + HEADER_SIZE;
|
||||
memset(buf, ' ', USEABLE_SIZE);
|
||||
}
|
||||
|
||||
// Aggiunge un campo non posizionale ai record di tipo E,F,G,H,J
|
||||
bool TRecord770::np_put(const char* code, const char* val)
|
||||
{
|
||||
CHECK(ha_campi_non_posizionali(), "Impossibile aggiungere campi non posizionali");
|
||||
CHECKS(code && strlen(code) == CODE_SIZE, "Invalid field code ", code);
|
||||
CHECKS(val && *val, "Can't add empty field ", code);
|
||||
|
||||
// Cerca il primo posto libero
|
||||
int pos;
|
||||
for (pos = HEADER_SIZE; pos < HEADER_SIZE+USEABLE_SIZE; pos += BLOCK_SIZE)
|
||||
{
|
||||
if (_buffer[pos] == ' ')
|
||||
break;
|
||||
}
|
||||
const int free_blocks = (USEABLE_SIZE - pos) / BLOCK_SIZE;
|
||||
const int needed_blocks = calculate_blocks(val);
|
||||
const bool ok = free_blocks >= needed_blocks;
|
||||
|
||||
if (ok) // Se ci sono abbastanza blocchi liberi
|
||||
{
|
||||
TString80 str(val); str.upper();
|
||||
const int lenstr = str.len();
|
||||
for (int i = 0; i < lenstr; )
|
||||
{
|
||||
_buffer.overwrite(code, pos);
|
||||
pos += CODE_SIZE;
|
||||
int maxlen = FIELD_SIZE;
|
||||
if (i > 0)
|
||||
{
|
||||
_buffer.overwrite("+", pos);
|
||||
pos++;
|
||||
maxlen--;
|
||||
}
|
||||
const TString& substr = str.mid(i, maxlen);
|
||||
_buffer.overwrite(substr, pos);
|
||||
pos += maxlen;
|
||||
i += maxlen;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TRecord770::np_put(const char* code, long val)
|
||||
{
|
||||
TString16 str; str.format("%16ld", val);
|
||||
return np_put(code, str);
|
||||
}
|
||||
|
||||
bool TRecord770::np_put(const char* code, const real& val)
|
||||
{
|
||||
const TString& str = val.stringa(16, 2);
|
||||
return np_put(code, str);
|
||||
}
|
||||
|
||||
bool TRecord770::np_get(int pos, TString& key, TString& val) const
|
||||
{
|
||||
CHECK(ha_campi_non_posizionali(), "Impossibile leggere campi non posizionali");
|
||||
const int n = HEADER_SIZE + pos * BLOCK_SIZE;
|
||||
bool ok = false;
|
||||
if (n < HEADER_SIZE + USEABLE_SIZE)
|
||||
{
|
||||
ok = _buffer[n] > ' ';
|
||||
if (ok)
|
||||
{
|
||||
key = _buffer.mid(n, CODE_SIZE);
|
||||
val = _buffer.mid(n+CODE_SIZE, FIELD_SIZE);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TRecord770::np_get_real(int pos, TString& key, real& val) const
|
||||
{
|
||||
TString16 str;
|
||||
const bool ok = np_get(pos, key, str);
|
||||
if (ok && str.full())
|
||||
{
|
||||
str.replace(',', '.');
|
||||
val = real(str);
|
||||
}
|
||||
else
|
||||
val = ZERO;
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TRecord770::valid() const
|
||||
{
|
||||
const char tipo = tipo_record();
|
||||
const bool ok = (tipo > ' ') && (strchr("ABEHJZ", tipo) != NULL);
|
||||
return ok;
|
||||
}
|
||||
|
||||
TRecord770::TRecord770() : _buffer(TOTAL_SIZE, ' ')
|
||||
{
|
||||
}
|
||||
|
||||
TRecord770::TRecord770(char tipo) : _buffer(TOTAL_SIZE, ' ')
|
||||
{
|
||||
tipo_record(tipo);
|
||||
}
|
||||
|
||||
TRecord770::TRecord770(const TRecord770& rec) : _buffer(rec._buffer)
|
||||
{ }
|
||||
|
||||
TRecord770::~TRecord770()
|
||||
{ }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTrasferimento770
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1480,7 +789,32 @@ bool TTrasferimento770::append_record_b()
|
||||
return ok;
|
||||
}
|
||||
|
||||
long TTrasferimento770::append_quadro(const char* quadro, long codditta, TProgind& pi)
|
||||
// Determina a partire dal codice quadro (LA o ST) il tipo record (H o E) ed il numero di record per modulo (1 o 12)
|
||||
// Ritorna il form da cui prelevare i codici (come AUXXX010) da inserire nei tracciati
|
||||
TForm770& TTrasferimento770::form(const char* quadro, char& tiporec, int& rpm)
|
||||
{
|
||||
CHECK(quadro && *quadro != '\0' && quadro[1] != '\0',
|
||||
"Codice quadro non valido");
|
||||
|
||||
const char* name = NULL;
|
||||
switch(quadro[1])
|
||||
{
|
||||
case 'A': name = "77qla"; tiporec = 'H'; rpm = 1; break;
|
||||
case 'T': name = "77qst"; tiporec = 'E'; rpm = 12; break;
|
||||
default : name = NULL; break;
|
||||
}
|
||||
|
||||
TForm770* frm = (TForm770*)_form.objptr(name);
|
||||
if (frm == NULL)
|
||||
{
|
||||
frm = new TForm770(name);
|
||||
_form.add(name, frm);
|
||||
}
|
||||
|
||||
return *frm;
|
||||
}
|
||||
|
||||
long TTrasferimento770::append_quadro(const char* quadro, long codditta, TProgress_monitor& pi)
|
||||
{
|
||||
TString str;
|
||||
str << TR("Trasferimento quadro ") << quadro << TR(" ditta ") << codditta;
|
||||
@ -1488,7 +822,7 @@ long TTrasferimento770::append_quadro(const char* quadro, long codditta, TProgin
|
||||
|
||||
char tipo;
|
||||
int rpm;
|
||||
TForm770& frm = _trc770.form(quadro, tipo, rpm);
|
||||
TForm770& frm = form(quadro, tipo, rpm);
|
||||
long items = frm.trasfer(codditta, *this, tipo, rpm);
|
||||
return items;
|
||||
}
|
||||
@ -1704,7 +1038,7 @@ void TTrasferimento770::remove()
|
||||
}
|
||||
|
||||
TTrasferimento770::TTrasferimento770(const char* path, char mode, int volume)
|
||||
: _in_stream(NULL), _out_stream(NULL), _save_headers(false)
|
||||
: _in_stream(NULL), _out_stream(NULL), _save_headers(false), _centesimi(false)
|
||||
{
|
||||
open(path, mode, volume);
|
||||
}
|
||||
@ -1748,7 +1082,7 @@ bool TTransfer770_msk::on_field_event(TOperable_field& of, TField_event fe, long
|
||||
TTransfer770_msk::TTransfer770_msk() : TAutomask("777100a")
|
||||
{
|
||||
/*
|
||||
int anno = ini_get_int(CONFIG_STUDIO, "77", "AnnoDic");
|
||||
int anno = ini_get_int(CONFIG_STUDIO, "77", ANNO_SEL);
|
||||
if (anno <= 0)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
@ -1774,7 +1108,7 @@ void TTransfer770_app::main_loop()
|
||||
TFilename tmp; tmp.tempdir();
|
||||
TTrasferimento770 t(tmp, 'w');
|
||||
t.save_headers(m.get_bool(F_HEADERS));
|
||||
_trc770.set_cent_mode(m.get_bool(F_CENT));
|
||||
t.set_cent_mode(m.get_bool(F_CENT));
|
||||
|
||||
TRelation rel_base(LF_BASE);
|
||||
TRectype da_rec(LF_BASE), a_rec(LF_BASE);
|
||||
@ -1790,25 +1124,23 @@ void TTransfer770_app::main_loop()
|
||||
const TRecnotype items = cur_base.items();
|
||||
cur_base.freeze();
|
||||
|
||||
TProgind pi(items, TR("Generazione file di trasferimento"), false, true);
|
||||
for (cur_base = 0; cur_base.ok(); ++cur_base)
|
||||
if (items > 0)
|
||||
{
|
||||
const TRectype& base = cur_base.curr();
|
||||
const long codditta = base.get_long(BSE_CODDITTA);
|
||||
pi.addstatus(1);
|
||||
t.read_codfis_dic(base);
|
||||
TProgress_monitor pi(items, TR("Generazione file di trasferimento"));
|
||||
for (cur_base = 0; cur_base.ok(); ++cur_base)
|
||||
{
|
||||
const TRectype& base = cur_base.curr();
|
||||
const long codditta = base.get_long(BSE_CODDITTA);
|
||||
pi.addstatus(1);
|
||||
t.read_codfis_dic(base);
|
||||
|
||||
t.append_record_b();
|
||||
t.append_quadro("ST", codditta, pi);
|
||||
t.append_quadro("LA", codditta, pi);
|
||||
t.append_record_b();
|
||||
t.append_quadro("ST", codditta, pi);
|
||||
t.append_quadro("LA", codditta, pi);
|
||||
}
|
||||
}
|
||||
pi.close_modal();
|
||||
|
||||
if (m.get(F_SUPPORTO) == "D")
|
||||
tmp = m.get(F_DISK);
|
||||
else
|
||||
tmp = m.get(F_PATH);
|
||||
|
||||
tmp = m.get(F_PATH);
|
||||
if (t.split(tmp))
|
||||
{
|
||||
tmp.add(t.default_name());
|
||||
@ -1822,13 +1154,11 @@ void TTransfer770_app::main_loop()
|
||||
}
|
||||
t.remove();
|
||||
}
|
||||
|
||||
_trc770.destroy();
|
||||
}
|
||||
|
||||
int m777100(int argc, char* argv[])
|
||||
{
|
||||
TTransfer770_app app;
|
||||
app.run(argc, argv, "Invio");
|
||||
app.run(argc, argv, TR("Invio 770"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
#define F_SUPPORTO 101
|
||||
#define F_PATH 102
|
||||
#define F_DISK 103
|
||||
#define F_ANNO 104
|
||||
#define F_DADITTA 105
|
||||
#define F_DADESC 106
|
||||
|
@ -1,37 +1,23 @@
|
||||
#include "777100a.h"
|
||||
|
||||
PAGE "Invio" -1 -1 72 10
|
||||
PAGE "Invio 770" -1 -1 72 8
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 47 2 "Anno dichiarazione "
|
||||
PROMPT 47 1 "Anno dichiarazione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_SUPPORTO 1 16
|
||||
STRING F_PATH 260 53
|
||||
BEGIN
|
||||
PROMPT 1 1 "Tipo"
|
||||
ITEM "T|Telematico"
|
||||
MESSAGE SHOW,F_PATH|HIDE,F_DISK
|
||||
ITEM "D|Dischetti"
|
||||
MESSAGE HIDE,F_PATH|SHOW,F_DISK
|
||||
END
|
||||
|
||||
LIST F_DISK 2 8
|
||||
BEGIN
|
||||
PROMPT 20 2 ""
|
||||
ITEM "A:|Disco A"
|
||||
ITEM "B:|Disco B"
|
||||
END
|
||||
|
||||
STRING F_PATH 50
|
||||
BEGIN
|
||||
PROMPT 20 3 ""
|
||||
PROMPT 1 2 "Destinazione "
|
||||
DSELECT
|
||||
CHECTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_DADITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 5 "Da ditta "
|
||||
PROMPT 1 3 "Da ditta "
|
||||
USE LF_BASE
|
||||
JOIN LF_NDITTE INTO CODDITTA=CODDITTA
|
||||
INPUT CODDITTA F_DADITTA
|
||||
@ -40,18 +26,18 @@ BEGIN
|
||||
DISPLAY "Ragione sociale@50" LF_NDITTE->RAGSOC
|
||||
OUTPUT F_DADITTA CODDITTA
|
||||
OUTPUT F_DADESC LF_NDITTE->RAGSOC
|
||||
CHECKTYPE SEARCH
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DADESC 50
|
||||
BEGIN
|
||||
PROMPT 20 5 ""
|
||||
PROMPT 20 3 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_ADITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "A ditta "
|
||||
PROMPT 1 4 "A ditta "
|
||||
COPY USE F_DADITTA
|
||||
INPUT CODDITTA F_ADITTA
|
||||
COPY DISPLAY F_DADITTA
|
||||
@ -64,18 +50,19 @@ END
|
||||
|
||||
STRING F_ADESC 50
|
||||
BEGIN
|
||||
PROMPT 20 6 ""
|
||||
PROMPT 20 4 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BOOLEAN F_HEADERS
|
||||
BEGIN
|
||||
PROMPT 1 8 "Genera record di testata (tipo A, B, Z)"
|
||||
PROMPT 1 6 "Genera record di testata (tipo A, B, Z)"
|
||||
END
|
||||
|
||||
BOOLEAN F_CENT
|
||||
BEGIN
|
||||
PROMPT 1 9 "Salva importi in centesimi (x 100)"
|
||||
PROMPT 1 7 "Salva importi in centesimi (x 100)"
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
|
||||
|
1812
m770/777200.cpp
1812
m770/777200.cpp
File diff suppressed because it is too large
Load Diff
825
m770/777201.cpp
Normal file
825
m770/777201.cpp
Normal file
@ -0,0 +1,825 @@
|
||||
#include "777200.h"
|
||||
|
||||
#include <colors.h>
|
||||
#include <isam.h>
|
||||
|
||||
const COLOR CU_BACKGROUND = XVT_MAKE_COLOR(224,224,224);
|
||||
|
||||
const TReport_font& best_font(const char* name, int size, XVT_FONT_STYLE_MASK fs)
|
||||
{
|
||||
static TAssoc_array fonts;
|
||||
static const long famax = 1024;
|
||||
static char* family[famax] = { 0 };
|
||||
static long families = 0;
|
||||
|
||||
TToken_string key;
|
||||
key = name; key.add(size); key.add((long)fs);
|
||||
TReport_font* fnt = (TReport_font*)fonts.objptr(key);
|
||||
if (fnt == NULL)
|
||||
{
|
||||
if (families == 0)
|
||||
families = xvt_fmap_get_families(NULL, family, famax);
|
||||
|
||||
int best = -1;
|
||||
double score = 0.5;
|
||||
for (long i = 0; i < families; i++) if (*name == *family[i])
|
||||
{
|
||||
const double s = xvt_str_fuzzy_compare(name, family[i]);
|
||||
if (s > score)
|
||||
{
|
||||
best = i;
|
||||
score = s;
|
||||
if (score >= 1.0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (best >= 0)
|
||||
name = family[best];
|
||||
fnt = new TReport_font;
|
||||
fnt->create(name, size, fs);
|
||||
fonts.add(key, fnt);
|
||||
}
|
||||
return *fnt;
|
||||
}
|
||||
|
||||
class TCU_report : public TReport
|
||||
{
|
||||
TReport_font _fnt_rep, _fnt_prm, _fnt_lbl, _fnt_sub, _fnt_prg;
|
||||
int _quality; // 0=text only; 1=borders only; 2=filled bars
|
||||
|
||||
private:
|
||||
const TReport_field& last_field() const;
|
||||
void set_field_pos(int row, int col, int width, TReport_field& fld) const;
|
||||
TReport_field& add_break(TReport_section& sec, int row, bool small);
|
||||
void add_field_label(const TReport_field& fld, const char* text, char alignment = 'L');
|
||||
TReport_field& add_prompt(TReport_section& sec, int row, int col, int len, const char* text);
|
||||
void add_field_sublabel(const TReport_field& fld, const char* text);
|
||||
void add_field_grid(const TReport_field& fld, bool underlined, bool date);
|
||||
TReport_field& add_field(TReport_section& sec, int row, int col, int width, const char* field);
|
||||
|
||||
protected:
|
||||
TReport_field& add_prompted_field(TReport_section& sec, int row, int col, int width, const char* field, const char* prompt, int promptlen = -1);
|
||||
TReport_field& add_prompted_bool(TReport_section& sec, int row, int col, int width, const char* field, const char* prompt, int promptlen = -1);
|
||||
TReport_field& add_labeled_field (TReport_section& sec, int row, int col, int width, const char* field, const char* label, char alignment = 'B');
|
||||
TReport_field& add_labeled_number(TReport_section& sec, int row, int col, int width, const char* field, const char* label, char alignment = 'B');
|
||||
TReport_field& add_boxed_field (TReport_section& sec, int row, int col, int width, const char* field, const char* prompt, int flags = 0x0);
|
||||
TReport_field& add_gridded_field (TReport_section& sec, int row, int col, int len,
|
||||
const char* field, const char* prompt);
|
||||
void add_underlined_text(TReport_section& body, int row, const char* text);
|
||||
|
||||
TReport_field& add_big_text(TReport_section& sec, int row, int col, const char* label, COLOR rgb);
|
||||
void add_band(TReport_section& sec, int row, int height, COLOR rgb = CU_BACKGROUND);
|
||||
void add_long_break (TReport_section& sec, int row);
|
||||
void add_short_break(TReport_section& sec, int row);
|
||||
void begin_paragraph(TReport_section& sec, int row, int height, const char* label, int mode = 0);
|
||||
void end_paragraph(TReport_section& sec);
|
||||
|
||||
void create_logo(TReport_section& header);
|
||||
void create_B();
|
||||
void create_D();
|
||||
void create_H();
|
||||
|
||||
public:
|
||||
TCU_report(int quality);
|
||||
};
|
||||
|
||||
#define CU_FORM_WIDTH 7800
|
||||
#define CU_FORM_BORDER 100
|
||||
#define CU_HEAD_WIDTH 1000
|
||||
|
||||
#define CU_AFTER_LAST -1
|
||||
#define CU_BEFORE_LAST -2
|
||||
#define CU_ALIGN_RIGHT -3
|
||||
|
||||
#define CU_EURO_LEN 16
|
||||
|
||||
static int _row_offset = 0;
|
||||
static int _row_height = 300;
|
||||
static int _row_last = 0;
|
||||
static TReport_field* _last_fld = NULL;
|
||||
|
||||
const TReport_field& TCU_report::last_field() const
|
||||
{
|
||||
return *_last_fld;
|
||||
}
|
||||
|
||||
|
||||
void TCU_report::set_field_pos(int row, int col, int len, TReport_field& fld) const
|
||||
{
|
||||
TReport_section& sec = fld.section();
|
||||
|
||||
int dimx = (len+1) * 100;
|
||||
int dimy = 150;
|
||||
int posx = 0;
|
||||
if (col < 0)
|
||||
{
|
||||
switch(col)
|
||||
{
|
||||
case CU_BEFORE_LAST: posx = last_field().get_rect().left() - dimx - 100; break;
|
||||
case CU_ALIGN_RIGHT: posx = CU_FORM_BORDER+CU_FORM_WIDTH - dimx - 100; break;
|
||||
default : posx = last_field().get_rect().right() + 100; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_row_offset > 0) // in paragraph
|
||||
posx = CU_FORM_BORDER+CU_HEAD_WIDTH + (col+1)*100;
|
||||
else
|
||||
posx = CU_FORM_BORDER + col*100; // in header
|
||||
}
|
||||
|
||||
int posy = 0;
|
||||
if (_row_offset > 0) // in paragraph
|
||||
posy = _row_offset + (row+1)*_row_height - dimy;
|
||||
else
|
||||
posy = (row+1)*100 - dimy; // in header
|
||||
|
||||
if (len <= 0)
|
||||
dimx = CU_FORM_BORDER+CU_FORM_WIDTH - posx - 100;
|
||||
|
||||
fld.set_pos(posx, posy);
|
||||
fld.set_size(dimx, dimy);
|
||||
}
|
||||
|
||||
|
||||
void TCU_report::begin_paragraph(TReport_section& sec, int row, int height, const char* label, int mode)
|
||||
{
|
||||
if (row < 0)
|
||||
_row_offset = _row_last;
|
||||
else
|
||||
_row_offset = row*100;
|
||||
_row_last = _row_offset + height*100;
|
||||
_row_height = height <= 2 ? 200 : (height%3 ? 400 : 300);
|
||||
_last_fld = NULL;
|
||||
|
||||
TString str1 = label, str2;
|
||||
int delta2 = 0;
|
||||
if (mode & 0x2)
|
||||
{
|
||||
if (mode == 0x2)
|
||||
{
|
||||
str2 = str1;
|
||||
str1.cut(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int due_paragrafi = str1.find('\n');
|
||||
str2 = str1.mid(due_paragrafi+1);
|
||||
str1.cut(due_paragrafi);
|
||||
delta2 = 200;
|
||||
}
|
||||
}
|
||||
|
||||
if (str1.full())
|
||||
{
|
||||
TReport_field* txt = new TReport_field(&sec);
|
||||
txt->set_vertical_alignment('T');
|
||||
txt->set_horizontal_alignment('L');
|
||||
txt->set_pos(CU_FORM_BORDER, _row_offset);
|
||||
txt->set_size(CU_HEAD_WIDTH, height*100);
|
||||
txt->set_pattern(PAT_HOLLOW);
|
||||
txt->set_text_color(COLOR_BLACK);
|
||||
txt->set_back_color(COLOR_INVALID);
|
||||
txt->set_picture(str1);
|
||||
txt->set_font(_fnt_prg);
|
||||
sec.add(txt);
|
||||
}
|
||||
|
||||
if (str2.full())
|
||||
{
|
||||
TReport_font fnt2;
|
||||
fnt2.create(_fnt_lbl.name(), _fnt_lbl.size(), XVT_FS_BOLD);
|
||||
|
||||
TReport_field* txt2 = new TReport_field(&sec);
|
||||
txt2->set_vertical_alignment('T');
|
||||
txt2->set_horizontal_alignment('L');
|
||||
txt2->set_pos(CU_FORM_BORDER, _row_offset+delta2);
|
||||
txt2->set_size(CU_HEAD_WIDTH, (height*100)-delta2);
|
||||
txt2->set_pattern(PAT_HOLLOW);
|
||||
txt2->set_text_color(COLOR_BLACK);
|
||||
txt2->set_back_color(COLOR_INVALID);
|
||||
txt2->set_picture(str2);
|
||||
txt2->set_font(fnt2);
|
||||
sec.add(txt2);
|
||||
}
|
||||
}
|
||||
|
||||
void TCU_report::end_paragraph(TReport_section& sec)
|
||||
{
|
||||
add_long_break(sec, _row_last/100);
|
||||
}
|
||||
|
||||
void TCU_report::add_field_label(const TReport_field& fld, const char* text, char alignment)
|
||||
{
|
||||
TReport_section& sec = fld.section();
|
||||
TReport_field* label = new TReport_field(&sec);
|
||||
label->set_type('T');
|
||||
label->set_pattern(PAT_HOLLOW);
|
||||
label->set_text_color(COLOR_BLACK);
|
||||
label->set_back_color(COLOR_INVALID);
|
||||
label->set_font(_fnt_lbl);
|
||||
const TReport_rct& rct = fld.get_rect();
|
||||
label->set_pos(rct.x, rct.y-100);
|
||||
label->set_size(rct.width(), 100);
|
||||
label->set_picture(text);
|
||||
label->set_vertical_alignment('B');
|
||||
if (alignment == 'C')
|
||||
{
|
||||
label->set_horizontal_alignment('C');
|
||||
label->set_pos(rct.x-400, rct.y-100);
|
||||
label->set_size(rct.width()+800, 75);
|
||||
}
|
||||
|
||||
sec.add(label);
|
||||
}
|
||||
|
||||
void TCU_report::add_field_sublabel(const TReport_field& fld, const char* text)
|
||||
{
|
||||
TReport_section& sec = fld.section();
|
||||
TReport_field* label = new TReport_field(&sec);
|
||||
label->set_type('T');
|
||||
label->set_pattern(PAT_HOLLOW);
|
||||
label->set_back_color(COLOR_INVALID);
|
||||
label->set_text_color(COLOR_BLACK);
|
||||
label->set_font(_fnt_sub);
|
||||
const TReport_rct& rct = fld.get_rect();
|
||||
label->set_pos(rct.x, rct.y);
|
||||
label->set_size(rct.width(), rct.height()/3);
|
||||
label->set_picture(text);
|
||||
sec.add(label);
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_field(TReport_section& sec, int row, int col, int len, const char* field)
|
||||
{
|
||||
TReport_field* txt = new TReport_field(&sec);
|
||||
txt->set_type('S');
|
||||
txt->set_vertical_alignment('B');
|
||||
txt->set_dynamic_height(false);
|
||||
if (_quality >= 2)
|
||||
{
|
||||
txt->set_pattern(PAT_SOLID);
|
||||
txt->set_back_color(COLOR_WHITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
txt->set_pattern(PAT_HOLLOW);
|
||||
txt->set_back_color(COLOR_INVALID);
|
||||
txt->set_fore_color(COLOR_GRAY);
|
||||
txt->set_border(1);
|
||||
}
|
||||
txt->set_field(field);
|
||||
set_field_pos(row, col, len, *txt);
|
||||
sec.add(txt);
|
||||
_last_fld = txt;
|
||||
return *txt;
|
||||
}
|
||||
|
||||
int estimated_prompt_len(const char* text)
|
||||
{
|
||||
static XVT_FNTID font_id = NULL;
|
||||
if (font_id == NULL)
|
||||
{
|
||||
font_id = xvt_font_create();
|
||||
xvt_font_set_family(font_id, XVT_FFN_HELVETICA);
|
||||
xvt_font_set_size(font_id, 12);
|
||||
xvt_dwin_set_font(TASK_WIN, font_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text == NULL)
|
||||
{
|
||||
xvt_font_destroy(font_id);
|
||||
font_id = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
const int len = (text && *text) ? xvt_dwin_get_text_width(TASK_WIN, text, -1) : 0;
|
||||
return len / 6;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_prompt(TReport_section& sec, int row, int col, int len, const char* text)
|
||||
{
|
||||
TReport_field* label = new TReport_field(&sec);
|
||||
label->set_type('T');
|
||||
label->set_vertical_alignment('C');
|
||||
label->set_pattern(PAT_HOLLOW);
|
||||
label->set_back_color(COLOR_INVALID);
|
||||
label->set_text_color(COLOR_BLACK);
|
||||
label->set_font(_fnt_prm);
|
||||
label->set_picture(text);
|
||||
if (len < 0)
|
||||
len = estimated_prompt_len(text)/2;
|
||||
set_field_pos(row, col, len, *label);
|
||||
const TReport_rct& rct = label->get_rect();
|
||||
if (rct.height() > 100)
|
||||
{
|
||||
const int delta = rct.height() - 100;
|
||||
label->set_pos(rct.left(), rct.top()+delta);
|
||||
label->set_size(rct.width(), rct.height()-delta);
|
||||
}
|
||||
sec.add(label);
|
||||
_last_fld = label;
|
||||
return *label;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_labeled_field(TReport_section& body, int row, int col, int len,
|
||||
const char* field, const char* label, char alignment)
|
||||
{
|
||||
if (alignment != 'C' && len > 0 && label && int(strlen(label)) > 2*len)
|
||||
alignment = 'C';
|
||||
|
||||
TReport_field& txt = add_field(body, row, col, len, field);
|
||||
if (alignment == 'C')
|
||||
txt.set_horizontal_alignment(alignment);
|
||||
if (field && *field && field[1] >= 'A')
|
||||
{
|
||||
TString4 num = field+7;
|
||||
if (num[0] == '0') num.ltrim(1);
|
||||
add_field_sublabel(txt, num);
|
||||
}
|
||||
if (label && *label)
|
||||
add_field_label(txt, label, alignment);
|
||||
return txt;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_labeled_number(TReport_section& body, int row, int col, int width,
|
||||
const char* field, const char* label, char alignment)
|
||||
{
|
||||
TReport_field& txt = add_labeled_field(body, row, col, width, field, label, alignment);
|
||||
txt.set_horizontal_alignment('R');
|
||||
if (width == CU_EURO_LEN)
|
||||
{
|
||||
txt.set_type('S'); // avoid obnoxious x100
|
||||
}
|
||||
else
|
||||
{
|
||||
txt.set_type('N');
|
||||
txt.hide_zeroes(true);
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_prompted_field(TReport_section& body, int row, int col, int width, const char* field, const char* prompt, int promptlen)
|
||||
{
|
||||
if (col == CU_ALIGN_RIGHT && width > 0)
|
||||
{
|
||||
TReport_field& fld = add_field(body, row, col, width, field);
|
||||
if ((prompt && *prompt) || promptlen > 0)
|
||||
add_prompt(body, row, CU_BEFORE_LAST, promptlen, prompt);
|
||||
return fld;
|
||||
}
|
||||
if ((prompt && *prompt) || promptlen > 0)
|
||||
{
|
||||
add_prompt(body, row, col, promptlen, prompt);
|
||||
col = CU_AFTER_LAST;
|
||||
}
|
||||
return add_field(body, row, col, width, field);
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_prompted_bool(TReport_section& sec, int row, int col, int width, const char* field, const char* prompt, int promptlen)
|
||||
{
|
||||
TReport_field& cb = add_prompted_field(sec, row, col, width, field, prompt, promptlen);
|
||||
cb.set_type('B');
|
||||
cb.set_horizontal_alignment('C');
|
||||
cb.set_vertical_alignment('C');
|
||||
return cb;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_boxed_field(TReport_section& sec, int row, int col, int width,
|
||||
const char* field, const char* prompt, int flags)
|
||||
{
|
||||
TReport_field* fld = NULL;
|
||||
if (flags & 0x2)
|
||||
fld = &add_gridded_field (sec, row, col, width, field, prompt);
|
||||
else
|
||||
fld = &add_prompted_field(sec, row, col, width, field, prompt);
|
||||
|
||||
TReport_field& txt = *fld;
|
||||
if (width < 16)
|
||||
txt.set_type('N');
|
||||
txt.set_border(2);
|
||||
txt.set_fore_color(COLOR_BLACK);
|
||||
txt.set_horizontal_alignment('C');
|
||||
|
||||
if (flags & 0x1) // Half height
|
||||
{
|
||||
const TReport_rct& rct = txt.get_rect();
|
||||
TReport_field* line = new TReport_field(&sec);
|
||||
line->set_type('R');
|
||||
line->set_pos(rct.left()-10, rct.top()-10);
|
||||
line->set_size(rct.width()+20, rct.height()/3);
|
||||
line->set_pattern(PAT_SOLID);
|
||||
line->set_back_color(COLOR_WHITE);
|
||||
sec.add(line);
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
|
||||
void TCU_report::add_field_grid(const TReport_field& fld, bool underlined, bool date)
|
||||
{
|
||||
TReport_section& sec = fld.section();
|
||||
const TReport_rct& rct = fld.get_rect();
|
||||
|
||||
if ((rct.width() / 100) & 1) // Campo di lunghezza dispari!
|
||||
{
|
||||
TReport_field& f = (TReport_field&)fld;
|
||||
f.set_width(rct.width()-100);
|
||||
}
|
||||
|
||||
if (underlined)
|
||||
{
|
||||
TReport_field* line = new TReport_field(&sec);
|
||||
line->set_type('L');
|
||||
line->set_pos(rct.left(), rct.bottom());
|
||||
line->set_size(rct.width(), 0);
|
||||
line->set_border(1);
|
||||
line->set_fore_color(COLOR_BLACK);
|
||||
sec.add(line);
|
||||
}
|
||||
|
||||
int fr, to, len, spc;
|
||||
if (date)
|
||||
{
|
||||
len = 4;
|
||||
fr = 1;
|
||||
to = 2;
|
||||
spc = 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = rct.width() / 200;
|
||||
fr = underlined ? 0 : 1;
|
||||
to = len - (underlined ? 0 : 1);
|
||||
spc = underlined ? 0 : 50;
|
||||
}
|
||||
for (int y = fr; y <= to; y++)
|
||||
{
|
||||
TReport_field* line = new TReport_field(&sec);
|
||||
line->set_type('L');
|
||||
line->set_pos(rct.left()+y*rct.width()/len, rct.top()+spc);
|
||||
line->set_size(0, rct.height()-spc);
|
||||
line->set_border(1);
|
||||
line->set_fore_color(COLOR_BLACK);
|
||||
sec.add(line);
|
||||
}
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_gridded_field(TReport_section& sec, int row, int col, int len,
|
||||
const char* field, const char* label)
|
||||
{
|
||||
const bool is_date = len == 10;
|
||||
const bool underlined = len>=16 && _row_offset <= 0; // Underlined grid in the header
|
||||
TString80 str;
|
||||
if (is_date)
|
||||
{
|
||||
str = "## ## ####";
|
||||
len = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (i) str << ' ';
|
||||
str << "#";
|
||||
}
|
||||
str.rtrim();
|
||||
}
|
||||
TReport_field& fld = add_labeled_field(sec, row, col, len*2, field, label);
|
||||
fld.set_picture(str);
|
||||
if (is_date)
|
||||
fld.set_horizontal_alignment('C');
|
||||
else
|
||||
fld.set_horizontal_alignment('R');
|
||||
add_field_grid(fld, underlined, is_date);
|
||||
|
||||
return fld;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_big_text(TReport_section& sec, int row, int col, const char* label, COLOR rgb)
|
||||
{
|
||||
const TReport_font& fnt_big = best_font("Arial Black", _fnt_prg.size()*3, _fnt_prg.style());
|
||||
|
||||
TReport_field* txt = new TReport_field(&sec);
|
||||
txt->set_type('T');
|
||||
txt->set_picture(label);
|
||||
txt->set_pos(CU_FORM_BORDER+col*100, row*100);
|
||||
txt->set_size(strlen(label)*300, 200);
|
||||
txt->set_pattern(PAT_HOLLOW);
|
||||
txt->set_back_color(COLOR_INVALID);
|
||||
txt->set_text_color(rgb);
|
||||
txt->set_font(fnt_big);
|
||||
|
||||
sec.add(txt);
|
||||
return *txt;
|
||||
}
|
||||
|
||||
TReport_field& TCU_report::add_break(TReport_section& sec, int row, bool small)
|
||||
{
|
||||
TReport_field* line = new TReport_field(&sec);
|
||||
line->set_type('L');
|
||||
if (small)
|
||||
{
|
||||
line->set_pos(CU_FORM_BORDER+CU_HEAD_WIDTH, row*100);
|
||||
line->set_size(CU_FORM_WIDTH-CU_HEAD_WIDTH, 0);
|
||||
line->set_border(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
line->set_pos(CU_FORM_BORDER, row*100);
|
||||
line->set_size(CU_FORM_WIDTH, 0);
|
||||
line->set_border(2);
|
||||
}
|
||||
line->set_fore_color(COLOR_BLACK);
|
||||
sec.add(line);
|
||||
return *line;
|
||||
}
|
||||
|
||||
void TCU_report::add_long_break(TReport_section& sec, int row)
|
||||
{ add_break(sec, row, false); }
|
||||
|
||||
void TCU_report::add_short_break(TReport_section& sec, int row)
|
||||
{ add_break(sec, row, true); }
|
||||
|
||||
void TCU_report::add_band(TReport_section& sec, int row, int height, COLOR rgb)
|
||||
{
|
||||
TReport_field* rct = new TReport_field(&sec);
|
||||
if (rgb == COLOR_INVALID)
|
||||
rgb = CU_BACKGROUND;
|
||||
rct->set_pos(CU_FORM_BORDER+CU_HEAD_WIDTH, row *100);
|
||||
rct->set_size(CU_FORM_WIDTH-CU_HEAD_WIDTH, height*100);
|
||||
if (_quality >= 2)
|
||||
{
|
||||
rct->set_pattern(PAT_SOLID);
|
||||
rct->set_back_color(rgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
rct->set_pattern(PAT_HOLLOW);
|
||||
rct->set_border(2);
|
||||
rct->set_fore_color(rgb);
|
||||
rct->set_back_color(COLOR_INVALID);
|
||||
}
|
||||
sec.add(rct);
|
||||
|
||||
add_long_break(sec, row);
|
||||
}
|
||||
|
||||
void TCU_report::add_underlined_text(TReport_section& body, int row, const char* text)
|
||||
{
|
||||
TReport_field& line = add_break(body, _row_offset/100+row+1, true);
|
||||
const TReport_rct rct = line.get_rect();
|
||||
line.set_pos(rct.left()+100, rct.top()+25);
|
||||
line.set_size(rct.width()-200, rct.height());
|
||||
add_field_label(line, text, 'C');
|
||||
}
|
||||
|
||||
void TCU_report::create_logo(TReport_section& header)
|
||||
{
|
||||
add_big_text(header, 4, 0, "CERTIFICAZIONE", COLOR_GRAY).set_vertical_alignment('T');
|
||||
add_big_text(header, 6, 0, "UNICA", COLOR_BLACK).set_vertical_alignment('B');
|
||||
add_big_text(header, 6,12, "2015", COLOR_LTGRAY).set_vertical_alignment('B');
|
||||
|
||||
TReport_field* txt = new TReport_field(&header);
|
||||
txt->set_type('I');
|
||||
txt->set("res/AgenziaEntrate.gif");
|
||||
txt->set_pos(CU_FORM_BORDER, 900);
|
||||
txt->set_size(1200, 200);
|
||||
header.add(txt);
|
||||
}
|
||||
|
||||
void TCU_report::create_B()
|
||||
{
|
||||
TReport_section& header = section('B', 1);
|
||||
header.set_condition("#1=\"B\"");
|
||||
|
||||
_row_offset = 0;
|
||||
estimated_prompt_len(NULL); // Reset font computer
|
||||
|
||||
create_logo(header);
|
||||
add_gridded_field(header, 11, CU_ALIGN_RIGHT, 16, "#2", ""); // Codice fiscale dichiarante
|
||||
add_prompt(header, 11, CU_BEFORE_LAST, 7, "Codice fiscale");
|
||||
|
||||
add_band(header, 13, 27);
|
||||
|
||||
begin_paragraph(header, 13, 2, "TIPO DI COMUNICAZIONE");
|
||||
add_prompted_bool(header, 0, 0, 2, "#10", "Annullamento");
|
||||
add_prompted_bool(header, 0, 28, 2, "#11", "Sostituzione");
|
||||
end_paragraph(header);
|
||||
|
||||
begin_paragraph(header, CU_AFTER_LAST, 9, "DATI RELATIVI\nAL SOSTITUTO");
|
||||
add_labeled_field(header, 0, 0, 32, "#2", "Codice Fiscale");
|
||||
add_labeled_field(header, 1, 0, 36, "#12", "Cognome o Denominazione").set_alternate_field("#14");
|
||||
add_labeled_field(header, 1,CU_AFTER_LAST, CU_ALIGN_RIGHT, "#13", "Nome"); // La colonna segue il cognome
|
||||
TReport_field& tel = add_labeled_field(header, 2, 0, 16, "#16", "Telefono o fax");
|
||||
add_field_sublabel(tel, "prefisso numero");
|
||||
tel.set_alternate_field("#17");
|
||||
add_labeled_field(header, 2, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#15", "Indirizzo di posta elettronica"); // La colonna segue il telefono
|
||||
end_paragraph(header);
|
||||
|
||||
begin_paragraph(header, CU_AFTER_LAST, 6, "DATI RELATIVI AL RAPPRESENTANTE FIRMATARIO DELLA COMUNICAZIONE");
|
||||
add_labeled_field(header, 0, 0, 24, "#18", "Codice Fiscale");
|
||||
add_labeled_field(header, 0,32, 3, "#19", "Codice carica", 'C');
|
||||
add_gridded_field(header, 0,CU_ALIGN_RIGHT, 11, "#2", "Codice fiscale società o ente dichiarante");
|
||||
add_labeled_field(header, 1, 0, 36, "#20", "Cognome");
|
||||
add_labeled_field(header, 1,CU_AFTER_LAST, CU_ALIGN_RIGHT, "#21", "Nome");
|
||||
end_paragraph(header);
|
||||
|
||||
begin_paragraph(header, CU_AFTER_LAST, 3, "FIRMA DELLA COMUNICAZIONE");
|
||||
add_labeled_number(header, 0, 4, 5, "#23", "Numero certificazioni\nlavoro dipendente ed assimilati", 'C');
|
||||
add_labeled_number(header, 0, 15, 5, "#24", "Numero certificazioni\nlavoro autonomo e provvigioni", 'C');
|
||||
add_labeled_field (header, 0, 25, 3, "#25", "Quadro CT", 'C');
|
||||
add_prompted_field(header, 0, CU_ALIGN_RIGHT, 24, "", "FIRMA");
|
||||
end_paragraph(header);
|
||||
|
||||
begin_paragraph(header, CU_AFTER_LAST, 7, "IMPEGNO ALLA PRESENTAZIONE TELEMATICA");
|
||||
_row_height = 300;
|
||||
add_prompted_field(header, 0, 0, 16, "#27", "Codice fiscale dell'intermediario");
|
||||
add_break(header, _row_offset/100+3, true);
|
||||
end_paragraph(header);
|
||||
|
||||
begin_paragraph(header, _row_offset/100+3, 2, "Riservato\nall'intermediario");
|
||||
add_prompt(header, 0, 0, 30, "Impegno a presentare in via telematica la comunicazione");
|
||||
TReport_field& ipt = add_field(header, 0, CU_ALIGN_RIGHT, 2, "#28");
|
||||
ipt.set_type('N');
|
||||
ipt.set_horizontal_alignment('C');
|
||||
ipt.hide_zeroes(true);
|
||||
add_break(header, _row_offset/100+2, true);
|
||||
add_prompt(header, 1,0, -1, "Data dell'impegno");
|
||||
TReport_field& dit = add_gridded_field(header, 1, 10, 10, "#29", "");
|
||||
dit.set_type('N');
|
||||
dit.hide_zeroes(true);
|
||||
add_prompted_field(header,1, CU_ALIGN_RIGHT,24, "", "FIRMA DELL'INTERMEDIARIO", 15);
|
||||
add_break(header, _row_offset/100+4, false);
|
||||
}
|
||||
|
||||
void TCU_report::create_D()
|
||||
{
|
||||
TReport_section& body = section('B', 2);
|
||||
body.set_condition("#1=\"D\"");
|
||||
body.force_page_break(true);
|
||||
|
||||
_row_offset = 0;
|
||||
create_logo(body);
|
||||
|
||||
TReport_font fnt_big; fnt_big.create(_fnt_prg.name(), 3*_fnt_prg.size()/2, _fnt_prg.style());
|
||||
TReport_field* txt = new TReport_field(&body);
|
||||
txt->set_type('T');
|
||||
txt->set_picture("CERTIFICAZIONE DI CUI ALL'ART.4, COMMI 6-ter e 6-quater,\n"
|
||||
"DEL D.P.R. 22 LUGLIO 1998, n. 322, RELATIVA ALL'ANNO");
|
||||
txt->set_pos(CU_FORM_BORDER+28*100, 7*100);
|
||||
txt->set_size(7000, 300);
|
||||
txt->set_pattern(PAT_HOLLOW);
|
||||
txt->set_back_color(COLOR_INVALID);
|
||||
txt->set_text_color(COLOR_BLACK);
|
||||
txt->set_font(fnt_big);
|
||||
body.add(txt);
|
||||
|
||||
add_boxed_field(body, 8, 68, 4, "2014", "");
|
||||
|
||||
add_band(body, 12, 35);
|
||||
|
||||
begin_paragraph(body, 12, 9, "DATI ANAGRAFICI\nDATI RELATIVI\nAL DATORE DI LAVORO,\nENTE PENSIONISTICO O\nALTRO SOSTITUTO\nD'IMPOSTA", 0x3);
|
||||
add_labeled_field(body, 0, 0, 16, "#DA001001", "Codice Fiscale");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, 30, "#DA001002", "Cognome o Denominazione");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#DA001003", "Nome"); // La colonna segue il cognome
|
||||
|
||||
add_labeled_field(body, 1, 0, 24, "#DA001004", "Comune");
|
||||
add_labeled_field(body, 1, CU_AFTER_LAST, 2, "#DA001005", "Prov.");
|
||||
add_labeled_field(body, 1, CU_AFTER_LAST, 5, "#DA001006", "Cap");
|
||||
add_labeled_field(body, 1, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#DA001007", "Indirizzo");
|
||||
|
||||
TReport_field& tel = add_labeled_field(body, 2, 0, 16, "#DA001008", "Telefono o fax");
|
||||
add_field_sublabel(tel, " prefisso numero");
|
||||
add_labeled_field(body, 2, CU_AFTER_LAST, 30, "#DA001009", "Indirizzo di posta elettronica");
|
||||
add_labeled_field(body, 2, CU_AFTER_LAST, 6, "#DA001010", "Codice attività");
|
||||
add_labeled_number(body, 2, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#DA001011", "Codice sede");
|
||||
end_paragraph(body);
|
||||
|
||||
begin_paragraph(body, CU_AFTER_LAST, 6, "DATI RELATIVI\nAL DIPENDENTE,\nPENSIONATO O\nALTRO PERCETTORE\nDELLE SOMME", 0x2);
|
||||
add_labeled_field(body, 0, 0, 16, "#DA002001", "Codice Fiscale");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, 30, "#DA002002", "Cognome o Denominazione");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#DA002003", "Nome"); // La colonna segue il cognome
|
||||
add_labeled_field(body, 1, 0, 1, "#DA002004", "Sesso\n(M o F)", 'C');
|
||||
add_gridded_field(body, 1, CU_AFTER_LAST, 10, "#DA002005", "Data di nascita");
|
||||
add_labeled_field(body, 1, 16, 24, "#DA002006", "Comune (o Stato estero) di nascita");
|
||||
add_labeled_field(body, 1, CU_AFTER_LAST, 3, "#DA002007", "Prov. nasc.\n(sigla)", 'C');
|
||||
add_labeled_field(body, 1, 49, 3, "#DA002008", "Categorie\nparticolari", 'C');
|
||||
add_labeled_number(body,1, 55, 3, "#DA002009", "Eventi\neccezionali", 'C');
|
||||
add_labeled_number(body,1, 61, 3, "#DA002010", "Casi di esclusione\ndalla precompilata", 'C');
|
||||
end_paragraph(body);
|
||||
|
||||
begin_paragraph(body, CU_AFTER_LAST, 8, "");
|
||||
add_underlined_text(body, 0, "DOMICILIO FISCALE ALL'1/1/2014");
|
||||
add_labeled_field(body, 0, 0, 50, "#DA002020", "Comune");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, 3, "#DA002021", "Provincia (sigla)");
|
||||
add_labeled_field(body, 0, CU_ALIGN_RIGHT, 6, "#DA002022", "Codice comune");
|
||||
add_underlined_text(body, 4, "DOMICILIO FISCALE ALL'1/1/2015");
|
||||
add_labeled_field(body, 1, 0, 50, "#DA002023", "Comune");
|
||||
add_labeled_field(body, 1, CU_AFTER_LAST, 3, "#DA002024", "Provincia (sigla)");
|
||||
add_labeled_field(body, 1, CU_ALIGN_RIGHT, 6, "#DA002025", "Codice comune");
|
||||
end_paragraph(body);
|
||||
|
||||
begin_paragraph(body, CU_AFTER_LAST, 3, "DATI RELATIVI\nAL RAPPRESENTANTE", 0x2);
|
||||
add_labeled_field(body, 0, 0, 16, "#DA002030", "Codice Fiscale");
|
||||
end_paragraph(body);
|
||||
|
||||
begin_paragraph(body, CU_AFTER_LAST, 6, "RISERVATO\nAI PERCIPIENTI ESTERI", 0x2);
|
||||
add_labeled_field(body, 0, 0, 16, "#DA002040", "Codice di identificazione fiscale estero");
|
||||
add_labeled_field(body, 0, CU_AFTER_LAST, CU_ALIGN_RIGHT, "#DA002041", "Località di residenza estera");
|
||||
add_labeled_field(body, 1, 0, 50, "#DA002042", "Via e numero civico");
|
||||
add_labeled_field(body, 1, CU_ALIGN_RIGHT, 5, "#DA002043", "Codice Stato estero", 'C');
|
||||
end_paragraph(body);
|
||||
begin_paragraph(body, CU_AFTER_LAST, 3, "");
|
||||
add_gridded_field(body, 0, 0, 10, "#DA003001", "DATA");
|
||||
add_labeled_field(body, 0, 15, CU_ALIGN_RIGHT, "", "FIRMA DEL SOSTITUTO DI IMPOSTA", 'C');
|
||||
end_paragraph(body);
|
||||
}
|
||||
|
||||
void TCU_report::create_H()
|
||||
{
|
||||
TReport_section& body = section('B', 3);
|
||||
body.set_condition("#1=\"H\"");
|
||||
body.force_page_break(true);
|
||||
_row_offset = 0;
|
||||
|
||||
add_prompt (body, 4, 0, 14, "Codice fiscale del percipiente");
|
||||
add_boxed_field(body, 4,CU_AFTER_LAST, 16, "#4", "", 0x1);
|
||||
|
||||
add_boxed_field(body, 4, 74, 2, "#3", "", 0x3);
|
||||
add_prompt(body, 4, CU_BEFORE_LAST, -1, "Mod. N.");
|
||||
|
||||
const TReport_font& fnt_big = best_font(_fnt_prg.name(), 3*_fnt_prg.size()/2, _fnt_prg.style());
|
||||
TReport_field* title = new TReport_field(&body);
|
||||
title->set_pos(CU_FORM_BORDER+CU_HEAD_WIDTH, 700);
|
||||
title->set_size(CU_FORM_WIDTH-CU_HEAD_WIDTH, 200);
|
||||
title->set_horizontal_alignment('C');
|
||||
title->set_vertical_alignment('C');
|
||||
title->set_picture("CERTIFICAZIONE LAVORO AUTONOMO,\nPROVVIGIONI E REDDITI DIVERSI");
|
||||
title->set_font(fnt_big);
|
||||
body.add(title);
|
||||
add_band(body, 10, 25);
|
||||
|
||||
const int tab0 = 2, tab1 = 6, tab2 = 27, tab3 = CU_ALIGN_RIGHT;
|
||||
|
||||
begin_paragraph(body, 10, 4, "DATI RELATIVI ALLE SOMME EROGATE\nTIPOLOGIA REDDITUALE", 0x3);
|
||||
add_labeled_field(body, 0, tab0, 1, "#AU001001", "Causale");
|
||||
end_paragraph(body);
|
||||
|
||||
begin_paragraph(body, -1, 21, "DATI FISCALI");
|
||||
add_labeled_number(body, 0, tab1-1, 4, "#AU001002", "Anno", 'C');
|
||||
add_labeled_field (body, 0, CU_AFTER_LAST, 2, "#AU001003", "Anticipazione", 'C');
|
||||
add_labeled_number(body, 0, tab2, CU_EURO_LEN, "#AU001004", "Ammontare lordo corrisposto", 'C');
|
||||
add_labeled_number(body, 0, tab3, CU_EURO_LEN, "#AU001005", "Somme non soggette a ritenuta\nper regime convenzionale", 'C');
|
||||
|
||||
add_labeled_number(body, 1, tab0, 2, "#AU001006", "Codice");
|
||||
add_labeled_number(body, 1, tab1, CU_EURO_LEN, "#AU001007", "Altre somme non soggette a ritenuta", 'C');
|
||||
add_labeled_number(body, 1, tab2, CU_EURO_LEN, "#AU001008", "Imponibile", 'C');
|
||||
add_labeled_number(body, 1, tab3, CU_EURO_LEN, "#AU001009", "Ritenute a titolo di acconto", 'C');
|
||||
|
||||
add_labeled_number(body, 2, tab1, CU_EURO_LEN, "#AU001010", "Ritenute a titolo d'imposta", 'C');
|
||||
add_labeled_number(body, 2, tab2, CU_EURO_LEN, "#AU001011", "Ritenute sospese", 'C');
|
||||
add_labeled_number(body, 2, tab3, CU_EURO_LEN, "#AU001012", "Addizionale regionale a titolo d'acconto", 'C');
|
||||
|
||||
add_labeled_number(body, 3, tab1, CU_EURO_LEN, "#AU001013", "Addizionale regionale a titolo d'imposta", 'C');
|
||||
add_labeled_number(body, 3, tab2, CU_EURO_LEN, "#AU001014", "Addizionale regionale sospesa", 'C');
|
||||
add_labeled_number(body, 3, tab3, CU_EURO_LEN, "#AU001015", "Addizionale comunale a titolo d'acconto", 'C');
|
||||
|
||||
add_labeled_number(body, 4, tab1, CU_EURO_LEN, "#AU001016", "Addizionale comunale a titolo d'imposta", 'C');
|
||||
add_labeled_number(body, 4, tab2, CU_EURO_LEN, "#AU001017", "Addizionale comunale sospesa", 'C');
|
||||
add_labeled_number(body, 4, tab3, CU_EURO_LEN, "#AU001018", "Imponibile anni precedenti", 'C');
|
||||
|
||||
add_labeled_number(body, 5, tab1, CU_EURO_LEN, "#AU001019", "Ritenute operate anni precedenti", 'C');
|
||||
add_labeled_number(body, 5, tab2, CU_EURO_LEN, "#AU001020", "Contributi previdenziali\na carico del soggetto erogante", 'C');
|
||||
add_labeled_number(body, 5, tab3, CU_EURO_LEN, "#AU001021", "Contributi previdenziali\na carico del percipiente", 'C');
|
||||
|
||||
add_labeled_number(body, 6, tab1, CU_EURO_LEN, "#AU001022", "Spese rimborsate", 'C');
|
||||
add_labeled_number(body, 6, tab2, CU_EURO_LEN, "#AU001023", "Ritenute rimborsate", 'C');
|
||||
end_paragraph(body);
|
||||
}
|
||||
|
||||
|
||||
TCU_report::TCU_report(int quality) : _quality(quality)
|
||||
{
|
||||
set_lpi(6);
|
||||
set_cpi(10);
|
||||
_fnt_rep.create("Courier New", 12, 0);
|
||||
set_font(_fnt_rep);
|
||||
_fnt_lbl.create("Arial", _fnt_rep.size()/2, 0);
|
||||
_fnt_sub.create(_fnt_lbl.name(), _fnt_lbl.size(), XVT_FS_BOLD);
|
||||
_fnt_prg.create(_fnt_lbl.name(), _fnt_rep.size()/2+1, XVT_FS_BOLD);
|
||||
_fnt_prm.create(_fnt_lbl.name(), 2*_fnt_rep.size()/3, 0);
|
||||
|
||||
create_B();
|
||||
create_D();
|
||||
create_H();
|
||||
}
|
||||
|
||||
void print_cu(const TFilename& datafile, int quality)
|
||||
{
|
||||
TCU_report cur(quality);
|
||||
cur.set_recordset(new TTrasferimentoCU(datafile, 'r'));
|
||||
cur.preview();
|
||||
xvtil_statbar_set(NULL);
|
||||
}
|
289
m770/777202.cpp
Normal file
289
m770/777202.cpp
Normal file
@ -0,0 +1,289 @@
|
||||
#include <automask.h>
|
||||
#include <diction.h>
|
||||
|
||||
#include "777200.h"
|
||||
#include "777200a.h"
|
||||
|
||||
class TCU_editor : public TAutomask
|
||||
{
|
||||
TTrasferimentoCU* _recset;
|
||||
int _quality;
|
||||
|
||||
TBit_array _dirty_row;
|
||||
bool _dirty_file;
|
||||
TString _txt;
|
||||
|
||||
protected:
|
||||
void save_page();
|
||||
bool save_page_if_dirty();
|
||||
void load();
|
||||
void save_file();
|
||||
bool find_text();
|
||||
|
||||
public:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
TCU_editor(const TFilename& fn, int quality);
|
||||
~TCU_editor() { delete _recset; }
|
||||
};
|
||||
|
||||
void TCU_editor::load()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_PATH);
|
||||
sheet.hide();
|
||||
sheet.destroy();
|
||||
|
||||
const unsigned int cols = _recset->columns();
|
||||
|
||||
TString8 name, last;
|
||||
for (unsigned int c = 0; c < cols; c++)
|
||||
{
|
||||
const TRecordset_column_info& ci = _recset->column_info(c);
|
||||
if (ci._type == _nullfld)
|
||||
continue;
|
||||
|
||||
const TVariant& var = _recset->get(c);
|
||||
if (ci._name.len() == 8 && isdigit(ci._name[2]))
|
||||
name = ci._name;
|
||||
else
|
||||
name.format("%d", int(c+1));
|
||||
if (name == last)
|
||||
{
|
||||
TToken_string& prev = sheet.row(sheet.items()-1);
|
||||
TString tmp;
|
||||
tmp << prev.get(2) << var.as_string().mid(1);
|
||||
prev.add(tmp, 2);
|
||||
continue;
|
||||
}
|
||||
last = name;
|
||||
|
||||
TToken_string row;
|
||||
row = name;
|
||||
switch (ci._type)
|
||||
{
|
||||
case _charfld:
|
||||
case _alfafld:
|
||||
row.add(" ");
|
||||
row.add(var.as_string());
|
||||
break;
|
||||
case _datefld:
|
||||
row.add("D");
|
||||
row.add(var.as_date().string());
|
||||
break;
|
||||
case _realfld:
|
||||
row.add("V");
|
||||
row.add(var.as_string());
|
||||
break;
|
||||
case _boolfld:
|
||||
row.add("B");
|
||||
row.add(var.as_bool() ? "1" : "0");
|
||||
break;
|
||||
default :
|
||||
row.add("N");
|
||||
row.add(var.as_string());
|
||||
break;
|
||||
}
|
||||
row.add(ci._name, 3);
|
||||
const int nr = sheet.rows_array().add(row);
|
||||
if (c == 0 || name.len() == 8)
|
||||
sheet.disable_row(nr);
|
||||
}
|
||||
sheet.force_update();
|
||||
sheet.show();
|
||||
_dirty_row.reset();
|
||||
|
||||
const TFilename n = _recset->query_text();
|
||||
TString80 msg; msg.format(FR("%s Record n. %ld"), n.name(), _recset->current_row()+1);
|
||||
xvtil_statbar_set(msg);
|
||||
}
|
||||
|
||||
void TCU_editor::save_page()
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_PATH);
|
||||
TString8 code;
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row) if (_dirty_row[r])
|
||||
{
|
||||
code = row->get(0);
|
||||
const bool positional = real::is_natural(code);
|
||||
if (positional)
|
||||
{
|
||||
TVariant var = row->get(2);
|
||||
_recset->set_field(atoi(code), var);
|
||||
}
|
||||
}
|
||||
_dirty_row.reset();
|
||||
}
|
||||
|
||||
void TCU_editor::save_file()
|
||||
{
|
||||
const TFilename fn = _recset->query_text();
|
||||
save_page();
|
||||
if (_recset->save(fn))
|
||||
_dirty_file = false;
|
||||
else
|
||||
cantwrite_box(fn);
|
||||
}
|
||||
|
||||
bool TCU_editor::save_page_if_dirty()
|
||||
{
|
||||
bool go = true;
|
||||
if (_dirty_row.first_one() >= 0)
|
||||
{
|
||||
const KEY k = yesnocancel_box(TR("Alcuni campi risultano modificati:\nSi desidera aggiornarli prima di proseguire?"));
|
||||
go = k != K_ESC;
|
||||
if (k == K_YES)
|
||||
save_page();
|
||||
}
|
||||
return go;
|
||||
}
|
||||
|
||||
bool TCU_editor::find_text()
|
||||
{
|
||||
_txt.trim(); _txt.upper();
|
||||
const int txtlen = _txt.len();
|
||||
if (txtlen <= 0)
|
||||
return false;
|
||||
|
||||
const TRecnotype cur_pos = _recset->current_row();
|
||||
|
||||
TRecnotype best = cur_pos;
|
||||
double score = (txtlen-1.1)/txtlen;
|
||||
TString str;
|
||||
|
||||
while (score < 1.0)
|
||||
{
|
||||
if (!_recset->move_next())
|
||||
if (!_recset->move_first())
|
||||
break;
|
||||
if (_recset->current_row() == cur_pos)
|
||||
break;
|
||||
|
||||
const unsigned int cols = _recset->columns();
|
||||
for (unsigned int i = 1; i < cols; i++)
|
||||
{
|
||||
const TVariant& var = _recset->get(i);
|
||||
if (var.type() == _alfafld)
|
||||
{
|
||||
str = var.as_string(); str.trim();
|
||||
const int slen = str.len();
|
||||
if (slen >= txtlen-1)
|
||||
{
|
||||
str.upper();
|
||||
if (str.find(_txt) >= 0)
|
||||
{
|
||||
best = _recset->current_row();
|
||||
score = 1.0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (score > 0.75) // Provo a cercare la sottostringa più simile
|
||||
{
|
||||
for (int i = str.find(_txt[0]); i >= 0; i = str.find(_txt[0], i+1))
|
||||
{
|
||||
const double k = xvt_str_fuzzy_compare(str.mid(i, txtlen), _txt);
|
||||
if (k > score)
|
||||
{
|
||||
best = _recset->current_row();
|
||||
score = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_recset->move_to(best);
|
||||
return best != cur_pos;
|
||||
}
|
||||
|
||||
bool TCU_editor::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_FIRSTREC: if (e == fe_button && save_page_if_dirty() && _recset->move_first()) load(); return false;
|
||||
case DLG_PREVREC : if (e == fe_button && save_page_if_dirty() && _recset->move_prev()) load(); return false;
|
||||
case DLG_NEXTREC : if (e == fe_button && save_page_if_dirty() && _recset->move_next()) load(); return false;
|
||||
case DLG_LASTREC : if (e == fe_button && save_page_if_dirty() && _recset->move_last()) load(); return false;
|
||||
case DLG_PREVIEW :
|
||||
{
|
||||
const TFilename fn = _recset->query_text();
|
||||
if (fn.exist())
|
||||
print_cu(fn, _quality);
|
||||
}
|
||||
return false;
|
||||
case DLG_SAVEREC:
|
||||
if (e == fe_button && _dirty_file)
|
||||
{
|
||||
save_file();
|
||||
o.enable(_dirty_file);
|
||||
}
|
||||
break;
|
||||
case DLG_FINDREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
::xvt_dm_post_string_prompt(TR("Inserire il codice da ricercare"), _txt.get_buffer(81), 80);
|
||||
if (_txt.full() && save_page_if_dirty())
|
||||
{
|
||||
if (find_text())
|
||||
load();
|
||||
else
|
||||
warning_box("Nessuna corrispondenza");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case F_PATH:
|
||||
switch (e)
|
||||
{
|
||||
case fe_init :
|
||||
if (jolly <= 0)
|
||||
load();
|
||||
break;
|
||||
case fe_close :
|
||||
if (_dirty_file)
|
||||
{
|
||||
const KEY k = yesnocancel_box(TR("Alcuni record risultano modificati:\nSi desidera salvare il file?"));
|
||||
if (k == K_ESC)
|
||||
return false;
|
||||
if (k == K_YES)
|
||||
save_file();
|
||||
}
|
||||
break;
|
||||
case se_notify_modify:
|
||||
if (o.shown())
|
||||
{
|
||||
_dirty_row.set(jolly);
|
||||
enable(DLG_SAVEREC, _dirty_file = true);
|
||||
}
|
||||
break;
|
||||
case se_query_modify :
|
||||
return ((TSheet_field&)o).row_enabled(jolly);
|
||||
case se_query_del :
|
||||
return false;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TCU_editor::TCU_editor(const TFilename& fn, int quality) : TAutomask("777200b"), _quality(quality)
|
||||
{
|
||||
_recset = new TTrasferimentoCU(fn, 'r');
|
||||
_recset->move_first();
|
||||
enable(DLG_SAVEREC, _dirty_file = false);
|
||||
}
|
||||
|
||||
void edit_cu(const TFilename& datafile, int quality)
|
||||
{
|
||||
if (datafile.exist())
|
||||
{
|
||||
TCU_editor m(datafile, quality);
|
||||
m.run();
|
||||
xvtil_statbar_set(NULL);
|
||||
}
|
||||
else
|
||||
cantread_box(datafile);
|
||||
}
|
@ -144,9 +144,12 @@ int conta_tipiper(const long codit, TString& quadro, int* NumFisiche, int* NumNo
|
||||
// Ritorna l'anno di dichiarazione sui parametri di studio
|
||||
int anno_770()
|
||||
{
|
||||
/*
|
||||
TConfig conf(CONFIG_STUDIO, "77");
|
||||
const int anno = conf.get_int(ANNO_SEL, NULL, -1, TDate(TODAY).year());
|
||||
return anno;
|
||||
*/
|
||||
return ini_get_int(CONFIG_STUDIO, "77", ANNO_SEL, TDate(TODAY).year());
|
||||
}
|
||||
|
||||
long get_firm_770()
|
||||
|
@ -5,10 +5,11 @@ Module = 4
|
||||
Flags = ""
|
||||
Item_01 = "Attivazione sostituto", "776mod -1", ""
|
||||
Item_02 = "Gestione percipienti", "776mod -0", ""
|
||||
Item_03 = "Stampe",[77MENU_002]
|
||||
Item_04 = "Tabella causali", "773mod -3 %ca7", ""
|
||||
Item_05 = "Azzeramento archivi", "774 -2 T", ""
|
||||
Item_06 = "Parametri di studio", "773mod -0", ""
|
||||
Item_03 = "Tabella causali", "773mod -3 %ca7", ""
|
||||
Item_04 = "Azzeramento archivi", "774 -2 T", ""
|
||||
Item_05 = "Parametri di studio", "773mod -0", ""
|
||||
Item_06 = "Certificazione Unica", "777 -1", ""
|
||||
Item_07 = "Stampe",[77MENU_002]
|
||||
|
||||
[77MENU_002]
|
||||
Caption = "Stampe"
|
||||
|
Loading…
x
Reference in New Issue
Block a user