diff --git a/lv/lv4500.cpp b/lv/lv4500.cpp index 7ca3f1284..314a96a8f 100755 --- a/lv/lv4500.cpp +++ b/lv/lv4500.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -65,10 +66,12 @@ TLaundry_recordset::TLaundry_recordset(const int rec_lenght) //classe TConti_cache class TConti_cache : public TCache { + TLog_report * _log; protected: virtual TObject* key2obj(const char* key); public: const TBill& decodifica_conti(const long mastro, const long conto); + TConti_cache(TLog_report * log) : _log(log) {} }; //KEY2OBJ: ridefinisco il metodo virtuale key2obj in modo che mi restituisca quello di cui ho bisogno @@ -80,6 +83,11 @@ TObject* TConti_cache::key2obj(const char* key) riclpdc.put("CODICE", key); if(riclpdc.read(_isgteq) == NOERR && riclpdc.get("CODICE") == key) return new TBill(riclpdc.get_int("GRUPPO"), riclpdc.get_int("CONTO"), riclpdc.get_long("SOTTOCONTO")); + TString mastro(key); + TString conto(mastro.mid(6)); + + mastro = mastro.left(6); + _log->log(2, format(FR("Mastro %6s Conto %6s assente"), (const char *) mastro, (const char *) conto)); return new TBill; } @@ -102,6 +110,7 @@ class TDecodifica_codici : public TObject { TAssoc_array _tab; TConti_cache _conti; + TLog_report * _log; protected: void riempi_array(); @@ -115,7 +124,7 @@ public: const TString& decodifica_valute(const int val_cog); const TBill& decodifica_conto(const long mastro, const long conto); - TDecodifica_codici(); + TDecodifica_codici(TLog_report * log); }; //RIEMPI_ARRAY: riempe l'Assoc_array che contiene i dati per fare la decodifica @@ -165,6 +174,7 @@ const TString& TDecodifica_codici::decodifica(const char* tabella, const int cod if(data != NULL) return *data; } + _log->log(2, format(FR("Tabella %s codice %ld assente"), tabella, codice)); return EMPTY_STRING; } @@ -205,7 +215,7 @@ const TBill& TDecodifica_codici::decodifica_conto(const long mastro, const long } //costruttore -TDecodifica_codici::TDecodifica_codici() +TDecodifica_codici::TDecodifica_codici(TLog_report * log) : _log(log), _conti(log) {} //////////////////////////////// @@ -329,6 +339,7 @@ class TImporta_fat_app : public TSkeleton_application TDecodifica_codici* _codici; TArray _conti; TArray _importi; + TLog_report * _log; protected: bool search_gr_sp_ca(const int gruppo, const char* specie, const int categoria); @@ -580,19 +591,26 @@ void TImporta_fat_app::transfer(const TFilename& file) if(configfile != NULL) delete configfile; + TReport_book book; + + book.add(*_log); + book.print_or_preview(); + _log->reset(); elabora_file(tmpdir); } bool TImporta_fat_app::create() { _msk = new TImporta_fat_msk(); - _codici = new TDecodifica_codici(); + _log = new TLog_report("Importazione fatture vecchio COGECO"); + _codici = new TDecodifica_codici(_log); return TSkeleton_application::create(); } bool TImporta_fat_app::destroy() { delete _msk; + delete _log; return TApplication::destroy(); }