From df2381572bac0d45e5ca40288bd628dc36053656 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 24 Oct 2011 15:50:00 +0000 Subject: [PATCH] Patch level : Files correlati : fe0.exe fe0100a.uml Ricompilazione Demo : [ ] Commento : Correzioni varie git-svn-id: svn://10.65.10.50/branches/R_10_00@22466 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- fe/fe0100.cpp | 92 ++++++++++++++++++++++++++++++++++++-------------- fe/fe0100a.uml | 3 +- 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/fe/fe0100.cpp b/fe/fe0100.cpp index 6077cfa16..1d4d6af0b 100755 --- a/fe/fe0100.cpp +++ b/fe/fe0100.cpp @@ -267,6 +267,7 @@ class TAnagrafica : public TObject TString16 _cofi, _paiv; TString _ragsoc; TString4 _com_nasc, _com_res; + TString _loc_res; TDate _data_nasc; int _allegato, _stato_estero; @@ -292,6 +293,7 @@ public: 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); } + const TString& localita_residenza() const { return _loc_res; } bool init(const TRectype& rec); bool init(int num, const TString& codice) { return init(cache().get(num, codice)); } @@ -333,6 +335,7 @@ bool TAnagrafica::init(const TRectype& rec) _data_nasc = rec.get(OCC_DNASC); _com_nasc = rec.get(OCC_COMNASC); _com_res = rec.get(OCC_COM); + _loc_res = rec.get(OCC_LOCALITA); _stato_estero = rec.get_int(OCC_STATO); _allegato = _paiv.blank() ? 6 : 2; break; @@ -367,7 +370,13 @@ bool TAnagrafica::init(const TRectype& rec) case LF_CLIFO: _tipo = rec.get_char(CLI_TIPOAPER); if (_tipo == 'F') + { init(LF_ANAG, _tipo, rec.get_long(CLI_CODANAGPER)); + if (rec.get(CLI_COMNASC).not_empty()) + _com_nasc = rec.get(CLI_COMNASC); + if (rec.get(CLI_DATANASC).not_empty()) + _data_nasc = rec.get(CLI_DATANASC); + } else _tipo = 'G'; // Assegno codice fiscale e partita IVA se validi, altrimenti mantengo quelli dell'anagrafica @@ -379,6 +388,7 @@ bool TAnagrafica::init(const TRectype& rec) _ragsoc = rec.get(CLI_RAGSOC); _ragsoc.upper(); _stato_estero = rec.get_int(CLI_STATOCF); _allegato = rec.get_int(CLI_ALLEG); + _loc_res = rec.get(CLI_LOCCF); break; case LF_MOV: return init(rec.get_char(MOV_TIPO), rec.get_long(MOV_CODCF), rec.get(MOV_OCFPI)); @@ -870,13 +880,14 @@ protected: TRecnotype last_user_progr() const; TRecnotype nuovo_progr() const; bool check_rows(bool show_error); + void enable_buttons(); bool send_rec(const TRectype& alleg, TDati_rilevanti_set& operaz); TExclusion_mode segnala_movimento(const TRectype& mov, TExclusion_mode motivo); bool fattura_associata(long numreg_var, TDate& datafatt, TString& numdoc) const; bool controlla_mov(TRectype& mrec) const; - bool azzera_alleg(int anno, TAssoc_array& manuali) const; + bool azzera_alleg(TAssoc_array& manuali) const; void collega_variazioni() const; public: @@ -1155,8 +1166,6 @@ bool TDati_rilevanti_msk::controlla_mov(TRectype& mrec) const if (contratto.full()) { const TContratto c(mrec); - if (c.codice() == "3") - int pippo = 1; new_modpag = c.modalita_pagamento(); } if (get(MOV_NUMRETT).full() || get(MOV_DATARETT).full()) @@ -1183,8 +1192,11 @@ bool TDati_rilevanti_msk::controlla_mov(TRectype& mrec) const return update; } -bool TDati_rilevanti_msk::azzera_alleg(int anno, TAssoc_array& manuali) const +bool TDati_rilevanti_msk::azzera_alleg(TAssoc_array& manuali) const { + const int anno = get_int(F_ANNO); + const TDate data = get(F_DATA); + TFast_isamfile fast_alleg(LF_ALLEG); TFast_isamfile fast_mov(LF_MOV); @@ -1211,17 +1223,21 @@ bool TDati_rilevanti_msk::azzera_alleg(int anno, TAssoc_array& manuali) const const long progr = arec.get_long(ALL_PROGR); const long numreg = mrec.get_long(MOV_NUMREG); + const TDate datareg = mrec.get_long(MOV_DATAREG); const int annoiva = mrec.get_long(MOV_ANNOIVA); - const bool kill = numreg != progr || annoiva < anno; // Riga generata dalla vecchia versione + bool kill = numreg != progr || annoiva < 2010; if (!kill) { const bool forzata = alleg.get(ALL_FORZATURA).as_bool(); if (forzata) manuali.add(arec.get(ALL_PROGR)); + else + kill = annoiva == data.year() && datareg > data; + } - else - falleg.remove(); + if (kill) + falleg.remove(); // Riga generata dalla vecchia versione } return !manuali.empty(); } @@ -1298,7 +1314,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg() _log = new TLog_report(str_pi); TAssoc_array manuali; - azzera_alleg(anno, manuali); + azzera_alleg(manuali); TRecnotype nprog = 1; @@ -1308,7 +1324,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg() TFast_isamfile fmov(LF_MOV); TString query; - query << "USE MOV KEY 3 SELECT BETWEEN(DATAREG," << anno << "0101," << get_date(F_DATA).date2ansi() << ")" + query << "USE MOV KEY 3 SELECT BETWEEN(DATAREG," << anno << "0101," << data_estrazione.date2ansi() << ")" << "\nFROM TIPO=C\nTO TIPO=F"; TISAM_recordset mov(query); TRectype& mov_rec = mov.cursor()->curr(); @@ -1496,7 +1512,10 @@ bool TDati_rilevanti_msk::send_fatt(const TRectype& alleg, TDati_rilevanti_set& else { operaz.set(8, anag.ragione_sociale()); - operaz.set(9, anag.comune_residenza()); + if (anag.comune_residenza().empty()) + operaz.set(9, anag.localita_residenza()); + else + operaz.set(9, anag.comune_residenza()); operaz.set(10, anag.stato_estero()); operaz.set(11, EMPTY_STRING); // TBI? Indirizzo estero } @@ -1828,6 +1847,7 @@ void TDati_rilevanti_msk::load_sheet() _mode = MODE_QUERY; enable(-1); } + enable_buttons(); } bool TDati_rilevanti_msk::save_sheet() @@ -1915,6 +1935,32 @@ bool TDati_rilevanti_msk::save_if_dirty() return done; } +void TDati_rilevanti_msk::enable_buttons() +{ + const int anno = get_int(F_ANNO); + const bool good_year = anno >= 2010; + const bool def = get_bool(F_DEFINITIVO); + const bool full_rows = !sfield(F_RIGHE).empty(); + + bool one_sent = false; // Ho spedito almeno un movimento in definitivo + if (good_year) + { + TString query; + query << "USE MOV KEY 2 SELECT ANNOFE=" << anno; + query << "\nFROM DATAREG=01-01-" << anno; + TISAM_recordset recset(query); + one_sent = recset.move_first(); + } + + enable(DLG_CANCEL, full_rows); + enable(DLG_EXPORT, full_rows); + enable(DLG_RECALC, !full_rows && good_year && !one_sent); + enable(DLG_ELABORA, good_year && !(one_sent && def)); + enable(DLG_DELREC, one_sent); + enable(F_DEFINITIVO, !def); + if (def) reset(F_DEFINITIVO); +} + bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) { switch (o.dlg()) @@ -1937,6 +1983,7 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon s.force_update(); _mode = MODE_QUERY; enable(-1); + enable_buttons(); } return false; } @@ -1945,6 +1992,10 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon if (e == fe_button) save_if_dirty(); break; + case DLG_EXPORT: + if (e == fe_button) + return sfield(F_RIGHE).esporta(); + break; case DLG_RECALC: if (e == fe_button && check_fields()) { @@ -1954,12 +2005,16 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon break; case DLG_ELABORA: if (e == fe_button && check_fields()) + { send_alleg(); + enable_buttons(); // Disabilita bottone se definitivo + } break; case DLG_DELREC: if (e == fe_button) { recall_alleg(); + enable_buttons(); // Disabilita bottone return false; } break; @@ -1978,18 +2033,7 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon d = TDate(30,4,anno+1); set(F_DATA, d); } - - bool one_sent = false; - if (anno >= 2010) - { - // Abilita azzeramento FE se necessario - TString query; - query << "USE MOV KEY 2 SELECT ANNOFE=" << anno; - query << "\nFROM DATAREG=01-01-" << anno; - TISAM_recordset movfe(query); - one_sent = movfe.move_first(); - } - enable(DLG_DELREC, one_sent); + enable_buttons(); } break; case F_OUTFOLDER: @@ -2029,10 +2073,6 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon if (e == se_query_del) return false; break; - case DLG_EXPORT: - if (e == fe_button) - return sfield(F_RIGHE).esporta(); - break; case A_CODCF: case A_OCFPI: if (e == fe_modify || (e == fe_init && !o.empty())) diff --git a/fe/fe0100a.uml b/fe/fe0100a.uml index 61661bef3..6623eabf3 100755 --- a/fe/fe0100a.uml +++ b/fe/fe0100a.uml @@ -28,7 +28,6 @@ BUTTON DLG_RECALC 2 2 BEGIN PROMPT 1 3 "Ricalcola" PICTURE TOOL_RECALC - GROUP 1 END BUTTON DLG_EXPORT 2 2 @@ -177,7 +176,7 @@ PAGE "Opzioni" 0 2 0 0 GROUPBOX DLG_NULL 78 6 BEGIN - PROMPT 1 1 "@bP[zioni per invio" + PROMPT 1 1 "@bOpzioni per invio" END LIST F_SENDALL 1 25