Patch level : 10.0 484

Files correlati     : ve2.exe
Ricompilazione Demo : [ ]
Commento

Separatore pre le  descrizioni nella generazione avanzata codici articolo


git-svn-id: svn://10.65.10.50/trunk@19505 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2009-10-23 14:17:03 +00:00
parent bf2ff9bc7c
commit 60824e543f

View File

@ -37,6 +37,7 @@ static const TRectype& get_sublevel_info(const TString& code)
class TCodart_mask : public TAutomask
{
static TCodice_articolo _restart;
TString80 _children;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -47,6 +48,8 @@ protected:
public:
bool restart() const { return _restart.full(); }
static void restart_with(const TString& cod) { _restart = cod; }
const TString & get_descr_separator(const int level);
TCodart_mask();
};
@ -103,6 +106,30 @@ void TCodart_mask::start_run()
TAutomask::start_run();
}
const TString & TCodart_mask::get_descr_separator(const int level)
{
TString & sep = get_tmp_string(8);
if (level > 0)
{
const TString4 subcode = _children.mid(level*3, 3);
if (subcode.full())
{
const TRectype& fsa = get_sublevel_info(subcode);
if (!fsa.empty())
{
sep = fsa.get("S11");
if (sep.full())
sep.replace('_', ' ');
}
}
}
return (const TString & )sep;
}
void TCodart_mask::create_level(int level, const TString& subcode)
{
const TRectype& fsa = get_sublevel_info(subcode);
@ -150,12 +177,12 @@ bool TCodart_mask::build_children()
code << get(101);
// Non usare qui un TString& children, altrimenti cambia sul piu' bello!
const TString80 children = cache().get("GSA", code, "S1");
_children = cache().get("GSA", code, "S1");
// Affetto la stringona S1 in sottocodici da 3 caratteri l'uno
for (int i = 0; i < 9; i++)
{
const TString4 subcode = children.mid(i*3, 3);
const TString4 subcode = _children.mid(i*3, 3);
if (subcode.full())
create_level(i+2, subcode);
else
@ -191,8 +218,8 @@ bool advanced_codart_ask(TString& code, TString& desc)
for (short id = 101; m.id2pos(id) >= 0; id++)
{
code << m.get(id);
if (id == 102)
desc << ' ';
if (id > 101)
desc << m.get_descr_separator(id - 102);
desc << m.get(id+100);
}
running = false;
@ -220,7 +247,11 @@ bool advanced_codart_handler(TMask_field& fld, KEY key)
if (advanced_codart_ask(code, desc))
{
TMask& msk = fld.mask();
TString desc1 = desc.mid(50);
desc = desc.left(50);
msk.set(F_DESCR, desc);
msk.set(F_DESCRAGG, desc1);
msk.set(F_CODART, code, true);
msk.field(F_CODART).set_focus();
}