From c30ae25f494d9d3942ccafa39c8a40cf62c1e038 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Jul 2013 15:34:22 +0000 Subject: [PATCH] Migliorata creazione dinamica campi analitici git-svn-id: svn://10.65.10.50/branches/R_10_00@22879 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/calib01.cpp | 61 ++++++++++++++++++++++++-------------------------- ca/calib01.h | 6 ++--- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/ca/calib01.cpp b/ca/calib01.cpp index 4bbe36655..6b8baf5bc 100755 --- a/ca/calib01.cpp +++ b/ca/calib01.cpp @@ -77,10 +77,10 @@ const TString& TConfig_anal::get(const char* varname, const char* section, int i return EMPTY_STRING; } -TConfig& ca_config(bool force) +TConfig& ca_config(bool force_reload) { static TConfig_anal* cfg = NULL; - if (cfg == NULL || force) + if (cfg == NULL || force_reload) { if (cfg != NULL) delete cfg; @@ -967,9 +967,9 @@ int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y, return mci.levels(); } -int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsigned int mode, +int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, short& first_cdc, short& first_cms, short& first_fase, short& first_conto, - const TString80 cdc_fld, const TString80 cms_fld, const TString80 fase_fld, const TString80 conto_fld) + const char* cdc_fld, const char* cms_fld, const char* fase_fld, const char* conto_fld) { int numero_campi = 0; const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI); @@ -981,7 +981,7 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsig { const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2 - if (level == "CDC" && !cdc_fld.empty()) // Crea centro di costo + if (level == "CDC" && cdc_fld) // Crea centro di costo { if (fasinfo.parent() == LF_CDC) { @@ -1000,33 +1000,30 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsig dlg += sh; numero_campi += sh; } - } - else if(!cms_fld.empty()) - { - if (level == "CMS") // Crea commessa - { - if (fasinfo.parent() == LF_COMMESSE) - { - int h = ca_multilevel_code_info(LF_COMMESSE).levels(); - const int sh = ca_create_fields_compact(m, 0, LF_FASI, x, y, dlg, dlg + 50); - y += 2; - first_cms = dlg; - first_fase = first_cms + h; - dlg += sh; - numero_campi += sh; - } - else - { - const int sh = ca_create_fields_compact(m, 0, LF_COMMESSE, x, y++, dlg, dlg + 50); - first_cms = dlg; - dlg += sh; - numero_campi += sh; - } - } - } + } else + if (level == "CMS" && cms_fld) // Crea commessa + { + if (fasinfo.parent() == LF_COMMESSE) + { + int h = ca_multilevel_code_info(LF_COMMESSE).levels(); + const int sh = ca_create_fields_compact(m, 0, LF_FASI, x, y, dlg, dlg + 50); + y += 2; + first_cms = dlg; + first_fase = first_cms + h; + dlg += sh; + numero_campi += sh; + } + else + { + const int sh = ca_create_fields_compact(m, 0, LF_COMMESSE, x, y++, dlg, dlg + 50); + first_cms = dlg; + dlg += sh; + numero_campi += sh; + } + } } - if (fasinfo.levels() > 0 && fasinfo.parent() <= 0 && !fase_fld.empty()) //Crea fase + if (fasinfo.levels() > 0 && fasinfo.parent() <= 0 && fase_fld) //Crea fase { const int sh = ca_create_fields_compact(m, 0, LF_FASI, x, y++, dlg, dlg + 50); first_fase = dlg; @@ -1034,7 +1031,7 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsig numero_campi += sh; } - if(!conto_fld.empty()) //Crea conto + if (conto_fld) //Crea conto { const bool use_pdcc = ini.get_bool("UsePdcc"); const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA; @@ -1044,7 +1041,7 @@ int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsig numero_campi += nfields; } - if(m.get_sheet() != NULL) //Se è una maschera di riga, sistemo le colonne delle sheet + if (m.get_sheet() != NULL) //Se è una maschera di riga, sistemo le colonne delle sheet { TSheet_field& s = *m.get_sheet(); for (short id = first_id + 116; id >= first_id + 100; id--) diff --git a/ca/calib01.h b/ca/calib01.h index 0f7a33ccb..679b52ea3 100755 --- a/ca/calib01.h +++ b/ca/calib01.h @@ -81,10 +81,10 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y, short key int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y, short key_id, short des_id, unsigned int mode = 0x0, const char* fieldname = NULL, int from = 0); -//CA_CREATE_FIELDS_EXT: crea tutti i campi dell'analitica desiderati in base alla configurazione della contabilità analitica -int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, unsigned int mode, +//CA_CREATE_FIELDS_EXT: crea tutti i campi dell'analitica desiderati in base alla configurazione del modulo +int ca_create_fields_ext(TMask& m, int page, int x, int y, short first_id, short& first_cdc, short& first_cms, short& first_fase, short& first_conto, - const TString80 cdc_fld = NULL, const TString80 cms_fld = NULL, const TString80 fase_fld = NULL, const TString80 conto_fld = NULL); + const char* cdc_fld = NULL, const char* cms_fld = NULL, const char* fase_fld = NULL, const char* conto_fld = NULL); //CA_GET_FIELDS: getta tutti i campi dell'analitica che sono stati generati in base alla configurazione della contabilità analitica void ca_get_fields(TMask& m,