Patch level :10.0 770

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Rivista tutta la gestione degli analtree; adesso vanno persino le fasi!!!

Stampa piano dei conti analitico decentizzato


git-svn-id: svn://10.65.10.50/trunk@20574 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-06-17 14:06:32 +00:00
parent 82df15a4bc
commit e3f416d6a9
2 changed files with 140 additions and 56 deletions

View File

@ -1,38 +1,38 @@
<report libraries="ca1100, ca1400a" name="ca1400a" lpi="6">
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ca1100, ca1400a" name="ca1400a" orientation="1" lpi="6">
<description>Stampa piano dei conti di analitica</description>
<font face="Courier New" size="10" />
<section type="Head" height="8">
<field type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">"!RAGSOC"
#REPORT.FIRM</prescript>
<font face="Arial" size="8" />
<section type="Head" pattern="1">
<field x="2" type="Testo" width="10" pattern="1" text="Codice">
<font face="Arial" bold="1" size="8" />
</field>
<field x="59" type="Data" width="10" pattern="1">
<field x="23" type="Testo" width="12" pattern="1" text="Descrizione">
<font face="Arial" bold="1" size="8" />
</field>
<field x="73.5" type="Testo" align="center" width="4" pattern="1" text="Sez.">
<font face="Arial" bold="1" size="8" />
</field>
<field x="80" type="Testo" width="5" pattern="1" text="Sosp.">
<font face="Arial" bold="1" size="8" />
</field>
<field border="1" x="1" y="1" type="Linea" width="117" height="0" pattern="1" />
</section>
<section type="Head" level="1" pattern="1">
<field border="1" radius="50" x="20" y="0.5" type="Testo" valign="center" align="center" shade_offset="50" width="80" height="2" pattern="2" text="Piano dei Conti Analitica">
<font face="Arial" bold="1" size="16" />
</field>
<field x="89" y="3.25" type="Testo" width="10" pattern="1" text="Data stampa:" />
<field x="100" y="3.25" type="Data" width="10" pattern="1">
<font face="Arial" bold="1" size="8" />
<source>#SYSTEM.DATE</source>
</field>
<field x="70" type="Stringa" width="10" pattern="1" text="Pag. #.###">
<source>#REPORT.PAGE</source>
<field x="1" y="3.5" type="Stringa" width="50" pattern="1">
<font face="Arial" bold="1" size="8" />
<source>#SYSTEM.RAGSOC</source>
</field>
<field y="2" type="Testo" align="center" width="80" height="2" pattern="1" text="Stampa Piano dei Conti Analitica">
<font face="Courier New" bold="1" size="16" />
</field>
<field y="5" type="Testo" width="10" pattern="1" text="Codice">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="25" y="5" type="Testo" width="20" pattern="1" text="Descrizione">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="71" y="5" type="Testo" width="4" pattern="1" text="Sez.">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="75" y="5" type="Testo" width="5" pattern="1" text="Sosp.">
<font face="Courier New" bold="1" size="10" />
</field>
<field border="1" y="6.25" type="Linea" width="80" height="0" pattern="1" />
</section>
<section type="Head" level="1" />
<section type="Body" />
<section type="Body" level="1">
<section type="Body" pattern="1" />
<section type="Body" level="1" pattern="1">
<postscript description="B1 POSTSCRIPT">"B11"
#SHOW_SUBSECTION @
IF
@ -40,43 +40,52 @@ IF
ELSE
HIDE
THEN</postscript>
<field type="Stringa" width="25" pattern="1">
<field x="2" type="Stringa" width="20" pattern="1">
<source>CODCONTO</source>
<prescript description="B1.0 PRESCRIPT">MESSAGE_FORMAT_CONTO</prescript>
</field>
<field x="25" type="Stringa" dynamic_height="1" width="47" height="2" pattern="1">
<field x="23" type="Stringa" width="50" pattern="1">
<source>DESCR</source>
</field>
<field x="73" type="Stringa" width="2" pattern="1">
<field x="75" type="Stringa" width="2" pattern="1">
<source>SEZSALDI</source>
</field>
<field x="77" type="Stringa" width="2" pattern="1">
<field x="80.5" type="Stringa" width="2" pattern="1">
<source>SOSPESO</source>
</field>
</section>
<section type="Head" level="11" />
<section type="Body" level="11">
<section type="Head" level="11" pattern="1" />
<section type="Body" level="11" hidden="1" pattern="1">
<sql>USE PANAPDC
JOIN PCON INTO GRUPPO==GRUPPO CONTO==CONTO SOTTOCONTO==SOTTOCONTO
FROM CODCONTO=#PARENT.CODCONTO
TO CODCONTO=#PARENT.CODCONTO</sql>
<font italic="1" face="Courier New" size="10" />
<field x="10" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Arial" size="8" />
<source>GRUPPO</source>
</field>
<field x="14" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Arial" size="8" />
<source>CONTO</source>
</field>
<field x="18" type="Numero" align="right" width="6" pattern="1">
<font italic="1" face="Arial" size="8" />
<source>SOTTOCONTO</source>
</field>
<field x="27" type="Stringa" width="50" pattern="1">
<font italic="1" face="Arial" size="8" />
<source>PCON.DESCR</source>
</field>
</section>
<section type="Foot" level="11" height="0.5" />
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="11" height="0.5" pattern="1" />
<section type="Foot" pattern="1">
<field border="1" x="1" y="0.25" type="Linea" width="117" height="0" pattern="1" />
<field x="100" y="0.5" type="Stringa" width="10" pattern="1" text="Pag. #.###">
<source>#REPORT.PAGE</source>
</field>
</section>
<section type="Foot" level="1" pattern="1" />
<sql>USE PCONANA
FROM CODCONTO=#DACONTO
TO CODCONTO=#ACONTO</sql>

