Patch level :4.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :stampa bilancio di commessa; commit di sicurezza;appaiono i primi numeri!


git-svn-id: svn://10.65.10.50/trunk@14144 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-07-11 12:20:19 +00:00
parent 9af41f5c34
commit ab7c42d80a
2 changed files with 184 additions and 74 deletions

View File

@ -147,8 +147,9 @@ protected:
virtual TObject* key2obj(const char* key); virtual TObject* key2obj(const char* key);
public: public:
int get_indbil(const TString& conto); int get_indbil(const TString& conto, TString& conto_anale);
void set_prefix(const char* prefix); void set_prefix(const char* prefix);
int get_prefix_length() const { return _prefix.len(); }
TIndbil_cache(); TIndbil_cache();
}; };
@ -201,15 +202,18 @@ TObject* TIndbil_cache::key2obj(const char* key)
//conto analitico //conto analitico
TAnal_bill bill(conto); TAnal_bill bill(conto);
int indbil = bill.indicatore_bilancio(); int indbil = bill.indicatore_bilancio();
TString* ib = new TString4; TToken_string* ib = new TToken_string;
*ib << indbil; *ib << indbil;
ib->add(conto);
return ib; return ib;
} }
int TIndbil_cache::get_indbil(const TString& conto) int TIndbil_cache::get_indbil(const TString& conto, TString& conto_anale)
{ {
TString* ib = (TString*)objptr(conto); TToken_string* ib = (TToken_string*)objptr(conto);
return ib ? atoi(*ib) : 0; if (ib != NULL)
ib->get(1, conto_anale);
return ib ? ib->get_int(0) : 0;
} }
void TIndbil_cache::set_prefix(const char* prefix) void TIndbil_cache::set_prefix(const char* prefix)
@ -253,6 +257,10 @@ protected:
virtual const TVariant& get(unsigned int column) const; virtual const TVariant& get(unsigned int column) const;
virtual const TVariant& get(const char* column_name) const; virtual const TVariant& get(const char* column_name) const;
void parse_bill(const TString& bill, TString& gruppo, TString& conto) const;
void aggiorna_importo(TAssoc_array* riga_array, const TString& livello,
const int indbil, const TRecordset& saldana) const;
public: public:
virtual void set_filter(const TPrint_bilancio_cms_mask& msk); virtual void set_filter(const TPrint_bilancio_cms_mask& msk);
}; };
@ -264,6 +272,56 @@ bool TPrint_bilancio_cms_recordset::move_to(TRecnotype pos)
return pos >= 0 && pos < items(); return pos >= 0 && pos < items();
} }
void TPrint_bilancio_cms_recordset::parse_bill(const TString& bill, TString& gruppo, TString& conto) const
{
TConfig& cfg = ca_config();
const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA);
const int pconana_levels = pconana_info.levels();
const int prefix = cfg.get_int("PdcPrefix")-1;
//lunghezza dell'eventuale prefisso di gruppo e conto
const int prefix_len = (prefix >= 0) ? pconana_info.total_len(prefix) : 0;
const int gruppo_len = pconana_info.len(prefix + 1);
const int conto_len = pconana_info.len(prefix + 2);
//stringhe con gruppo e conto da mettere nel record dell'assoc_array
gruppo = bill.mid(prefix_len, gruppo_len);
conto = bill.mid(prefix_len, gruppo_len + conto_len);
}
void TPrint_bilancio_cms_recordset::aggiorna_importo(TAssoc_array* riga_array,
const TString& livello, const int indbil, const TRecordset& saldana) const
{
TString* str_imp = (TString*)riga_array->objptr(livello);
if (str_imp == NULL)
{
str_imp = new TString;
riga_array->add(livello, str_imp);
}
//dare o avere?
const char sezione = indbil == 3 ? 'D' : 'A';
TImporto imp(sezione, real(*str_imp));
/*
const TImporto imp_saldop(saldana.get(SALDANA_SEZIONEP).as_string()[0],
saldana.get(SALDANA_SALDOP).as_real());
const TImporto imp_saldov(saldana.get(SALDANA_SEZIONEV).as_string()[0],
saldana.get(SALDANA_SALDOV).as_real());
imp += imp_saldop;
imp += imp_saldov;
*/
const TImporto imp_saldo(saldana.get(SALDANA_SEZIONE).as_string()[0],
saldana.get(SALDANA_SALDO).as_real());
imp += imp_saldo;
imp.normalize(sezione);
*str_imp = imp.valore().string();
}
void TPrint_bilancio_cms_recordset::requery() void TPrint_bilancio_cms_recordset::requery()
{ {
//prende le date di inizio e fine dell'eserizio selezionato sulla maschera //prende le date di inizio e fine dell'eserizio selezionato sulla maschera
@ -284,11 +342,17 @@ void TPrint_bilancio_cms_recordset::requery()
TISAM_recordset saldana(query); TISAM_recordset saldana(query);
for (bool ok = saldana.move_first(); ok; ok = saldana.move_next()) for (bool ok = saldana.move_first(); ok; ok = saldana.move_next())
{ {
const TString& conto = saldana.get(SALDANA_CONTO).as_string(); const TString& codconto = saldana.get(SALDANA_CONTO).as_string();
//trova l'indicatore di bilancio //trova l'indicatore di bilancio
const int indbil = _indicatori.get_indbil(conto); TString80 conto_anale;
const int indbil = _indicatori.get_indbil(codconto, conto_anale);
//solo i Costi(3) ed i Ricavi(4) devono essere considerati per la stampa
if (indbil == 3 || indbil == 4) if (indbil == 3 || indbil == 4)
{
//solo i record di tipo Preventivo(P) o Variazione(V) devono essere considerati
const real saldop = saldana.get(SALDANA_SALDOP).as_real();
const real saldov = saldana.get(SALDANA_SALDOV).as_real();
//if (saldop != ZERO || saldov != ZERO)
{ {
const TString& codcms = saldana.get(SALDANA_COMMESSA).as_string(); const TString& codcms = saldana.get(SALDANA_COMMESSA).as_string();
const TString& fase = saldana.get(SALDANA_FASE).as_string(); const TString& fase = saldana.get(SALDANA_FASE).as_string();
@ -327,8 +391,16 @@ void TPrint_bilancio_cms_recordset::requery()
//aggiunge la riga all'array-ino //aggiunge la riga all'array-ino
cms[indice].add(chiave, riga_array); cms[indice].add(chiave, riga_array);
} }
} //if (datafine >= datainiesc &&... //aggiunge gli importi e normalizza
TString80 gruppo, conto;
parse_bill(conto_anale, gruppo, conto);
aggiorna_importo(riga_array, gruppo, indbil, saldana);
aggiorna_importo(riga_array, conto, indbil, saldana);
} //if (datafine >= datainiesc &&...
} //if (saldop != ZERO..
} //if (indbil == 3 ||... } //if (indbil == 3 ||...
} }

