Patch level :4.0 500
Files correlati :ca3 & friends Ricompilazione Demo : [ ] Commento :ca3900 (stima ricavi di competenza) primo funzionamento;sara' giusto? git-svn-id: svn://10.65.10.50/trunk@14350 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
596ef8b6e2
commit
9ca3bd8ff2
@ -164,11 +164,12 @@ 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;
|
||||
int estrai_saldi(const TRecordset& saldana, const int indbil,
|
||||
TImporto& saldo, TImporto& saldop) const;
|
||||
void aggiorna_importo(TAssoc_array& riga_array, const TString& livello,
|
||||
const int indbil, const TRecordset& saldana, const bool inverti = false) const;
|
||||
void aggiorna_importi(TAssoc_array& riga_array, const int indbil, const TRecordset& saldana,
|
||||
const bool inverti = false) const;
|
||||
void incrementa_importo(TAssoc_array& riga_array, const TString& livello, const int indbil,
|
||||
const TImporto& saldo, const bool inverti) const;
|
||||
TAssoc_array& get_row(TAssoc_array& cms, const char* chiave,
|
||||
const int indice, const TString& codcms, const TString& descrizione);
|
||||
|
||||
@ -184,23 +185,6 @@ bool TPrint_stima_ricavi_recordset::move_to(TRecnotype pos)
|
||||
}
|
||||
|
||||
|
||||
void TPrint_stima_ricavi_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);
|
||||
}
|
||||
|
||||
|
||||
int TPrint_stima_ricavi_recordset::estrai_saldi(const TRecordset& saldana, const int indbil,
|
||||
TImporto& saldo, TImporto& saldop) const
|
||||
@ -222,8 +206,8 @@ int TPrint_stima_ricavi_recordset::estrai_saldi(const TRecordset& saldana, const
|
||||
return flag;
|
||||
}
|
||||
|
||||
void TPrint_stima_ricavi_recordset::aggiorna_importo(TAssoc_array& riga_array,
|
||||
const TString& livello, const int indbil, const TRecordset& saldana, const bool inverti) const
|
||||
void TPrint_stima_ricavi_recordset::incrementa_importo(TAssoc_array& riga_array,
|
||||
const TString& livello, const int indbil, const TImporto& saldo, const bool inverti) const
|
||||
{
|
||||
TString* str_imp = (TString*)riga_array.objptr(livello);
|
||||
if (str_imp == NULL)
|
||||
@ -236,24 +220,38 @@ void TPrint_stima_ricavi_recordset::aggiorna_importo(TAssoc_array& riga_array,
|
||||
const char sezione = indbil == 3 ? 'D' : 'A';
|
||||
TImporto imp(sezione, real(*str_imp));
|
||||
|
||||
//ci sono tutti i tipi di saldo, ma solo quelli che rientrano nei parametri iniziali..
|
||||
//..verranno considerati (_tipostima,indbil)
|
||||
TImporto imp_saldo, imp_saldop;
|
||||
estrai_saldi(saldana, indbil, imp_saldo, imp_saldop);
|
||||
|
||||
if (inverti) // Devo sottrarre l'importo = gli scambio la sezione
|
||||
{
|
||||
imp_saldo.swap_section();
|
||||
imp_saldop.swap_section();
|
||||
}
|
||||
imp += imp_saldo;
|
||||
imp += imp_saldop;
|
||||
imp -= saldo;
|
||||
else
|
||||
imp += saldo;
|
||||
|
||||
imp.normalize(sezione);
|
||||
*str_imp = imp.valore().string();
|
||||
}
|
||||
|
||||
|
||||
void TPrint_stima_ricavi_recordset::aggiorna_importi(TAssoc_array& riga_array,
|
||||
const int indbil, const TRecordset& saldana, const bool inverti) const
|
||||
{
|
||||
TString8 livello;
|
||||
|
||||
TImporto imp_saldo, imp_saldop;
|
||||
estrai_saldi(saldana, indbil, imp_saldo, imp_saldop);
|
||||
|
||||
if (!imp_saldo.is_zero())
|
||||
{
|
||||
livello.format("%s_BDG", indbil == 3 ? "COS" : "RIC");
|
||||
incrementa_importo(riga_array, livello, indbil, imp_saldo, inverti);
|
||||
}
|
||||
|
||||
if (!imp_saldop.is_zero())
|
||||
{
|
||||
livello.format("%s_MAT", indbil == 3 ? "COS" : "RIC");
|
||||
incrementa_importo(riga_array, livello, indbil, imp_saldop, inverti);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TAssoc_array& TPrint_stima_ricavi_recordset::get_row(TAssoc_array& cms, const char* chiave,
|
||||
const int indice, const TString& codcms,
|
||||
const TString& descrizione)
|
||||
@ -321,8 +319,6 @@ void TPrint_stima_ricavi_recordset::requery()
|
||||
if (flag != 0)
|
||||
{
|
||||
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);
|
||||
@ -342,10 +338,7 @@ void TPrint_stima_ricavi_recordset::requery()
|
||||
TAssoc_array& riga_array = get_row(cms[indice], chiave, indice, codcms,
|
||||
rec_commesse.get(COMMESSE_DESCRIZ));
|
||||
//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);
|
||||
aggiorna_importi(riga_array, indbil, saldana);
|
||||
|
||||
//..poi le righe speciali,che esistono solo se la commessa e' iniziata prima dell'anno
|
||||
//selezionato,quindi se l'indice e' 0 o 2
|
||||
@ -361,8 +354,7 @@ void TPrint_stima_ricavi_recordset::requery()
|
||||
cazzo_descr << (_anno - 1);
|
||||
TAssoc_array& riga_array = get_row(cms[indice], CMS_DELLA_MINCHIA, indice, cazzo_cod,
|
||||
cazzo_descr);
|
||||
aggiorna_importo(riga_array, gruppo, indbil, saldana, true);
|
||||
//***** aggiorna_importo(riga_array, conto, indbil, saldana, true);
|
||||
aggiorna_importi(riga_array, indbil, saldana, true);
|
||||
}
|
||||
} //if(indice...
|
||||
|
||||
|
@ -109,7 +109,7 @@ MESSAGE RESET,F3.108</prescript>
|
||||
<field x="17" type="Stringa" dynamic_height="1" width="30" height="2" pattern="1">
|
||||
<source>DESCRIZ</source>
|
||||
</field>
|
||||
<field x="160" type="Testo" align="center" width="2" pattern="1" text="%" />
|
||||
<field x="167" type="Testo" align="center" width="2" pattern="1" text="%" />
|
||||
<field x="48" type="Valuta" align="right" width="14" id="101" pattern="1" text="###.###.###,@@">
|
||||
<source>#COS_BDG</source>
|
||||
<postscript description="B1.101 POSTSCRIPT">MESSAGE ADD,F3.101</postscript>
|
||||
@ -118,8 +118,22 @@ MESSAGE RESET,F3.108</prescript>
|
||||
<source>#COS_MAT</source>
|
||||
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F3.102</postscript>
|
||||
</field>
|
||||
<field x="80" type="Numero" align="right" width="6" id="103" pattern="1" text="###,@@">
|
||||
<source>#102F;#101*100</source>
|
||||
<field x="80" type="Numero" align="right" width="6" id="103" pattern="1" text="##@,@@">
|
||||
<prescript description="B1.103 PRESCRIPT">#101 @
|
||||
0 = IF
|
||||
100
|
||||
ELSE
|
||||
#102 @
|
||||
100 *
|
||||
#101 @ F;
|
||||
2 ROUND
|
||||
DUP
|
||||
100 E; IF
|
||||
DROP
|
||||
100
|
||||
THEN
|
||||
THEN
|
||||
#THIS !</prescript>
|
||||
</field>
|
||||
<field x="89" type="Valuta" align="right" width="14" id="104" pattern="1" text="###.###.###,@@">
|
||||
<source>#RIC_BDG</source>
|
||||
@ -150,10 +164,10 @@ IF
|
||||
0
|
||||
ELSE
|
||||
#108 @
|
||||
#105 @
|
||||
F;
|
||||
100
|
||||
*
|
||||
#105 @
|
||||
F;
|
||||
0
|
||||
ROUND
|
||||
THEN
|
||||
@ -167,14 +181,28 @@ THEN
|
||||
<field x="1" y="1.5" type="Testo" fg_color="#FFFFFF" bg_color="#000000" width="25" height="1.5" text="TOTALI GENERALI " />
|
||||
<field x="48" y="1.5" type="Valuta" align="right" width="14" id="101" pattern="1" text="###.###.###,@@" />
|
||||
<field x="62" y="1.5" type="Valuta" align="right" width="14" id="102" pattern="1" text="###.###.###,@@" />
|
||||
<field x="80" y="1.5" type="Numero" align="right" width="6" id="103" pattern="1" text="###,@@">
|
||||
<source>#102F;#101*100</source>
|
||||
<field x="80" y="1.5" type="Numero" align="right" width="6" id="103" pattern="1" text="##@,@@">
|
||||
<prescript description="F1.103 PRESCRIPT">#101 @
|
||||
0 = IF
|
||||
100
|
||||
ELSE
|
||||
#102 @
|
||||
100 *
|
||||
#101 @ F;
|
||||
2 ROUND
|
||||
DUP
|
||||
100 E; IF
|
||||
DROP
|
||||
100
|
||||
THEN
|
||||
THEN
|
||||
#THIS !</prescript>
|
||||
</field>
|
||||
<field x="89" y="1.5" type="Valuta" align="right" width="14" id="104" pattern="1" text="###.###.###,@@" />
|
||||
<field x="103" y="1.5" type="Valuta" align="right" width="14" id="105" pattern="1" text="###.###.###,@@" />
|
||||
<field x="117" y="1.5" type="Valuta" align="right" width="14" id="106" pattern="1" text="###.###.###,@@" />
|
||||
<field x="131" y="1.5" type="Valuta" align="right" width="14" id="107" pattern="1" text="###.###.###,@@" />
|
||||
<field x="149" y="1.5" type="Valuta" align="right" width="14" id="108" pattern="1" text="###.###.###,@@" />
|
||||
<field x="147.5" y="1.5" type="Valuta" align="right" width="14" id="108" pattern="1" text="###.###.###,@@" />
|
||||
</section>
|
||||
<section type="Foot" level="2" height="2.5">
|
||||
<font italic="1" face="Courier New" bold="1" size="8" />
|
||||
@ -205,8 +233,22 @@ THEN
|
||||
<font italic="1" face="Arial Narrow" bold="1" size="8" />
|
||||
<postscript description="F2.102 POSTSCRIPT">MESSAGE ADD,F1.102</postscript>
|
||||
</field>
|
||||
<field x="80" y="1" type="Numero" align="right" width="6" id="103" pattern="1" text="###,@@">
|
||||
<source>#102F;#101*100</source>
|
||||
<field x="80" y="1" type="Numero" align="right" width="6" id="103" pattern="1" text="##@,@@">
|
||||
<prescript description="F2.103 PRESCRIPT">#101 @
|
||||
0 = IF
|
||||
100
|
||||
ELSE
|
||||
#102 @
|
||||
100 *
|
||||
#101 @ F;
|
||||
2 ROUND
|
||||
DUP
|
||||
100 E; IF
|
||||
DROP
|
||||
100
|
||||
THEN
|
||||
THEN
|
||||
#THIS !</prescript>
|
||||
</field>
|
||||
<field x="89" y="1" type="Valuta" align="right" width="14" id="104" pattern="1" text="###.###.###,@@">
|
||||
<font italic="1" face="Arial Narrow" bold="1" size="8" />
|
||||
@ -224,7 +266,7 @@ THEN
|
||||
<font italic="1" face="Arial Narrow" bold="1" size="8" />
|
||||
<postscript description="F2.107 POSTSCRIPT">MESSAGE ADD,F1.107</postscript>
|
||||
</field>
|
||||
<field x="149" y="1" type="Valuta" align="right" width="14" id="108" pattern="1" text="###.###.###,@@">
|
||||
<field x="147" y="1" type="Valuta" align="right" width="14" id="108" pattern="1" text="###.###.###,@@">
|
||||
<font italic="1" face="Arial Narrow" bold="1" size="8" />
|
||||
<postscript description="F2.108 POSTSCRIPT">MESSAGE ADD,F1.108</postscript>
|
||||
</field>
|
||||
@ -248,8 +290,22 @@ THEN
|
||||
<field x="62" y="0.5" type="Valuta" align="right" width="14" id="102" pattern="1" text="###.###.###,@@">
|
||||
<postscript description="F3.102 POSTSCRIPT">MESSAGE ADD,F2.102</postscript>
|
||||
</field>
|
||||
<field x="80" y="0.5" type="Numero" align="right" width="6" id="103" pattern="1" text="###,@@">
|
||||
<source>#102F;#101*100</source>
|
||||
<field x="80" y="0.5" type="Numero" align="right" width="6" id="103" pattern="1" text="##@,@@">
|
||||
<prescript description="F3.103 PRESCRIPT">#101 @
|
||||
0 = IF
|
||||
100
|
||||
ELSE
|
||||
#102 @
|
||||
100 *
|
||||
#101 @ F;
|
||||
2 ROUND
|
||||
DUP
|
||||
100 E; IF
|
||||
DROP
|
||||
100
|
||||
THEN
|
||||
THEN
|
||||
#THIS !</prescript>
|
||||
</field>
|
||||
<field x="89" y="0.5" type="Valuta" align="right" width="14" id="104" pattern="1" text="###.###.###,@@">
|
||||
<postscript description="F3.104 POSTSCRIPT">MESSAGE ADD,F2.104</postscript>
|
||||
@ -263,7 +319,7 @@ THEN
|
||||
<field x="131" y="0.5" type="Valuta" align="right" width="14" id="107" pattern="1" text="###.###.###,@@">
|
||||
<postscript description="F3.107 POSTSCRIPT">MESSAGE ADD,F2.107</postscript>
|
||||
</field>
|
||||
<field x="149" y="0.5" type="Valuta" align="right" width="13" id="108" pattern="1" text="###.###.###,@@">
|
||||
<field x="147" y="0.5" type="Valuta" align="right" width="14" id="108" pattern="1" text="###.###.###,@@">
|
||||
<postscript description="F3.108 POSTSCRIPT">MESSAGE ADD,F2.108</postscript>
|
||||
</field>
|
||||
</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user