Patch level : 4.0 905

Files correlati     :
Ricompilazione Demo : [ ]
Commento           :

Riportata la versione 3.2 patch 1092


git-svn-id: svn://10.65.10.50/trunk@16298 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-03-11 16:59:33 +00:00
parent 1d7bc3d6b0
commit aead747733
6 changed files with 161 additions and 143 deletions

View File

@ -941,38 +941,38 @@ void TAnacespi::init_modify_mode(TMask& m)
{
init_mask(m);
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
dc.esercizio_corrente(iniz, fine);
const TDate dtacq(m.get(F_DTCOMP));
const TDate dtfunz(m.get(F_DTFUNZ));
const int staat = _qmask->stato_attivita();
TToken_string enabling;
switch (staat)
if (staat == 2 || staat == 3)
{
case 2:
if (dtacq < iniz)
TDitta_cespiti& dc = ditta_cespiti();
TDate iniz, fine;
dc.esercizio_corrente(iniz, fine);
const TDate dtacq = m.get(F_DTCOMP);
const TDate dtfunz = m.get(F_DTFUNZ);
if (staat == 2)
{
if (dtacq < iniz)
{
if (!dtfunz.ok() || dtfunz >= iniz)
enabling.add(F_DTFUNZ);
if (_emask->tipo_cespite() == tc_materiale)
{
enabling.add(F_USOPROM);
enabling.add(F_VEIDIP);
enabling.add(F_VEICOLO);
enabling.add(F_SPEMAN);
enabling.add(F_FABBR06);
}
}
}
else // == 3
{
if (!dtfunz.ok() || dtfunz >= iniz)
enabling.add(F_DTFUNZ);
if (_emask->tipo_cespite() == tc_materiale)
{
enabling.add(F_USOPROM);
enabling.add(F_VEIDIP);
enabling.add(F_VEICOLO);
enabling.add(F_SPEMAN);
enabling.add(F_FABBR06);
}
}
break;
case 3:
if (!dtfunz.ok() || dtfunz >= iniz)
enabling.add(F_DTFUNZ);
break;
default:
break;
}
_emask->protect_page(1, enabling);
@ -1002,9 +1002,9 @@ int TAnacespi::read(TMask& m)
int TAnacespi::write(const TMask& m)
{
TRectype& curr = get_relation()->curr();
const TDitta_cespiti& dc = ditta_cespiti();
const TRectype& cac = dc.categoria(0, NULL, m.get_int(F_CATEGORIA));
TRectype& curr = get_relation()->curr();
switch (_emask->tipo_cespite())
{
case tc_immateriale:

View File

@ -297,13 +297,13 @@ bool TForce_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
case F_QUOTE_PERSE:
case F_PRIVATO:
case F_QUOTE_PRIV:
if (e==fe_close||e==fe_modify)
if (e==fe_close || e==fe_modify)
{
real sumf = get_real(F_AMMNOR_F)+get_real(F_AMMACC_F)+get_real(F_AMMANT_F)+get_real(F_QUOTE_PERSE)+get_real(F_PRIVATO)+get_real(F_QUOTE_PRIV);
if (sumf > _residuof_ini)
return error_box(TR("Attenzione: l'ammortamento richiesto supera il residuo fiscale del cespite"));
if (e == fe_close && field(F_FRINGEBEN).shown())
if (e == fe_close && field(F_FRINGEBEN).active())
{
const real fringe_amm = get_real(F_AMMNOR_F)+get_real(F_AMMACC_F)+get_real(F_AMMANT_F);
const real fringe_ben = get_real(F_FRINGEBEN);

View File

@ -110,7 +110,7 @@ bool TCalcamm::calcola_ammortamenti()
cur.freeze();
TString msg;
msg << TR("Calcolo ammortamenti di ") << items << TR(" cespiti...");
msg << TR("Calcolo ammortamenti cespiti: ") << items;
TProgind pi(items, msg, TRUE, TRUE);
for (cur = 0L; cur.pos() < items; ++cur)

View File

@ -1,5 +1,4 @@
#include <applicat.h>
#include <form.h>
#include <printer.h>
#include <recarray.h>
#include <utility.h>
@ -194,7 +193,11 @@ bool TStampa_storico::stampa_primo_saldo(const int tipo)
section1.find_field(FF_DESCRUNO).set(TR("Ripresa saldi"));
section1.find_field(FF_NUMELEUNO).set(recsalce.get(SALCE_NUMELE));
real sum = recsalce.get_real("CSTO");
if (tipo == 2)
sum -= recsalce.get_real("VNONAMMC");
else
sum -= recsalce.get_real("VNONAMM");
sum -= recsalce.get_real("VNONAMM06");
sum += recsalce.get_real("RIV75");
sum += recsalce.get_real("RIV83");
sum += recsalce.get_real("RIV90");
@ -640,4 +643,4 @@ int ce3200(int argc, char* argv[])
TStampa_storico a;
a.run(argc,argv,TR("Scheda storica cespite"));
return 0;
}
}

View File

@ -266,12 +266,13 @@ void TStampa_prospetto::stampa_totali_tipo(TTipo_cespite tcesp)
{
// scrive il tipo di cespiti di cui calcola il totale
set_field(FR_TC_CAT,"");
TString80 tipodescr = TR("TOTALI BENI ");
TString80 tipodescr;
tipodescr << TR("TOTALI BENI") << ' ';
switch (tcesp)
{
case tc_pluriennale: tipodescr << TR("PLURIENNALI"); break;
case tc_immateriale: tipodescr << TR("IMMATERIALI"); break;
default: tipodescr << TR("MATERIALI"); break;
case tc_pluriennale: tipodescr << TR("PLURIENNALI"); break;
case tc_immateriale: tipodescr << TR("IMMATERIALI"); break;
default: tipodescr << TR("MATERIALI"); break;
}
set_field(FR_TC_D_CAT,tipodescr);
@ -329,11 +330,14 @@ void TStampa_prospetto::fill_body(const TTotali& tot)
set_field(FR_TC_RESBIL,tempval2);
}
//-------------------------------------------------------------------------------------------------------------------------//
void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cespite tcesp)
void TStampa_prospetto::aggiorna_totali(TCursor& curcespi, const int tipo, TTipo_cespite tcesp)
{
// valori della riga 1 (dipendenti da tipo solo le rivgf/rivgc)
TRectype& recsalce = cur.curr(LF_SALCE);
const TRectype& recsalce = curcespi.curr(LF_SALCE);
real csto = recsalce.get_real(SALCE_CSTO);
const TRectype& cespi = curcespi.curr();
const bool leasing = cespi.get_bool(CESPI_LEASING);
_cat._tot_csto += csto;
if (tipo == 2)
@ -341,23 +345,31 @@ void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cesp
else
_cat._tot_csto -= recsalce.get_real(SALCE_VNONAMM);
_cat._tot_csto -= recsalce.get_real(SALCE_VNONAMM06);
real rivsalce = recsalce.get_real(SALCE_RIV75);
real rivsalce = recsalce.get_real(SALCE_RIV75);
rivsalce += recsalce.get_real(SALCE_RIV83);
rivsalce += recsalce.get_real(SALCE_RIV90);
rivsalce += recsalce.get_real(SALCE_RIV91);
_cat._tot_riv += rivsalce;
if (tipo == 2)
_cat._tot_riv += rivsalce;
if (tipo == 1 || leasing)
_cat._tot_riv += recsalce.get_real(SALCE_RIVGF); else
if (tipo == 2 && !leasing)
_cat._tot_riv += recsalce.get_real(SALCE_RIVGC);
else
_cat._tot_riv += recsalce.get_real(SALCE_RIVGF);
// valori della riga 2 (e, giá che si fa la scansione dei movimenti, anche i valori dei movam della riga 3)
// (i valori della riga 2 non dipendono da tipo, mentre quelli della riga 3 si, in quanto hanno movam)
TRectype recmovce(LF_MOVCE);
recmovce.put(MOVCE_IDCESPITE, cur.curr().get(CESPI_IDCESPITE));
const TString16 idcespite = cespi.get(CESPI_IDCESPITE);
recmovce.put(MOVCE_IDCESPITE, idcespite);
real amv_ammnor, amv_ammacc, amv_ammant;
#ifdef DBG
if (atol(idcespite) == 178)
int cazzo = 1;
#endif
TRelation relmovce(LF_MOVCE);
// viene aggiunta la relazione su movam (che contiene il filtro su tpamm dovuto al tipo di situazione scelto nella maschera)..
TString expr;
@ -366,115 +378,118 @@ void TStampa_prospetto::aggiorna_totali(TCursor& cur, const int tipo, TTipo_cesp
//.. e quindi viene aggiunta la relazione su ammmv (che contiene il filtro su tpamm dovuto al tipo di situazione scelto nella
// maschera) utilizzando la stessa espressione di filtro, in quanto la chiave di ammmv é identica a quella di movam (olé!)
relmovce.add(LF_AMMMV, expr);
// Scansione movimenti in base alla chiave IDCESPITE+IDMOV
TCursor curmovce (&relmovce, "", 2, &recmovce, &recmovce);
const TRecnotype num1 = curmovce.items();
long num1 = curmovce.items();
curmovce.freeze();
if (num1 > 0)
{
curmovce.freeze();
real amv_ammnor;
real amv_ammacc;
real amv_ammant;
for (curmovce=0; curmovce.pos()<num1; ++curmovce)
{
const TRectype& mov = curmovce.curr();
const TRectype& amm = curmovce.curr(LF_MOVAM);
const TRectype& amv = curmovce.curr(LF_AMMMV);
const TDate dtmov = mov.get_date(MOVCE_DTMOV);
if (dtmov >= _dataini && dtmov <= _datafine)
const TRectype& movce = curmovce.curr();
const TRectype& movam = curmovce.curr(LF_MOVAM);
const TRectype& ammmv = curmovce.curr(LF_AMMMV);
for (curmovce=0; curmovce.pos() < num1; ++curmovce)
{
const TString8 codmov = mov.get(MOVCE_CODMOV);
const char tmc = cache().get("%TMC", codmov, "S6")[0]; //prende il valore del campo S6 nella tabella tipi movimento
const char segno = mov.get_char(MOVCE_SEGNO);
const real signum = segno == '-' ? -1.0 : +1.0; //serve per sommare i movimenti con il loro segno effettivo
real rivmovce = mov.get_real(MOVCE_RIV75);
rivmovce += mov.get_real(MOVCE_RIV83);
rivmovce += mov.get_real(MOVCE_RIV90);
rivmovce += mov.get_real(MOVCE_RIV91);
csto = mov.get_real(MOVCE_CSTO);
// inquietante modo di selezionare la rivg (rivgf o rivgc) in base al tipo senza usare una if else!
const real rivg = mov.get_real(tipo == 2 ? MOVCE_RIVGC : MOVCE_RIVGF);
real vnonamm2;
if (tipo == 2)
vnonamm2 = recsalce.get_real(SALCE_VNONAMMC);
else
vnonamm2 = recsalce.get_real(SALCE_VNONAMM);
vnonamm2 += recsalce.get_real(SALCE_VNONAMM06);
//non si puo' avere un valore non ammortizzabile maggiore del costo prima delle
//rivalutazioni
if (vnonamm2 > csto)
vnonamm2 = csto;
real qmovam = amm.get_real(MOVAM_QNOR);
qmovam += amm.get_real(MOVAM_QACC);
qmovam += amm.get_real(MOVAM_QANT);
if (tmc == 'R')
_cat._tot_riveser += (rivmovce + rivg) * signum;
if (tmc == 'I' || (tmc <= ' ' && segno == '+'))
{
_cat._tot_acqincr += (csto - vnonamm2 + rivmovce + rivg) * signum;
_cat._tot_incr += qmovam * signum;
}
if (tmc == 'E' || (tmc <= ' ' && segno == '-'))
{
_cat._tot_cesselim2 += (csto - vnonamm2 + rivmovce + rivg) * (-signum);
_cat._tot_cesselim3 += qmovam * (-signum);
}
if (tmc == 'P')
_cat._tot_reinplus += (mov.get_real(MOVCE_PLUSREIN)) * signum;
// solo nei casi con tipo =2 e/o 3 viene preso l'ammortamento da ammmv (che verrá poi sommato nella riga 4, piú sotto, a quello
// preso da ammce); l'ammortamento viene preso qui in quanto é relativo ai movimenti che vengono qui scanditi
if (tipo != 1)
{
amv_ammnor += (amv.get_real(AMMMV_QNOR)) * signum;
amv_ammacc += (amv.get_real(AMMMV_QACC)) * signum;
amv_ammant += (amv.get_real(AMMMV_QANT)) * signum;
}
const TDate dtmov = movce.get_date(MOVCE_DTMOV);
if (dtmov >= _dataini && dtmov <= _datafine)
{
const TString4 codmov = movce.get(MOVCE_CODMOV);
const char tmc = cache().get("%TMC", codmov, "S6")[0]; //prende il valore del campo S6 nella tabella tipi movimento
const char segno = movce.get_char(MOVCE_SEGNO);
const real signum = segno == '-' ? -UNO : UNO; //serve per sommare i movimenti con il loro segno effettivo
} //fine controllo sulle date
} //fine scansione sui movimenti
real rivmovce = movce.get_real(MOVCE_RIV75);
rivmovce += movce.get_real(MOVCE_RIV83);
rivmovce += movce.get_real(MOVCE_RIV90);
rivmovce += movce.get_real(MOVCE_RIV91);
csto = movce.get_real(MOVCE_CSTO);
// inquietante modo di selezionare la rivg (rivgf o rivgc) in base al tipo senza usare una if else!
real rivg;
if (tipo == 1 || leasing)
rivg = movce.get_real(MOVCE_RIVGF); else
if (tipo == 2 && !leasing)
rivg = movce.get_real(MOVCE_RIVGC);
real vnonamm2;
if (tipo == 2)
vnonamm2 = recsalce.get_real(SALCE_VNONAMMC);
else
vnonamm2 = recsalce.get_real(SALCE_VNONAMM);
vnonamm2 += recsalce.get_real(SALCE_VNONAMM06);
//non si puo' avere un valore non ammortizzabile maggiore del costo prima delle
//rivalutazioni
if (vnonamm2 > csto)
vnonamm2 = csto;
real qmovam = movam.get_real(MOVAM_QNOR);
qmovam += movam.get_real(MOVAM_QACC);
qmovam += movam.get_real(MOVAM_QANT);
if (tmc == 'R')
_cat._tot_riveser += (rivmovce + rivg) * signum; else
if (tmc == 'P')
_cat._tot_reinplus += movce.get_real(MOVCE_PLUSREIN) * signum; else
if (tmc == 'I' || (tmc <= ' ' && segno == '+'))
{
_cat._tot_acqincr += (csto - vnonamm2 + rivmovce + rivg) * signum;
_cat._tot_incr += qmovam * signum;
} else
if (tmc == 'E' || (tmc <= ' ' && segno == '-'))
{
_cat._tot_cesselim2 += (csto - vnonamm2 + rivmovce + rivg) * (-signum);
_cat._tot_cesselim3 += qmovam * (-signum);
}
// solo nei casi con tipo =2 e/o 3 viene preso l'ammortamento da ammmv (che verrá poi sommato nella riga 4, piú sotto, a quello
// preso da ammce); l'ammortamento viene preso qui in quanto é relativo ai movimenti che vengono qui scanditi
//if (tipo != 1)
{
amv_ammnor += (ammmv.get_real(AMMMV_QNOR)) /* * signum */;
amv_ammacc += (ammmv.get_real(AMMMV_QACC)) /* * signum */;
amv_ammant += (ammmv.get_real(AMMMV_QANT)) /* * signum */;
}
} //fine controllo sulle date
} //fine scansione sui movimenti
}
// valori delle righe 3 e 4 di ammce (questi valori dipendono dal tipo di situazione selezionato nella maschera)
// record con chiave idcespite,codes,tpamm
TRectype recammce(LF_AMMCE);
recammce.put(AMMCE_IDCESPITE, cur.curr().get(CESPI_IDCESPITE));
recammce.put(AMMCE_IDCESPITE, idcespite);
recammce.put(AMMCE_CODES, _mask->get(F_ESERCIZIO));
// filtro sul tpamm (va messo per non prendere tutti gli ammortamenti (dei 3 tipi) assieme)
expr.cut(0);
expr << AMMCE_TPAMM << "=" << tipo;
expr.cut(0) << AMMCE_TPAMM << "=" << tipo;
TRelation relammce(LF_AMMCE);
TCursor curammce (&relammce, expr, 1, &recammce, &recammce);
long num2 = curammce.items();
const TRecnotype num2 = curammce.items();
curammce.freeze();
// scandisce gli ammce del cespite (al massimo 2 per ogni codes, ovvero iniziale e finale)
const TRectype& ammce = curammce.curr();
// scandisce gli ammce del cespite (al massimo 2 per ogni codes, ovvero iniziale e finale)
for (curammce=0; curammce.pos()<num2; ++curammce)
{
const TRectype& amm = curammce.curr();
// se tpsaldo = 1 (inizio) gli ammortamenti sono....
if (amm.get_int(AMMCE_TPSALDO) == 1)
if (ammce.get_int(AMMCE_TPSALDO) == 1)
{
real qnor = amm.get_real(AMMCE_QNOR);
real qacc = amm.get_real(AMMCE_QACC);
real qant = amm.get_real(AMMCE_QANT);
_cat._tot_fondinieser += qnor + qant +qacc;
_cat._tot_fondinieser += ammce.get_real(AMMCE_QNOR);
_cat._tot_fondinieser += ammce.get_real(AMMCE_QACC);
_cat._tot_fondinieser += ammce.get_real(AMMCE_QANT);
}
// se invece tpsaldo = 2 (fine) gli ammortamenti sono....
else
{
_cat._tot_ammnor += amm.get_real(AMMCE_QNOR);
_cat._tot_ammacc += amm.get_real(AMMCE_QACC);
_cat._tot_ammant += amm.get_real(AMMCE_QANT);
// se, mentre tpsaldo=2, ho anche tpamm =2 e/o 3, gli ammortamenti devono tenere conto anche di quelli sui movimenti, calcolati
_cat._tot_ammnor += ammce.get_real(AMMCE_QNOR);
_cat._tot_ammacc += ammce.get_real(AMMCE_QACC);
_cat._tot_ammant += ammce.get_real(AMMCE_QANT);
// se, mentre tpsaldo=2, ho anche tpamm =2 e/o 3,
// gli ammortamenti devono tenere conto anche di quelli sui movimenti, calcolati
// durante la scansione dei movimenti
if (tipo != 1)
// if (tipo != 1)
{
_cat._tot_ammnor += amv_ammnor;
_cat._tot_ammacc += amv_ammacc;
@ -513,7 +528,7 @@ void TStampa_prospetto::main_loop()
// prepara il cursore di tipo sorted perché ho due tipi di ordinamento possibili: per categoria e per impianto
const int ordinamento = _mask->get_int(F_ORDINA);
TString ordin = ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP;
TString16 ordin = ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP;
ordin << "|" <<CESPI_IDCESPITE;
TSorted_cursor sortcur (&relcespi, ordin, filtro, 1, &rec, &rec);
sortcur.setregion(rec,rec);
@ -522,18 +537,18 @@ void TStampa_prospetto::main_loop()
const TRecnotype num = sortcur.items();
sortcur.freeze();
printer().open();
// scansione sulle 3 possibili situazioni stampabili
for (int j = 1; j <= 3; j++)
// scansione sulle 3 possibili situazioni stampabili: 1=fiscale; 2=civilistica; 3=gestionale.
for (int sit = 1; sit <= 3; sit++)
{
// stampa solo le situazioni selezionate
if (j == 1 && !_mask->get_bool(F_SITFISC))
if (sit == 1 && !_mask->get_bool(F_SITFISC))
continue;
if (j == 2 && !_mask->get_bool(F_SITCIV))
if (sit == 2 && !_mask->get_bool(F_SITCIV))
continue;
if (j == 3 && !_mask->get_bool(F_SITGEST))
if (sit == 3 && !_mask->get_bool(F_SITGEST))
continue;
// setta l'intestazione del form...
set_intestazione(j, ordinamento);
set_intestazione(sit, ordinamento);
// ed il fondo pagina
set_pavimentazione();
// gestione categorie ed effettivo main loop di stampa
@ -544,7 +559,7 @@ void TStampa_prospetto::main_loop()
{
const TTipo_cespite tipocespite = (TTipo_cespite)i; // trasforma l'intero i in un tipo cespite
TString16 currcodcat = "@@"; //codice categoria iniziale (non si puó metterlo nullo perché potrebbe esistere)
TString8 currcodcat = "@@"; //codice categoria iniziale (non si puó metterlo nullo perché potrebbe esistere)
TString80 currdescat = "";
_mtr.azzera(); // azzeratore tipi cespite (materiali, immateriali, pluriennali)
@ -553,7 +568,7 @@ void TStampa_prospetto::main_loop()
const TCespite ces(sortcur.curr());
if (ces.tipo() == tipocespite) //considera solo i cespiti del tipo attualmente selezionato
{
const TString16 codcat = sortcur.curr().get(ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP);
const TString8 codcat = sortcur.curr().get(ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP);
if (codcat != currcodcat) //cambia categoria
{
if (currcodcat != "@@")
@ -567,7 +582,7 @@ void TStampa_prospetto::main_loop()
currdescat = cache().get("CIM", currcodcat, "S0");
}
aggiorna_totali (sortcur, j, tipocespite);
aggiorna_totali (sortcur, sit, tipocespite);
}
} // fine scansione cespiti della categoria selezionata
if (currcodcat != "@@")

View File

@ -53,7 +53,7 @@ END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 2 4 "Gruppo "
PROMPT 2 4 "Gruppo "
FLAGS "Z"
USE CCB KEY 1
JOIN %CGR ALIAS 106 INTO CODTAB==CODTAB[5,6]
@ -67,7 +67,7 @@ BEGIN
CHECKTYPE REQUIRED
END
STRING F_D_GRUPPO 60 55
STRING F_D_GRUPPO 60 58
BEGIN
PROMPT 20 4 ""
FLAGS "D"
@ -75,7 +75,7 @@ END
STRING F_SPECIE 4
BEGIN
PROMPT 2 5 "Specie "
PROMPT 2 5 "Specie "
FLAGS "_"
USE CCB KEY 1
JOIN %CAT ALIAS 400 INTO CODTAB[1,2]==CODTAB[5,6] CODTAB[3,6]==CODTAB[7,10]
@ -90,7 +90,7 @@ BEGIN
CHECKTYPE REQUIRED
END
STRING F_D_SPECIE 60 55
STRING F_D_SPECIE 60 58
BEGIN
PROMPT 20 5 ""
FLAGS "D"