Corrette ricerche e caricamneto funzioni9 utente
git-svn-id: svn://10.65.10.50/trunk@3477 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c4c17f1e9a
commit
96485b6fc6
@ -69,19 +69,16 @@ void TTable_expression::load_table(bool force)
|
|||||||
n = expr.get("CODTAB");
|
n = expr.get("CODTAB");
|
||||||
e = expr.get("S1");
|
e = expr.get("S1");
|
||||||
e << expr.get("S2");
|
e << expr.get("S2");
|
||||||
const TTypeexp t = expr.get_bool("B0") ? _numexpr : _strexpr;
|
const TTypeexp t = expr.get_bool("B0") ? _strexpr : _numexpr;
|
||||||
|
|
||||||
TTable_expression* te = new TTable_expression;
|
TTable_expression* te = new TTable_expression;
|
||||||
if (te->set(e, t))
|
THash_object* o = new THash_object(n, te);
|
||||||
{
|
const int index = _expr.add(o);
|
||||||
THash_object* o = new THash_object(n, te);
|
if (!te->set(e, t))
|
||||||
_expr.add(o);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
te->error_box("La funzione %s contiene un simbolo errato: %s",
|
te->error_box("La funzione %s contiene un simbolo errato: %s",
|
||||||
(const char*)n, te->last_token());
|
(const char*)n, te->last_token());
|
||||||
delete te;
|
te->set("", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,17 +168,18 @@ int TTable_expression::name2index(const char* name) const
|
|||||||
if (_expr.items() == 0)
|
if (_expr.items() == 0)
|
||||||
load_table();
|
load_table();
|
||||||
|
|
||||||
|
TString code(name); code.upper();
|
||||||
for (int index = _expr.items()-1; index >= 0; index--)
|
for (int index = _expr.items()-1; index >= 0; index--)
|
||||||
{
|
{
|
||||||
const THash_object& h = (const THash_object&)_expr[index];
|
const THash_object& h = (const THash_object&)_expr[index];
|
||||||
if (h.key() == name)
|
if (h.key() == code)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
TTable expr("%FRM");
|
TTable expr("%FRM");
|
||||||
expr.put("CODTAB", name);
|
expr.put("CODTAB", code);
|
||||||
if (expr.read() == NOERR)
|
if (expr.read() == NOERR)
|
||||||
{
|
{
|
||||||
TString e(127);
|
TString e(127);
|
||||||
@ -190,7 +188,7 @@ int TTable_expression::name2index(const char* name) const
|
|||||||
TTable_expression* te = new TTable_expression;
|
TTable_expression* te = new TTable_expression;
|
||||||
if (te->set(e, t))
|
if (te->set(e, t))
|
||||||
{
|
{
|
||||||
THash_object* o = new THash_object(name, te);
|
THash_object* o = new THash_object(code, te);
|
||||||
index = _expr.add(o);
|
index = _expr.add(o);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -587,15 +585,15 @@ TCursor& TRicalcolo_mask::create_cursor()
|
|||||||
bool TRicalcolo_mask::file_handler(TMask_field& f, KEY k)
|
bool TRicalcolo_mask::file_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE && m.is_running())
|
||||||
{
|
{
|
||||||
const int n = atoi(f.get());
|
const int n = atoi(f.get());
|
||||||
if (n != m._cur_file || !m.is_running())
|
if (n != m._cur_file)
|
||||||
{
|
{
|
||||||
m._cur_file = n;
|
m._cur_file = n;
|
||||||
const RecDes* rd = m.get_rec_des();
|
const RecDes* rd = m.get_rec_des();
|
||||||
const int keys = rd->NKeys;
|
const int keys = rd->NKeys;
|
||||||
|
|
||||||
TToken_string codes(16);
|
TToken_string codes(16);
|
||||||
TToken_string values(80);
|
TToken_string values(80);
|
||||||
TString16 tmp;
|
TString16 tmp;
|
||||||
@ -607,10 +605,9 @@ bool TRicalcolo_mask::file_handler(TMask_field& f, KEY k)
|
|||||||
tmp.format("Chiave %d", k);
|
tmp.format("Chiave %d", k);
|
||||||
values.add(tmp);
|
values.add(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
TList_field& lk = (TList_field&)m.field(F_KEY);
|
TList_field& lk = (TList_field&)m.field(F_KEY);
|
||||||
lk.replace_items(codes, values);
|
lk.replace_items(codes, values);
|
||||||
if (atoi(lk.get()) != 0)
|
|
||||||
lk.reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -621,41 +618,44 @@ bool TRicalcolo_mask::key_handler(TMask_field& f, KEY k)
|
|||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
{
|
{
|
||||||
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
TRicalcolo_mask& m = (TRicalcolo_mask&)f.mask();
|
||||||
const int cur_key = atoi(f.get());
|
|
||||||
TToken_string& key_expr = m.get_key_expr(cur_key);
|
|
||||||
const bool empty = key_expr.empty_items();
|
|
||||||
int first_enabled = 0;
|
|
||||||
|
|
||||||
TSheet_field& sheet = (TSheet_field&)m.field(F_FIELDS);
|
TSheet_field& sheet = (TSheet_field&)m.field(F_FIELDS);
|
||||||
TString_array& sa = sheet.rows_array();
|
if (m.is_running() || sheet.items() == 0)
|
||||||
sa.destroy();
|
|
||||||
if (empty)
|
|
||||||
{
|
{
|
||||||
for (int i = 4; i >= 0; i--)
|
const int cur_key = atoi(f.get());
|
||||||
sa.add("");
|
TToken_string& key_expr = m.get_key_expr(cur_key);
|
||||||
|
const bool empty = key_expr.empty_items();
|
||||||
|
int first_enabled = 0;
|
||||||
|
|
||||||
|
TString_array& sa = sheet.rows_array();
|
||||||
|
sa.destroy();
|
||||||
|
if (empty)
|
||||||
|
{
|
||||||
|
for (int i = 4; i >= 0; i--)
|
||||||
|
sa.add("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRelation_description& des = m.get_des();
|
||||||
|
for (TString field = key_expr.get(0); !field.blank(); field = key_expr.get())
|
||||||
|
{
|
||||||
|
const int r = sa.add(field);
|
||||||
|
sa.row(r).add(des.get_field_description(field), F_DESCR-F_FIELD);
|
||||||
|
}
|
||||||
|
if (des.file_num() == LF_CONDV || des.file_num() == LF_RCONDV)
|
||||||
|
{
|
||||||
|
first_enabled = 4;
|
||||||
|
TToken_string& row = sa.row(0);
|
||||||
|
const TString& lco = m.get(F_TIPO_LCO);
|
||||||
|
row.add(lco, 1);
|
||||||
|
row.add(lco, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int r = sa.items()-1; r >= 0; r--)
|
||||||
|
sheet.enable_cell(0, -1, r >= first_enabled);
|
||||||
|
|
||||||
|
sheet.force_update();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
TRelation_description& des = m.get_des();
|
|
||||||
for (TString field = key_expr.get(0); field.not_empty(); field = key_expr.get())
|
|
||||||
{
|
|
||||||
const int r = sa.add(field);
|
|
||||||
sa.row(r).add(des.get_field_description(field), F_DESCR-F_FIELD);
|
|
||||||
}
|
|
||||||
if (des.file_num() == LF_CONDV || des.file_num() == LF_RCONDV)
|
|
||||||
{
|
|
||||||
first_enabled = 4;
|
|
||||||
TToken_string& row = sa.row(0);
|
|
||||||
const TString& lco = m.get(F_TIPO_LCO);
|
|
||||||
row.add(lco, 1);
|
|
||||||
row.add(lco, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int r = sa.items()-1; r >= 0; r--)
|
|
||||||
sheet.enable_cell(0, -1, r >= first_enabled);
|
|
||||||
|
|
||||||
sheet.force_update();
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user