From f2b9e296c9fc340125e52bc9e669f564ace42275 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 29 Jun 2011 08:39:08 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : fe0.exe fetbcon.msk Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@22347 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- fe/fe0100.cpp | 153 ++++++++++++++------------------------------------ fe/fe0100a.h | 1 - fe/fetbcon.h | 10 +++- 3 files changed, 49 insertions(+), 115 deletions(-) diff --git a/fe/fe0100.cpp b/fe/fe0100.cpp index 9cf3fd750..223b665dc 100755 --- a/fe/fe0100.cpp +++ b/fe/fe0100.cpp @@ -26,75 +26,33 @@ // Data limite da cui si cominciano a dichiarare anche gli scontrini const TDate data_limite_scontrini(1,7,2011); -/////////////////////////////////////////////////////////// -// Utilities -/////////////////////////////////////////////////////////// - -// Classe per estrarre il codice attivitą di un movimento di prima nota -class TAttivita_cache : public TAssoc_array -{ -public: - const TString& mov2att(const TRectype& mov); - const TString& att2ateco(const TString& att) const; -} _att_cache; - -const TString& TAttivita_cache::mov2att(const TRectype& mov) -{ - const TString& reg = mov.get(MOV_REG); - if (reg.blank()) - return EMPTY_STRING; - - TString8 key; - key << mov.get(MOV_ANNOIVA) << reg; - - TString* codatt = (TString*)objptr(key); - if (codatt == NULL) - { - codatt = new TString8(cache().get("REG", key, "S8")); - add(key, codatt); - } - - return *codatt; -} - -const TString& TAttivita_cache::att2ateco(const TString& att) const -{ - TToken_string key; - key.add(prefix().get_codditta()); - key.add(att); - const TRectype& attiv = cache().get(LF_ATTIV, key); - if (!attiv.empty() && attiv.exist(ATT_CODATECO)) // Non e' detto che il campo esista sempre - return attiv.get(ATT_CODATECO); - return att; -} - /////////////////////////////////////////////////////////// // Utility /////////////////////////////////////////////////////////// -static bool comune_di(const TString& codcom, TString& den, TString& prov) +static const TString& comune_di(const TString& codcom) { if (codcom.blank() || codcom.len() != 4) - return false; + return EMPTY_STRING; TString8 key; key << " |" << codcom; - const TRectype& rec = cache().get(LF_COMUNI, key); - if (rec.empty()) - { - den = prov = ""; - } - else - { - den = rec.get(COM_DENCOM); den.cut(40); - den.upper(); - prov = rec.get(COM_PROVCOM); - prov.upper(); - if (codcom[0] == 'Z' && prov.blank()) - prov = "EE"; - } - return den.not_empty(); + TString& den = get_tmp_string(); + den = cache().get(LF_COMUNI, key, COM_DENCOM); + den.cut(40); + den.upper(); + + return den; } +static const TString& provincia_di(const TString& codcom) +{ + if (codcom.blank() || codcom.len() != 4) + return EMPTY_STRING; + TString8 key; key << '|' << codcom; + return cache().get(LF_COMUNI, key, COM_PROVCOM); +} + + /////////////////////////////////////////////////////////// // TAnagrafica /////////////////////////////////////////////////////////// @@ -104,8 +62,7 @@ class TAnagrafica : public TObject char _tipo; // F o G TString16 _cofi, _paiv; TString80 _key, _ragsoc; - TString80 _com_nasc, _com_res; - TString4 _prov_nasc, _prov_res; + TString4 _com_nasc, _com_res; TDate _data_nasc; TAnagrafica(const TAnagrafica&) { CHECK(false, "Can't copy TAnagrafica"); } @@ -125,10 +82,10 @@ public: char sesso() const { return (_cofi[9] >= '4') ? 'F' : 'M'; } const TDate& data_nascita() const { return _data_nasc; } - const TString& comune_nascita() const { return _com_nasc; } - const TString& provincia_nascita() const { return _prov_nasc; } - const TString& comune_residenza() const { return _com_res; } - const TString& provincia_residenza() const { return _prov_res; } + const TString& comune_nascita() const { return comune_di(_com_nasc); } + const TString& provincia_nascita() const { return provincia_di(_com_nasc); } + const TString& comune_residenza() const { return comune_di(_com_res); } + const TString& provincia_residenza() const { return provincia_di(_com_res); } bool init(const TRectype& rec); bool init(int num, const char* codice) { return init(cache().get(num, codice)); } @@ -166,8 +123,8 @@ bool TAnagrafica::init(const TRectype& rec) } _ragsoc = rec.get(OCC_RAGSOC); _ragsoc.upper(); _data_nasc = rec.get(OCC_DNASC); - comune_di(rec.get(OCC_COMNASC), _com_nasc, _prov_nasc); - comune_di(rec.get(OCC_COM), _com_res, _prov_res); + _com_nasc = rec.get(OCC_COMNASC); + _com_res = rec.get(OCC_COM); break; case LF_ANAG: _tipo = rec.get_char(ANA_TIPOA); @@ -176,15 +133,16 @@ bool TAnagrafica::init(const TRectype& rec) _paiv = rec.get(ANA_PAIV); // Comune di residenza fiscale o domicilio - if (!comune_di(rec.get(ANA_COMRF), _com_res, _prov_res)) - comune_di(rec.get(ANA_COMRES), _com_res, _prov_res); + _com_res = rec.get(ANA_COMRF); + if (_com_res.empty()) + _com_res = rec.get(ANA_COMRES); // Dati di nascita persone fisiche if (_tipo == 'F') { const TRectype& anafis = cache().get(LF_ANAGFIS, rec.get_long(ANA_CODANAGR)); _data_nasc = anafis.get(ANF_DATANASC); - comune_di(rec.get(ANF_COMNASC), _com_nasc, _prov_nasc); + _com_nasc = rec.get(ANF_COMNASC); } break; case LF_NDITTE: @@ -410,7 +368,6 @@ void TDati_rilevanti_trc::create_fields(int tipo, TAS400_recordset& recset) class TDati_rilevanti_set : public TAS400_recordset { int _anno; - TString8 _codatt; protected: virtual bool set_field(const TAS400_column_info& fi, const TVariant& var); @@ -423,7 +380,7 @@ public: void set(unsigned int n, const real& v) { TAS400_recordset::set(n-1, v.integer()); } void set(unsigned int n, const TDate& v) { TAS400_recordset::set(n-1, TVariant(v)); } void add_control_rec(int zero_o_nove); - TDati_rilevanti_set(int anno, const TString& codatt); + TDati_rilevanti_set(int anno); }; bool TDati_rilevanti_set::set_field(const TAS400_column_info& fi, const TVariant& var) @@ -469,9 +426,8 @@ void TDati_rilevanti_set::add_control_rec(int zon) set(17, _anno); } -TDati_rilevanti_set::TDati_rilevanti_set(int anno, const TString& codatt) - : TAS400_recordset("AS400(1800,1)"), - _anno(anno), _codatt(codatt) +TDati_rilevanti_set::TDati_rilevanti_set(int anno) + : TAS400_recordset("AS400(1800,1)"), _anno(anno) { TDati_rilevanti_trc trc; for (int i = 0; i <= 5; i++) @@ -499,7 +455,6 @@ protected: void set_dirty(bool d = true); protected: - const TString& mov2att(const TRectype& mov) const { return _att_cache.mov2att(mov); } TRecnotype last_user_progr() const; TRecnotype nuovo_progr() const; bool check_rows(bool show_error); @@ -550,11 +505,8 @@ bool TDati_rilevanti_msk::convalida_clifo(const TRectype& mov, TLog_report& log) const TRectype& rec_clifo = cache().get(LF_CLIFO, key); stato = rec_clifo.get(CLI_STATOCF); - const int alleg = rec_clifo.get_int(CLI_ALLEG); - if (alleg == 1) - return ignora_movimento(mov, TR("Soggetto escluso da comunicazione (Stato, Regioni, Province,...)"), log); - // tutti i fornitori esteri vanno esclusi (importazioni) + const int alleg = rec_clifo.get_int(CLI_ALLEG); if (tipocf == 'F' && alleg == 5) return ignora_movimento(mov, TR("Importazione da fornitore estero"), log); } @@ -618,7 +570,6 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa falleg.zero(); TRectype& alleg = falleg.curr(); alleg.put(ALL_ANNO, mov.get(MOV_ANNOIVA)); - alleg.put(ALL_CODATT, mov2att(mov)); alleg.put(ALL_PROGR, progr); TString80 contratto = mov.get(MOV_CONTRATTO); @@ -821,14 +772,12 @@ bool TDati_rilevanti_msk::elabora_movimento(const TRectype& mov, TFast_isamfile& bool TDati_rilevanti_msk::azzera_alleg(bool manual, TRecnotype first) const { const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); TFast_isamfile falleg(LF_ALLEG); // Azzeramento anno/attivitą selezionati TString limit; limit << ALL_ANNO << '=' << anno << ' ' - << ALL_CODATT << '=' << codatt << ' ' << ALL_PROGR << '='; TRecnotype daprog = manual ? MANUAL_ROW : first; @@ -847,7 +796,7 @@ bool TDati_rilevanti_msk::azzera_alleg(bool manual, TRecnotype first) const const TRecnotype items = alleg.items(); TString str_pi; - str_pi << TR("Compattazione dati rilevanti ") << anno << TR(" attivitą ") << codatt; + str_pi << TR("Compattazione dati rilevanti ") << anno; TProgind pi(items, str_pi); const TRectype& rec = alleg.cursor()->curr(); @@ -866,12 +815,10 @@ bool TDati_rilevanti_msk::azzera_alleg(bool manual, TRecnotype first) const TRecnotype TDati_rilevanti_msk::last_user_progr() const { const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); TString limit; limit << ALL_ANNO << '=' << anno << ' ' - << ALL_CODATT << '=' << codatt - << ' ' << ALL_PROGR << '='; + << ALL_PROGR << '='; TRecnotype progr = MANUAL_ROW; TString query; @@ -887,12 +834,10 @@ TRecnotype TDati_rilevanti_msk::last_user_progr() const TRecnotype TDati_rilevanti_msk::nuovo_progr() const { const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); TString limit; limit << ALL_ANNO << '=' << anno << ' ' - << ALL_CODATT << '=' << codatt - << ' ' << ALL_PROGR << '='; + << ALL_PROGR << '='; TRecnotype progr = last_user_progr(); @@ -919,10 +864,9 @@ TRecnotype TDati_rilevanti_msk::nuovo_progr() const TRecnotype TDati_rilevanti_msk::genera_alleg() { const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); TString str_pi; - str_pi << TR("Movimenti ") << anno << TR(" attivitą ") << codatt; + str_pi << TR("Movimenti ") << anno; TLog_report log(str_pi); TFast_isamfile falleg(LF_ALLEG); @@ -945,8 +889,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg() { if (!pi.addstatus(1)) break; - if (codatt == mov2att(mov_rec)) - elabora_movimento(mov_rec, falleg, nprog, log); + elabora_movimento(mov_rec, falleg, nprog, log); } log.preview(); @@ -973,7 +916,7 @@ bool TDati_rilevanti_msk::send_alleg() TFilename temp; temp.tempdir(); temp.add("datiril.txt"); - TDati_rilevanti_set recset(get_int(F_ANNO), get(F_CODATT)); + TDati_rilevanti_set recset(get_int(F_ANNO)); recset.add_control_rec(0); TISAM_recordset alleg(""); @@ -991,9 +934,7 @@ void TDati_rilevanti_msk::set_dirty(bool d) void TDati_rilevanti_msk::load_sheet() { const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); - TString limit; - limit << ALL_ANNO << '=' << anno << ' ' << ALL_CODATT << '=' << codatt; + TString16 limit; limit << ALL_ANNO << '=' << anno; const char tipocf = get(F_TIPOCF)[0]; const long codcf = get_long(F_CODCF); @@ -1015,7 +956,7 @@ void TDati_rilevanti_msk::load_sheet() const TRecnotype items = alleg.items(); if (items > 0) { - TString pi_str; pi_str << TR("Caricamento ") << anno << TR(" attivitą ") << codatt; + TString pi_str; pi_str << TR("Caricamento ") << anno; TProgind pi(items, pi_str); const TRectype& curr = alleg.cursor()->curr(); int rec = 0; @@ -1049,7 +990,6 @@ bool TDati_rilevanti_msk::save_sheet() bool done = true; const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); TSheet_field& s = sfield(F_RIGHE); const TRecnotype items = s.items(); @@ -1064,7 +1004,6 @@ bool TDati_rilevanti_msk::save_sheet() alleg.zero(); rec.put(ALL_ANNO, anno); - rec.put(ALL_CODATT, codatt); s.autosave_line(r+1, rec); const int err = alleg.rewrite_write(); if (err != NOERR) @@ -1088,9 +1027,7 @@ bool TDati_rilevanti_msk::check_rows(bool show_error) TSheet_field& s = sfield(F_RIGHE); const int anno = get_int(F_ANNO); - const TString& codatt = get(F_CODATT); - - bool ok = anno >= 2010 && codatt.full(); + bool ok = anno >= 2010; if (!ok) { if (show_error) @@ -1130,14 +1067,6 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon { switch (o.dlg()) { - case F_CODATT: - if (e == fe_init) - { - TBrowse& b = *((TEdit_field&)o).browse(); - *b.cursor() = 0L; - b.do_output(); - } - break; case DLG_OK: // Salva if (e == fe_button && jolly == 0) // Selezione su maschera principale { diff --git a/fe/fe0100a.h b/fe/fe0100a.h index d1fa3506e..4b6c11d29 100755 --- a/fe/fe0100a.h +++ b/fe/fe0100a.h @@ -2,7 +2,6 @@ #define F_RAGSOCD 202 #define F_ANNO 203 -#define F_CODATT 204 #define F_DESCATT 205 #define F_SENDALL 206 diff --git a/fe/fetbcon.h b/fe/fetbcon.h index 587b9d797..9c95aec10 100755 --- a/fe/fetbcon.h +++ b/fe/fetbcon.h @@ -1,2 +1,8 @@ -#define F_CODICE 101 -#define F_DESCRIZIONE 102 +#define F_TIPOCF 101 +#define F_CODCF 102 +#define F_RAGSOC 103 +#define F_CONTRATTO 104 +#define F_DESCRIZIONE 105 +#define F_INIZIO 106 +#define F_FINE 107 +#define F_IMPORTO 108