View File

@ -1,5 +1,5 @@
<report libraries="ve1300" name="ca3800a" orientation="2" lpi="9" class="ca3800a"> <report libraries="ve1300" name="ca3800a" orientation="2" lpi="6" class="ca3800a">
<description>Bilancio commessa CA</description> <description>Bilancio commessa CA</description>
<font face="Courier New" size="8" /> <font face="Courier New" size="8" />
<section type="Head"> <section type="Head">
@ -13,11 +13,17 @@
<field x="165" type="Numero" align="right" width="3" pattern="1"> <field x="165" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source> <source>#REPORT.PAGE</source>
</field> </field>
<field border="2" x="1" y="2" type="Linea" width="169" height="0" pattern="1" /> <field border="2" x="1" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<field x="70" y="2.5" type="Testo" width="80" pattern="1" text="Costi e ricavi di Commessa maturati nell'esercizio - Stima avanzamento TEMPO" /> <field x="70" y="1.75" type="Testo" width="57" pattern="1" text="Costi e ricavi di Commessa maturati nell'esercizio">
<font italic="1" face="Courier New" size="9" />
</field>
<field x="130" y="1.75" type="Testo" width="28" pattern="1" text="Stima avanzamento TEMPO" />
<field x="160" y="2.25" type="Testo" width="10" pattern="1" text="Margine" />
<field x="80" y="2.75" type="Testo" align="center" width="60" pattern="1" text="Costi" />
<field x="160" y="3.25" type="Testo" width="10" pattern="1" text=" Contribuz.
" />
<field x="70" y="3.75" type="Testo" width="8" pattern="1" text="Ricavi" /> <field x="70" y="3.75" type="Testo" width="8" pattern="1" text="Ricavi" />
<field x="80" y="3.75" type="Testo" align="center" width="60" pattern="1" text="Costi" /> <field border="1" x="1" y="4.75" type="Linea" width="169" height="0" pattern="1" />
<field border="1" x="1" y="5.5" type="Linea" width="169" height="0" pattern="1" />
<field x="1" y="3.5" type="Testo" width="15" id="121" pattern="1" text="Commessa" /> <field x="1" y="3.5" type="Testo" width="15" id="121" pattern="1" text="Commessa" />
</section> </section>
<section type="Head" level="1" height="6"> <section type="Head" level="1" height="6">
@ -33,11 +39,11 @@
</field> </field>
<field border="2" x="1" y="5" type="Linea" width="169" height="0" pattern="1" /> <field border="2" x="1" y="5" type="Linea" width="169" height="0" pattern="1" />
</section> </section>
<section type="Head" level="2" height="3" page_break="1"> <section type="Head" level="2" height="2" page_break="1">
<groupby>LEVEL &#3C; 2</groupby> <groupby>LEVEL &#3C; 2</groupby>
<font italic="1" face="Courier New" size="8" /> <font italic="1" face="Courier New" size="9" />
<field x="1" y="0.5" type="Array" bg_color="#C0C0C0" width="35" height="1.5"> <field x="1" y="0.25" type="Array" bg_color="#C0C0C0" width="35">
<font italic="1" face="Courier New" bold="1" size="10" /> <font italic="1" face="Courier New" bold="1" size="9" />
<source>LEVEL</source> <source>LEVEL</source>
<list> <list>
<li Value="Commesse terminate nel" Code="0" /> <li Value="Commesse terminate nel" Code="0" />
@ -46,23 +52,24 @@
<li Value="Commesse in corso entro fine" Code="3" /> <li Value="Commesse in corso entro fine" Code="3" />
</list> </list>
</field> </field>
<field x="36" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="6" height="1.5"> <field x="36" y="0.25" type="Numero" align="right" bg_color="#C0C0C0" width="6">
<font face="Courier New" bold="1" size="10" /> <font face="Courier New" bold="1" size="9" />
<source>ANNO</source> <source>ANNO</source>
</field> </field>
<field border="1" x="1" y="2.5" type="Linea" width="169" height="0" pattern="1" /> <field border="1" x="1" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<field y="0.5" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1"> <field y="0.25" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1">
<source>LEVEL</source> <source>LEVEL</source>
<postscript description="H2.101 POSTSCRIPT">MESSAGE COPY,F2.101</postscript> <postscript description="H2.101 POSTSCRIPT">MESSAGE COPY,F2.101</postscript>
</field> </field>
<field x="42" y="0.75" type="Numero" hidden="1" align="right" width="4" id="102" pattern="1"> <field x="42" y="0.25" type="Numero" hidden="1" align="right" width="4" id="102" pattern="1">
<source>ANNO</source> <source>ANNO</source>
<postscript description="H2.102 POSTSCRIPT">MESSAGE COPY,F2.102</postscript> <postscript description="H2.102 POSTSCRIPT">MESSAGE COPY,F2.102</postscript>
</field> </field>
</section> </section>
<section type="Head" level="3" height="4"> <section type="Head" level="3" height="2">
<groupby>LEVEL</groupby> <groupby>LEVEL</groupby>
<field x="3" y="1.25" type="Array" bg_color="#C0C0C0" width="45" pattern="1"> <font face="Courier New" size="8" />
<field x="3" y="0.25" type="Array" bg_color="#C0C0C0" width="45" pattern="1">
<font italic="1" face="Courier New" bold="1" size="8" /> <font italic="1" face="Courier New" bold="1" size="8" />
<source>LEVEL</source> <source>LEVEL</source>
<list> <list>
@ -72,21 +79,52 @@
<li Value="Commesse avviate nell'esercizio selezionato" Code="3" /> <li Value="Commesse avviate nell'esercizio selezionato" Code="3" />
</list> </list>
</field> </field>
<field border="1" x="2" y="3" type="Linea" width="169" height="0" pattern="1" /> <field border="1" x="2" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<field y="1.25" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1"> <field y="0.25" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1">
<source>LEVEL</source> <source>LEVEL</source>
<postscript description="H3.101 POSTSCRIPT">MESSAGE COPY,F3.101</postscript> <postscript description="H3.101 POSTSCRIPT">MESSAGE COPY,F3.101</postscript>
</field> </field>
</section> </section>
<section type="Body" /> <section type="Body" />
<section type="Body" level="1"> <section type="Body" level="1">
<condition>HIDDEN!='X'</condition> <field x="1" type="Stringa" width="20" pattern="1">
<field x="1" y="0.5" type="Stringa" width="20" pattern="1">
<source>CODCMS</source> <source>CODCMS</source>
</field> </field>
<field x="22" y="0.5" type="Stringa" dynamic_height="1" width="30" height="2" pattern="1"> <field x="21" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1">
<source>DESCRIZ</source> <source>DESCRIZ</source>
</field> </field>
<field x="46" type="Stringa" width="10" pattern="1">
<source>FASE</source>
</field>
<field x="57" type="Numero" align="right" width="3" pattern="1">
<source>100</source>
</field>
<field x="61" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#RIC</source>
</field>
<field x="73" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC01</source>
</field>
<field x="85" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC02</source>
</field>
<field x="97" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC03</source>
</field>
<field x="109" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC04</source>
</field>
<field x="121" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC05</source>
</field>
<field x="133" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COSC06</source>
</field>
<field x="145" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@">
<source>#COS</source>
</field>
<field x="157" type="Valuta" align="right" width="12" pattern="1" text="###.###.###,@@" />
<field x="170" type="Numero" align="right" width="3" pattern="1" />
</section> </section>
<section type="Foot" /> <section type="Foot" />
<section type="Foot" level="1" height="3"> <section type="Foot" level="1" height="3">
@ -95,11 +133,11 @@
<font face="Courier New" bold="1" size="10" /> <font face="Courier New" bold="1" size="10" />
</field> </field>
</section> </section>
<section type="Foot" level="2" height="3.5"> <section type="Foot" level="2" height="2.5">
<font face="Courier New" size="10" /> <font face="Courier New" size="9" />
<field border="1" x="1" y="0.5" type="Linea" width="169" height="0" pattern="1" /> <field border="1" x="1" y="0.5" type="Linea" width="169" height="0" pattern="1" />
<field x="1" y="1" type="Array" bg_color="#C0C0C0" width="45" height="1.5"> <field x="1" y="1" type="Array" bg_color="#C0C0C0" width="45">
<font italic="1" face="Courier New" bold="1" size="10" /> <font italic="1" face="Courier New" bold="1" size="9" />
<source>F2.101</source> <source>F2.101</source>
<list> <list>
<li Value="TOTALI Commesse terminate nel" Code="0" /> <li Value="TOTALI Commesse terminate nel" Code="0" />
@ -108,18 +146,18 @@
<li Value="TOTALI Commesse in corso entro fine" Code="3" /> <li Value="TOTALI Commesse in corso entro fine" Code="3" />
</list> </list>
</field> </field>
<field x="46" y="1" type="Numero" align="right" bg_color="#C0C0C0" width="6" height="1.5"> <field x="46" y="1" type="Numero" align="right" bg_color="#C0C0C0" width="6">
<font face="Courier New" bold="1" size="10" /> <font face="Courier New" bold="1" size="9" />
<source>F2.102</source> <source>F2.102</source>
</field> </field>
<field y="1" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" /> <field y="1" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
<field x="52" y="1.25" type="Numero" hidden="1" align="right" width="4" id="102" pattern="1"> <field x="52" y="1" type="Numero" hidden="1" align="right" width="4" id="102" pattern="1">
<postscript description="F2.102 POSTSCRIPT">MESSAGE COPY,F2.101</postscript> <postscript description="F2.102 POSTSCRIPT">MESSAGE COPY,F2.101</postscript>
</field> </field>
</section> </section>
<section type="Foot" level="3" height="3.5"> <section type="Foot" level="3" height="2">
<field border="1" x="2" y="0.5" type="Linea" width="169" height="0" pattern="1" /> <field border="1" x="2" y="0.25" type="Linea" width="169" height="0" pattern="1" />
<field x="3" y="1" type="Array" bg_color="#C0C0C0" width="50" pattern="1"> <field x="3" y="0.5" type="Array" bg_color="#C0C0C0" width="50" pattern="1">
<font italic="1" face="Courier New" bold="1" size="8" /> <font italic="1" face="Courier New" bold="1" size="8" />
<source>F3.101</source> <source>F3.101</source>
<list> <list>
@ -129,7 +167,7 @@
<li Value="TOTALI Commesse avviate nell'esercizio selezionato" Code="3" /> <li Value="TOTALI Commesse avviate nell'esercizio selezionato" Code="3" />
</list> </list>
</field> </field>
<field y="1" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" /> <field y="0.5" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
</section> </section>
<sql>USE SALDANA</sql> <sql>USE SALDANA</sql>
</report> </report>