Patch level : 2.2

Files correlati     : ca3.exe ca3300c.rep ca3300d.rep
Ricompilazione Demo : [ ]
Commento            :
Aggiunte stampe bilancio di verifica e a sezioni contrapposte di raffronto


git-svn-id: svn://10.65.10.50/trunk@13310 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2005-08-08 14:08:52 +00:00
parent 762fdfddba
commit e3da6f6378
5 changed files with 288 additions and 20 deletions

View File

@ -414,9 +414,27 @@ TReport_bilancio_verifica::TReport_bilancio_verifica(const char* name)
struct TSaldo_contrapposto : public TObject
{
TString _conto;
TImporto _saldo;
TImporto _saldo, _preventivo, _consuntivo;
TSaldo_contrapposto& operator+=(const TSaldo_contrapposto& sc);
void reset();
};
TSaldo_contrapposto& TSaldo_contrapposto::operator+=(const TSaldo_contrapposto& sc)
{
_preventivo += sc._preventivo;
_consuntivo += sc._consuntivo;
_saldo += sc._saldo;
return *this;
}
void TSaldo_contrapposto::reset()
{
_preventivo.reset();
_consuntivo.reset();
_saldo.reset();
}
class TRecordset_sezioni_contrapposte : public TRecordset
{
char _tipo_piano;
@ -434,9 +452,10 @@ protected:
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(const TString& b, const TImporto& s, const TImporto& p, const TImporto& c, TArray& a, int n = -1);
void add_conto(int indbil, const TString& b);
void calcola_totali();
void get_section(const TImporto& imp, TVariant& var) const;
public:
virtual TRecnotype items() const;
@ -506,12 +525,15 @@ TArray& TRecordset_sezioni_contrapposte::conti(int indbil)
return *ptar;
}
void TRecordset_sezioni_contrapposte::add_conto(const TString& b, const TImporto& i,
void TRecordset_sezioni_contrapposte::add_conto(const TString& b,
const TImporto& s, const TImporto& p, const TImporto& c,
TArray& a, int n)
{
TSaldo_contrapposto* sc = new TSaldo_contrapposto;
sc->_conto = b;
sc->_saldo = i;
sc->_conto = b;
sc->_saldo = s; sc->_saldo.normalize();
sc->_preventivo = p; sc->_preventivo.normalize();
sc->_consuntivo = c; sc->_consuntivo.normalize();
if (n < 0)
a.add(sc);
else
@ -524,11 +546,27 @@ void TRecordset_sezioni_contrapposte::add_conto(int indbil, const TString& b)
{
TAnal_bill bill(_filter);
bill.set_conto(b);
const TSaldanal& sa = ca_saldo(bill, _da_data, _a_data, _tipimov);
if (!sa._fin.is_zero())
if ((_tipimov & _saldanal_qualsiasi) == _saldanal_qualsiasi) // Bilancio a sezioni contrapposte di raffronto
{
TArray& a = conti(indbil);
add_conto(b, sa._fin, a);
const TSaldanal& sp = ca_saldo(bill, _da_data, _a_data, _saldanal_preventivi);
const TSaldanal& sc = ca_saldo(bill, _da_data, _a_data, _saldanal_consuntivo);
if (!sp._fin.is_zero() || !sc._fin.is_zero())
{
TArray& a = conti(indbil);
TImporto s = sp._fin; s -= sc._fin; s.normalize();
add_conto(b, s, sp._fin, sc._fin, a);
}
}
else
{
const TSaldanal& sa = ca_saldo(bill, _da_data, _a_data, _tipimov);
if (!sa._fin.is_zero())
{
TImporto zero;
TArray& a = conti(indbil);
add_conto(b, sa._fin, zero, zero, a);
}
}
}
}
@ -549,7 +587,7 @@ void TRecordset_sezioni_contrapposte::calcola_totali()
TArray& a = conti(indbil);
if (!a.empty())
{
TImporto totale[4]; // Totali dei 3 livelli intermedi (4 per fare conto pari)
TSaldo_contrapposto 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
@ -565,7 +603,9 @@ void TRecordset_sezioni_contrapposte::calcola_totali()
if (sc._conto.compare(last_conto, cut) != 0)
{
const TString& intermedio = last_conto.left(cut);
add_conto(intermedio, totale[level], a, i+1);
add_conto(intermedio,
totale[level]._saldo, totale[level]._preventivo, totale[level]._consuntivo,
a, i+1);
totale[level].reset();
}
else
@ -574,7 +614,7 @@ void TRecordset_sezioni_contrapposte::calcola_totali()
}
last_conto = sc._conto;
for (int l = 0; l < break_level; l++)
totale[l] += sc._saldo;
totale[l] += sc;
}
a.destroy(0, true); // Elimina sentinella
}
@ -638,13 +678,24 @@ void TRecordset_sezioni_contrapposte::requery()
}
unsigned int TRecordset_sezioni_contrapposte::columns() const
{ return 9; }
{ return 1; }
const TRecordset_column_info& TRecordset_sezioni_contrapposte::column_info(unsigned int column) const
{
return *(TRecordset_column_info*)NULL;
}
void TRecordset_sezioni_contrapposte::get_section(const TImporto& imp, TVariant& var) const
{
if (imp.is_zero())
var = EMPTY_STRING;
else
{
const char sez[2] = { imp.sezione(), '\0' };
var = sez;
}
}
const TVariant& TRecordset_sezioni_contrapposte::get_fld(const TArray& a, int r, const char* field) const
{
TVariant& var = get_tmp_var();
@ -672,15 +723,25 @@ const TVariant& TRecordset_sezioni_contrapposte::get_fld(const TArray& a, int r,
{
var = sc._saldo.valore();
} else
if (fld == "SALDOC")
{
var = sc._consuntivo.valore();
} else
if (fld == "SALDOP" || fld == "SALDOV")
{
var = sc._preventivo.valore();
} else
if (fld == "SEZIONE")
{
if (sc._saldo.is_zero())
var = EMPTY_STRING;
else
{
const char sez[2] = { sc._saldo.sezione(), '\0' };
var = sez;
}
get_section(sc._saldo, var);
} else
if (fld == "SEZIONEC")
{
get_section(sc._consuntivo, var);
}
if (fld == "SEZIONEP" || fld == "SEZIONEV")
{
get_section(sc._preventivo, var);
}
}
else

104
ca/ca3300c.rep Executable file
View File

@ -0,0 +1,104 @@
<report name="ca3300c" orientation="2" lpi="8" command="ca3 -2" class="ca3300d">
<description>Bilancio a sezioni contrapposte</description>
<font face="Courier New" size="8" />
<section type="Head">
<field x="1" type="Stringa" width="50" pattern="1">
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="91" type="Data" width="10" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="165" type="Numero" align="right" width="4" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="1" y="2" type="Testo" width="20" pattern="1" text="Centro di costo:" />
<field x="21" y="2" type="Stringa" width="24" pattern="1">
<source>#COSTO</source>
</field>
<field x="46" y="2" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ</prescript>
</field>
<field x="1" y="3" type="Testo" width="20" pattern="1" text="Commessa:" />
<field x="21" y="3" type="Stringa" width="24" pattern="1">
<source>#COMMESSA</source>
</field>
<field x="46" y="3" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ</prescript>
</field>
<field x="1" y="4" type="Testo" width="20" pattern="1" text="Fase:" />
<field x="21" y="4" type="Stringa" width="13" pattern="1">
<source>#FASE</source>
</field>
<field x="46" y="4" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,FASI,CODCMSFAS=#CMSCDC!CODFASE=#FASE,DESCRIZ</prescript>
</field>
<field border="1" x="1" y="6" type="Linea" width="168" height="0" pattern="1" />
</section>
<section type="Head" level="1" />
<section type="Head" level="2" height="3" page_break="1">
<groupby>SEZIONE</groupby>
<field x="26" y="1" type="Stringa" width="12" pattern="1">
<source>IF(SEZIONE=="AP","ATTIVITA'","COSTI")</source>
</field>
<field x="109" y="1" type="Stringa" width="12" pattern="1">
<source>IF(SEZIONE=="AP","PASSIVITA'","RICAVI")</source>
</field>
</section>
<section type="Body" />
<section type="Body" level="1">
<field x="1" type="Stringa" width="24" pattern="1">
<source>LEFT:CONTO</source>
<prescript description="B1.0 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="26" type="Stringa" width="35" height="2" pattern="1">
<source>LEFT:DESCR</source>
</field>
<field x="62" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>LEFT:SALDOP</source>
</field>
<field x="79" type="Stringa" width="1" pattern="1">
<source>LEFT:SEZIONEP</source>
</field>
<field x="84" type="Stringa" width="24" pattern="1">
<source>RIGHT:CONTO</source>
<prescript description="B1.0 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="109" type="Stringa" width="35" height="2" pattern="1">
<source>RIGHT:DESCR</source>
</field>
<field x="145" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>RIGHT:SALDO</source>
</field>
<field x="162" type="Stringa" width="1" pattern="1">
<source>RIGHT:SEZIONE</source>
</field>
<field x="62" y="1" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>LEFT:SALDOC</source>
</field>
<field x="79" y="1" type="Stringa" width="1" pattern="1">
<source>LEFT:SEZIONEC</source>
</field>
<field x="145" y="1" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>RIGHT:SALDOC</source>
</field>
<field x="162" y="1" type="Stringa" width="1" pattern="1">
<source>RIGHT:SEZIONEC</source>
</field>
<field x="62" y="2" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>LEFT:SALDO</source>
</field>
<field x="79" y="2" type="Stringa" width="1" pattern="1">
<source>LEFT:SEZIONE</source>
</field>
<field x="145" y="2" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>RIGHT:SALDO</source>
</field>
<field x="162" y="2" type="Stringa" width="1" pattern="1">
<source>RIGHT:SEZIONE</source>
</field>
</section>
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="2" />
</report>

80
ca/ca3300d.rep Executable file
View File

@ -0,0 +1,80 @@
<report name="ca3300d" orientation="2" lpi="8" command="ca3 -2" class="ca3300d">
<description>Bilancio a sezioni contrapposte</description>
<font face="Courier New" size="8" />
<section type="Head">
<field x="1" type="Stringa" width="50" pattern="1">
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="91" type="Data" width="10" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="165" type="Numero" align="right" width="4" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="1" y="2" type="Testo" width="20" pattern="1" text="Centro di costo:" />
<field x="21" y="2" type="Stringa" width="24" pattern="1">
<source>#COSTO</source>
</field>
<field x="46" y="2" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ</prescript>
</field>
<field x="1" y="3" type="Testo" width="20" pattern="1" text="Commessa:" />
<field x="21" y="3" type="Stringa" width="24" pattern="1">
<source>#COMMESSA</source>
</field>
<field x="46" y="3" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ</prescript>
</field>
<field x="1" y="4" type="Testo" width="20" pattern="1" text="Fase:" />
<field x="21" y="4" type="Stringa" width="13" pattern="1">
<source>#FASE</source>
</field>
<field x="46" y="4" type="Stringa" width="50" pattern="1">
<prescript>MESSAGE ISAMREAD,FASI,CODCMSFAS=#CMSCDC!CODFASE=#FASE,DESCRIZ</prescript>
</field>
<field border="1" x="1" y="6" type="Linea" width="168" height="0" pattern="1" />
</section>
<section type="Head" level="1" />
<section type="Head" level="2" height="3" page_break="1">
<groupby>SEZIONE</groupby>
<field x="26" y="1" type="Stringa" width="12" pattern="1">
<source>IF(SEZIONE=="AP","ATTIVITA'","COSTI")</source>
</field>
<field x="109" y="1" type="Stringa" width="12" pattern="1">
<source>IF(SEZIONE=="AP","PASSIVITA'","RICAVI")</source>
</field>
</section>
<section type="Body" />
<section type="Body" level="1">
<field x="1" type="Stringa" width="24" pattern="1">
<source>LEFT:CONTO</source>
<prescript description="B1.0 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="26" type="Stringa" dynamic_height="1" width="35" height="2" pattern="1">
<source>LEFT:DESCR</source>
</field>
<field x="62" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>LEFT:SALDO</source>
</field>
<field x="79" type="Stringa" width="1" pattern="1">
<source>LEFT:SEZIONE</source>
</field>
<field x="84" type="Stringa" width="24" pattern="1">
<source>RIGHT:CONTO</source>
<prescript description="B1.0 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="109" type="Stringa" dynamic_height="1" width="35" height="2" pattern="1">
<source>RIGHT:DESCR</source>
</field>
<field x="145" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>RIGHT:SALDO</source>
</field>
<field x="162" type="Stringa" width="1" pattern="1">
<source>RIGHT:SEZIONE</source>
</field>
</section>
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="2" />
</report>

View File

@ -13,6 +13,19 @@
#include "rmovana.h"
#include "saldana.h"
///////////////////////////////////////////////////////////
// TSaldanal
///////////////////////////////////////////////////////////
void TSaldanal::copy(const TSaldanal& sa)
{
_ini = sa._ini;
_dare = sa._dare;
_avere = sa._avere;
_fin = sa._fin;
_movimentato = sa._movimentato;
}
///////////////////////////////////////////////////////////
// TPconana_recordset
///////////////////////////////////////////////////////////

View File

@ -59,6 +59,16 @@ struct TSaldanal : public TObject
{
TImporto _ini, _dare, _avere, _fin;
bool _movimentato;
protected:
void copy(const TSaldanal& sa);
public:
TObject* dup() const { return new TSaldanal(*this); }
const TSaldanal& operator=(const TSaldanal& sa) { copy(sa); return *this; }
TSaldanal() { }
TSaldanal(const TSaldanal& sa) { copy(sa); }
};
const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi = _saldanal_consuntivo);