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);
public:
int get_indbil(const TString& conto);
int get_indbil(const TString& conto, TString& conto_anale);
void set_prefix(const char* prefix);
int get_prefix_length() const { return _prefix.len(); }
TIndbil_cache();
};
@ -201,15 +202,18 @@ TObject* TIndbil_cache::key2obj(const char* key)
//conto analitico
TAnal_bill bill(conto);
int indbil = bill.indicatore_bilancio();
TString* ib = new TString4;
TToken_string* ib = new TToken_string;
*ib << indbil;
ib->add(conto);
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);
return ib ? atoi(*ib) : 0;
TToken_string* ib = (TToken_string*)objptr(conto);
if (ib != NULL)
ib->get(1, conto_anale);
return ib ? ib->get_int(0) : 0;
}
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(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:
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();
}
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()
{
//prende le date di inizio e fine dell'eserizio selezionato sulla maschera
@ -284,51 +342,65 @@ void TPrint_bilancio_cms_recordset::requery()
TISAM_recordset saldana(query);
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
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)
{
const TString& codcms = saldana.get(SALDANA_COMMESSA).as_string();
const TString& fase = saldana.get(SALDANA_FASE).as_string();
const TRectype& rec_commesse = cache().get(LF_COMMESSE, codcms);
const TDate dataini = rec_commesse.get(COMMESSE_DATAINIZIO);
const TDate datafine = rec_commesse.get(COMMESSE_DATAFINE);
//e' inutile considerare le commesse terminate prima dell'esercizio selezionato..
//..cioe' nel passato oppure che iniziano nel futuro!
if (datafine >= datainiesc && dataini <= datafinesc)
//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)
{
int indice = datafine <= datafinesc ? 0 : 2;
if (dataini >= datainiesc)
indice++;
const TString& codcms = saldana.get(SALDANA_COMMESSA).as_string();
const TString& fase = saldana.get(SALDANA_FASE).as_string();
TString80 chiave = codcms;
if (_use_fasi)
chiave << '|' << fase;
const TRectype& rec_commesse = cache().get(LF_COMMESSE, codcms);
//cerca se la commessa (e l'eventuale fase) esistono gia' nell'assocarray delle commesse
TAssoc_array* riga_array = (TAssoc_array*)cms[indice].objptr(chiave);
//se non esiste la crea!
if (riga_array == NULL)
const TDate dataini = rec_commesse.get(COMMESSE_DATAINIZIO);
const TDate datafine = rec_commesse.get(COMMESSE_DATAFINE);
//e' inutile considerare le commesse terminate prima dell'esercizio selezionato..
//..cioe' nel passato oppure che iniziano nel futuro!
if (datafine >= datainiesc && dataini <= datafinesc)
{
riga_array = new TAssoc_array;
TString4 str_indice; //l'indice va stringato per l'assoc_array
str_indice << indice;
riga_array->add("LEVEL", str_indice);
riga_array->add("CODCMS", codcms);
riga_array->add("FASE", fase);
riga_array->add("DESCRIZ", rec_commesse.get(COMMESSE_DESCRIZ));
//aggiunge la riga all'array-ino
cms[indice].add(chiave, riga_array);
}
} //if (datafine >= datainiesc &&...
int indice = datafine <= datafinesc ? 0 : 2;
if (dataini >= datainiesc)
indice++;
TString80 chiave = codcms;
if (_use_fasi)
chiave << '|' << fase;
//cerca se la commessa (e l'eventuale fase) esistono gia' nell'assocarray delle commesse
TAssoc_array* riga_array = (TAssoc_array*)cms[indice].objptr(chiave);
//se non esiste la crea!
if (riga_array == NULL)
{
riga_array = new TAssoc_array;
TString4 str_indice; //l'indice va stringato per l'assoc_array
str_indice << indice;
riga_array->add("LEVEL", str_indice);
riga_array->add("CODCMS", codcms);
riga_array->add("FASE", fase);
riga_array->add("DESCRIZ", rec_commesse.get(COMMESSE_DESCRIZ));
//aggiunge la riga all'array-ino
cms[indice].add(chiave, riga_array);
}
//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 ||...
}

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>
<font face="Courier New" size="8" />
<section type="Head">
@ -13,11 +13,17 @@
<field x="165" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field border="2" x="1" y="2" 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 border="2" x="1" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<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="80" y="3.75" type="Testo" align="center" width="60" pattern="1" text="Costi" />
<field border="1" x="1" y="5.5" type="Linea" width="169" height="0" pattern="1" />
<field border="1" x="1" y="4.75" type="Linea" width="169" height="0" pattern="1" />
<field x="1" y="3.5" type="Testo" width="15" id="121" pattern="1" text="Commessa" />
</section>
<section type="Head" level="1" height="6">
@ -33,11 +39,11 @@
</field>
<field border="2" x="1" y="5" type="Linea" width="169" height="0" pattern="1" />
</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>
<font italic="1" face="Courier New" size="8" />
<field x="1" y="0.5" type="Array" bg_color="#C0C0C0" width="35" height="1.5">
<font italic="1" face="Courier New" bold="1" size="10" />
<font italic="1" face="Courier New" size="9" />
<field x="1" y="0.25" type="Array" bg_color="#C0C0C0" width="35">
<font italic="1" face="Courier New" bold="1" size="9" />
<source>LEVEL</source>
<list>
<li Value="Commesse terminate nel" Code="0" />
@ -46,23 +52,24 @@
<li Value="Commesse in corso entro fine" Code="3" />
</list>
</field>
<field x="36" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="6" height="1.5">
<font face="Courier New" bold="1" size="10" />
<field x="36" y="0.25" type="Numero" align="right" bg_color="#C0C0C0" width="6">
<font face="Courier New" bold="1" size="9" />
<source>ANNO</source>
</field>
<field border="1" x="1" y="2.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 border="1" x="1" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<field y="0.25" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1">
<source>LEVEL</source>
<postscript description="H2.101 POSTSCRIPT">MESSAGE COPY,F2.101</postscript>
</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>
<postscript description="H2.102 POSTSCRIPT">MESSAGE COPY,F2.102</postscript>
</field>
</section>
<section type="Head" level="3" height="4">
<section type="Head" level="3" height="2">
<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" />
<source>LEVEL</source>
<list>
@ -72,21 +79,52 @@
<li Value="Commesse avviate nell'esercizio selezionato" Code="3" />
</list>
</field>
<field border="1" x="2" y="3" 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 border="1" x="2" y="1.5" type="Linea" width="169" height="0" pattern="1" />
<field y="0.25" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1">
<source>LEVEL</source>
<postscript description="H3.101 POSTSCRIPT">MESSAGE COPY,F3.101</postscript>
</field>
</section>
<section type="Body" />
<section type="Body" level="1">
<condition>HIDDEN!='X'</condition>
<field x="1" y="0.5" type="Stringa" width="20" pattern="1">
<field x="1" type="Stringa" width="20" pattern="1">
<source>CODCMS</source>
</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>
</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 type="Foot" />
<section type="Foot" level="1" height="3">
@ -95,11 +133,11 @@
<font face="Courier New" bold="1" size="10" />
</field>
</section>
<section type="Foot" level="2" height="3.5">
<font face="Courier New" size="10" />
<section type="Foot" level="2" height="2.5">
<font face="Courier New" size="9" />
<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">
<font italic="1" face="Courier New" bold="1" size="10" />
<field x="1" y="1" type="Array" bg_color="#C0C0C0" width="45">
<font italic="1" face="Courier New" bold="1" size="9" />
<source>F2.101</source>
<list>
<li Value="TOTALI Commesse terminate nel" Code="0" />
@ -108,18 +146,18 @@
<li Value="TOTALI Commesse in corso entro fine" Code="3" />
</list>
</field>
<field x="46" y="1" type="Numero" align="right" bg_color="#C0C0C0" width="6" height="1.5">
<font face="Courier New" bold="1" size="10" />
<field x="46" y="1" type="Numero" align="right" bg_color="#C0C0C0" width="6">
<font face="Courier New" bold="1" size="9" />
<source>F2.102</source>
</field>
<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>
</field>
</section>
<section type="Foot" level="3" height="3.5">
<field border="1" x="2" y="0.5" type="Linea" width="169" height="0" pattern="1" />
<field x="3" y="1" type="Array" bg_color="#C0C0C0" width="50" pattern="1">
<section type="Foot" level="3" height="2">
<field border="1" x="2" y="0.25" type="Linea" width="169" height="0" 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" />
<source>F3.101</source>
<list>
@ -129,7 +167,7 @@
<li Value="TOTALI Commesse avviate nell'esercizio selezionato" Code="3" />
</list>
</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>
<sql>USE SALDANA</sql>
</report>