Patch level : 2.2

Files correlati     : ca3300a.rep
Ricompilazione Demo : [ ]
Commento            :

Aggiunto report bilancio di verifica di raffronto


git-svn-id: svn://10.65.10.50/trunk@13309 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-08-08 11:55:59 +00:00
parent 44a06dbdd1
commit 762fdfddba
5 changed files with 620 additions and 81 deletions

View File

@ -1,7 +1,9 @@
#include <applicat.h>
#include <execp.h>
#include <progind.h>
#include <reprint.h>
#include <pconti.h>
#include "movana.h"
#include "pconana.h"
#include "rmovana.h"
@ -409,22 +411,32 @@ TReport_bilancio_verifica::TReport_bilancio_verifica(const char* name)
// TRecordset_sezioni_contapposte
////////////////////////////////////////////////////////
struct TSaldo_contrapposto : public TObject
{
TString _conto;
TImporto _saldo;
};
class TRecordset_sezioni_contrapposte : public TRecordset
{
char _tipo_piano;
TAnal_bill _filter;
TDate _da_data, _a_data;
int _tipimov;
word _tipimov;
bool _movimentati, _nonnulli;
TString_array _attivita, _passivita, _costi, _ricavi;
TArray _attivita, _passivita, _costi, _ricavi; // Elenco di saldi contrapposti
TRecnotype _pos;
TRecordset_column_info _info[4];
protected:
TRecnotype items_ap() const;
TRecnotype items_cr() const;
virtual const TVariant& get_fld(const TArray& a, int r, const char* field) const;
TArray& conti(int indbil);
void add_conto(const TString& b, const TImporto& i, TArray& a, int n = -1);
void add_conto(int indbil, const TString& b);
void calcola_totali();
public:
virtual TRecnotype items() const;
@ -434,11 +446,12 @@ public:
virtual unsigned int columns() const;
virtual const TRecordset_column_info& column_info(unsigned int column) const;
virtual const TVariant& get(unsigned int column) const;
virtual const TVariant& get(unsigned int column) const { return NULL_VARIANT; }
virtual const TVariant& get(const char* field) const;
void set_filter(char piano, const char* costo, const char* commessa, const char* fase,
const TDate& dal, const TDate& al, word tipimov, bool movimentati, bool nonnulli);
char tipo_piano() const { return _tipo_piano; }
TRecordset_sezioni_contrapposte(char tipo_piano) : _tipo_piano(tipo_piano) { }
};
@ -470,8 +483,8 @@ void TRecordset_sezioni_contrapposte::set_filter(char piano, const char* costo,
_a_data = al;
_tipimov = tipimov;
_movimentati = movimentati;
_nonnulli = nonnulli;
_movimentati = false; // movimentati;
_nonnulli = false; // nonnulli;
_filter.reset();
_filter.set_costo(costo);
@ -479,48 +492,250 @@ void TRecordset_sezioni_contrapposte::set_filter(char piano, const char* costo,
_filter.set_fase(fase);
}
TArray& TRecordset_sezioni_contrapposte::conti(int indbil)
{
TArray* ptar = NULL;
switch (indbil)
{
case 1: ptar = &_attivita; break;
case 2: ptar = &_passivita; break;
case 3: ptar = &_costi; break;
case 4: ptar = &_ricavi; break;
default: CHECKD(0, "Indicatore di bilancio errato:", indbil); break;
}
return *ptar;
}
void TRecordset_sezioni_contrapposte::add_conto(const TString& b, const TImporto& i,
TArray& a, int n)
{
TSaldo_contrapposto* sc = new TSaldo_contrapposto;
sc->_conto = b;
sc->_saldo = i;
if (n < 0)
a.add(sc);
else
a.insert(sc, n);
}
void TRecordset_sezioni_contrapposte::add_conto(int indbil, const TString& b)
{
if (indbil >= 1 && indbil <= 4)
{
TAnal_bill bill(_filter);
bill.set_conto(b);
const TSaldanal& sa = ca_saldo(bill, _da_data, _a_data, _tipimov);
if (!sa._fin.is_zero())
{
TArray& a = conti(indbil);
add_conto(b, sa._fin, a);
}
}
}
void TRecordset_sezioni_contrapposte::calcola_totali()
{
const int logicnum = _tipo_piano == 'A' ? LF_PCONANA : LF_PCON;
const TMultilevel_code_info& info = ca_multilevel_code_info(logicnum);
const int break_level = info.levels()-1;
int maxlen[4]; // I livelli intermedi sono al massimo 3 ma facciamo conto pari
for (int level = 0; level < break_level; level++)
maxlen[level] = info.total_len(level);
// Scandisce tutti i 4 array dei conti
for (int indbil = 1; indbil <= 4; indbil++)
{
TArray& a = conti(indbil);
if (!a.empty())
{
TImporto totale[4]; // Totali dei 3 livelli intermedi (4 per fare conto pari)
TString80 last_conto;
// Inserisci sentinella per far scattare il cambio del conto sull'ultimo record
a.insert(new TSaldo_contrapposto, 0);
for (int i = a.last(); i >= 0; i--)
{
const TSaldo_contrapposto& sc = (const TSaldo_contrapposto&)a[i];
if (last_conto.not_empty())
{
for (int level = break_level-1; level >= 0; level--)
{
const int cut = maxlen[level];
if (sc._conto.compare(last_conto, cut) != 0)
{
const TString& intermedio = last_conto.left(cut);
add_conto(intermedio, totale[level], a, i+1);
totale[level].reset();
}
else
break;
}
}
last_conto = sc._conto;
for (int l = 0; l < break_level; l++)
totale[l] += sc._saldo;
}
a.destroy(0, true); // Elimina sentinella
}
}
}
void TRecordset_sezioni_contrapposte::requery()
{
TPconana_recordset pconana(_tipo_piano);
pconana.set_filter(_tipo_piano, NULL, NULL, _filter.costo(), _filter.commessa(), _filter.fase(),
_da_data, _a_data, _tipimov, _movimentati, _nonnulli);
// Crea recordset del piano dei conti appropriato
TString query = "USE PCON";
if (_tipo_piano == 'A')
query << "ANA";
TISAM_recordset pconana(query);
int indicatore_bilancio = 1;
TProgind pi(pconana.items(), TR("Elaborazione conti"), true, true);
TString80 conto;
int indicatore_bilancio = 0;
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
const int maxlen = info.total_len(4); // Calcola lunghezza livello massimo dei conti
// Scandisce il piano dei conti considerando solo quelli di livello piu' basso
for (TRecnotype i = 0; pconana.move_to(i); i++)
{
const int ib = pconana.get(PCONANA_INDBIL).as_int();
if (ib >= 1 && ib <= 4)
indicatore_bilancio = ib;
pi.addstatus(1);
if (pi.iscancelled())
break;
const TString& conto = pconana.get(PCONANA_CODCONTO).as_string();
switch (indicatore_bilancio)
if (_tipo_piano == 'C')
{
case 1: _attivita.add(conto); break;
case 2: _passivita.add(conto); break;
case 3: _costi.add(conto); break;
case 4: _ricavi.add(conto); break;
default: break;
const int g = pconana.get(PCN_GRUPPO).as_int();
const int c = pconana.get(PCN_CONTO).as_int();
const long s = pconana.get(PCN_SOTTOCONTO).as_int();
const TBill b(g, c, s);
if (s == 0 || !b.is_analitico())
continue; // Ignora tutti i gruppi e conti, ignora sottoconti non analitici
conto = b.string(0x8);
indicatore_bilancio = b.indicatore_bilancio();
}
else
{
conto = pconana.get(PCONANA_CODCONTO).as_string();
if (conto.len() < maxlen) // Ignora conti intermedi
continue;
// Ricerca l'indicatore di bilancio sui livelli precedenti
indicatore_bilancio = 0;
for (int l = info.levels()-2; l >= 0 && indicatore_bilancio <= 0; l--)
{
const TString& k = conto.left(info.total_len(l)); // Costruisce codice conto intermedio
indicatore_bilancio = atoi(cache().get(LF_PCONANA, k, PCONANA_INDBIL));
}
}
add_conto(indicatore_bilancio, conto);
}
calcola_totali(); // Aggiungi i gruppi e conti intermedi coi loro totali
move_to(0);
}
unsigned int TRecordset_sezioni_contrapposte::columns() const
{ return 4; }
{ return 9; }
const TRecordset_column_info& TRecordset_sezioni_contrapposte::column_info(unsigned int column) const
{
return _info[column];
return *(TRecordset_column_info*)NULL;
}
const TVariant& TRecordset_sezioni_contrapposte::get(unsigned int column) const
const TVariant& TRecordset_sezioni_contrapposte::get_fld(const TArray& a, int r, const char* field) const
{
return NULL_VARIANT;
TVariant& var = get_tmp_var();
if (r >= 0 && r < a.items())
{
const TFixed_string fld(field);
const TSaldo_contrapposto& sc = (const TSaldo_contrapposto&)a[r];
if (fld == "CONTO")
var = sc._conto; else
if (fld == "DESCR")
{
const TString& conto = sc._conto;
if (tipo_piano() == 'C')
{
TToken_string k;
k.add(conto.mid(0,3));
k.add(conto.mid(3,3));
k.add(conto.mid(6,6));
var = cache().get(LF_PCON, k, PCN_DESCR);
}
else
var = cache().get(LF_PCONANA, conto, PCONANA_DESCR);
} else
if (fld == "SALDO")
{
var = sc._saldo.valore();
} else
if (fld == "SEZIONE")
{
if (sc._saldo.is_zero())
var = EMPTY_STRING;
else
{
const char sez[2] = { sc._saldo.sezione(), '\0' };
var = sez;
}
}
}
else
var = EMPTY_STRING;
return var;
}
const TVariant& TRecordset_sezioni_contrapposte::get(const char* field) const
{
const TFixed_string fld(field);
if (*field == '#')
{
if (fld == "#CMSCDC")
{
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_FASI);
switch (info.parent())
{
case LF_CDC : return get_tmp_var() = _filter.costo();
case LF_COMMESSE: return get_tmp_var() = _filter.commessa();
default : return NULL_VARIANT;
}
}
if (fld == "#COSTO")
return get_tmp_var() = _filter.costo();
if (fld == "#COMMESSA")
return get_tmp_var() = _filter.commessa();
if (fld == "#FASE")
return get_tmp_var() = _filter.fase();
}
else
{
if (fld == "SEZIONE")
return get_tmp_var() = _pos < items_ap() ? "AP" : "CR";
const bool left = fld.starts_with("LEFT:");
if (_pos < items_ap())
{
if (left)
return get_fld(_attivita, _pos, field+5);
else
return get_fld(_passivita, _pos, field+6);
}
else
{
const TRecnotype pos = _pos - items_ap();
if (pos < items_cr())
{
if (left)
return get_fld(_costi, pos, field+5);
else
return get_fld(_ricavi, pos, field+6);
}
}
return get_tmp_var() = EMPTY_STRING;
}
return NULL_VARIANT;
}
@ -531,7 +746,8 @@ const TVariant& TRecordset_sezioni_contrapposte::get(const char* field) const
class TReport_bilancio_sezioni_contrapposte : public TAnal_report
{
protected:
virtual bool TReport_bilancio_sezioni_contrapposte::set_recordset(const TString& sql);
virtual bool set_recordset(const TString& sql);
virtual void msg_format_conto(TVariant_stack& stack);
public:
void set_filter(const TMask& msk, int row);
@ -544,6 +760,15 @@ bool TReport_bilancio_sezioni_contrapposte::set_recordset(const TString& /* sql
return TReport::set_recordset(rset);
}
void TReport_bilancio_sezioni_contrapposte::msg_format_conto(TVariant_stack& stack)
{
const TRecordset_sezioni_contrapposte* rset = (TRecordset_sezioni_contrapposte*)recordset();
if (rset->tipo_piano() == 'C')
msg_format(LF_PCON, stack);
else
msg_format(LF_PCONANA, stack);
}
void TReport_bilancio_sezioni_contrapposte::set_filter(const TMask& m, int row)
{
TDate dal = m.get(F_DATADA);
@ -611,8 +836,7 @@ void TPrint_bilancio_ca::bilancio_a_sezioni_contrapposte(TMask& mask)
{
TReport_bilancio_sezioni_contrapposte rep(mask.get(F_REPORT));
TSheet_field& sf = mask.sfield(F_RIGHE);
const int rows = sf.items();
const int rows = mask.sfield(F_RIGHE).items();
TReport_book book;
for (int i = 0; i < rows; i++)
{
@ -625,6 +849,7 @@ void TPrint_bilancio_ca::bilancio_a_sezioni_contrapposte(TMask& mask)
void TPrint_bilancio_ca::bilancio_di_verifica(TMask& mask)
{
TReport_bilancio_verifica rep(mask.get(F_REPORT));
const int rows = mask.sfield(F_RIGHE).items();
TReport_book book;
for (int i = 0; i < rows; i++)

View File

@ -1,34 +1,323 @@
<report name="ca3300a" lpi="6">
<description>Stampa mastrini contabilta' analitica</description>
<font face="Courier New" size="10" />
<report name="ca3300a" orientation="2" lpi="8" command="ca3 -2" class="ca3300b">
<description>Bilancio normale di verifica</description>
<font face="Courier New" size="8" />
<section type="Head">
<font italic="1" face="Courier New" bold="1" size="10" />
<field type="Stringa" width="50" pattern="1">
<font face="Courier New" bold="1" size="10" />
<source>#SYSTEM.RAGSOC</source>
</field>
<field y="1" type="Testo" valign="center" align="center" width="198" height="2" pattern="1" text="Stampa Bilancio di Contabilita' Analitica">
<font face="Courier New" bold="1" size="14" />
</field>
</section>
<section type="Head" level="1" />
<section type="Head" level="2">
<groupby>CODCONTO</groupby>
<font face="Courier New" bold="1" size="12" />
<field border="1" y="3" type="Linea" width="198" height="0" pattern="1" />
</section>
<section type="Body" />
<section type="Body" level="1" />
<section type="Foot" height="1">
<field x="2" type="Data" width="10" pattern="1">
<field x="90" type="Data" width="10" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="180" type="Numero" align="right" width="10" pattern="1">
<field x="164" type="Numero" align="right" width="4" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field y="2" type="Testo" width="20" pattern="1" text="Centro di costo:" />
<field x="20" y="2" type="Stringa" width="24" pattern="1">
<source>#COSTO</source>
</field>
<field x="45" y="2" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ</prescript>
</field>
<field y="3" type="Testo" width="20" pattern="1" text="Commessa:" />
<field x="20" y="3" type="Stringa" width="24" pattern="1">
<source>#COMMESSA</source>
</field>
<field x="45" y="3" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ</prescript>
</field>
<field y="4" type="Testo" width="20" pattern="1" text="Fase:" />
<field x="20" y="4" type="Stringa" width="13" pattern="1">
<source>#FASE</source>
</field>
<field x="45" y="4" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,FASI,CODCMSFAS=#CMSCDC!CODFASE=#FASE,DESCRIZ</prescript>
</field>
<field border="1" y="6" type="Linea" width="168" height="0" pattern="1" />
<field x="85" y="6" type="Testo" align="center" width="27" pattern="1" text="SALDO INIZIALE" />
<field x="113" y="6" type="Testo" align="center" width="27" pattern="1" text="MOVIMENTI DEL PERIODO" />
<field x="141" y="6" type="Testo" align="center" width="27" pattern="1" text="SALDO FINALE" />
<field y="6.5" type="Testo" width="10" pattern="1" text="Conto" />
<field x="30" y="6.5" type="Testo" width="15" pattern="1" text="Descrizione" />
<field x="78" y="7" type="Testo" align="right" width="13" pattern="1" text="DARE" />
<field x="92" y="7" type="Testo" align="right" width="13" pattern="1" text="AVERE" />
<field x="109" y="7" type="Testo" align="right" width="13" pattern="1" text="DARE" />
<field x="123" y="7" type="Testo" align="right" width="13" pattern="1" text="AVERE" />
<field x="141" y="7" type="Testo" align="right" width="13" pattern="1" text="DARE" />
<field x="155" y="7" type="Testo" align="right" width="13" pattern="1" text="AVERE" />
<field border="1" x="-1" y="8" type="Linea" width="168" height="0" pattern="1" />
</section>
<section type="Head" level="1" height="3">
<field border="1" radius="100" x="1" type="Testo" valign="center" align="center" shade_offset="25" width="166" height="2.5" text="BILANCIO DI VERIFICA">
<font face="Courier New" bold="1" size="16" />
</field>
</section>
<section type="Head" level="2">
<condition>CODCONTO:2!=""</condition>
<groupby>CODCONTO:1</groupby>
<prescript description="H2 PRESCRIPT">"CODCONTO:1" @
"F2.101" !
"DESCR:1" @
"F2.102" !
"F2" AZZERA_TOTALI
</prescript>
</section>
<section type="Head" level="3">
<condition>CODCONTO:3!=""</condition>
<groupby>CODCONTO:2</groupby>
<prescript description="H3 PRESCRIPT">"CODCONTO:2" @
"F3.101" !
"DESCR:2" @
"F3.102" !
"F3" AZZERA_TOTALI</prescript>
</section>
<section type="Head" level="4">
<condition>CODCONTO:4 != ""</condition>
<groupby>CODCONTO:3</groupby>
<prescript description="H4 PRESCRIPT">"CODCONTO:3" @
"F4.101" ! \ Copia il codice conto nel footer
"DESCR:3" @
"F4.102" !
"F4" AZZERA_TOTALI</prescript>
</section>
<section type="Body" />
<section type="Body" level="1">
<field type="Stringa" width="24" id="101" pattern="1">
<source>CODCONTO</source>
<prescript description="B1.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="25" type="Stringa" width="50" id="102" pattern="1">
<source>DESCR</source>
</field>
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:INI_DAREP</source>
<postscript description="B1.103 POSTSCRIPT">MESSAGE ADD,F2.103|ADD,F3.103|ADD,F4.103
</postscript>
</field>
<field x="92" type="Valuta" align="right" width="13" id="104" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:INI_AVEREP</source>
<postscript description="B1.104 POSTSCRIPT">MESSAGE ADD,F2.104|ADD,F3.104|ADD,F4.104</postscript>
</field>
<field x="109" type="Valuta" align="right" width="13" id="105" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:MOV_DAREP</source>
<postscript description="B1.105 POSTSCRIPT">MESSAGE ADD,F2.105|ADD,F3.105|ADD,F4.105</postscript>
</field>
<field x="123" type="Valuta" align="right" width="13" id="106" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:MOV_AVEREP</source>
<postscript description="B1.106 POSTSCRIPT">MESSAGE ADD,F2.106|ADD,F3.106|ADD,F4.106</postscript>
</field>
<field x="141" type="Valuta" align="right" width="13" id="107" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:FIN_DAREP</source>
<postscript description="B1.107 POSTSCRIPT">MESSAGE ADD,F2.107|ADD,F3.107|ADD,F4.107</postscript>
</field>
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:FIN_AVEREP</source>
<postscript description="B1.108 POSTSCRIPT">MESSAGE ADD,F2.108|ADD,F3.108|ADD,F4.108</postscript>
</field>
<field x="78" y="1" type="Valuta" align="right" width="13" id="203" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:INI_DAREC</source>
<postscript description="B1.203 POSTSCRIPT">MESSAGE ADD,F2.103|ADD,F3.103|ADD,F4.103
</postscript>
</field>
<field x="92" y="1" type="Valuta" align="right" width="13" id="204" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:INI_AVEREC</source>
<postscript description="B1.204 POSTSCRIPT">MESSAGE ADD,F2.104|ADD,F3.104|ADD,F4.104</postscript>
</field>
<field x="109" y="1" type="Valuta" align="right" width="13" id="205" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:MOV_DAREC</source>
<postscript description="B1.205 POSTSCRIPT">MESSAGE ADD,F2.105|ADD,F3.105|ADD,F4.105</postscript>
</field>
<field x="123" y="1" type="Valuta" align="right" width="13" id="206" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:MOV_AVEREC</source>
<postscript description="B1.206 POSTSCRIPT">MESSAGE ADD,F2.106|ADD,F3.106|ADD,F4.106</postscript>
</field>
<field x="141" y="1" type="Valuta" align="right" width="13" id="207" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:FIN_DAREC</source>
<postscript description="B1.207 POSTSCRIPT">MESSAGE ADD,F2.107|ADD,F3.107|ADD,F4.107</postscript>
</field>
<field x="155" y="1" type="Valuta" align="right" width="13" id="208" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDO:FIN_AVEREC</source>
<postscript description="B1.208 POSTSCRIPT">MESSAGE ADD,F2.108|ADD,F3.108|ADD,F4.108</postscript>
</field>
<field x="78" y="2" type="Valuta" align="right" width="13" id="303" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#103 + #203</source>
<prescript description="B1.303 PRESCRIPT">303 DARE_AVERE</prescript>
<postscript description="B1.303 POSTSCRIPT">MESSAGE ADD,F2.303|ADD,F3.303|ADD,F4.303
</postscript>
</field>
<field x="92" y="2" type="Valuta" align="right" width="13" id="304" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#104 + #204</source>
<postscript description="B1.304 POSTSCRIPT">MESSAGE ADD,F2.304|ADD,F3.304|ADD,F4.304</postscript>
</field>
<field x="109" y="2" type="Valuta" align="right" width="13" id="305" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#105 + #205</source>
<prescript description="B1.305 PRESCRIPT">305 DARE_AVERE</prescript>
<postscript description="B1.305 POSTSCRIPT">MESSAGE ADD,F2.305|ADD,F3.305|ADD,F4.305</postscript>
</field>
<field x="123" y="2" type="Valuta" align="right" width="13" id="306" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#106 + #206</source>
<postscript description="B1.306 POSTSCRIPT">MESSAGE ADD,F2.306|ADD,F3.306|ADD,F4.306</postscript>
</field>
<field x="141" y="2" type="Valuta" align="right" width="13" id="307" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#107 + #207</source>
<prescript description="B1.307 PRESCRIPT">307 DARE_AVERE</prescript>
<postscript description="B1.307 POSTSCRIPT">MESSAGE ADD,F2.307|ADD,F3.307|ADD,F4.307</postscript>
</field>
<field x="155" y="2" type="Valuta" align="right" width="13" id="308" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>#108 + #208</source>
<postscript description="B1.308 POSTSCRIPT">MESSAGE ADD,F2.308|ADD,F3.308|ADD,F4.308</postscript>
</field>
</section>
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="2" />
<sql>USE RMOVANA
JOIN PCONANA INTO CODCONTO==CODCONTO</sql>
<section type="Foot" level="2">
<condition>#101 != ""</condition>
<font face="Courier New" bold="1" size="8" />
<field type="Stringa" width="23" id="101" pattern="1">
<prescript description="F2.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="25" type="Stringa" width="50" id="102" pattern="1" />
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" type="Valuta" align="right" width="13" id="104" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" type="Valuta" align="right" width="13" id="105" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" type="Valuta" align="right" width="13" id="106" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" type="Valuta" align="right" width="13" id="107" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="1" type="Valuta" align="right" width="13" id="203" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" y="1" type="Valuta" align="right" width="13" id="204" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="1" type="Valuta" align="right" width="13" id="205" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="1" type="Valuta" align="right" width="13" id="206" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="1" type="Valuta" align="right" width="13" id="207" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" y="1" type="Valuta" align="right" width="13" id="208" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="2" type="Valuta" align="right" width="13" id="303" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" y="2" type="Valuta" align="right" width="13" id="304" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="2" type="Valuta" align="right" width="13" id="305" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="2" type="Valuta" align="right" width="13" id="306" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="2" type="Valuta" align="right" width="13" id="307" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" y="2" type="Valuta" align="right" width="13" id="308" pattern="1" hide_zero="1" text="###.###.###,@@" />
</section>
<section type="Foot" level="3">
<condition>#101 != ""</condition>
<font face="Courier New" bold="1" size="8" />
<field type="Stringa" width="23" id="101" pattern="1">
<prescript description="F3.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="25" type="Stringa" width="50" id="102" pattern="1" />
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" type="Valuta" align="right" width="13" id="104" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" type="Valuta" align="right" width="13" id="105" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" type="Valuta" align="right" width="13" id="106" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" type="Valuta" align="right" width="13" id="107" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="1" type="Valuta" align="right" width="13" id="203" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" y="1" type="Valuta" align="right" width="13" id="204" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="1" type="Valuta" align="right" width="13" id="205" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="1" type="Valuta" align="right" width="13" id="206" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="1" type="Valuta" align="right" width="13" id="207" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" y="1" type="Valuta" align="right" width="13" id="208" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="2" type="Valuta" align="right" width="13" id="303" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>103 DARE_AVERE</prescript>
</field>
<field x="92" y="2" type="Valuta" align="right" width="13" id="304" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="2" type="Valuta" align="right" width="13" id="305" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="2" type="Valuta" align="right" width="13" id="306" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="2" type="Valuta" align="right" width="13" id="307" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript>107 DARE_AVERE</prescript>
</field>
<field x="155" y="2" type="Valuta" align="right" width="13" id="308" pattern="1" hide_zero="1" text="###.###.###,@@" />
</section>
<section type="Foot" level="4">
<condition>#101 != ""</condition>
<font face="Courier New" bold="1" size="8" />
<field type="Stringa" width="23" id="101" pattern="1">
<prescript description="F4.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="25" type="Stringa" width="50" id="102" pattern="1" />
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.103 PRESCRIPT">103 DARE_AVERE</prescript>
</field>
<field x="92" type="Valuta" align="right" width="13" id="104" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" type="Valuta" align="right" width="13" id="105" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" type="Valuta" align="right" width="13" id="106" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" type="Valuta" align="right" width="13" id="107" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.107 PRESCRIPT">107 DARE_AVERE</prescript>
</field>
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="1" type="Valuta" align="right" width="13" id="203" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.203 PRESCRIPT">103 DARE_AVERE</prescript>
</field>
<field x="92" y="1" type="Valuta" align="right" width="13" id="204" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="1" type="Valuta" align="right" width="13" id="205" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="1" type="Valuta" align="right" width="13" id="206" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="1" type="Valuta" align="right" width="13" id="207" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.207 PRESCRIPT">107 DARE_AVERE</prescript>
</field>
<field x="155" y="1" type="Valuta" align="right" width="13" id="208" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="78" y="2" type="Valuta" align="right" width="13" id="303" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.303 PRESCRIPT">103 DARE_AVERE</prescript>
</field>
<field x="92" y="2" type="Valuta" align="right" width="13" id="304" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="109" y="2" type="Valuta" align="right" width="13" id="305" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="123" y="2" type="Valuta" align="right" width="13" id="306" pattern="1" hide_zero="1" text="###.###.###,@@" />
<field x="141" y="2" type="Valuta" align="right" width="13" id="307" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="F4.307 PRESCRIPT">107 DARE_AVERE</prescript>
</field>
<field x="155" y="2" type="Valuta" align="right" width="13" id="308" pattern="1" hide_zero="1" text="###.###.###,@@" />
</section>
<sql>USE PCONANA</sql>
<prescript description="PRESCRIPT">: AZZERA_TOTALI ( ID_SEC - )
109 103 DO
DUP \ Duplica codice sezione
"." + \ Aggiunge punto
I + \ Aggiunge codice campo
0 SWAP ! \ Lo azzera
LOOP
DROP
;
: DARE_AVERE ( ID_DARE -- )
VARIABLE _DARE
VARIABLE _AVERE
DUP
_DARE !
1 + _AVERE !
_DARE @ @ \ DARE
_AVERE @ @ \ AVERE
- \ DARE-AVERE
DUP
0 &#3C; IF \ Se negativo
-1 * \ Cambia segno
_AVERE @ ! \ Setta AVERE
0 _DARE @ ! \ Azzera DARE
ELSE
_DARE @ ! \ Setta DARE
0 _AVERE @ ! \ Azzera AVERE
THEN
;
</prescript>
</report>

View File

@ -636,7 +636,7 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
const TRectype* babbo = riga.find_original_rdoc(); //cerca il doc padre della riga doc attuale
if (babbo != NULL) //se trova il doc padre..
{
const TString8 babbo_codnum = babbo->get(RDOC_CODNUM);
const TString4 babbo_codnum = babbo->get(RDOC_CODNUM);
const int anno = babbo->get_int(RDOC_ANNO);
const long ndoc = babbo->get_long(RDOC_NDOC);
riferimento << babbo_codnum << '-' << anno << '-' << ndoc;

View File

@ -20,9 +20,9 @@
const TVariant& TPconana_recordset::get(const char* field) const
{
const TFixed_string column_name(field);
if (*column_name == '#')
if (column_name[0] == '#')
{
if (strcmp(column_name, "#CMSCDC") == 0)
if (column_name == "#CMSCDC")
{
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_FASI);
switch (info.parent())
@ -32,25 +32,26 @@ const TVariant& TPconana_recordset::get(const char* field) const
default : return NULL_VARIANT;
}
}
if (strcmp(column_name, "#COSTO") == 0)
if (column_name == "#COSTO")
return get_tmp_var() = _bill.costo();
if (strcmp(column_name, "#COMMESSA") == 0)
if (column_name == "#COMMESSA")
return get_tmp_var() = _bill.commessa();
if (strcmp(column_name, "#FASE") == 0)
if (column_name == "#FASE")
return get_tmp_var() = _bill.fase();
}
else
{
if (column_name.compare(PCONANA_CODCONTO, 8) == 0)
const TRectype& curr = relation()->curr();
if (column_name.starts_with(PCONANA_CODCONTO))
{
TString80 str;
if (_tipo == 'C')
{
const TBill b(relation()->curr());
const TBill b(curr);
str = b.string(0x8);
}
else
str = TISAM_recordset::get(PCONANA_CODCONTO).as_string();
str = curr.get(PCONANA_CODCONTO);
if (column_name[8] == ':')
{
@ -60,12 +61,12 @@ const TVariant& TPconana_recordset::get(const char* field) const
}
return get_tmp_var() = str;
}
if (column_name.compare(PCONANA_DESCR, 5) == 0)
if (column_name.starts_with(PCONANA_DESCR))
{
TString80 str;
if (_tipo == 'C')
{
TBill b(relation()->curr());
TBill b(curr);
if (column_name[5] == ':')
{
if (column_name[6] == '1')
@ -81,19 +82,43 @@ const TVariant& TPconana_recordset::get(const char* field) const
{
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
const int level = column_name[6] - '1';
str = TISAM_recordset::get(PCONANA_CODCONTO).as_string();
str = curr.get(PCONANA_CODCONTO);
str.cut(info.total_len(level));
str = cache().get(LF_PCONANA, str, PCONANA_DESCR);
}
else
str = TISAM_recordset::get(PCONANA_DESCR).as_string();
str = curr.get(PCONANA_DESCR);
}
return get_tmp_var() = str;
}
if (column_name.compare("SALDO:", 6) == 0)
if (column_name == PCONANA_INDBIL)
{
TString16 sub_field = column_name+6;
long ib = curr.get_int(PCONANA_INDBIL);
if (ib == 0)
{
if (_tipo == 'C')
{
TBill b(curr);
ib = b.indicatore_bilancio();
}
else
{
const TString80 conto = curr.get(PCONANA_CODCONTO);
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
for (int i = info.levels()-2; i >= 0 && ib <= 0; i--)
{
const TString& k = conto.left(info.total_len(i));
const TRectype& pca = cache().get(LF_PCONANA, conto);
ib = pca.get_long(PCONANA_INDBIL);
}
}
}
return get_tmp_var() = ib;
}
if (column_name.starts_with("SALDO:"))
{
TString16 sub_field = column_name.mid(6);
const char last = sub_field.right(1)[0];
int tipimov = 0;
switch (last)
@ -108,27 +133,27 @@ const TVariant& TPconana_recordset::get(const char* field) const
const TSaldanal& s = ca_saldo(_bill, _dal, _al, tipimov);
TVariant& var = get_tmp_var();
if (strcmp(sub_field, "INI_DARE") == 0)
if (sub_field == "INI_DARE")
{
var = s._ini.sezione() == 'D' ? s._ini.valore() : ZERO;
} else
if (strcmp(sub_field, "INI_AVERE") == 0)
if (sub_field == "INI_AVERE")
{
var = s._ini.sezione() == 'A' ? s._ini.valore() : ZERO;
} else
if (strcmp(sub_field, "MOV_DARE") == 0)
if (sub_field == "MOV_DARE")
{
var = s._dare.valore();
} else
if (strcmp(sub_field, "MOV_AVERE") == 0)
if (sub_field == "MOV_AVERE")
{
var = s._avere.valore();
} else
if (strcmp(sub_field, "FIN_DARE") == 0)
if (sub_field == "FIN_DARE")
{
var = s._fin.sezione() == 'D' ? s._fin.valore() : ZERO;
} else
if (strcmp(sub_field, "FIN_AVERE") == 0)
if (sub_field == "FIN_AVERE")
{
var = s._fin.sezione() == 'A' ? s._fin.valore() : ZERO;
}
@ -471,14 +496,14 @@ class TRiclassify_cache : public TCache
protected:
virtual TObject* key2obj(const char* key);
void extract(const char* conto, TString_array& conti) const;
void extract(const TString& conto, TString_array& conti) const;
public:
const TString_array& conti(const TString& conto);
TRiclassify_cache();
};
void TRiclassify_cache::extract(const char* conto, TString_array& conti) const
void TRiclassify_cache::extract(const TString& conto, TString_array& conti) const
{
TRecord_array table(conto, LF_PANAPDC);
for (int r = table.last_row(); r > 0; r = table.pred_row(r))
@ -810,7 +835,7 @@ TObject* TSaldi_cache::key2obj(const char* key)
const TDate dal = tok.get(4); // Le get precedenti avvengono in ordine inverso!
const TDate al = tok.get();
const int tipo = tok.get_int();
s->_movimentato = saldi(bill, dal, al, tipo, *s);
saldi(bill, dal, al, tipo, *s);
return s;
}

View File

@ -107,12 +107,12 @@ protected: // protected is safer
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
virtual bool use_mask() { return false;}
void msg_format(int logicnum, TVariant_stack& stack);
void msg_format_costo (TVariant_stack& stack);
void msg_format_commessa (TVariant_stack& stack);
void msg_format_fase (TVariant_stack& stack);
void msg_format_conto (TVariant_stack& stack);
void msg_format_commessa_costo(TVariant_stack& stack);
virtual void msg_format(int logicnum, TVariant_stack& stack);
virtual void msg_format_costo (TVariant_stack& stack);
virtual void msg_format_commessa (TVariant_stack& stack);
virtual void msg_format_fase (TVariant_stack& stack);
virtual void msg_format_conto (TVariant_stack& stack);
virtual void msg_format_commessa_costo(TVariant_stack& stack);
public: // meglio pubic?
};