View File

@ -694,9 +694,9 @@ void TAnal_tree_pos::set(const char * key, TRecnotype pos, bool is_father)
void TAnal_tree_pos::reset()
{
_key.cut(0);
_pos = 0;
_is_father = false;
_key.cut(0);
}
TAnal_tree_pos::TAnal_tree_pos(const char* id)
@ -720,6 +720,8 @@ class TAnal_tree : public TBidirectional_tree
protected:
virtual void node2id(const TObject* node, TString& id) const;
virtual bool has_son() const;
virtual bool has_father() const;
virtual bool goto_firstson();
virtual bool goto_rbrother();
virtual bool goto_node(const TString &id);
@ -792,7 +794,7 @@ bool TSimple_anal_msk::on_field_event(TOperable_field& o, TField_event e, long j
const short id = get_field_id(i);
if (id <= 0)
break;
const char* tok = curr.get(i+1);
const char* tok = curr.get(i+2);
TEdit_field& e = efield(id);
e.set(tok);
e.show();
@ -836,8 +838,16 @@ int TSimple_anal_msk::compute_offset() const
if (delta > 0)
{
TLocalisamfile lif(get_logicnum());
if (lif.items() > 2048) // Niente alberi enormi ... per ora
int ln = get_logicnum();
if (ln == LF_FASI)
{
const TString& ff = ca_config().get("FathFasi");
if (ff.full())
ln = (ff == "CMS") ? LF_COMMESSE : LF_CDC;
}
TLocalisamfile lif(ln);
const TRecnotype recs = lif.items();
if (recs > 2048) // Niente alberi enormi ... per ora
delta = 0;
}
@ -1113,15 +1123,63 @@ bool TAnal_tree::goto_root()
return ok;
}
bool TAnal_tree::has_father() const
{
//se sono sul file delle fasi e queste sono legate, allora ho sicuramente un padre
if (_father_curs && !_is_father)
return true;
return TBidirectional_tree::has_father();
}
bool TAnal_tree::has_son() const
{
if (_is_father && _father_curs)
{
const TMultilevel_code_info& fci = ca_multilevel_code_info(_father_curs->file().num());
const int son_lev = _curr.level() + 1;
if (son_lev > fci.levels())
{
TLocalisamfile& fasi = _curs->file();
fasi.zero();
fasi.put(FASI_CODCMSFAS, _curr._key);
return fasi.read(_isgteq) == NOERR && fasi.get(FASI_CODCMSFAS) == _curr._key;
}
}
return TBidirectional_tree::has_son();
}
bool TAnal_tree::goto_firstson()
{
bool ok = _curr.level() < max_level() && repos();
if (ok)
{
ok = _curs->pos() < _curs->items();
if (_is_father && _father_curs)
{
const TMultilevel_code_info& fci = ca_multilevel_code_info(_father_curs->file().num());
const int son_lev = _curr.level() + 1;
if (son_lev > fci.levels())
{
TRectype& rec = _curs->curr();
rec.zero();
rec.put(FASI_CODCMSFAS, _curr._key);
ok = _curs->read() >= 0 && rec.get(FASI_CODCMSFAS) == _curr._key;
if (ok)
{
_is_father = false; // Forzo cursore fasi prima della update_curr
update_curr();
}
else
repos();
return ok;
}
}
TCursor& c = _is_father ? *_father_curs : *_curs;
ok = c.pos() < c.items();
if (ok)
{
++(*_curs);
++c;
ok = father_of_file() == _curr._key;
if (ok)
update_curr();
@ -1161,10 +1219,10 @@ bool TAnal_tree::goto_node(const TString &id)
const TRecnotype rec = ap.pos();
_is_father = ap.is_father();
if (rec >= 0L && rec < _curs->items())
TCursor& c = _is_father ? *_father_curs : *_curs;
if (rec >= 0L && rec < c.items())
{
*_curs = rec;
c = rec;
update_curr();
return true;
}
@ -1178,19 +1236,34 @@ bool TAnal_tree::goto_father()
bool ok = lev > 1;
if (ok)
{
TRectype& rec = _curs->curr();
const int logicnum = _curs->relation()->lfile().num();
if (logicnum == LF_FASI && !_is_father)
{
const TMultilevel_code_info& mci = ca_multilevel_code_info(logicnum);
if (mci.parent() != 0)
{
const TMultilevel_code_info& fci = ca_multilevel_code_info(mci.parent());
_is_father = fci.levels() <= lev-1;
}
}
TCursor& c = *(_is_father ? _father_curs : _curs);
TRectype& rec = c.curr();
rec.zero();
const TMultilevel_code_info& mci = ca_multilevel_code_info(_curs->relation()->lfile().num());
const TMultilevel_code_info& mci = ca_multilevel_code_info(rec.num());
for (int i = 0; i < lev-1; i++)
{
const char* val = _curr._key.get(i);
const TFieldref& fld = mci.fieldref(i);
fld.write(val, rec);
}
ok = _curs->read() == NOERR;
ok = c.read() == NOERR;
if (ok)
{
update_curr();
CHECKD(_curr.level() < lev, "Invalid analitic node level: father=son=", lev);
}
}
return ok;
}
@ -1201,8 +1274,9 @@ bool TAnal_tree::goto_lbrother()
if (repos())
{
const TString curr_father = father_of(_curr._key);
--(*_curs);
while (ok = _curs->pos() > 0L)
TCursor& c = _is_father ? *_father_curs : *_curs;
--c;
while (ok = c.pos() > 0L)
{
const int lev = level_of_file();
if (lev <= _curr.level())
@ -1211,7 +1285,7 @@ bool TAnal_tree::goto_lbrother()
ok = next_father == curr_father;
break;
}
--(*_curs);
--c;
}
if (ok)
update_curr();
@ -1232,10 +1306,11 @@ bool TAnal_tree::get_description(TString& desc) const
const int lev = _curr.level();
if (lev > 0)
{
const TMultilevel_code_info& mci = ca_multilevel_code_info(_curs->relation()->lfile().num());
TCursor& c = _is_father ? *_father_curs : *_curs;
const TRectype& rec = c.curr();
const TMultilevel_code_info& mci = ca_multilevel_code_info(rec.num());
const TFieldref& fld1 = mci.fieldref(lev-1, 1);
const TFieldref& fld2 = mci.fieldref(0, 2);
const TRectype& rec = _curs->curr();
desc = fld1.read(rec);
desc << ' ' << fld2.read(rec);
}