Patch level :10.0

Files correlati     :ca3
Ricompilazione Demo : [ ]
Commento            :
sistemato il filtro su cdc e basta


git-svn-id: svn://10.65.10.50/trunk@20057 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-02-05 09:11:14 +00:00
parent f25f7511ec
commit 325ed9f23b
2 changed files with 82 additions and 52 deletions

View File

@ -1267,9 +1267,8 @@ int TPrint_rendiconto_ca_recordset::crea_filtro_rmovana(const TMask& msk, TRecty
da_rmovana.put(RMOVANA_CODCCOSTO, _codcosto); da_rmovana.put(RMOVANA_CODCCOSTO, _codcosto);
a_rmovana = da_rmovana; a_rmovana = da_rmovana;
const TString& first_lev = ca_config().get("Level", "ca", 1); //se c'è solo cdc deve cambiare la chiave..
//se il primo livello è cdc deve cambiare la chiave.. if (_codcms.blank() && _codcosto.full())
if (first_lev == "CDC")
cur_key = 5; cur_key = 5;
//adesso tocca al filtro //adesso tocca al filtro
@ -1394,10 +1393,8 @@ int TPrint_rendiconto_ca_recordset::crea_filtro_rdoc(const TMask& msk, TRectype&
da_rdoc.put(RDOC_CODCOSTO, _codcosto); da_rdoc.put(RDOC_CODCOSTO, _codcosto);
a_rdoc = da_rdoc; a_rdoc = da_rdoc;
//gestione chiave di scansione //se c'è solo cdc..
const TString& first_lev = ca_config().get("Level", "ca", 1); if (_codcms.blank() && _codcosto.full())
//se il primo livello è cdc..
if (first_lev == "CDC")
cur_key = 7; cur_key = 7;
//filtro date //filtro date

View File

@ -647,44 +647,63 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y,
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TAnal_tree // TAnal_tree_pos
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
struct TAnal_tree_pos : public TObject struct TAnal_tree_pos : public TObject
{ {
TRecnotype _pos; TRecnotype _pos;
TToken_string _key; TToken_string _key;
bool _is_father;
void as_string(TString& id) const; void as_string(TString& id) const;
TRecnotype pos() const { return _pos; } TRecnotype pos() const { return _pos; }
bool is_father() const { return _is_father; }
int level() const { return _key.items(); } int level() const { return _key.items(); }
void reset(); void reset();
void set(const char * key, TRecnotype pos); void set(const char * key, TRecnotype pos, bool is_father);
TAnal_tree_pos() : _pos(0), _is_father(false) {}
TAnal_tree_pos(const TAnal_tree_pos& p) : _pos(p._pos), _is_father(p._is_father), _key(p._key) {}
TAnal_tree_pos(const char* id);
}; };
void TAnal_tree_pos::as_string(TString& id) const void TAnal_tree_pos::as_string(TString& id) const
{ {
id.format("%ld|%s", _pos, (const char*)_key); id.format("%ld|%c|%s", _pos, _is_father ? 'F' : 'S', (const char*)_key);
} }
void TAnal_tree_pos::set(const char * key, TRecnotype pos) void TAnal_tree_pos::set(const char * key, TRecnotype pos, bool is_father)
{ {
_key = key; _key = key;
_pos = _key.full() ? pos : 0; _pos = _key.full() ? pos : 0;
_is_father = is_father;
} }
void TAnal_tree_pos::reset() void TAnal_tree_pos::reset()
{ {
_pos = 0; _pos = 0;
_is_father = false;
_key.cut(0); _key.cut(0);
} }
TAnal_tree_pos::TAnal_tree_pos(const char* id)
{
TToken_string ts(id);
_pos = ts.get_long(0);
_is_father = ts.get_char(1) == 'F';
int pipe = ts.find(ts.separator());
pipe = ts.find(ts.separator(), pipe+1);
_key = ts.mid(pipe+1);
}
class TAnal_tree : public TBidirectional_tree class TAnal_tree : public TBidirectional_tree
{ {
TCursor * _curs; TCursor* _curs;
TCursor* _father_curs;
int _fathfasi; int _fathfasi;
bool _is_father;
TAnal_tree_pos _curr; TAnal_tree_pos _curr;
protected: protected:
@ -952,23 +971,11 @@ int TSimple_anal_msk::create_key_fields()
const TToken_string& TAnal_tree::curr_of_file() const const TToken_string& TAnal_tree::curr_of_file() const
{ {
const TMultilevel_code_info& mci = ca_multilevel_code_info(_curs->relation()->lfile().num()); const TRectype& rec = _is_father ? _father_curs->curr() : _curs->curr();
const TRectype& rec = _curs->curr();
const TMultilevel_code_info& mci = ca_multilevel_code_info(rec.num());
TToken_string& k = get_tmp_string(); TToken_string& k = get_tmp_string();
/* if (_fathfasi > 0)
{
const TMultilevel_code_info& ffci = ca_multilevel_code_info(_fathfasi);
for (int i = 0; i < ffci.levels(); i++)
{
const TFieldref& ff_fld = ffci.fieldref(i);
TString16 fname = FASI_CODCMSFAS;
fname << '[' << (ff_fld.from()+1) << ',' << (ff_fld.to()) << ']';
const TFieldref fld(fname, 0);
k.add(fld.read(rec));
}
}*/
for (int i = 0; i < mci.levels(); i++) for (int i = 0; i < mci.levels(); i++)
{ {
const TFieldref& fld = mci.fieldref(i); const TFieldref& fld = mci.fieldref(i);
@ -1004,14 +1011,9 @@ int TAnal_tree::curr_level() const
int TAnal_tree::max_level() const int TAnal_tree::max_level() const
{ {
const TMultilevel_code_info& mci = ca_multilevel_code_info(_curs->relation()->lfile().num()); const int logic = _curs->relation()->lfile().num();
int ml = mci.levels(); const TMultilevel_code_info& mci = ca_multilevel_code_info(logic);
if (_fathfasi > 0) return mci.levels();
{
const TMultilevel_code_info& ffci = ca_multilevel_code_info(_fathfasi);
ml += ffci.levels();
}
return ml;
} }
const TToken_string& TAnal_tree::father_of(const TToken_string& key) const const TToken_string& TAnal_tree::father_of(const TToken_string& key) const
@ -1033,7 +1035,7 @@ const TToken_string& TAnal_tree::father_of_file() const
void TAnal_tree::update_curr() void TAnal_tree::update_curr()
{ {
_curr.set(curr_of_file(), _curs->pos()); _curr.set(curr_of_file(), _is_father ? _father_curs->pos() : _curs->pos(), _is_father);
} }
bool TAnal_tree::repos() const bool TAnal_tree::repos() const
@ -1041,8 +1043,16 @@ bool TAnal_tree::repos() const
bool ok = false; bool ok = false;
if (_curr.level() > 0) if (_curr.level() > 0)
{ {
if (_curs->pos() != _curr.pos()) if (_is_father)
((TCursor&) *_curs) = _curr.pos(); {
if (_father_curs->pos() != _curr.pos())
((TCursor&)*_father_curs) = _curr.pos();
}
else
{
if (_curs->pos() != _curr.pos())
((TCursor&) *_curs) = _curr.pos();
}
ok = true; ok = true;
} }
return ok; return ok;
@ -1057,14 +1067,30 @@ void TAnal_tree::node2id(const TObject* node, TString& id) const
bool TAnal_tree::goto_root() bool TAnal_tree::goto_root()
{ {
bool ok = false; bool ok = false;
if (_curs->items() > 0) //gestione speciale per le fasi con babbo
{ if (_father_curs != NULL)
*_curs = 0L; {
update_curr(); if (_father_curs->items() > 0)
ok = true; {
} *_father_curs = 0L;
else _is_father = true;
_curr.reset(); update_curr();
ok = true;
}
else
_curr.reset();
}
else //caso standard (cms, cdc, fasi senza babbo)
{
if (_curs->items() > 0)
{
*_curs = 0L;
update_curr();
ok = true;
}
else
_curr.reset();
}
return ok; return ok;
} }
@ -1090,9 +1116,10 @@ bool TAnal_tree::goto_rbrother()
bool ok = false; bool ok = false;
if (repos()) if (repos())
{ {
TCursor& c = _is_father ? *_father_curs : *_curs;
const TToken_string curr_father = father_of(_curr._key); const TToken_string curr_father = father_of(_curr._key);
++(*_curs); ++c;
while (ok = _curs->pos() < _curs->items()) while (ok = c.pos() < c.items())
{ {
const int lev = level_of_file(); const int lev = level_of_file();
if (lev <= _curr.level()) if (lev <= _curr.level())
@ -1101,7 +1128,7 @@ bool TAnal_tree::goto_rbrother()
ok = next_father == curr_father; ok = next_father == curr_father;
break; break;
} }
++(*_curs); ++c;
} }
if (ok) if (ok)
update_curr(); update_curr();
@ -1111,7 +1138,10 @@ bool TAnal_tree::goto_rbrother()
bool TAnal_tree::goto_node(const TString &id) bool TAnal_tree::goto_node(const TString &id)
{ {
const TRecnotype rec = atol(id); const TAnal_tree_pos ap(id);
const TRecnotype rec = ap.pos();
_is_father = ap.is_father();
if (rec >= 0L && rec < _curs->items()) if (rec >= 0L && rec < _curs->items())
{ {
@ -1194,7 +1224,7 @@ bool TAnal_tree::get_description(TString& desc) const
return ok; return ok;
} }
TAnal_tree::TAnal_tree(int logicnum) TAnal_tree::TAnal_tree(int logicnum) : _curs(NULL), _father_curs(NULL), _is_father(false)
{ {
TString select; TString select;
_curs = new TCursor(new TRelation(logicnum), ca_create_user_select_clause(logicnum)); _curs = new TCursor(new TRelation(logicnum), ca_create_user_select_clause(logicnum));
@ -1203,7 +1233,10 @@ TAnal_tree::TAnal_tree(int logicnum)
{ {
const TString& ff = ca_config().get("FathFasi"); const TString& ff = ca_config().get("FathFasi");
if (ff.full()) if (ff.full())
{
_fathfasi = (ff == "CMS") ? LF_COMMESSE : LF_CDC; _fathfasi = (ff == "CMS") ? LF_COMMESSE : LF_CDC;
_father_curs = new TCursor(new TRelation(_fathfasi), ca_create_user_select_clause(_fathfasi));
}
} }
} }