Patch level : 2.2
Files correlati : ca3 Ricompilazione Demo : [ ] Commento : Aggiunta classe TAnal_bill per gestire congiuntamente CONTO.COSTO,COMMESSA,FASE Prima versione di alcuni report per bilancio di verifica git-svn-id: svn://10.65.10.50/trunk@13224 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9191d73f21
commit
5b97f21b73
@ -315,7 +315,8 @@ void TPrint_mastrini_ca_recordset::set_custom_filter(TCursor& cur) const
|
||||
|
||||
const TImporto& TPrint_mastrini_ca_recordset::saldo_iniziale(const char* conto) const
|
||||
{
|
||||
const TSaldanal& saldo = ca_saldo(conto, _codcosto, _codcms, _codfas, _dadata, _adata, _tipimov);
|
||||
TAnal_bill bill(conto, _codcosto, _codcms, _codfas);
|
||||
const TSaldanal& saldo = ca_saldo(bill, _dadata, _adata, _tipimov);
|
||||
return saldo._ini;
|
||||
}
|
||||
|
||||
|
110
ca/ca3300.cpp
110
ca/ca3300.cpp
@ -239,7 +239,7 @@ class TPiano_conti_recordset : public TISAM_recordset
|
||||
word _tipimov;
|
||||
TString _da_conto, _a_conto;
|
||||
int _contolen;
|
||||
TString _codcms, _codfas, _codcosto;
|
||||
TAnal_bill _bill;
|
||||
TDate _dal, _al;
|
||||
bool _movimentati, _nonnulli;
|
||||
|
||||
@ -270,8 +270,9 @@ const TVariant& TPiano_conti_recordset::get(const char* column_name) const
|
||||
case 'V': tipimov = 6; sub_field.rtrim(1); break; // Preventivo o variazaione preventivo
|
||||
default : tipimov = _tipimov; break;
|
||||
}
|
||||
const TString& conto = get(PCONANA_CODCONTO).as_string();
|
||||
const TSaldanal& s = ca_saldo(conto, _codcosto, _codcms, _codfas, _dal, _al, tipimov);
|
||||
|
||||
((TAnal_bill&)_bill).set_conto(get(PCONANA_CODCONTO).as_string());
|
||||
const TSaldanal& s = ca_saldo(_bill, _dal, _al, tipimov);
|
||||
|
||||
TVariant& var = get_tmp_var();
|
||||
if (strcmp(sub_field, "INI_DARE") == 0)
|
||||
@ -300,24 +301,35 @@ const TVariant& TPiano_conti_recordset::get(const char* column_name) const
|
||||
}
|
||||
return var;
|
||||
}
|
||||
if (strcmp(column_name, "#CMSCDC") == 0)
|
||||
{
|
||||
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_FASI);
|
||||
switch (info.parent())
|
||||
{
|
||||
case LF_CDC : column_name = "#COSTO"; break;
|
||||
case LF_COMMESSE: column_name = "#COMMESSA"; break;
|
||||
default : return NULL_VARIANT;
|
||||
}
|
||||
}
|
||||
if (strcmp(column_name, "#COSTO") == 0)
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
var = _codcosto;
|
||||
var = _bill.costo();
|
||||
return var;
|
||||
}
|
||||
if (strcmp(column_name, "#COMMESSA") == 0)
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
var = _codcms;
|
||||
var = _bill.commessa();
|
||||
return var;
|
||||
}
|
||||
if (strcmp(column_name, "#FASE") == 0)
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
var = _codfas;
|
||||
var = _bill.fase();
|
||||
return var;
|
||||
}
|
||||
|
||||
return TISAM_recordset::get(column_name);
|
||||
}
|
||||
|
||||
@ -329,7 +341,8 @@ bool TPiano_conti_recordset::valid_record(const TRelation& rel) const
|
||||
|
||||
if (_movimentati || _nonnulli)
|
||||
{
|
||||
const TSaldanal& s = ca_saldo(conto, _codcosto, _codcms, _codfas, _dal, _al, _tipimov);
|
||||
((TAnal_bill&)_bill).set_conto(conto);
|
||||
const TSaldanal& s = ca_saldo(_bill, _dal, _al, _tipimov);
|
||||
if (_movimentati && !s._movimentato)
|
||||
return false;
|
||||
if (_nonnulli && s._ini.is_zero() && s._dare.is_zero() && s._avere.is_zero())
|
||||
@ -389,11 +402,10 @@ void TPiano_conti_recordset::set_filter(const TMask& m, int r)
|
||||
sf.update_mask(r);
|
||||
TRelation rel(LF_RMOVANA);
|
||||
sm.autosave(rel);
|
||||
const TRectype& rec = rel.curr();
|
||||
_codcosto = rec.get(RMOVANA_CODCCOSTO);
|
||||
_codcms = rec.get(RMOVANA_CODCMS);
|
||||
_codfas = rec.get(RMOVANA_CODFASE);
|
||||
_bill.get(rel.curr());
|
||||
}
|
||||
else
|
||||
_bill.reset();
|
||||
}
|
||||
|
||||
TPiano_conti_recordset::TPiano_conti_recordset(const char* sql) : TISAM_recordset(sql)
|
||||
@ -439,84 +451,8 @@ public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void randomov()
|
||||
{
|
||||
#ifdef DBG
|
||||
TLocalisamfile fmov(LF_MOVANA);
|
||||
if (fmov.first() != NOERR && yesno_box("Vuoi generare un po' di movimenti casuali?"))
|
||||
{
|
||||
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
||||
TString filter;
|
||||
int len = 0;
|
||||
for (int l = info.levels()-1; l >= 0; l--)
|
||||
len += info.len(l);
|
||||
filter << "LEN(CODCONTO)==" << len;
|
||||
|
||||
TRelation relconti(LF_PCONANA);
|
||||
TCursor curconti(&relconti, filter);
|
||||
const TRecnotype conti = curconti.items();
|
||||
curconti.freeze();
|
||||
|
||||
TRelation relcaus(LF_CAUSALI);
|
||||
TCursor curcaus(&relcaus, "MOVIND=\"X\"");
|
||||
const TRecnotype causali = curcaus.items();
|
||||
curcaus.freeze();
|
||||
|
||||
TEsercizi_contabili esc;
|
||||
|
||||
for (int m = 0; m < 100; m++)
|
||||
{
|
||||
TAnal_mov mov;
|
||||
|
||||
TDate data(TODAY); data -= rand()%365;
|
||||
mov.put(MOVANA_DATAREG, data);
|
||||
mov.put(MOVANA_DATACOMP, data-1L);
|
||||
mov.put(MOVANA_DATADOC, data-2L);
|
||||
mov.put(MOVANA_ANNOES, esc.date2esc(data));
|
||||
mov.put(MOVANA_DESCR, "Movimento random");
|
||||
switch (rand() % 10)
|
||||
{
|
||||
case 0: mov.put(MOVANA_TIPOMOV, "P"); break;
|
||||
case 1: mov.put(MOVANA_TIPOMOV, "V"); break;
|
||||
default: mov.put(MOVANA_TIPOMOV, " "); break; // Alta probabilita'
|
||||
}
|
||||
|
||||
if (causali > 0)
|
||||
{
|
||||
curcaus = rand() % causali;
|
||||
mov.put(MOVANA_CODCAUS, curcaus.curr().get("CODCAUS"));
|
||||
}
|
||||
|
||||
const int rows = rand()%10+1;
|
||||
TImporto tot;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
TRectype& rmov = mov.new_row();
|
||||
rmov.put(RMOVANA_DATACOMP, mov.get(MOVANA_DATACOMP));
|
||||
rmov.put(RMOVANA_ANNOES, mov.get(MOVANA_ANNOES));
|
||||
|
||||
curconti = rand() % conti;
|
||||
rmov.put(RMOVANA_CODCONTO, curconti.curr().get(PCONANA_CODCONTO));
|
||||
const TImporto imp(i & 0x1 ? 'A' : 'D', real(10*(rand()%1000+1)));
|
||||
rmov.put(RMOVANA_SEZIONE, imp.sezione());
|
||||
rmov.put(RMOVANA_IMPORTO, imp.valore());
|
||||
tot += imp;
|
||||
}
|
||||
|
||||
tot.normalize();
|
||||
mov.put(MOVANA_SEZIONE, tot.sezione());
|
||||
mov.put(MOVANA_TOTDOC, tot.valore());
|
||||
mov.write(fmov);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void TPrint_bilancio_ca::main_loop()
|
||||
{
|
||||
randomov();
|
||||
|
||||
TPrint_bilancio_ca_mask mask;
|
||||
while (mask.run() != K_QUIT)
|
||||
{
|
||||
|
@ -17,17 +17,23 @@
|
||||
<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>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,DESCR</prescript>
|
||||
<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>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" />
|
||||
@ -38,8 +44,8 @@
|
||||
<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="AVERE" />
|
||||
<field x="155" y="7" type="Testo" align="right" width="13" pattern="1" text="DARE" />
|
||||
<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">
|
||||
@ -66,7 +72,7 @@
|
||||
"F4.101" !</prescript>
|
||||
</section>
|
||||
<section type="Body" />
|
||||
<section type="Body" level="1">
|
||||
<section type="Body" level="1" height="4">
|
||||
<field type="Stringa" width="24" id="101" pattern="1">
|
||||
<source>CODCONTO</source>
|
||||
<prescript description="B1.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
|
||||
@ -133,23 +139,23 @@
|
||||
<section type="Foot" level="1" />
|
||||
<section type="Foot" level="2" height="2">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<field type="Stringa" width="23" id="101" pattern="1">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<prescript description="F2.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
|
||||
</field>
|
||||
</section>
|
||||
<section type="Foot" level="3" height="2">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript>CA_FORMAT_CONTO</prescript>
|
||||
<field type="Stringa" width="23" id="101" pattern="1">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<prescript description="F3.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
|
||||
</field>
|
||||
</section>
|
||||
<section type="Foot" level="4" height="2">
|
||||
<section type="Foot" level="4">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript>CA_FORMAT_CONTO</prescript>
|
||||
<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>
|
||||
</section>
|
||||
<sql>USE PCONANA SELECT LEN(CODCONTO)=10</sql>
|
||||
|
132
ca/ca3300b.rep
132
ca/ca3300b.rep
@ -17,17 +17,23 @@
|
||||
<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,DESCR</prescript>
|
||||
<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" />
|
||||
@ -38,8 +44,8 @@
|
||||
<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="AVERE" />
|
||||
<field x="155" y="7" type="Testo" align="right" width="13" pattern="1" text="DARE" />
|
||||
<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">
|
||||
@ -51,39 +57,53 @@
|
||||
<condition>CODCONTO:2!=""</condition>
|
||||
<groupby>CODCONTO:1</groupby>
|
||||
<prescript description="H2 PRESCRIPT">"CODCONTO:1" @
|
||||
"F2.101" !</prescript>
|
||||
"F2.101" !
|
||||
|
||||
"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" !</prescript>
|
||||
"F3.101" !
|
||||
|
||||
"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" !</prescript>
|
||||
"F4.101" ! \ Copia il codice conto nel footer
|
||||
|
||||
"F4" AZZERA_TOTALI</prescript>
|
||||
</section>
|
||||
<section type="Body" />
|
||||
<section type="Body" level="1">
|
||||
<field x="78" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:INI_DARE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.103|ADD,F3.103|ADD,F4.103
|
||||
</postscript>
|
||||
</field>
|
||||
<field x="92" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:INI_AVERE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.104|ADD,F3.104|ADD,F4.104</postscript>
|
||||
</field>
|
||||
<field x="109" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:MOV_DARE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.105|ADD,F3.105|ADD,F4.105</postscript>
|
||||
</field>
|
||||
<field x="123" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:MOV_AVERE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.106|ADD,F3.106|ADD,F4.106</postscript>
|
||||
</field>
|
||||
<field x="141" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:FIN_DARE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.107|ADD,F3.107|ADD,F4.107</postscript>
|
||||
</field>
|
||||
<field x="155" type="Valuta" align="right" width="13" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<source>SALDO:FIN_AVERE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.108|ADD,F3.108|ADD,F4.108</postscript>
|
||||
</field>
|
||||
<field type="Stringa" width="24" id="101" pattern="1">
|
||||
<source>CODCONTO</source>
|
||||
@ -95,26 +115,100 @@
|
||||
</section>
|
||||
<section type="Foot" />
|
||||
<section type="Foot" level="1" />
|
||||
<section type="Foot" level="2" height="2">
|
||||
<section type="Foot" level="2">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript description="F2.101 PRESCRIPT">CA_FORMAT_CONTO</prescript>
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript description="F2.101 PRESCRIPT">#THIS @ #102 !
|
||||
CA_FORMAT_CONTO</prescript>
|
||||
</field>
|
||||
<field x="25" type="Stringa" width="50" id="102" pattern="1">
|
||||
<prescript description="F2.102 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=#102,DESCR</prescript>
|
||||
</field>
|
||||
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F2.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="F2.107 PRESCRIPT">107 DARE_AVERE</prescript>
|
||||
</field>
|
||||
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@" />
|
||||
</section>
|
||||
<section type="Foot" level="3" height="2">
|
||||
<section type="Foot" level="3">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript>CA_FORMAT_CONTO</prescript>
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript description="F3.101 PRESCRIPT">#THIS @ #102 !
|
||||
CA_FORMAT_CONTO</prescript>
|
||||
</field>
|
||||
<field x="25" type="Stringa" width="50" id="102" pattern="1">
|
||||
<prescript description="F3.102 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=#102,DESCR</prescript>
|
||||
</field>
|
||||
<field x="78" type="Valuta" align="right" width="13" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F3.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="F3.107 PRESCRIPT">107 DARE_AVERE</prescript>
|
||||
</field>
|
||||
<field x="155" type="Valuta" align="right" width="13" id="108" pattern="1" hide_zero="1" text="###.###.###,@@" />
|
||||
</section>
|
||||
<section type="Foot" level="4" height="2">
|
||||
<section type="Foot" level="4">
|
||||
<condition>#101 != ""</condition>
|
||||
<field type="Testo" width="7" pattern="1" text="Totale" />
|
||||
<field x="8" type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript>CA_FORMAT_CONTO</prescript>
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field type="Stringa" width="23" id="101" pattern="1">
|
||||
<prescript description="F4.101 PRESCRIPT">#THIS @ #102 !
|
||||
CA_FORMAT_CONTO</prescript>
|
||||
</field>
|
||||
<field x="25" type="Stringa" width="50" id="102" pattern="1">
|
||||
<prescript description="F4.102 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=#102,DESCR</prescript>
|
||||
</field>
|
||||
<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="###.###.###,@@" />
|
||||
</section>
|
||||
<sql>USE PCONANA SELECT LEN(CODCONTO)=10</sql>
|
||||
<sql>USE PCONANA</sql>
|
||||
<prescript description="PRESCRIPT">: AZZERA_TOTALI ( ID_SEC - )
|
||||
MON
|
||||
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 C; IF \ Se negativo
|
||||
-1 * \ Cambia segno
|
||||
_AVERE @ ! \ Setta AVERE
|
||||
0 _DARE @ ! \ Azzera DARE
|
||||
ELSE
|
||||
_DARE @ ! \ Setta DARE
|
||||
0 _AVERE @ ! \ Azzera AVERE
|
||||
THEN
|
||||
;
|
||||
</prescript>
|
||||
</report>
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "ca3.h"
|
||||
#include "calib01.h"
|
||||
#include "../cg/cglib01.h"
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// APPLICAZIONE
|
||||
@ -97,9 +98,6 @@ void TRandom_ca::main_loop()
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
TRectype& rmov = mov.new_row();
|
||||
rmov.put(RMOVANA_DATACOMP, mov.get(MOVANA_DATACOMP));
|
||||
rmov.put(RMOVANA_ANNOES, mov.get(MOVANA_ANNOES));
|
||||
|
||||
TString80 descr; descr.format("Riga casuale %d", i+1);
|
||||
rmov.put(RMOVANA_DESCR, descr);
|
||||
|
||||
@ -140,8 +138,6 @@ void TRandom_ca::main_loop()
|
||||
for (i = 1; i <= rows; i++)
|
||||
{
|
||||
TRectype& rmov = mov.body()[i];
|
||||
rmov.put(RMOVANA_ANNOES, mov.get(MOVANA_ANNOES));
|
||||
rmov.put(RMOVANA_DATACOMP, mov.get(MOVANA_DATACOMP));
|
||||
real imp = rmov.get(RMOVANA_IMPORTO);
|
||||
imp += real((rand()%100)-50);
|
||||
rmov.put(RMOVANA_IMPORTO, imp);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "calib01.h"
|
||||
#include "calibmsk.h"
|
||||
#include "../cg/cg2103.h"
|
||||
|
||||
#include "movana.h"
|
||||
#include "rmovana.h"
|
||||
@ -1212,8 +1213,16 @@ int TAnal_mov::read(TBaseisamfile& f, word op, word lockop)
|
||||
return err;
|
||||
}
|
||||
|
||||
// Riporta su tutte le righe la data di competenza e l'esercizio dellla testata
|
||||
void TAnal_mov::update_datacomp() const
|
||||
{
|
||||
body().renum_key(RMOVANA_ANNOES, get(MOVANA_ANNOES));
|
||||
body().renum_key(RMOVANA_DATACOMP, get(MOVANA_DATACOMP));
|
||||
}
|
||||
|
||||
int TAnal_mov::write(TBaseisamfile& f) const
|
||||
{
|
||||
update_datacomp();
|
||||
const int err = TMultiple_rectype::write(f);
|
||||
if (err == NOERR)
|
||||
((TAnal_mov*)this)->update_saldi(false);
|
||||
@ -1222,6 +1231,7 @@ int TAnal_mov::write(TBaseisamfile& f) const
|
||||
|
||||
int TAnal_mov::rewrite(TBaseisamfile& f) const
|
||||
{
|
||||
update_datacomp();
|
||||
const int err = TMultiple_rectype::rewrite(f);
|
||||
if (err == NOERR)
|
||||
((TAnal_mov*)this)->update_saldi(false);
|
||||
|
@ -14,7 +14,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef __CGLIB03_H
|
||||
#include "../cg/cg2103.h"
|
||||
class TBill;
|
||||
#endif
|
||||
|
||||
|
||||
@ -129,6 +129,7 @@ protected:
|
||||
void kill_saldi() { _saldi.destroy(); }
|
||||
void update_saldi(bool kill);
|
||||
bool save_saldi();
|
||||
void update_datacomp() const;
|
||||
|
||||
public:
|
||||
virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop);
|
||||
@ -142,19 +143,16 @@ public:
|
||||
TAnal_mov(long numreg = 0);
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_rip
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TAnal_rip : public TMultiple_rectype
|
||||
{
|
||||
|
||||
public:
|
||||
TAnal_rip();
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCache_ripartizioni
|
||||
///////////////////////////////////////////////////////////
|
||||
|
278
ca/calib02.cpp
278
ca/calib02.cpp
@ -3,6 +3,9 @@
|
||||
#include "calib01.h"
|
||||
#include "calib02.h"
|
||||
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../include/rdoc.h"
|
||||
|
||||
#include "movana.h"
|
||||
#include "rmovana.h"
|
||||
#include "saldana.h"
|
||||
@ -133,6 +136,122 @@ bool TAnal_report::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_bill
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int TAnal_bill::compare(const TSortable& s) const
|
||||
{
|
||||
const TAnal_bill& b = (const TAnal_bill&)s;
|
||||
int cmp = _conto.compare(b._conto);
|
||||
if (cmp == 0)
|
||||
{
|
||||
cmp = _costo.compare(b._costo);
|
||||
if (cmp == 0)
|
||||
{
|
||||
cmp = _commessa.compare(b._commessa);
|
||||
if (cmp == 0)
|
||||
cmp = _fase.compare(b._fase);
|
||||
}
|
||||
}
|
||||
return cmp;
|
||||
}
|
||||
|
||||
bool TAnal_bill::match(const TAnal_bill& b) const
|
||||
{
|
||||
if (b._conto.not_empty() && _conto != b._conto)
|
||||
return false;
|
||||
if (b._costo.not_empty() && _costo != b._costo)
|
||||
return false;
|
||||
if (b._commessa.not_empty() && _commessa != b._commessa)
|
||||
return false;
|
||||
if (b._fase.not_empty() && _fase != b._fase)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TAnal_bill::set_conto(const char* c)
|
||||
{ _conto = c; _conto.trim(); }
|
||||
|
||||
void TAnal_bill::set_costo(const char* c)
|
||||
{ _costo = c; _costo.trim(); }
|
||||
|
||||
void TAnal_bill::set_commessa(const char* c)
|
||||
{ _commessa = c; _commessa.trim(); }
|
||||
|
||||
void TAnal_bill::set_fase(const char* c)
|
||||
{ _fase = c; _fase.trim(); }
|
||||
|
||||
const TString& TAnal_bill::conto() const
|
||||
{ return _conto; }
|
||||
|
||||
const TString& TAnal_bill::costo() const
|
||||
{ return _costo; }
|
||||
|
||||
const TString& TAnal_bill::commessa() const
|
||||
{ return _commessa; }
|
||||
|
||||
const TString& TAnal_bill::fase() const
|
||||
{ return _fase; }
|
||||
|
||||
void TAnal_bill::reset()
|
||||
{
|
||||
_conto = _costo = _commessa = _fase = "";
|
||||
}
|
||||
|
||||
bool TAnal_bill::get(const TRectype& rec)
|
||||
{
|
||||
bool ok = true;
|
||||
reset();
|
||||
switch(rec.num())
|
||||
{
|
||||
case LF_RMOVANA:
|
||||
set_conto(rec.get(RMOVANA_CODCONTO));
|
||||
set_costo(rec.get(RMOVANA_CODCCOSTO));
|
||||
set_commessa(rec.get(RMOVANA_CODCMS));
|
||||
set_fase(rec.get(RMOVANA_CODFASE));
|
||||
break;
|
||||
case LF_RIGHEDOC:
|
||||
set_commessa(RDOC_CODCMS);
|
||||
set_fase(RDOC_FASCMS);
|
||||
break;
|
||||
case LF_SALDANA:
|
||||
set_conto(rec.get(SALDANA_CONTO));
|
||||
set_costo(rec.get(SALDANA_COSTO));
|
||||
set_commessa(rec.get(SALDANA_COMMESSA));
|
||||
set_fase(rec.get(SALDANA_FASE));
|
||||
break;
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
TAnal_bill::TAnal_bill()
|
||||
{ }
|
||||
|
||||
TAnal_bill::TAnal_bill(const TAnal_bill& b)
|
||||
{
|
||||
set_conto(b.conto());
|
||||
set_costo(b.costo());
|
||||
set_commessa(b.commessa());
|
||||
set_fase(b.fase());
|
||||
}
|
||||
|
||||
TAnal_bill::TAnal_bill(const char* conto, const char* costo, const char* commessa, const char* fase)
|
||||
{
|
||||
set_conto(conto);
|
||||
set_costo(costo);
|
||||
set_commessa(commessa);
|
||||
set_fase(fase);
|
||||
}
|
||||
|
||||
TAnal_bill::TAnal_bill(const TRectype& rec)
|
||||
{
|
||||
get(rec);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_balance
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -140,22 +259,12 @@ bool TAnal_report::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
class TAnal_balance : public TObject
|
||||
{
|
||||
public:
|
||||
TImporto saldo_fine_anno(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
int annofin, word tipo) const;
|
||||
bool saldo_movimenti(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipo,
|
||||
TImporto& ini, TImporto& dare, TImporto& avere) const;
|
||||
bool saldi(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipo,
|
||||
TImporto& ini, TImporto& dare, TImporto& avere) const;
|
||||
TImporto saldo_fine_anno(const TAnal_bill& bill, int annofin, word tipo) const;
|
||||
bool saldo_movimenti(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipo, TSaldanal& s) const;
|
||||
bool saldi(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipo, TSaldanal& s) const;
|
||||
};
|
||||
|
||||
TImporto TAnal_balance::saldo_fine_anno(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
int anno, word tipo) const
|
||||
TImporto TAnal_balance::saldo_fine_anno(const TAnal_bill& b, int anno, word tipo) const
|
||||
{
|
||||
TImporto saldo;
|
||||
|
||||
@ -163,22 +272,22 @@ TImporto TAnal_balance::saldo_fine_anno(const char* conto, const char* costo,
|
||||
{
|
||||
TString query, select;
|
||||
|
||||
if (costo && *costo)
|
||||
select << "(CODCOSTO=='" << costo << "')";
|
||||
if (commessa && *commessa)
|
||||
if (b.costo().not_empty())
|
||||
select << "(CODCOSTO=='" << b.costo() << "')";
|
||||
if (b.commessa().not_empty())
|
||||
{
|
||||
if (select.not_empty()) select << "&&";
|
||||
select << "(COMMESSA=='" << commessa << "')";
|
||||
select << "(CODCMS=='" << b.commessa() << "')";
|
||||
}
|
||||
if (fase && *fase)
|
||||
if (b.fase().not_empty())
|
||||
{
|
||||
if (select.not_empty()) select << "&&";
|
||||
select << "(FASCMS=='" << fase << "')";
|
||||
select << "(FASCMS=='" << b.fase() << "')";
|
||||
}
|
||||
if (conto && *conto)
|
||||
if (b.conto().not_empty())
|
||||
{
|
||||
if (select.not_empty()) select << "&&";
|
||||
select << "(CONTO=='" << conto << "')";
|
||||
select << "(CONTO=='" << b.conto() << "')";
|
||||
}
|
||||
|
||||
query << "USE SALDANA";
|
||||
@ -216,10 +325,9 @@ TImporto TAnal_balance::saldo_fine_anno(const char* conto, const char* costo,
|
||||
return saldo;
|
||||
}
|
||||
|
||||
bool TAnal_balance::saldo_movimenti(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
bool TAnal_balance::saldo_movimenti(const TAnal_bill& b,
|
||||
const TDate& dal, const TDate& al, word tipo,
|
||||
TImporto& ini, TImporto& dare, TImporto& avere) const
|
||||
TSaldanal& s) const
|
||||
{
|
||||
TDate dataini;
|
||||
if (dal.ok())
|
||||
@ -232,57 +340,64 @@ bool TAnal_balance::saldo_movimenti(const char* conto, const char* costo,
|
||||
|
||||
TString query, select;
|
||||
|
||||
if (costo && *costo)
|
||||
if (b.costo().not_empty())
|
||||
{
|
||||
if (select.not_empty())
|
||||
select << "&&";
|
||||
select << "(CODCOSTO==\"" << costo << "\")";
|
||||
select << "(CODCOSTO==\"" << b.costo() << "\")";
|
||||
}
|
||||
if (commessa && *commessa)
|
||||
if (b.commessa().not_empty())
|
||||
{
|
||||
if (select.not_empty())
|
||||
select << "&&";
|
||||
select << "(CODCMS==\"" << commessa << "\")";
|
||||
select << "(CODCMS==\"" << b.commessa() << "\")";
|
||||
}
|
||||
if (fase && *fase)
|
||||
if (b.fase().not_empty())
|
||||
{
|
||||
if (select.not_empty())
|
||||
select << "&&";
|
||||
select << "(CODFASE==\"" << fase << "\")";
|
||||
select << "(CODFASE==\"" << b.fase() << "\")";
|
||||
}
|
||||
|
||||
query << "USE RMOVANA KEY 2\n";
|
||||
if (select.not_empty())
|
||||
query << "SELECT " << select << "\n";
|
||||
query << "JOIN MOVANA INTO NUMREG==NUMREG\n";
|
||||
|
||||
query << "FROM CODCONTO=" << conto;
|
||||
// Faccio la join solo se mi serve il tipo movimento in testata
|
||||
if (tipo != 0 && tipo != 7)
|
||||
query << "JOIN MOVANA INTO NUMREG==NUMREG\n";
|
||||
|
||||
query << "FROM CODCONTO=" << b.conto();
|
||||
if (dataini.ok())
|
||||
query << " DATACOMP=" << dataini.string();
|
||||
query << " DATACOMP=" << dataini;
|
||||
query << "\n";
|
||||
|
||||
query << "TO CODCONTO=" << conto;
|
||||
query << "TO CODCONTO=" << b.conto();
|
||||
if (al.ok())
|
||||
query << " DATACOMP=" << al.string();
|
||||
query << " DATACOMP=" << al;
|
||||
query << "\n";
|
||||
|
||||
TISAM_recordset rmovana(query);
|
||||
|
||||
bool movimentato = false;
|
||||
s._movimentato = false;
|
||||
for (int i = 0; i < rmovana.items(); i++)
|
||||
{
|
||||
rmovana.move_to(i);
|
||||
|
||||
const char tipomov = rmovana.get("107.TIPOMOV").as_string()[0];
|
||||
int ntipomov = 0;
|
||||
if (tipomov == 'P')
|
||||
ntipomov = 2; else
|
||||
if (tipomov == 'V')
|
||||
ntipomov = 4;
|
||||
else
|
||||
ntipomov = 1;
|
||||
if ((ntipomov & tipo) == 0)
|
||||
continue;
|
||||
// Controllo il tipo movimento solo se necessario
|
||||
if (tipo != 0 && tipo != 7)
|
||||
{
|
||||
const char tipomov = rmovana.get("107.TIPOMOV").as_string()[0];
|
||||
int ntipomov = 0;
|
||||
if (tipomov == 'P')
|
||||
ntipomov = 2; else
|
||||
if (tipomov == 'V')
|
||||
ntipomov = 4;
|
||||
else
|
||||
ntipomov = 1;
|
||||
if ((ntipomov & tipo) == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
const TDate data = rmovana.get(RMOVANA_DATACOMP).as_date();
|
||||
const TImporto imp(rmovana.get(RMOVANA_SEZIONE).as_string()[0],
|
||||
@ -290,32 +405,32 @@ bool TAnal_balance::saldo_movimenti(const char* conto, const char* costo,
|
||||
if (data >= dal)
|
||||
{
|
||||
if (imp.sezione() == 'D')
|
||||
dare += imp;
|
||||
s._dare += imp;
|
||||
else
|
||||
avere += imp;
|
||||
movimentato = true;
|
||||
s._avere += imp;
|
||||
s._movimentato = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ini += imp;
|
||||
s._ini += imp;
|
||||
}
|
||||
}
|
||||
ini.normalize();
|
||||
|
||||
return movimentato;
|
||||
s._ini.normalize();
|
||||
s._fin = s._ini;
|
||||
s._fin += s._dare;
|
||||
s._fin += s._avere;
|
||||
s._fin.normalize();
|
||||
return s._movimentato;
|
||||
}
|
||||
|
||||
bool TAnal_balance::saldi(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
bool TAnal_balance::saldi(const TAnal_bill& bill,
|
||||
const TDate& dal, const TDate& al, word tipo,
|
||||
TImporto& ini, TImporto& dare, TImporto& avere) const
|
||||
TSaldanal& s) const
|
||||
{
|
||||
TEsercizi_contabili esc;
|
||||
const int annoprec = esc.date2prevesc(dal);
|
||||
ini = saldo_fine_anno(conto, costo, commessa, fase, annoprec, tipo);
|
||||
const bool mov = saldo_movimenti(conto, costo, commessa, fase, dal, al, tipo,
|
||||
ini, dare, avere);
|
||||
return mov;
|
||||
s._ini = saldo_fine_anno(bill, annoprec, tipo);
|
||||
return saldo_movimenti(bill, dal, al, tipo, s);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@ -324,13 +439,13 @@ bool TAnal_balance::saldi(const char* conto, const char* costo,
|
||||
|
||||
class TSaldi_cache : private TCache
|
||||
{
|
||||
TAnal_balance _bal;
|
||||
|
||||
protected:
|
||||
virtual TObject* key2obj(const char* key);
|
||||
|
||||
public:
|
||||
const TSaldanal& saldo(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipi = 0x1);
|
||||
const TSaldanal& saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi = 0x1);
|
||||
TSaldi_cache() : TCache(3883) { }
|
||||
};
|
||||
|
||||
@ -339,44 +454,31 @@ TObject* TSaldi_cache::key2obj(const char* key)
|
||||
TSaldanal* s = new TSaldanal;
|
||||
|
||||
TToken_string tok(key);
|
||||
TString80 conto = tok.get(); conto.trim();
|
||||
TString80 costo = tok.get(); costo.trim();
|
||||
TString80 commessa = tok.get(); commessa.trim();
|
||||
TString80 fase = tok.get(); fase.trim();
|
||||
const TDate dal = tok.get();
|
||||
const TAnal_bill bill(tok.get(0), tok.get(1), tok.get(2), tok.get(3));
|
||||
const TDate dal = tok.get(4); // Le get precedenti avvengono in ordine inverso!
|
||||
const TDate al = tok.get();
|
||||
const char tipo = tok.get_char();
|
||||
|
||||
TAnal_balance bal;
|
||||
s->_movimentato = bal.saldi(conto, costo, commessa, fase, dal, al, tipo,
|
||||
s->_ini, s->_dare, s->_avere);
|
||||
s->_fin = s->_ini; s->_fin += s->_dare; s->_fin += s->_avere;
|
||||
s->_fin.normalize();
|
||||
|
||||
const int tipo = tok.get_int();
|
||||
s->_movimentato = _bal.saldi(bill, dal, al, tipo, *s);
|
||||
return s;
|
||||
}
|
||||
|
||||
const TSaldanal& TSaldi_cache::saldo(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipi)
|
||||
const TSaldanal& TSaldi_cache::saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi)
|
||||
{
|
||||
TToken_string key;
|
||||
key.add(conto, 0);
|
||||
key.add(costo, 1);
|
||||
key.add(commessa, 2);
|
||||
key.add(fase, 3);
|
||||
key.add(bill.conto(), 0);
|
||||
key.add(bill.costo(), 1);
|
||||
key.add(bill.commessa(), 2);
|
||||
key.add(bill.fase(), 3);
|
||||
key.add(dal, 4);
|
||||
key.add(al, 5);
|
||||
key.add(tipi, 6);
|
||||
return *(const TSaldanal*)objptr(key);
|
||||
}
|
||||
|
||||
const TSaldanal& ca_saldo(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipi)
|
||||
const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi)
|
||||
{
|
||||
static TSaldi_cache* cache = NULL;
|
||||
if (cache == NULL)
|
||||
cache = new TSaldi_cache;
|
||||
return cache->saldo(conto, costo, commessa, fase, dal, al, tipi);
|
||||
return cache->saldo(bill, dal, al, tipi);
|
||||
}
|
||||
|
38
ca/calib02.h
38
ca/calib02.h
@ -29,6 +29,39 @@ protected: // protected is safer
|
||||
public: // meglio pubic?
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_bill
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Classe simile al TBill, che contiene un conto piu' o meno completo di analitica
|
||||
class TAnal_bill : public TSortable
|
||||
{
|
||||
TString _conto, _costo, _commessa, _fase;
|
||||
|
||||
public:
|
||||
virtual int compare(const TSortable& s) const;
|
||||
bool match(const TAnal_bill& b) const;
|
||||
|
||||
public:
|
||||
void set_conto(const char* c);
|
||||
void set_costo(const char* c);
|
||||
void set_commessa(const char* c);
|
||||
void set_fase(const char* c);
|
||||
|
||||
const TString& conto() const;
|
||||
const TString& costo() const;
|
||||
const TString& commessa() const;
|
||||
const TString& fase() const;
|
||||
|
||||
bool get(const TRectype& rec);
|
||||
void reset();
|
||||
|
||||
TAnal_bill();
|
||||
TAnal_bill(const TAnal_bill& bill);
|
||||
TAnal_bill(const char* conto, const char* costo, const char* commessa, const char* fase);
|
||||
TAnal_bill(const TRectype& rec);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_balance
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -41,9 +74,6 @@ struct TSaldanal : public TObject
|
||||
bool _movimentato;
|
||||
};
|
||||
|
||||
const TSaldanal& ca_saldo(const char* conto, const char* costo,
|
||||
const char* commessa, const char* fase,
|
||||
const TDate& dal, const TDate& al, word tipi = 1);
|
||||
|
||||
const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi = 1);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user