Modifiche per memory leaks in look_iva() e per scandire solo
i movimenti del mese piu' velocemente. (Costruisce il cursore in modo differente, specificando l'intervallo di date, senza scandire tutti i movimenti dell'anno per poi fare il controllo sul mese). git-svn-id: svn://10.65.10.50/trunk@4127 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8b10f609ff
commit
0e1b3f9382
@ -11,8 +11,17 @@
|
||||
#include <nditte.h>
|
||||
#include <attiv.h>
|
||||
#include <tab1100.h>
|
||||
#include <mov.h>
|
||||
#include "cg4300.h"
|
||||
|
||||
#ifdef DBG
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// -------------------- QUI comincia l'avventura --------------------------
|
||||
// Datemi un punto di appoggio ******************
|
||||
// e mi ci appoggero' ******************
|
||||
@ -147,9 +156,8 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
// se necessario (serve nelle chiamate ricorsive)
|
||||
// Ritorna FALSE soltanto se il ricalcolo era necessario e non e'
|
||||
// stato effettuato per scelta dello stronzo commercialista.
|
||||
|
||||
|
||||
look_lim(liq_month(month), TRUE);
|
||||
|
||||
//modifica del 19/01/1996
|
||||
//if (_isfinal && _lim->get_bool("B1")) // && _month != 13)
|
||||
// return TRUE;
|
||||
@ -392,6 +400,8 @@ bool TLiquidazione_app::update_att(int month, const char* codatt,
|
||||
// saranno solo quelli di dicembre per data <= 20/12;
|
||||
// il ricalcolo e' FORZATO da _recalc messo a one
|
||||
{
|
||||
|
||||
|
||||
look_plm(month, codatt, TRUE);
|
||||
bool ok = _plm->get_bool("B0");
|
||||
if (ok && !recalc) return TRUE;
|
||||
@ -529,20 +539,40 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
real agr_imp = 0.0;
|
||||
real agr_iva = 0.0;
|
||||
|
||||
if (!_isviaggio)
|
||||
{
|
||||
TRectype from(_cur->curr()); from.zero();
|
||||
TRectype to(from);
|
||||
TDate f(1, month == 13 ? 1 : month, atoi(_year));
|
||||
TDate t(1, month == 13 ? 12 : month, atoi(_year));
|
||||
t.set_end_month();
|
||||
from.put(MOV_DATAREG, f);
|
||||
to.put(MOV_DATAREG, t);
|
||||
_cur->setregion(from, to);
|
||||
}
|
||||
*_cur = 0;
|
||||
|
||||
long items = _cur->items();
|
||||
TString trueatt(codatt);
|
||||
int tipatt = atoi(trueatt.sub(5));
|
||||
trueatt = trueatt.left(5);
|
||||
//trueatt = trueatt.left(5);
|
||||
trueatt.cut(5);
|
||||
#ifdef DBG
|
||||
TString msgdbg;
|
||||
long freespace;
|
||||
#endif
|
||||
|
||||
for (; _cur->pos() < items; ++(*_cur))
|
||||
{
|
||||
#ifdef DBG
|
||||
msgdbg.format("Month: %d, att: %s, current item: %ld/%ld",month, codatt,_cur->pos(),items);
|
||||
xvt_statbar_set(msgdbg);
|
||||
if (_cur->pos() % 100 == 0L)
|
||||
{
|
||||
msgdbg.format("Ricalcolo attivita': P=%ld/%ld",_cur->pos(),items);
|
||||
freespace = GetFreeSpace(0);
|
||||
msgdbg << " Memoria libera(1): " << freespace/1024 << " Kbytes.";
|
||||
xvt_statbar_set(msgdbg);
|
||||
do_events();
|
||||
}
|
||||
#endif
|
||||
TDate date(_mov->get("DATAREG"));
|
||||
TString16 reg = _mov->get("REG");
|
||||
@ -595,7 +625,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
do
|
||||
{
|
||||
look_iva(_rmoviva->get("CODIVA"));
|
||||
|
||||
|
||||
// totali parziali registrati nei pim per motivi ignoti
|
||||
real bolld_imp = 0.0; // imponibile bolle doganali
|
||||
real bolld_iva = 0.0; // imposta bolle doganali
|
||||
@ -617,8 +647,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
int tipoag = atoi(_iva->get("S5"));
|
||||
int tipopla = atoi(_iva->get("S3"));
|
||||
int tipodet = atoi(_rmoviva->get("TIPODET"));
|
||||
bool isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI
|
||||
bool ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media
|
||||
int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI
|
||||
int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media
|
||||
TString tipocr_s = _rmoviva->get("TIPOCR");
|
||||
int tipocr = atoi(tipocr_s);
|
||||
real imponibile = _rmoviva->get_real("IMPONIBILE");
|
||||
|
@ -420,10 +420,10 @@ bool TLiquidazione_app::look_reg(const char* reg)
|
||||
else
|
||||
{
|
||||
_reg_r->zero();
|
||||
_reg_r->put("CODTAB",(const char*)s);
|
||||
_reg_r->put("CODTAB",s);
|
||||
if (_reg->read() == NOERR)
|
||||
_reg_arr.add(s,_reg->curr(),FALSE);
|
||||
rt = _reg->good();
|
||||
_reg_arr.add(s,_reg->curr());
|
||||
else rt = FALSE;
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
@ -431,16 +431,18 @@ bool TLiquidazione_app::look_reg(const char* reg)
|
||||
bool TLiquidazione_app::look_iva(const char* cod)
|
||||
{
|
||||
bool rt = TRUE;
|
||||
TString16 s(cod);
|
||||
const bool is_key = _codiva_arr.is_key(cod);
|
||||
|
||||
if (is_key)
|
||||
_iva->curr() = (TRectype&) _codiva_arr[cod];
|
||||
_iva->curr() = (TRectype&) _codiva_arr[s];
|
||||
else
|
||||
{
|
||||
_iva->zero();
|
||||
_iva->put("CODTAB",cod);
|
||||
_iva->read();
|
||||
_codiva_arr.add(cod,_iva->curr(),FALSE);
|
||||
rt = _iva->good();
|
||||
_iva->put("CODTAB",s);
|
||||
if (_iva->read() == NOERR)
|
||||
_codiva_arr.add(s,_iva->curr());
|
||||
else rt = FALSE;
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user