Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :riportata nuova gestione saldi mozzarella dalla 5.0 e report ristretti per il nostro amato adolf!


git-svn-id: svn://10.65.10.50/trunk@16547 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2008-04-28 09:37:19 +00:00
parent 9f452e8acf
commit 0379617a17
7 changed files with 221 additions and 102 deletions

@ -8,6 +8,8 @@
#include "ca2.h"
#include "ca2300a.h"
#include "../cg/cglib01.h"
#include "movana.h"
#include "rmovana.h"
#include "saldana.h"
@ -33,12 +35,14 @@ TRic_saldi_msk::TRic_saldi_msk() :TAutomask ("ca2300a") { }
class TAnal_mov_ric : public TAnal_mov
{
int _annoes;
public:
virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop);
virtual int read(TBaseisamfile& f, word op, word lockop);
public:
void set_annoes(int anno) { _annoes = anno; }
TAnal_mov_ric(long numreg = 0) : TAnal_mov(numreg) {}
};
@ -47,7 +51,9 @@ int TAnal_mov_ric::readat(TBaseisamfile& f, TRecnotype nrec, word lockop)
const int err = TMultiple_rectype::readat(f, nrec, lockop);
kill_saldi();
update_saldi(false);
load_saldi(false);
save_saldi(_annoes);
return err;
}
@ -56,7 +62,9 @@ int TAnal_mov_ric::read(TBaseisamfile& f, word op, word lockop)
const int err = TMultiple_rectype::read(f, op, lockop);
kill_saldi();
update_saldi(false);
load_saldi(false);
save_saldi(_annoes);
return err;
}
@ -116,15 +124,37 @@ void TRic_saldi_app::main_loop()
cur_saldi.scan(remove_saldo, this, "Azzeramento saldi...");
TRelation rel_movana(LF_MOVANA);
TString filter; filter.format("ANNOES==%04d", anno) ;
TString filter; filter.format("ANNOES==%04d", anno);
TCursor cur_movana(&rel_movana, filter, 1);
const long items = cur_movana.items();
//usa la scan dei TCursor,quindi niente progind e for,x' gia' nel metodo
if (items > 0)
{
rel_movana.lfile().set_curr(new TAnal_mov_ric); //il record principale della rel e' un TMov_anal!!
TAnal_mov_ric* amr = new TAnal_mov_ric;
amr->set_annoes(anno);
rel_movana.lfile().set_curr(amr); //il record principale della rel e' un TMov_anal!!
cur_movana.scan(elabora_movimento, this, "Ricostruzione saldi...");
rel_movana.lfile().set_curr(new TRectype(LF_MOVANA)); //il record principale della rel e' un TMov_anal!!
}
//ricostruzione saldi di preventivo spammati su piu' anni
TEsercizi_contabili esc;
const TDate datainies = esc[anno].inizio();
filter.format("((TIPOMOV='P')||(TIPOMOV='V'))&&(NUM(ANSI(DATAFCOMP))>=%ld)", datainies.date2ansi());
TRectype beginning(LF_MOVANA), ending(LF_MOVANA);
ending.put(MOVANA_ANNOES, anno - 1);
cur_movana.setregion(beginning, ending);
cur_movana.setfilter(filter, true);
const long preventivi_items = cur_movana.items();
if (preventivi_items > 0)
{
TAnal_mov_ric* amr = new TAnal_mov_ric;
amr->set_annoes(anno);
rel_movana.lfile().set_curr(amr); //il record principale della rel e' un TMov_anal!!
cur_movana.scan(elabora_movimento, this, "Ricostruzione saldi preventivi precedenti...");
rel_movana.lfile().set_curr(new TRectype(LF_MOVANA)); //il record principale della rel e' un TMov_anal!!
}
}
}

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="ca3800a" orientation="2" lpi="6" class="ca3800a">
<report libraries="ve1300" name="ca3800a" orientation="2" lpi="6">
<description>Bilancio commessa CA</description>
<font face="Arial Narrow" size="8" />
<section type="Head">
@ -13,19 +13,19 @@
<field x="64" type="Data" width="12" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="83" type="Testo" width="4" pattern="1" text="Pag.">
<field x="81" type="Testo" width="4" pattern="1" text="Pag.">
<font italic="1" face="Arial Narrow" size="8" />
</field>
<field x="87" type="Numero" align="right" width="3" pattern="1">
<field x="85" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="85" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="46.5" y="2" type="Testo" align="center" width="6" pattern="1" text="Fase" />
<field x="54.5" y="2" type="Testo" align="center" width="6" pattern="1" text="CdC" />
<field x="60" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="85" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field x="80" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="43" y="2" type="Testo" align="center" width="6" pattern="1" text="Fase" />
<field x="50.5" y="2" type="Testo" align="center" width="6" pattern="1" text="CdC" />
<field x="56" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="80" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field border="1" x="1" y="3" type="Linea" width="169" height="0" pattern="1" />
<field x="65" y="2" type="Testo" align="right" width="13" id="69" pattern="1" text="Testata" />
<field x="61" y="2" type="Testo" align="right" width="13" id="69" pattern="1" text="Testata" />
<field x="1" y="2" type="Testo" width="15" id="121" pattern="1" text="Commessa" />
</section>
<section type="Head" level="1">
@ -146,14 +146,14 @@
<section type="Body" level="1">
<prescript description="B1 PRESCRIPT">1 #H4.3 \ incrementa il contatore per il numero di righe di fase
+!</prescript>
<field x="1" type="Stringa" width="20" pattern="1">
<field x="1" type="Stringa" width="17" pattern="1">
<source>CODCMS</source>
</field>
<field x="21" type="Stringa" width="25" pattern="1">
<field x="18" type="Stringa" width="25" pattern="1">
<font face="Arial Narrow" size="7" />
<source>IF(#H4.3=0;DESCRIZ;"")</source>
</field>
<field x="47" type="Stringa" width="9" pattern="1">
<field x="43" type="Stringa" width="9" pattern="1">
<source>FASE</source>
<prescript description="B1.0 PRESCRIPT">#STAMPAFASI @
EMPTY= IF
@ -163,7 +163,7 @@ ELSE
THEN
</prescript>
</field>
<field x="57" type="Stringa" width="5" pattern="1">
<field x="52" type="Stringa" width="5" pattern="1">
<source>CDC</source>
<prescript description="B1.0 PRESCRIPT">#STAMPACDC @
EMPTY= IF
@ -173,21 +173,21 @@ ELSE
THEN
</prescript>
</field>
<field x="62" type="Numero" align="right" width="3" pattern="1">
<field x="57" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<source>ROUND(AVANZAMENTO;0)</source>
</field>
<field x="96" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="65" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="91" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="60.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="B1.69 POSTSCRIPT">MESSAGE ADD,F4.69
MESSAGE ADD,F3.69</postscript>
</field>
<field x="79" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="74" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<source>#RICAVI-#COSTI</source>
<postscript description="B1.169 POSTSCRIPT">MESSAGE ADD,F4.169
MESSAGE ADD,F3.169</postscript>
</field>
<field x="92" type="Numero" align="right" width="4" id="170" pattern="1">
<field x="87" type="Numero" align="right" width="4" id="170" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<prescript description="B1.170 PRESCRIPT">#RICAVI @
EMPTY= IF
@ -220,8 +220,8 @@ THEN
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<field border="2" x="1" y="0.75" type="Linea" width="169" height="0" pattern="1" />
<field x="1" y="1.5" type="Testo" fg_color="#FFFFFF" bg_color="#000000" width="25" height="1.5" text="TOTALI GENERALI " />
<field x="65" y="1.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="79" y="1.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@" />
<field x="60.5" y="1.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="74" y="1.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@" />
</section>
<section type="Foot" level="2" height="2.5">
<font italic="1" face="Courier New" bold="1" size="8" />
@ -240,7 +240,7 @@ THEN
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<source>H2.102</source>
</field>
<field x="65" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="60.5" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.69 POSTSCRIPT">MESSAGE ADD,F1.69</postscript>
</field>
@ -248,7 +248,7 @@ THEN
<field x="35" 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>
<field x="79" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="74" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.169 POSTSCRIPT">MESSAGE ADD,F1.169
MESSAGE RESET,169</postscript>
@ -266,11 +266,11 @@ MESSAGE RESET,169</postscript>
<li Value="TOTALI Commesse avviate nell'esercizio selezionato" Code="3" />
</list>
</field>
<field x="65" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="60.5" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="F3.69 POSTSCRIPT">MESSAGE ADD,F2.69</postscript>
</field>
<field y="0.5" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
<field x="79" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="74" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F3.169 POSTSCRIPT">MESSAGE ADD,F2.169
MESSAGE RESET,169</postscript>
</field>
@ -283,8 +283,8 @@ MESSAGE RESET,169</postscript>
<field x="2" type="Stringa" bg_color="#C0C0C0" width="20" id="2" pattern="1">
<source>H4.2</source>
</field>
<field x="65" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="79" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="60.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="74" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F4.169 POSTSCRIPT">MESSAGE RESET,169</postscript>
</field>
</section>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="ca3800b" orientation="2" lpi="6" class="ca3800b">
<description>Bilancio commessa CA per fasi</description>
<report libraries="ve1300" name="ca3800b" orientation="2" lpi="6">
<description>Bilancio commessa CA riassuntivo per fasi</description>
<font face="Arial Narrow" size="8" />
<section type="Head">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
@ -19,15 +19,15 @@
<field x="80" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="80" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="76.5" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="10" y="2" type="Stringa" width="12" pattern="1">
<font face="Arial" bold="1" size="10" />
<source>FASESPEC</source>
</field>
<field x="54" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="80" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field x="52" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="76.5" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field border="1" x="1" y="3" type="Linea" width="169" height="0" pattern="1" />
<field x="59" y="1" type="Testo" valign="bottom" align="right" width="13" height="2" id="69" pattern="1" text="Testata" />
<field x="55.5" y="1" type="Testo" valign="bottom" align="right" width="13" height="2" id="69" pattern="1" text="Testata" />
<field x="1" y="2" type="Testo" width="8" id="121" pattern="1" text="Fase" />
</section>
<section type="Head" level="1">
@ -127,30 +127,30 @@
<section type="Body" level="1" hidden="1">
<prescript description="B1 PRESCRIPT">1 #H4.3 \ incrementa il contatore per il numero di righe di fase
+!</prescript>
<field x="1" type="Stringa" width="20" pattern="1">
<field x="1" type="Stringa" width="17" pattern="1">
<source>CODCMS</source>
</field>
<field x="21" type="Stringa" width="25" pattern="1">
<field x="18" type="Stringa" width="25" pattern="1">
<font face="Arial Narrow" size="7" />
<source>IF(#H4.3=0;DESCRIZ;"")</source>
</field>
<field x="47" type="Stringa" width="9" pattern="1">
<field x="43" type="Stringa" width="9" pattern="1">
<source>FASE</source>
</field>
<field x="56" type="Numero" align="right" width="3" pattern="1">
<field x="52" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<source>ROUND(AVANZAMENTO;0)</source>
</field>
<field x="91" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="59" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="86" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="55.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="B1.69 POSTSCRIPT">MESSAGE ADD,F3.69</postscript>
</field>
<field x="73" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<source>#RICAVI-#COSTI</source>
<postscript description="B1.169 POSTSCRIPT">MESSAGE ADD,F4.169
MESSAGE ADD,F3.169</postscript>
</field>
<field x="87" type="Numero" align="right" width="4" id="170" pattern="1">
<field x="82" type="Numero" align="right" width="4" id="170" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<prescript description="B1.170 PRESCRIPT">#RICAVI @
EMPTY= IF
@ -186,8 +186,8 @@ THEN
<field x="21" y="1" type="Stringa" valign="center" fg_color="#FFFFFF" bg_color="#400040" width="15" height="1.5" id="1">
<font italic="1" face="Arial" bold="1" size="8" />
</field>
<field x="59" y="1.25" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="73" y="1.25" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="55.5" y="1.25" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="69" y="1.25" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F1.169 POSTSCRIPT">MESSAGE RESET,169</postscript>
</field>
</section>
@ -208,7 +208,7 @@ THEN
<font italic="1" face="Arial Narrow" size="8" />
<source>H2.102</source>
</field>
<field x="59" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="55.5" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.69 POSTSCRIPT">MESSAGE ADD,F1.69</postscript>
</field>
@ -216,7 +216,7 @@ THEN
<field x="35" 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>
<field x="73" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.169 POSTSCRIPT">MESSAGE ADD,F1.169
MESSAGE RESET,169</postscript>
@ -233,11 +233,11 @@ MESSAGE RESET,169</postscript>
<li Value="Commesse avviate nell'esercizio selezionato" Code="3" />
</list>
</field>
<field x="59" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="55.5" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="F3.69 POSTSCRIPT">MESSAGE ADD,F2.69</postscript>
</field>
<field y="0.5" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
<field x="73" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F3.169 POSTSCRIPT">MESSAGE ADD,F2.169
MESSAGE RESET,169</postscript>
</field>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="ca3800c" orientation="2" lpi="6" class="ca3800c">
<description>Bilancio commessa CA per CdC</description>
<report libraries="ve1300" name="ca3800c" orientation="2" lpi="6">
<description>Bilancio commessa CA riassuntivo per CdC</description>
<font face="Arial Narrow" size="8" />
<section type="Head">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
@ -19,15 +19,15 @@
<field x="80" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="80" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="76.5" y="1.25" type="Testo" align="center" width="13" pattern="1" text="Margine" />
<field x="17.5" y="2" type="Stringa" width="12" pattern="1">
<font face="Arial" bold="1" size="10" />
<source>CDCSPEC</source>
</field>
<field x="54" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="80" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field x="52" y="2" type="Testo" align="center" width="6" pattern="1" text="% Av." />
<field x="76.5" y="2" type="Testo" align="center" width="13" pattern="1" text=" Contribuz. " />
<field border="1" x="1" y="3" type="Linea" width="169" height="0" pattern="1" />
<field x="59" y="1" type="Testo" valign="bottom" align="right" width="13" height="2" id="69" pattern="1" text="Testata" />
<field x="55.5" y="1" type="Testo" valign="bottom" align="right" width="13" height="2" id="69" pattern="1" text="Testata" />
<field x="1" y="2" type="Testo" width="14" id="121" pattern="1" text="Centro di costo" />
</section>
<section type="Head" level="1">
@ -127,30 +127,30 @@
<section type="Body" level="1" hidden="1">
<prescript description="B1 PRESCRIPT">1 #H4.3 \ incrementa il contatore per il numero di righe di cdc
+!</prescript>
<field x="1" type="Stringa" width="20" pattern="1">
<field x="1" type="Stringa" width="17" pattern="1">
<source>CODCMS</source>
</field>
<field x="21" type="Stringa" width="25" pattern="1">
<field x="18" type="Stringa" width="25" pattern="1">
<font face="Arial Narrow" size="7" />
<source>IF(#H4.3=0;DESCRIZ;"")</source>
</field>
<field x="47" type="Stringa" width="9" pattern="1">
<field x="43" type="Stringa" width="9" pattern="1">
<source>CDC</source>
</field>
<field x="56" type="Numero" align="right" width="3" pattern="1">
<field x="52" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<source>ROUND(AVANZAMENTO;0)</source>
</field>
<field x="91" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="59" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="86" type="Testo" align="center" width="2" pattern="1" text="%" />
<field x="55.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="B1.69 POSTSCRIPT">MESSAGE ADD,F3.69</postscript>
</field>
<field x="73" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<source>#RICAVI-#COSTI</source>
<postscript description="B1.169 POSTSCRIPT">MESSAGE ADD,F4.169
MESSAGE ADD,F3.169</postscript>
</field>
<field x="87" type="Numero" align="right" width="4" id="170" pattern="1">
<field x="82" type="Numero" align="right" width="4" id="170" pattern="1">
<font italic="1" face="Arial Narrow" size="8" />
<prescript description="B1.170 PRESCRIPT">#RICAVI @
EMPTY= IF
@ -186,8 +186,8 @@ THEN
<field x="21" y="1" type="Stringa" valign="center" fg_color="#FFFFFF" bg_color="#400040" width="15" height="1.5" id="1">
<font italic="1" face="Arial" bold="1" size="8" />
</field>
<field x="59" y="1.25" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="73" y="1.25" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="55.5" y="1.25" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@" />
<field x="69" y="1.25" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F1.169 POSTSCRIPT">MESSAGE RESET,169</postscript>
</field>
</section>
@ -208,7 +208,7 @@ THEN
<font italic="1" face="Arial Narrow" size="8" />
<source>H2.102</source>
</field>
<field x="59" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="55.5" y="1" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.69 POSTSCRIPT">MESSAGE ADD,F1.69</postscript>
</field>
@ -216,7 +216,7 @@ THEN
<field x="35" 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>
<field x="73" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" y="1" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<font italic="1" face="Arial Narrow" bold="1" size="8" />
<postscript description="F2.169 POSTSCRIPT">MESSAGE ADD,F1.169
MESSAGE RESET,169</postscript>
@ -233,11 +233,11 @@ MESSAGE RESET,169</postscript>
<li Value="Commesse avviate nell'esercizio selezionato" Code="3" />
</list>
</field>
<field x="59" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<field x="55.5" y="0.5" type="Valuta" align="right" width="13" id="69" pattern="1" text="###.###.###,@@">
<postscript description="F3.69 POSTSCRIPT">MESSAGE ADD,F2.69</postscript>
</field>
<field y="0.5" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
<field x="73" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<field x="69" y="0.5" type="Valuta" align="right" width="13" id="169" pattern="1" text="###.###.###,@@">
<postscript description="F3.169 POSTSCRIPT">MESSAGE ADD,F2.169
MESSAGE RESET,169</postscript>
</field>

@ -702,7 +702,12 @@ void TPrint_saldana_recordset::create_lines_to_print(const TString& query)
//..cioe' nel passato oppure che iniziano nel futuro!
if (datafine >= datainiesc && dataini <= datafinesc)
{
//indice e' il parametro che stabilisce in quale sezione del report viene stampata la commessa
//se la commessa termina prima della fine dell'esercizio selezionato -> indice 0, altrimenti..
//..indice 2
int indice = datafine <= datafinesc ? 0 : 2;
//se poi la commessa inizia dopo la data inizio esercizio selezionato -> l'indice va incrementato..
//..di una unita' (viene spostata nella sezione di stampa successiva)
if (dataini >= datainiesc)
indice++;

@ -1253,23 +1253,102 @@ bool TAnal_app::user_destroy()
// TAnal_mov
///////////////////////////////////////////////////////////
TImporto& TAnal_mov::saldo(const TRectype& row)
void TAnal_mov::saldo_set_reset(const TRectype& row, bool reset)
{
const int dec = TCurrency::get_firm_dec();
const TImporto imp_row(row.get_char(RMOVANA_SEZIONE), row.get_real(RMOVANA_IMPORTO));
const int esc_iniziale = get_int(MOVANA_ANNOES);
int esc_finale = esc_iniziale;
//che movimento e'?
TToken_string annies;
annies.add(esc_iniziale);
const char tipomov = get_char(MOVANA_TIPOMOV);
//se e' un movimento di tipo preventivo potrebbe avere una data di scadenza come la mozzarella
if (tipomov == 'P' || tipomov == 'V')
{
const TDate datacomp = get_date(MOVANA_DATACOMP);
const TDate datafcomp = get_date(MOVANA_DATAFCOMP);
if (datafcomp.ok() && datafcomp > datacomp)
{
TEsercizi_contabili esc;
esc_finale = esc.date2esc(datafcomp);
if (esc_finale < esc_iniziale) //se l'esercizio di scadenza non esiste ancora perche' troppo futuro...
esc_finale = esc_iniziale + datafcomp.year() - datacomp.year(); //...se lo genera
if (esc_finale > esc_iniziale)
{
for (int a = esc_iniziale + 1; a <= esc_finale; a++)
annies.add(a);
}
}
}
TToken_string key;
key.add(get(MOVANA_TIPOMOV));
key.add(get(MOVANA_ANNOES));
key.add(tipomov);
key.add(esc_iniziale);
key.add(row.get(RMOVANA_CODCCOSTO));
key.add(row.get(RMOVANA_CODCMS));
key.add(row.get(RMOVANA_CODFASE));
key.add(row.get(RMOVANA_CODCONTO));
TImporto* imp = (TImporto*)_saldi.objptr(key);
if (imp == NULL)
if (annies.items() > 1) //saldi spammati su piu' anni
{
imp = new TImporto;
_saldi.add(key, imp);
TToken_string giorni_annies; //lista dei giorni di saldo per annoes
TEsercizi_contabili esc;
const TDate datacomp = get_date(MOVANA_DATACOMP);
const TDate datafcomp = get_date(MOVANA_DATAFCOMP);
giorni_annies.add(esc[esc_iniziale].fine() - datacomp + 1); //primo esercizio
TDate inizio_esc_finale, fine_esc_finale;
for (int a = 1; a < annies.items() - 1; a++)
{
const int curr_esc = annies.get_int(a);
esc.code2range(curr_esc, inizio_esc_finale, fine_esc_finale);
giorni_annies.add(fine_esc_finale - inizio_esc_finale + 1); //esercizi intermedi
}
esc.code2range(esc_finale, inizio_esc_finale, fine_esc_finale);
giorni_annies.add(datafcomp - inizio_esc_finale + 1); //ultimo esercizio
//Adesso che ha l'elenco dei giorni impegnati per esercizio, scatta il casino del distributore..
TGeneric_distrib texaco(imp_row.valore(), dec);
FOR_EACH_TOKEN(giorni_annies, gg)
texaco.add(real(gg));
FOR_EACH_TOKEN(annies, es)
{
TImporto curr_imp(imp_row.sezione(), texaco.get());
key.add(es, 1); //sistema l'anno di esercizio nella chiave
TImporto* imp = (TImporto*)_saldi.objptr(key);
if (imp == NULL)
{
imp = new TImporto;
_saldi.add(key, imp);
}
if (reset)
*imp -= curr_imp;
else
*imp += curr_imp;
}
}
else //saldo in un solo anno (caso standard)
{
TImporto* imp = (TImporto*)_saldi.objptr(key);
if (imp == NULL)
{
imp = new TImporto;
_saldi.add(key, imp);
}
if (reset)
*imp -= imp_row;
else
*imp += imp_row;
imp->valore().round(dec);
}
return *imp;
}
void TAnal_mov::load_saldi(bool reset)
@ -1277,18 +1356,11 @@ void TAnal_mov::load_saldi(bool reset)
if (reset)
_saldi.destroy();
const int dec = TCurrency::get_firm_dec();
const TRecord_array& a = body(LF_RMOVANA);
for (int i = a.last_row(); i > 0; i--)
{
const TRectype& row = a[i];
const TImporto imp(row.get_char(RMOVANA_SEZIONE), row.get_real(RMOVANA_IMPORTO));
TImporto& sld = saldo(row);
if (reset)
sld -= imp;
else
sld += imp;
sld.valore().round(dec);
saldo_set_reset(row, reset); //aggiunge o toglie la riga corrente ai saldi in memoria
}
}
@ -1305,7 +1377,7 @@ void TAnal_mov::update_saldi(bool kill)
load_saldi(true);
}
bool TAnal_mov::save_saldi()
bool TAnal_mov::save_saldi(const int annoes)
{
TLocalisamfile saldi(LF_SALDANA);
FOR_EACH_ASSOC_OBJECT(_saldi, h, k, o)
@ -1315,22 +1387,34 @@ bool TAnal_mov::save_saldi()
{
TToken_string key = k;
const char tipo = key.get_char(0);
saldi.put(SALDANA_ANNO, key.get());
saldi.put(SALDANA_COSTO, key.get());
saldi.put(SALDANA_COMMESSA, key.get());
saldi.put(SALDANA_FASE, key.get());
saldi.put(SALDANA_CONTO, key.get());
const int anno = key.get_int(1);
// Se e' attivo il filtro su un anno, aggiorno i saldi solo dell'anno voluto
if (annoes != 0 && anno != annoes) // Usata solo da ricalcolo saldi
continue;
saldi.put(SALDANA_ANNO, anno);
saldi.put(SALDANA_COSTO, key.get(2));
saldi.put(SALDANA_COMMESSA, key.get(3));
saldi.put(SALDANA_FASE, key.get(4));
saldi.put(SALDANA_CONTO, key.get(5));
int err = saldi.read(_isequal, _testandlock);
if (err != NOERR)
{
saldi.zero();
saldi.put(SALDANA_ANNO, key.get(1));
saldi.put(SALDANA_COSTO, key.get());
saldi.put(SALDANA_COMMESSA, key.get());
saldi.put(SALDANA_FASE, key.get());
saldi.put(SALDANA_CONTO, key.get());
err = saldi.write();
TEsercizi_contabili esc;
if (esc.exist(anno))
{
saldi.zero();
saldi.put(SALDANA_ANNO, anno);
saldi.put(SALDANA_COSTO, key.get(2));
saldi.put(SALDANA_COMMESSA, key.get(3));
saldi.put(SALDANA_FASE, key.get(4));
saldi.put(SALDANA_CONTO, key.get(5));
err = saldi.write();
}
else
continue; // NON devo dare errori fuorvianti causa saldi nel futuro che ci saranno ma non vanno scritti
}
if (err == NOERR)

@ -140,11 +140,11 @@ class TAnal_mov : public TMultiple_rectype
TAssoc_array _saldi;
protected:
TImporto& saldo(const TRectype& rec);
void saldo_set_reset(const TRectype& row, bool reset);
void load_saldi(bool reset);
void kill_saldi() { _saldi.destroy(); }
void update_saldi(bool kill);
bool save_saldi();
bool save_saldi(const int anno = 0);
void update_datacomp() const;
public: