diff --git a/src/ce/ce4200.cpp b/src/ce/ce4200.cpp index 8df0366e5..56451fbab 100755 --- a/src/ce/ce4200.cpp +++ b/src/ce/ce4200.cpp @@ -17,24 +17,14 @@ //=============================================================================================== //maschera -class TCalc_cesp_cms_mask: public TAutomask +class TCalc_cesp_cms_mask: public TSimpleAutomask { public: - virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); - TCalc_cesp_cms_mask():TAutomask("ce4200a") {} + TCalc_cesp_cms_mask():TSimpleAutomask("ce4200a") {} }; -bool TCalc_cesp_cms_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) -{ -/* switch (o.dlg()) - { - default: break; - }*/ - return true; -} - //=============================================================================================== //form class TCalc_cesp_cms_form : public TForm diff --git a/src/ce/ce4400.cpp b/src/ce/ce4400.cpp index 5194a2466..58adb17d9 100755 --- a/src/ce/ce4400.cpp +++ b/src/ce/ce4400.cpp @@ -1303,7 +1303,7 @@ void TContabilizza_ce::elabora() // 0) Acquisizione parametri generali, eliminazione movimenti provvisori //-------------------------------------------------------------------------------- //gettiamo un po' di parametri dalla maschera - const long codes = _mask->get_long(F_ESERCIZIO); + const int codes = _mask->get_int(F_ESERCIZIO); const TDate ini_es = _mask->get_date(F_INIZIO_ES); const TDate fine_es = _mask->get_date(F_FINE_ES); //se il trasferimento e' definitivo la data di calcolo e' quella finale dell'esercizio selezionato, senno'... @@ -1332,6 +1332,10 @@ void TContabilizza_ce::elabora() delete_old_movs(ini_es); } + const int gruppo = _mask->get_int(F_GRUPPO); + const TString specie = _mask->get(F_SPECIE); + + ditta_cespiti().set_attivita(codes, gruppo, specie); //report con log errori TLog_report cont_cesp_log(TR("Contabilizzazione cespiti")); cont_cesp_log.kill_duplicates(); @@ -1383,7 +1387,7 @@ void TContabilizza_ce::elabora() TSaldo_per_codice* sc = (TSaldo_per_codice*)quote_per_codice.objptr(gsc); //se non trova il codice (categoria o cespite) lo aggiunge... - if (sc == NULL) + if (sc == nullptr) { sc = new TSaldo_per_codice(gruppo, specie, codcat, idcespite); quote_per_codice.add(gsc, sc); @@ -1455,7 +1459,7 @@ void TContabilizza_ce::elabora() key.add(curr_salcecms_line.get(SALCECMS_CODFASE)); TSaldo_per_codice* anal_sc = (TSaldo_per_codice*)anal_quote_per_codice.objptr(key); - if (anal_sc == NULL) + if (anal_sc == nullptr) { anal_sc = new TSaldo_per_codice(gruppo, specie, codcat, idcespite); diff --git a/src/include/automask.h b/src/include/automask.h index 9b3ea3f82..9d0f01966 100755 --- a/src/include/automask.h +++ b/src/include/automask.h @@ -84,6 +84,7 @@ public: TSimpleVariableAutomask(const char* name, int num = 0) : TVariable_automask(name, num) { } virtual ~TSimpleVariableAutomask() { } }; + class TIBAN_mask : public TAutomask { TString _last_iso; diff --git a/src/include/report.h b/src/include/report.h index e399d10ab..b4bda0e6e 100755 --- a/src/include/report.h +++ b/src/include/report.h @@ -678,12 +678,25 @@ public: virtual ~TReport(); }; -class TProgramReport : public TReport +/////////////////////////////////////////////////////////// +// Report senza maschera // +/////////////////////////////////////////////////////////// + +class TProgram_report : public TReport { - public: +protected: virtual bool use_mask() { return false; } - TProgramReport() {} - virtual ~TProgramReport() {} +public: + TProgram_report() {} + TProgram_report(const char * name) { load(name); } +}; + +class TConfigurable_report : public TProgram_report +{ + public: + + TConfigurable_report() {} + virtual ~TConfigurable_report() {} }; #endif diff --git a/src/include/reputils.h b/src/include/reputils.h index ccc56f067..1ef6fb766 100755 --- a/src/include/reputils.h +++ b/src/include/reputils.h @@ -56,17 +56,4 @@ public: TLog_report(const char* title = "", const char* name = "bagn010a"); }; -/////////////////////////////////////////////////////////// -// Report senza maschera // -/////////////////////////////////////////////////////////// - -class TProgram_report : public TReport -{ -protected: - virtual bool use_mask() { return false; } - -public: - TProgram_report() {} -}; - #endif diff --git a/src/li/li0100.cpp b/src/li/li0100.cpp index 978fd677a..0f715afde 100644 --- a/src/li/li0100.cpp +++ b/src/li/li0100.cpp @@ -156,10 +156,8 @@ bool TVisLI_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (e == fe_init) { o.set(today.year()); - load_config(); } break; - case F_TIPORIC: if( e == fe_modify) { @@ -182,7 +180,6 @@ bool TVisLI_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) // Creo una maschera che richiede la data TMask sto("li0700a"); - // Lancio la maschera sto.disable(F_ANNO_STO); sto.disable(F_FROM_CLI); @@ -224,31 +221,6 @@ bool TVisLI_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) return true; } -void TVisLI_mask::load_config() -{ - TToken_string tipidoc(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC")); - TSheet_field &docs = sfield(DOCUMENTI_STATO); - - docs.destroy(); - for (int i = 0; i < tipidoc.items(); i++) - { - TString td = tipidoc.get(i); - TToken_string stati(ini_get_string(CONFIG_DITTA, "li", td)); - - for (int j = 0; j < stati.items(); j++) - { - - TToken_string s(stati.get(j), ','); - const int r = docs.set_row_cell(F_TIPODOC_C, td); - - docs.set_row_cell(F_STATODOCDA_C, s.get(0), r); - docs.set_row_cell(F_STATODOCA_C, s.get(1), r); - } - } - docs.force_update(); -} - - class TVisLI_app : public TSkeleton_application { public: diff --git a/src/li/li0100a.h b/src/li/li0100a.h index 1681fe0cd..8044c4642 100644 --- a/src/li/li0100a.h +++ b/src/li/li0100a.h @@ -8,13 +8,8 @@ #define F_ACODCF 408 #define F_ARAGSOC 409 -#define DOCUMENTI_STATO 201 #define F_RIGHE 301 -#define F_TIPODOC_C 101 -#define F_STATODOCDA_C 102 -#define F_STATODOCA_C 103 - #define A_DATADOC 101 #define A_ANNO 102 #define A_NUMDOC 103 @@ -25,6 +20,7 @@ #define A_CODCF 108 #define A_RAGSOC 109 #define A_TOTDOC 110 + // Campi lettere intento #define START_PLA 111 diff --git a/src/li/li0100a.uml b/src/li/li0100a.uml index 1eb90d60a..4dca061f9 100644 --- a/src/li/li0100a.uml +++ b/src/li/li0100a.uml @@ -144,23 +144,6 @@ BEGIN FLAGS "D" END -SPREADSHEET DOCUMENTI_STATO 45 10 -BEGIN - PROMPT 18 10 "" - ITEM "Tipo Numerazione" - ITEM "Da stato" - ITEM "A stato" - FLAGS "D" -END - -STRING DLG_PROFILE 256 -BEGIN - PROMPT -1 -1 "Profilo " - PSELECT - FLAGS "H" -END - - ENDPAGE PAGE "Documenti/Lettere Intento" 0 2 0 0 @@ -204,31 +187,6 @@ ENDPAGE ENDMASK -PAGE "Riga tipo numerazione" -1 -1 78 8 - -STRING F_TIPODOC_C 4 -BEGIN - PROMPT 2 1 "Tipo Documento " - FIELD TIPODOC -END - -STRING F_STATODOCDA_C 4 -BEGIN - PROMPT 2 2 "Da Numerazione " - FIELD CODTAB - -END - -STRING F_STATODOCA_C 4 -BEGIN - PROMPT 2 3 "A Numerazione " - FIELD CODTAB -END - -ENDPAGE - -ENDMASK - PAGE "Riga" -1 -1 69 14 DATE A_DATADOC diff --git a/src/li/li0200.cpp b/src/li/li0200.cpp index ec711b525..a24c77078 100644 --- a/src/li/li0200.cpp +++ b/src/li/li0200.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include "..\ve\velib.h" @@ -13,177 +14,35 @@ #define CONFIG_DICINT "DICINT.ini" -class TResDI_mask : public TAutomask + +class TLista_dichiarazioni : public TSkeleton_application { -private: - TSheet_field& sheet; // Sheet - -public: - bool on_field_event(TOperable_field& o, TField_event e, long jolly) { return true; }; - TResDI_mask() : TAutomask("li0200a"), sheet(sfield(DOCUMENTI_STATO)) { load_config(); }; - void load_config(); - void elabTipiDoc(TToken_string& tipi, TToken_string& stati, TToken_string& tipif, TToken_string& statif); -}; - -void TResDI_mask::load_config() -{ - //Anno - set(F_A_DATA, TDate(TODAY)); - - set(F_TABIVA_CODTAB, ini_get_string(CONFIG_DITTA, "li", "CODIVA")); - TToken_string tipidoc(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC")); - - TString_array& strarr = sheet.rows_array(); - sheet.hide(); - sheet.destroy(); - - for(int i = 0; i < tipidoc.items(); i++) - { - TString td = tipidoc.get(i); - TToken_string stati(ini_get_string(CONFIG_DITTA, "li", td)); - for(int j = 0; j < stati.items(); j++) - { - TToken_string row, s(stati.get(j), ','); - row.add(td); - row.add(s.get(0)); - row.add(s.get(1)); - strarr.add(row); - } - } - sheet.force_update(); - sheet.show(); -} - -void TResDI_mask::elabTipiDoc(TToken_string& tipi, TToken_string& stati, TToken_string& tipif, TToken_string& statif) -{ - bool fattura; - TString tipo; - for(int i = 0; i < sheet.items(); i++) - { - TToken_string row = sheet.row(i); // Es. "F01|1|5" - int statoin = row.get_int(1), statoout = row.get_int(2); - tipo = row.get(0); - - if(cache().get("%TIP", tipo).get_int("I1") == 2) // Se il tipo è una fattura - fattura = true; - else - fattura = false; - - for(; statoin <= statoout; statoin++) - { - // Aggiornamento: Ci sono 4 token string ora, due per le fatture e due per il resto. - // Immetto nelle due TToken_string i valori per gestire la classe TLista_documenti - // Per ogni posizione metto il documento e stato interessato, es. F01: da 1 a 3 -> tipi {F01|F01|F01} stati {1|2|3} - if (fattura) - { - tipif.add(tipo); - statif.add(statoin); - } - else - { - tipi.add(tipo); - stati.add(statoin); - } - } - } -} - -class TResDI_app : public TSkeleton_application -{ - void elab(TResDI_mask& m); + void elab(TSimpleAutomask& m); public: virtual void main_loop(); }; -void TResDI_app::elab(TResDI_mask& m) +void TLista_dichiarazioni::elab(TSimpleAutomask& m) { - int clifoda = m.get_long(F_CODICE_CLIFO_DA); - int clifoa = m.get_long(F_CODICE_CLIFO_A); - TDate aData(m.get_date(F_A_DATA)); - - // Creo le TToken_string necessarie per filtrare i documenti - TToken_string tipi, stati, tipif, statif; - m.elabTipiDoc(tipi, stati, tipif, statif); + TProgram_report rep("li0200a"); + TReport_book book; - TRelation r_clifo(LF_CLIFO); - TRectype fil_from(r_clifo.curr()), fil_to(r_clifo.curr()); - fil_from.put("TIPOCF", "C"); - fil_to.put("TIPOCF", "C"); - - if(clifoda > 0) - fil_from.put("CODCF", clifoda); - - if(clifoa > 0) - fil_to.put("CODCF", clifoa); - - TCursor c_clifo(&r_clifo, "", 1, &fil_from, &fil_to); - - TLog_report log(TR("Resoconto plafond")); - for(c_clifo = 0; c_clifo.pos() < c_clifo.items(); ++c_clifo) - { - TRectype row_clifo(c_clifo.curr()); - - TLi_manager cli(row_clifo.get_long("CODCF"), aData.year()); // Inizializzo l'oggetto per la gestione del plafond - - if (cli.has_valid_plafond()) - { - TArray arr = cli.get_plafond_array(); - const int rows = arr.items(); - - for (int r = 0; r < rows; r++) - { - const TRectype & reclint = (const TRectype &) arr[r]; - const int numprot = reclint.get_int(LETINT_NUMPROT); - real plafond = reclint.get_real(LETINT_IMPORTO); - real utilizzato = reclint.get_real(LETINT_UTILIZZATO); - real residuo = plafond - utilizzato; - const int tipo = reclint.get_int(LETINT_TIPOOP); - const TDate dal = reclint.get_date(LETINT_DAL); - const TDate al = reclint.get_date(LETINT_AL); - TString msg; - - msg << TR("Dichiarazione di intento cliente ") << row_clifo.get_long(CLI_CODCF) << " - "<< row_clifo.get(CLI_RAGSOC) << '\n'; - log.log(0, msg); - msg.cut(0) << TR("Protocollo: ") << numprot << " - " << TR("Plafond disponibile: ") << residuo << "€" << '\n'; - log.log(0, msg); - msg.cut(0) << TR("Tipo dichiarazione: "); - switch (tipo) - { - case SOLUZIONE_UNICA: - msg << TR("Singola") << '\n'; - break; - case FINO_A_PLAFOND: - msg << TR("A concorrenza ") << TR("Dal ") << dal << '\n'; - break; - case A_TEMPO: - msg << TR("Dal ") << dal << TR("Al ") << al << '\n'; - break; - default: - break; - } - - log.log(0, msg); - log.log(0, ""); - } - } - } - log.print_or_preview(); + rep.mask2report(m); + book.add(rep); + rep.print_or_preview(); } - -void TResDI_app::main_loop() +void TLista_dichiarazioni::main_loop() { - TResDI_mask m; + TSimpleAutomask m("li0200a"); + while (m.run() == K_ENTER) - { elab(m); - } } - int li0200(int argc, char* argv[]) { - TResDI_app a; + TLista_dichiarazioni a; a.run(argc, argv, TR("Stato lettere di intento")); return 0; } \ No newline at end of file diff --git a/src/li/li0200a.h b/src/li/li0200a.h index c768ca01b..475b98bb2 100644 --- a/src/li/li0200a.h +++ b/src/li/li0200a.h @@ -1,10 +1,3 @@ -#define F_TIPODOC 101 -#define F_STATODOCDA 102 -#define F_STATODOCA 103 - -#define DOCUMENTI_STATO 201 - -#define F_TABIVA_CODTAB 301 -#define F_A_DATA 303 -#define F_CODICE_CLIFO_DA 304 -#define F_CODICE_CLIFO_A 305 \ No newline at end of file +#define F_ANNO 101 +#define F_CODCLI_DA 102 +#define F_CODCLI_A 103 \ No newline at end of file diff --git a/src/li/li0200a.rep b/src/li/li0200a.rep new file mode 100644 index 000000000..47040b64f --- /dev/null +++ b/src/li/li0200a.rep @@ -0,0 +1,132 @@ + + + registro dichiarazioni d'intento + + +