diff --git a/ca/ca0300.cpp b/ca/ca0300.cpp index 8694ce559..1d5f732c6 100755 --- a/ca/ca0300.cpp +++ b/ca/ca0300.cpp @@ -13,6 +13,8 @@ protected: bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: + void config_loader(TSheet_field& sf, const char* paragrafo); + void config_setter(TSheet_field& sf, const char* paragrafo); TConf_mask(const TFilename& f); virtual ~TConf_mask(){}; @@ -20,7 +22,7 @@ public: TConf_mask::TConf_mask(const TFilename& f) :TAutomask (f) { -} +} bool TConf_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { @@ -90,6 +92,9 @@ public: virtual bool user_create( ); virtual bool user_destroy( ); + void config_loader(TSheet_field& sf, TConfig& config); + void config_setter(TSheet_field& sf, TConfig& config); + TConf_Analitica() : TConfig_application( CONFIG_DITTA ), _cm(NULL) { } virtual ~TConf_Analitica( ){ } }; @@ -107,13 +112,56 @@ TMask* TConf_Analitica::create_mask(const TFilename& f) return _cm; } +void TConf_Analitica::config_loader(TSheet_field& sf, TConfig& config) +{ + for (int i = 0;;i++) + { + TToken_string num_doc(config.get("ND", NULL, i)); + if (num_doc.blank()) + break; + TToken_string& row = sf.row(i); + row.add(num_doc.get(0)); + row.add(""); + row.add(num_doc.get(1)); + row.add(num_doc.get(2)); + row.add(num_doc.get(3)); + sf.check_row(i); + } +} + +void TConf_Analitica::config_setter(TSheet_field& sf, TConfig& config) +{ + const int items = sf.items(); + for (int i = items;;i++) + { + TToken_string num_doc(config.get("ND", NULL, i)); + + if (num_doc.blank()) + break; + + config.remove("ND", i); + } + + FOR_EACH_SHEET_ROW (sf, j, row) + { + TToken_string num_doc; + num_doc.add(row->get(0)); + num_doc.add(row->get(2)); + num_doc.add(row->get(3)); + num_doc.add(row->get(4)); + config.set("ND", (const char*) num_doc, NULL, true, j); //setta i valori nel config + } +} + bool TConf_Analitica::preprocess_config (TMask& mask, TConfig& config) { + config_loader(mask.sfield(F_RIGHE_NUM), config); return true; } bool TConf_Analitica::postprocess_config (TMask& mask, TConfig& config) { + config_setter(mask.sfield(F_RIGHE_NUM), config); return true; } diff --git a/ca/ca0300a.h b/ca/ca0300a.h index fbe45afb1..39f8dea43 100755 --- a/ca/ca0300a.h +++ b/ca/ca0300a.h @@ -1,9 +1,9 @@ -//campi maschera ca0300a.uml (configurazione Cintabilita' Analitica -#define F_DATAATTCA 101 -#define F_LEVEL_1 102 -#define F_LEVEL_2 103 -#define F_ATTIVA_FASI 104 -#define F_FATHER_FASI 105 +//campi maschera ca0300a.uml (configurazione Contabilita' Analitica +#define F_DATAATTCA 151 +#define F_LEVEL_1 152 +#define F_LEVEL_2 153 +#define F_ATTIVA_FASI 154 +#define F_FATHER_FASI 155 #define F_CDC_1 106 #define F_CDC_2 107 @@ -47,3 +47,13 @@ #define F_CMSREQ 141 #define F_FSCREQ 142 #define F_PDCREQ 143 + +//sheet delle numerazioni documenti +#define F_RIGHE_NUM 170 + +//elementi dello sheet dei documenti +#define SN_CODNUM 101 +#define SN_DESCR 102 +#define SN_EXCLUDE 103 +#define SN_DASTATO 104 +#define SN_ASTATO 105 diff --git a/ca/ca0300a.uml b/ca/ca0300a.uml index 3645bc6db..83492e712 100755 --- a/ca/ca0300a.uml +++ b/ca/ca0300a.uml @@ -406,4 +406,86 @@ END ENDPAGE -ENDMASK \ No newline at end of file +PAGE "Regole num. doc." -1 -1 78 20 + +SPREADSHEET F_RIGHE_NUM -1 -2 +BEGIN + PROMPT 1 2 "" + ITEM "Numerazione" + ITEM "Descrizione@50" + ITEM "Da escludere" + ITEM "Da stato" + ITEM "A stato" +END + +ENDPAGE + +ENDMASK + +PAGE "Riga Numerazione" -1 -1 78 8 + +STRING SN_CODNUM 4 +BEGIN + PROMPT 1 1 "Codice numerazione " + USE %NUM + CHECKTYPE REQUIRED + INPUT CODTAB SN_CODNUM + DISPLAY "Codice" CODTAB + DISPLAY "Descrizione@50" S0 + OUTPUT SN_CODNUM CODTAB + OUTPUT SN_DESCR S0 + KEY 1 + FLAGS "UZ" +END + +STRING SN_DESCR 50 +BEGIN + PROMPT 1 3 "Descrizione " + USE %NUM KEY 2 + INPUT S0 SN_DESCR + DISPLAY "Descrizione@50" S0 + DISPLAY "Codice" CODTAB + COPY OUTPUT SN_CODNUM +END + +BOOLEAN SN_EXCLUDE +BEGIN + PROMPT 1 5 "Da escudere" + MESSAGE FALSE ENABLE,1@ + MESSAGE TRUE CLEAR,1@ +END + +NUMBER SN_DASTATO 1 +BEGIN + PROMPT 20 5 "Da stato " + CHECKTYPE REQUIRED + GROUP 1 +END + +NUMBER SN_ASTATO 1 +BEGIN + PROMPT 35 5 "A stato " + CHECKTYPE REQUIRED + NUM_EXPR #SN_ASTATO>=#SN_DASTATO + WARNING "Lo stato iniziale non puo' essere > dello stato finale" + GROUP 1 +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -13 -1 "" +END + +BUTTON DLG_DELREC 10 2 +BEGIN + PROMPT -23 -1 "" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -33 -1 "" +END + +ENDPAGE + +ENDMASK diff --git a/ca/ca3700.cpp b/ca/ca3700.cpp index 00d00406e..1813e4732 100755 --- a/ca/ca3700.cpp +++ b/ca/ca3700.cpp @@ -193,7 +193,7 @@ void TPrint_rendiconto_ca_mask::create_sheet() const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI); TConfig_anal ini; - const bool fsc_req = ini.get_bool("FscRequired"); +// const bool fsc_req = ini.get_bool("FscRequired"); int y = 1; short dlg = S_CDC1 + 100; // id del primo campo da generare @@ -204,7 +204,7 @@ void TPrint_rendiconto_ca_mask::create_sheet() if (level == "CDC") // Crea centro di costo { if (fasinfo.parent() == LF_CDC) - create_sheet_fields(LF_FASI, y, dlg, fsc_req); + create_sheet_fields(LF_FASI, y, dlg, false); //fsc_req); else { const bool cdc_req = ini.get_bool("CdcRequired"); @@ -214,7 +214,7 @@ void TPrint_rendiconto_ca_mask::create_sheet() if (level == "CMS") // Crea commessa { if (fasinfo.parent() == LF_COMMESSE) - create_sheet_fields(LF_FASI, y, dlg, fsc_req); + create_sheet_fields(LF_FASI, y, dlg, false); //fsc_req); else { const bool cms_req = ini.get_bool("CmsRequired"); @@ -224,7 +224,7 @@ void TPrint_rendiconto_ca_mask::create_sheet() } if (fasinfo.levels() > 0 && fasinfo.parent() <= 0) - create_sheet_fields(LF_FASI, y, dlg, fsc_req); + create_sheet_fields(LF_FASI, y, dlg, false); //fsc_req); for (short id = S_CDC12+100; id >= S_CDC1+100; id--) { @@ -894,19 +894,33 @@ void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(const TPrint_rendiconto_ //inizialmente il filtro di scansione delle righedoc coincide con quello sulle date TString filtro = filtro_date; + //****DA MODIFICARE DOPO IL CAMBIO DELLA CONFIGURAZIONE //deve filtrare i soli documenti con codnum NON presente nello sheet dei codnum - TSheet_field& sheet = msk.sfield(F_RIGHE_NUM); - - FOR_EACH_SHEET_ROW(sheet, r, row) + TConfig_anal config; + bool update = false; + for (int i = 0;;i++) { - const TString4 codnum(row->get(0)); //prende il codice numerazione sulla riga - //aggiunge al filtro il codice numerazione: - //NON vanno prese le righe dei doc con codnum indicato nello sheet!! - + TToken_string num_doc(config.get("ND", NULL, i)); + + const TString4 codnum = num_doc.get(0); + if (codnum.blank()) + break; + + const bool exclude = num_doc.get_char(1) == 'X'; if (filtro.not_empty()) filtro << "&&"; - filtro << "(CODNUM!=\"" << codnum << "\")"; - } //FOR_EACH_SHEET_ROW + if (exclude) + { + filtro << "(CODNUM!=\"" << codnum << "\")"; + } + else + { + filtro << "((CODNUM!=\"" << codnum << "\")"; + filtro << "||((" << LF_DOC << "->STATO>=\"" << num_doc.get(2) << "\")"; + filtro << "&&(" << LF_DOC << "->STATO<=\"" << num_doc.get(3) << "\")))"; + update=true; + } + } //poi deve aggiungere il filtro per cdc/cms/fas if (_codcosto.not_empty()) @@ -929,7 +943,10 @@ void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(const TPrint_rendiconto_ } //il filtro č completo;puņ eseguire la scansione - TCursor cur_rdoc(&rel_rdoc, filtro, 3, &dardoc, &ardoc); + TCursor cur_rdoc(&rel_rdoc, "", 3, &dardoc, &ardoc); + + cur_rdoc.setfilter(filtro, update); + const long rdoc_items = cur_rdoc.items(); cur_rdoc.freeze(); diff --git a/ca/ca3700.h b/ca/ca3700.h index 37e04e807..895e021c4 100755 --- a/ca/ca3700.h +++ b/ca/ca3700.h @@ -46,8 +46,6 @@ //sheet di pagina 2 #define F_RIGHE 260 -//sheet di pagina 3 -#define F_RIGHE_NUM 270 //elementi dello sheet con CdC/Cms/Fas (pag.2) #define S_CDC1 101 @@ -63,9 +61,5 @@ #define S_CDC11 111 #define S_CDC12 112 -//elementi dello sheet dei documenti (pag.3) -#define SN_CODNUM 101 -#define SN_DESCR 102 - #endif // __CA3700_H diff --git a/ca/ca3700.uml b/ca/ca3700.uml index 3a0fa0950..0657b9799 100755 --- a/ca/ca3700.uml +++ b/ca/ca3700.uml @@ -130,17 +130,6 @@ END ENDPAGE -PAGE "Num.doc. da escludere" -1 -1 78 20 - -SPREADSHEET F_RIGHE_NUM -1 -2 -BEGIN - PROMPT 1 2 "" - ITEM "Numerazione" - ITEM "Descrizione@50" -END - -ENDPAGE - ENDMASK PAGE "Riga Analitica" -1 -1 78 19 @@ -259,49 +248,3 @@ END ENDPAGE ENDMASK - - -PAGE "Riga Numerazione" -1 -1 78 5 - -STRING SN_CODNUM 4 -BEGIN - PROMPT 1 1 "Codice numerazione " - USE %NUM - CHECKTYPE REQUIRED - INPUT CODTAB SN_CODNUM - DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@50" S0 - OUTPUT SN_CODNUM CODTAB - OUTPUT SN_DESCR S0 - KEY 1 - FLAGS "UZ" -END - -STRING SN_DESCR 50 -BEGIN - PROMPT 1 2 "Descrizione " - USE %NUM KEY 2 - INPUT S0 SN_DESCR - DISPLAY "Descrizione@50" S0 - DISPLAY "Codice" CODTAB - COPY OUTPUT SN_CODNUM -END - -BUTTON DLG_OK 10 2 -BEGIN - PROMPT -13 -1 "" -END - -BUTTON DLG_DELREC 10 2 -BEGIN - PROMPT -23 -1 "" -END - -BUTTON DLG_CANCEL 10 2 -BEGIN - PROMPT -33 -1 "" -END - -ENDPAGE - -ENDMASK \ No newline at end of file diff --git a/ca/ca3700a.rep b/ca/ca3700a.rep index c02bb382a..001354df6 100755 --- a/ca/ca3700a.rep +++ b/ca/ca3700a.rep @@ -160,19 +160,20 @@ MESSAGE RESET,F2.103 #PREVENTIVO -
-
- +
+ CODNUM+ANNO+NUMRD + - - + - - + +
+
+
DATA @@ -206,6 +207,37 @@ MESSAGE RESET,F2.103 IMPEGNATO MESSAGE ADD,F2.103 + + + CODNUM + + + + ANNO + + + + NUMRD +
@@ -239,5 +271,9 @@ MESSAGE RESET,F2.103 #H2.103-#103
+
+ 0 +#B1.100 ! +
USE 1000 \ No newline at end of file