Patch level : 10.0
Files correlati : calib Ricompilazione Demo : [ ] Commento : Aggiunti metodi per creare le maschere e gettare/settare i campi di analitica in base alla configurazione git-svn-id: svn://10.65.10.50/branches/R_10_00@21016 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
587378f621
commit
6094516e1f
280
ca/calib01.cpp
280
ca/calib01.cpp
@ -728,6 +728,7 @@ int ca_create_fields_compact(TMask& msk, int page, int logicnum, int x, int y,
|
||||
prompt = items == 1 ? mci.prompt(i) : "Fase";
|
||||
break;
|
||||
default:
|
||||
prompt = "Conto";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -793,6 +794,285 @@ 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,
|
||||
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)
|
||||
{
|
||||
int numero_campi = 0;
|
||||
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
||||
TConfig& ini = ca_config();
|
||||
short dlg = first_id;
|
||||
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
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 (fasinfo.parent() == LF_CDC)
|
||||
{
|
||||
int h = ca_multilevel_code_info(LF_CDC).levels();
|
||||
const int sh = ca_create_fields_compact(m, 0, LF_FASI, x, y, dlg, dlg + 50);
|
||||
y += 2;
|
||||
first_cdc = dlg;
|
||||
first_fase = first_cdc + h;
|
||||
dlg += sh;
|
||||
numero_campi += sh;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int sh = ca_create_fields_compact(m, 0, LF_CDC, x, y++, dlg, dlg + 50);
|
||||
first_cdc = dlg;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0 && !fase_fld.empty()) //Crea fase
|
||||
{
|
||||
const int sh = ca_create_fields_compact(m, 0, LF_FASI, x, y++, dlg, dlg + 50);
|
||||
first_fase = dlg;
|
||||
dlg += sh;
|
||||
numero_campi += sh;
|
||||
}
|
||||
|
||||
if(!conto_fld.empty()) //Crea conto
|
||||
{
|
||||
const bool use_pdcc = ini.get_bool("UsePdcc");
|
||||
const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA;
|
||||
const int nfields = ca_create_fields_compact(m, 0, logicnum, x, y++, dlg, dlg + 50);
|
||||
first_conto = nfields;
|
||||
dlg += nfields;
|
||||
numero_campi += nfields;
|
||||
}
|
||||
|
||||
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--)
|
||||
{
|
||||
const int pos = m.id2pos(id);
|
||||
if (pos >= 0)
|
||||
{
|
||||
TMask_field& f = m.fld(pos);
|
||||
const int size = f.size();
|
||||
const TString prompt = ((TEditable_field &)f).get_warning();
|
||||
s.set_column_header(id, prompt);
|
||||
s.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
|
||||
s.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
|
||||
s.enable_column(id);
|
||||
}
|
||||
else
|
||||
s.delete_column(id);
|
||||
}
|
||||
}
|
||||
return numero_campi;
|
||||
}
|
||||
|
||||
void ca_get_fields(TMask& m,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld, const TString80 cms_fld, const TString80 fase_fld, const TString80 conto_fld)
|
||||
{
|
||||
TString val;
|
||||
cdc.cut(0);
|
||||
cms.cut(0);
|
||||
fase.cut(0);
|
||||
conto.cut(0);
|
||||
|
||||
if (!cdc_fld.empty())
|
||||
for (short id = first_cdc; id < first_cdc + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cdc_fld)
|
||||
break;
|
||||
val = fld.get();
|
||||
val.rpad(fld.size());
|
||||
cdc << val;
|
||||
}
|
||||
cdc.trim();
|
||||
|
||||
if (!cms_fld.empty())
|
||||
for (short id = first_cms; id < first_cms + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cms_fld)
|
||||
break;
|
||||
val = fld.get();
|
||||
val.rpad(fld.size());
|
||||
cms << val;
|
||||
}
|
||||
cms.trim();
|
||||
|
||||
if (!fase_fld.empty())
|
||||
for (short id = first_fase; id < first_fase + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != fase_fld)
|
||||
break;
|
||||
val = fld.get();
|
||||
val.rpad(fld.size());
|
||||
fase << val;
|
||||
}
|
||||
fase.trim();
|
||||
|
||||
if (!conto_fld.empty())
|
||||
for (short id = first_conto; id <= first_conto + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != conto_fld)
|
||||
break;
|
||||
val = fld.get();
|
||||
val.rpad(fld.size());
|
||||
conto << val;
|
||||
}
|
||||
conto.trim();
|
||||
}
|
||||
|
||||
void ca_get_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld, const TString80 cms_fld, const TString80 fase_fld, const TString80 conto_fld)
|
||||
{
|
||||
TString val;
|
||||
cdc.cut(0);
|
||||
cms.cut(0);
|
||||
fase.cut(0);
|
||||
conto.cut(0);
|
||||
|
||||
TToken_string& row = sheet.row(selected_row);
|
||||
TMask& m = sheet.sheet_mask();
|
||||
|
||||
if (!cdc_fld.empty())
|
||||
for (short id = first_cdc; id < first_cdc + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cdc_fld)
|
||||
break;
|
||||
val = row.get(sheet.cid2index(id));
|
||||
val.rpad(fld.size());
|
||||
cdc << val;
|
||||
}
|
||||
cdc.trim();
|
||||
|
||||
if (!cms_fld.empty())
|
||||
for (short id = first_cms; id < first_cms + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cms_fld)
|
||||
break;
|
||||
val = row.get(sheet.cid2index(id));
|
||||
val.rpad(fld.size());
|
||||
cms << val;
|
||||
}
|
||||
cms.trim();
|
||||
|
||||
if (!fase_fld.empty())
|
||||
for (short id = first_fase; id < first_fase + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != fase_fld)
|
||||
break;
|
||||
val = row.get(sheet.cid2index(id));
|
||||
val.rpad(fld.size());
|
||||
fase << val;
|
||||
}
|
||||
fase.trim();
|
||||
|
||||
if (!conto_fld.empty())
|
||||
for (short id = first_conto; id <= first_conto + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != conto_fld)
|
||||
break;
|
||||
val = row.get(sheet.cid2index(id));
|
||||
val.rpad(fld.size());
|
||||
conto << val;
|
||||
}
|
||||
conto.trim();
|
||||
}
|
||||
|
||||
void ca_put_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld, const TString80 cms_fld, const TString80 fase_fld, const TString80 conto_fld)
|
||||
{
|
||||
TMask& m = sheet.sheet_mask();
|
||||
TToken_string& row = sheet.row(selected_row);
|
||||
|
||||
int pos = 0;
|
||||
if (!cdc_fld.empty())
|
||||
for (short id = first_cdc; id < first_cdc + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cdc_fld)
|
||||
break;
|
||||
const int len = fld.size();
|
||||
row.add(cdc.mid(pos, len), sheet.cid2index(id));
|
||||
pos += len;
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
if (!cms_fld.empty())
|
||||
for (short id = first_cms; id < first_cms + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != cms_fld)
|
||||
break;
|
||||
const int len = fld.size();
|
||||
row.add(cdc.mid(pos, len), sheet.cid2index(id));
|
||||
pos += len;
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
if (!fase_fld.empty())
|
||||
for (short id = first_fase; id < first_fase + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != fase_fld)
|
||||
break;
|
||||
const int len = fld.size();
|
||||
row.add(cdc.mid(pos, len), sheet.cid2index(id));
|
||||
pos += len;
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
if (!conto_fld.empty())
|
||||
for (short id = first_conto; id < first_conto + 4; id++)
|
||||
{
|
||||
TMask_field& fld = m.field(id);
|
||||
if(fld.prompt() != conto_fld)
|
||||
break;
|
||||
const int len = fld.size();
|
||||
row.add(cdc.mid(pos, len), sheet.cid2index(id));
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_tree_pos
|
||||
///////////////////////////////////////////////////////////
|
||||
|
23
ca/calib01.h
23
ca/calib01.h
@ -71,6 +71,29 @@ 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,
|
||||
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);
|
||||
|
||||
//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,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld = NULL, const TString80 cms_fld = NULL, const TString80 fase_fld = NULL, const TString80 conto_fld = NULL);
|
||||
|
||||
//CA_GET_ROW_FIELDS: getta tutti i campi dell'analitica che sono stati generati in base alla configurazione della contabilità analitica su una maschera di riga
|
||||
void ca_get_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld = NULL, const TString80 cms_fld = NULL, const TString80 fase_fld = NULL, const TString80 conto_fld = NULL);
|
||||
|
||||
//CA_PUT_ROW_FIELDS: setta tutti i campi dell'analitica che sono stati generati in base alla configurazione della contabilità analitica su una maschera di riga
|
||||
void ca_put_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
TString& cdc, TString& cms, TString& fase, TString& conto,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const TString80 cdc_fld, const TString80 cms_fld, const TString80 fase_fld, const TString80 conto_fld);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSimple_anal_msk
|
||||
///////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user