From 1736b4644ebe74aee089fd90b4877ed61e5bb480 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 3 Dec 2008 14:53:51 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20level=20=20=20=20=20=20=20=20=20:=2010.?= =?UTF-8?q?0=20Files=20correlati=20=20=20=20=20:=20cg4.exe=20Ricompilazion?= =?UTF-8?q?e=20Demo=20:=20[=20]=20Commento=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20:=200001001:=20Stampa=20libro=20iva=20provvisorio=20-=20r?= =?UTF-8?q?ipilogo=20Stampando=20l'iva=20acquisti=20della=20soc.=20Sailog?= =?UTF-8?q?=20(presente=20nella=20cartella=20Ilaria=20del=20FTP)=20per=20i?= =?UTF-8?q?l=20mese=20di=20gennaio,=20il=20riepilogo=20provvisorio=20(quel?= =?UTF-8?q?lo=20definitivo=20va=20bene)=20espone=20come=20riepilogo=20del?= =?UTF-8?q?=20n.d.=209=202=20volte=20il=20codice=2024.=20Il=20totale=20qua?= =?UTF-8?q?dra=20con=20la=20lista=20fatture=20con=20iva=20indetraibile,=20?= =?UTF-8?q?dove=20sono=20dettagliate=2011=20fatture=20con=20tale=20aliquot?= =?UTF-8?q?a,=20la=2012=C2=B0=20ha=20iva=20diversa=20e=20come=20numerazion?= =?UTF-8?q?e=20iva=20=C3=A8=20superiore=20alle=20altre.=20Da=20nessuna=20d?= =?UTF-8?q?elle=20due=20stampe=20riesco=20a=20capire=20la=20motivazione=20?= =?UTF-8?q?della=20spezzettatura=20del=20totale.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.65.10.50/trunk@17793 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg3300.cpp | 41 +++++++------------ cg/cg4.cpp | 32 +++++---------- cg/cg4300.cpp | 15 +++---- cg/cg4300.h | 8 +--- cg/cg4301.cpp | 2 +- cg/cg4305.cpp | 1 - cg/cg4400.cpp | 107 +++++++++++++++++++++++++++---------------------- cg/cg4400a.uml | 5 +-- 8 files changed, 93 insertions(+), 118 deletions(-) diff --git a/cg/cg3300.cpp b/cg/cg3300.cpp index 9ab63c376..fbfa890fa 100755 --- a/cg/cg3300.cpp +++ b/cg/cg3300.cpp @@ -129,8 +129,8 @@ public: TPrintrow * get_fornitori () ; TPrintrow * get_record_fine_volume (bool) ; - long cerca_codice_all(char tipo, long codcf) ; - bool corrispettivo (const char * tipodoc); + long cerca_codice_all(char tipo, long codcf) const; + bool corrispettivo (const char * tipodoc) const; TStampa_allegati () {} virtual ~TStampa_allegati () {} @@ -143,14 +143,14 @@ public: // // ---------------------------------------------------------------- -const char* segno (const real& val) +static const char* segno (const real& val) { if (val < ZERO) - return SEGNO_MENO; + return SEGNO_MENO; return " "; } -const char* filler (int size) +static const char* filler (int size) { static TString_array _fill; @@ -158,37 +158,24 @@ const char* filler (int size) if (dep == NULL) { dep = new TToken_string(size); - dep->fill (' '); + dep->fill(' ', size); _fill.add(dep, size); } return *dep; } -long TStampa_allegati::cerca_codice_all(char tipo, long codcf) +long TStampa_allegati::cerca_codice_all(char tipo, long codcf) const { - TString16 key; - - key.format("%c|%ld", tipo, codcf); - - const TRectype & clifo = cache().get(LF_CLIFO, key); - - if (!clifo.empty()) - return clifo.get_long (CLI_CODALLEG); - - return 0L; + TString8 key; key.format("%c|%ld", tipo, codcf); + return atol(cache().get(LF_CLIFO, key, CLI_CODALLEG)); } -bool TStampa_allegati::corrispettivo (const char * tipodoc) +bool TStampa_allegati::corrispettivo (const char* tipodoc) const { - TString natura_doc; - bool corrisp; - - const TRectype & tpd = cache().get("%TPD", tipodoc); - - natura_doc = tpd.get("I0"); - corrisp = tpd.get_bool ("B0"); - - return corrisp && (natura_doc == "1" || natura_doc == "9"); + const TRectype& tpd = cache().get("%TPD", tipodoc); + const int natura_doc = tpd.get_int("I0"); + const bool corrisp = tpd.get_bool ("B0"); + return corrisp && (natura_doc == 1 || natura_doc == 9); } // -------------------------------------------------------------------- diff --git a/cg/cg4.cpp b/cg/cg4.cpp index 878ad0b73..e5be3d2f7 100755 --- a/cg/cg4.cpp +++ b/cg/cg4.cpp @@ -6,31 +6,19 @@ int main(int argc,char** argv) { const int n = argc > 1 ? argv[1][1]-'0' : 0; - switch (n) { - case 1: - cg4200(argc,argv); break; // Copia archivi - case 2: - cg4300(argc,argv); break; // Calcolo liquidazione - case 3: - cg4400(argc,argv); break; // Stampa Registri IVA - case 4: - cg4500(argc,argv); break; // Apertura nuovo esercizio - case 5: - cg4600(argc,argv); break; // Chiusura /Apertura - case 6: - cg4700(argc,argv); break; // Gestione acconti - case 7: - cg4800(argc,argv); break; // Creazione versamenti per acconto - case 8: - cg4900(argc,argv); break; // Visualizzazione liquidazione acconti - case 9: - cg4a00(argc,argv); break; // Gestione Autotrasportatori - default: - cg4100(argc,argv); break; // Ricalcolo saldi + case 1: cg4200(argc,argv); break; // Copia archivi + case 2: cg4300(argc,argv); break; // Calcolo liquidazione + case 3: cg4400(argc,argv); break; // Stampa Registri IVA + case 4: cg4500(argc,argv); break; // Apertura nuovo esercizio + case 5: cg4600(argc,argv); break; // Chiusura /Apertura + case 6: cg4700(argc,argv); break; // Gestione acconti + case 7: cg4800(argc,argv); break; // Creazione versamenti per acconto + case 8: cg4900(argc,argv); break; // Visualizzazione liquidazione acconti + case 9: cg4a00(argc,argv); break; // Gestione Autotrasportatori + default: cg4100(argc,argv); break; // Ricalcolo saldi } - exit(0); return 0; } diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index 7e4e414ce..0ac25084e 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -3,7 +3,6 @@ // Part 1: interfaccia // fv 21-1-94 // ------------------------------------------------------------ - #include "cg4300.h" #include "cg4300a.h" @@ -16,7 +15,6 @@ #include - // Methods of _Iva11Array bool _Iva11Array::add(const real& val, const char* fld_name, int num_file) { @@ -25,8 +23,10 @@ bool _Iva11Array::add(const real& val, const char* fld_name, int num_file) TAssoc_array::add(fld_name,(_Iva11Item*)new _Iva11Item,is_key); _Iva11Item& bi = (_Iva11Item&)find(fld_name); bi.value() += val; - if (num_file != LF_TAB1100A) bi.file() = num_file; - return TRUE; + if (num_file != LF_TAB1100A) + bi.file() = num_file; + + return true; } bool _Iva11Array::sub(const real& val, const char* fld_name, int num_file) @@ -42,7 +42,7 @@ void _Iva11Array::zero(const char* fld_name) if (!is_key) TAssoc_array::add(fld_name,(_Iva11Item*) new _Iva11Item,is_key); _Iva11Item& bi = (_Iva11Item&)find(fld_name); - bi.value() = 0.0; + bi.value() = ZERO; } // Methods of _ProrataItem @@ -52,7 +52,7 @@ void _Iva11Array::zero(const char* fld_name) real _ProrataItem::calc_prorata(const real& acq, const char * year) { real perc = _percentuali.objptr(year) ? (real&) *_percentuali.objptr(year) : ZERO; - real prorata = (acq * perc) / 100.0; + real prorata = (acq * perc) / CENTO; prorata.round(TCurrency::get_firm_dec()); return prorata; } @@ -67,9 +67,6 @@ real _ProrataItem::percentuale(const char * year) return perc; } -// Methods of application! -real TLiquidazione_app::CENTO(100.0); - inline TLiquidazione_app& app() { return (TLiquidazione_app&)main_app(); } diff --git a/cg/cg4300.h b/cg/cg4300.h index ebf2c9ca3..3382aec0a 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -303,17 +303,13 @@ class TLiquidazione_app : public TPrint_application // La cui chiave e' a sua volta sul nome campo // totali vari per attivita' - real _p8, _p8b, _p9; // totali plafond - _ProrataItem - _prorata; // Mini cazzetto per calcoli prorata + real _p8, _p8b, _p9; // totali plafond + _ProrataItem _prorata; // Mini cazzetto per calcoli prorata long __firm; // ditta selezionata all'inizio bool _is_interactive; // lanciata da menu o da altro prog bool _is_visliq; // lanciata da visualizzazione liquidazione - int _monthinatt; // mese inizio attivita' (serve per differita) - static real CENTO; - // main cursor TRelation* _rel; TCursor* _cur; diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index d30d05264..22327c953 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -2424,7 +2424,7 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt) // e' perche' alcune operazioni di calcolo (scorporo corrispettivi, ventilazione...) vengono effettuate // dopo la recalc_att(), punto in cui viene chiamata la phase_1. { - TString16 codiva, reg, tiva; + TString4 codiva, reg, tiva; TString16 tpla, tvia; TString16 v11, a11; TToken_string tt("",'!'); diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 92efc21c2..93d8772f5 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -22,7 +22,6 @@ bool TLiquidazione_app::set_deleghe() { TMask m("cg4300b.msk"); - m.field(FLD_CGB_YEAR).set_handler(ch_year_handler); m.field(FLD_CGB_YEAR).set(_year); diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index d3f52adc6..c9dbb542d 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -36,14 +36,15 @@ static enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione }; inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); } -#define RIGHE_FOOTER 3 // Righe da saltare nel footer per evitare di scrivere sulla perforazione +// Righe da saltare nel footer per evitare di scrivere sulla perforazione +#define RIGHE_FOOTER 3 bool TStampa_registri_app::filter_func (const TRelation * r) { const TRectype& mov = r->curr(LF_MOV); - const TString4 codreg = mov.get(MOV_REG); const int annoiva = mov.get_int(MOV_ANNOIVA); + const TString& codreg = mov.get(MOV_REG); if (codreg != (app()._codreg) || annoiva != (app()._annoes)) return FALSE; @@ -77,15 +78,8 @@ HIDDEN int compare_righeiva(const TObject** o1, const TObject** o2) { const TRigaiva& r1 = *(const TRigaiva*)*o1; const TRigaiva& r2 = *(const TRigaiva*)*o2; - /* - TString8 campo1; - TString8 campo2; - campo1.format("%d%4s", r1->_tipodet, (const char*)r1->_codiva); - campo2.format("%d%4s", r2->_tipodet, (const char*)r2->_codiva); - return strcmp(campo1, campo2); - */ - int diff = r1._tipodet - r2._tipodet; // Confronto il tipo indetraibilita' + int diff = r1._tipodet - r2._tipodet; // Confronto il tipo indetraibilita' if (diff == 0) // Se ho un uguale indetraibilita' ... diff = r1._codiva.compare(r2._codiva); // ... confronto il codice IVA @@ -1114,20 +1108,44 @@ int TStampa_registri_app::riga_rmoviva() } int TStampa_registri_app::setta_riga(int r, const TRigaiva& riga, real& tot1, - real& tot2, real& tot3, real& tot4) + real& tot2, real& tot3, real& tot4) { - set_row(r, "%-4s", (const char*)riga._codiva); - const TString& descr = descr_iva(riga._codiva); - set_row(r, "@5g%-.23s",(const char*)descr); - if (riga._imponibile != ZERO) + set_row(r, riga._codiva); + + TString descrizione = descr_iva(riga._codiva); + if (riga._tipocr > 0) + { + const char* cr = NULL; + switch (riga._tipocr) + { + case 1: cr = TR("Beni per rivendita"); break; + case 2: cr = TR("Beni ammortizzabili"); break; + case 3: cr = TR("Beni ammortizzabili con detr. 6%"); break; + case 4: cr = TR("Beni strumentali art. 17"); break; + case 5: cr = TR("Beni per rivendita da non ventilare"); break; + case 8: cr = TR("Altri beni strumentali in leasing"); break; + case 9: cr = TR("Spese generali"); break; + default: break; + } + if (cr && *cr) + descrizione << " (" << cr << ')'; + } + if (descrizione.full()) + { + TParagraph_string descr(descrizione, 23); + --r; + FOR_EACH_TOKEN(descr, d) + set_row(++r, "@5g%-.23s", d); + } + if (!riga._imponibile.is_zero()) set_row(r, "@29g%r", &riga._imponibile); - if (riga._imposta != ZERO) + if (!riga._imposta.is_zero()) set_row(r, "@45g%r", &riga._imposta); if (_tipo_stampa != prova) { - if (riga._imponibilep != ZERO) + if (!riga._imponibilep.is_zero()) set_row(r, "@81g%r", &riga._imponibilep); - if (riga._impostap != ZERO) + if (!riga._impostap.is_zero()) set_row(r, "@98g%r", &riga._impostap); } r++; // Incrementa sempre: cazzone! @@ -1136,20 +1154,19 @@ int TStampa_registri_app::setta_riga(int r, const TRigaiva& riga, real& tot1, tot2 += riga._imposta; tot3 += riga._imponibilep; tot4 += riga._impostap; - + return r; } messaggio TStampa_registri_app::controlla_liquidazione() { - TTable lim ("LIM"); - TString mesi_cal = ""; - TString16 chiave = ""; - TString16 ditta = ""; - int i, mese; - bool continua; + TTable lim("LIM"); + TString mesi_cal; + TString8 chiave, ditta; + bool continua = false; ditta << get_firm(); + int mese = 0; if (_tipo_stampa == prova) //stampa di prova mese = _data_a.month(); else @@ -1159,26 +1176,22 @@ messaggio TStampa_registri_app::controlla_liquidazione() { if (_frequiva == 'T') //la LIM esiste solo per i mesi 3, 6, 9, 12 { - for (i=3; i<=mese; i+=3) + for (int i=3; i<=mese; i+=3) { - chiave = ""; - TString16 m; m.format("%02d", i); - chiave << _annoes << m; + chiave.format("%04d%02d", _annoes, i); lim.put("CODTAB", chiave); if (lim.read() != NOERR || !lim.get_bool("B0")) - mesi_cal << itom(i) << "\n"; + mesi_cal << itom(i) << '\n'; } - } + } else if (_frequiva == 'M') { - for (i=1 ; i<=mese; i++) + for (int i=1; i<=mese; i++) { - chiave = ""; - TString16 m; m.format("%02d", i); - chiave << _annoes << m; + chiave.format("%04d%02d", _annoes, i); lim.put("CODTAB", chiave); if (lim.read() != NOERR || !lim.get_bool("B0")) - mesi_cal << itom(i) << "\n"; + mesi_cal << itom(i) << '\n'; } } if (mesi_cal.not_empty()) @@ -1193,8 +1206,7 @@ messaggio TStampa_registri_app::controlla_liquidazione() } else if (_tipo_riepilogativo == 'A') { - chiave = ""; - chiave << _annoes << 13; + chiave.format("%04d%02d", _annoes, 13); lim.put("CODTAB", chiave); if (lim.read() != NOERR || !lim.get_bool("B0")) { @@ -1211,9 +1223,7 @@ messaggio TStampa_registri_app::controlla_liquidazione() if (_frequiva == 'M' || (m==3 || m==6 || m==9 || m==12)) { - chiave = ""; - TString16 m; m.format("%02d", m); - chiave << _annoes << m; + chiave.format("%04d%02d", _annoes, m); lim.put("CODTAB", chiave); if (lim.read() != NOERR || !lim.get_bool("B0")) { @@ -3697,7 +3707,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m) void TStampa_registri_app::stampa_prospetto_riepilogo(tiporeg tipo, const TString& codreg, const TString& codatt, const bool print_prec) { - TString80 desc(desc_attivita(codatt)); + const TString80 desc(desc_attivita(codatt)); TPrinter& pr = printer(); TPrintrow row; @@ -3706,18 +3716,16 @@ void TStampa_registri_app::stampa_prospetto_riepilogo(tiporeg tipo, const TStrin if (!print_prec) { - row.put(TR("Registro iva:"), 0); + row.put(TR("Registro IVA:"), 0); row.put(codreg, 14); row.put(format("%-.40s",(const char*)_tabreg->get("S0")), 18); row.put(TR("Attivita\'"), 60); if (_annoes > 2007) { - TString key; - - key.format("%ld|%s", _ditta, (const char *)codatt); - const TString16 codateco = cache().get(LF_ATTIV, key, ATT_CODATECO); - + TString16 key; + key.format("%ld|%s", _ditta, (const char*)codatt); + const TString& codateco = cache().get(LF_ATTIV, key, ATT_CODATECO); row.put(codateco, 70); } else @@ -3765,7 +3773,8 @@ void TStampa_registri_app::stampa_prospetto_riepilogo(tiporeg tipo, const TStrin row.put(TR("V E N D I T E"), 94); row.put(TR("CORRISPETTIVI"), 118); } - else row.put(TR("V E N D I T E"), 95); + else + row.put(TR("V E N D I T E"), 95); } } pr.print(row); diff --git a/cg/cg4400a.uml b/cg/cg4400a.uml index ca1071c38..ca1d847e4 100755 --- a/cg/cg4400a.uml +++ b/cg/cg4400a.uml @@ -194,13 +194,12 @@ END GROUPBOX DLG_NULL 52 6 BEGIN - PROMPT 2 13 "Parametri addizionali" + PROMPT 2 13 "@bParametri addizionali" END NUMBER ULTIMA_PAGINA 4 BEGIN - PROMPT 3 14 "Ultimo nr. di pagina stampata libro unico " - FLAGS "R" + PROMPT 3 14 "Ultimo nr. di pagina stampata libro unico" GROUP 5 END