cg1500.cpp Corretto ciclo errato
cg3600.cpp Migliorate prestazioni lettura mastrino git-svn-id: svn://10.65.10.50/trunk@3951 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
96f7df5c8b
commit
b6e4ac9fbe
@ -1729,9 +1729,9 @@ bool CG1500_application::calcola(int g, int c, long s)
|
||||
rmov.put(RMV_CONTO,c);
|
||||
if (s != 0)
|
||||
rmov.put(RMV_SOTTOCONTO,s);
|
||||
TRectype rec(rmov.curr());
|
||||
const TRectype rec(rmov.curr());
|
||||
|
||||
for (int err = rmov.read(_isgteq); err != NOERR; err = rmov.next())
|
||||
for (int err = rmov.read(_isgteq); err == NOERR; err = rmov.next())
|
||||
{
|
||||
if (rmov.curr() != rec)
|
||||
break;
|
||||
|
@ -652,7 +652,7 @@ void TMastrino::read(const TBill& conto,
|
||||
|
||||
rmov().setkey(2);
|
||||
TRectype& rmov_rec = rmov().curr();
|
||||
const TRectype& mov_rec = mov().curr();
|
||||
TRectype& mov_rec = mov().curr();
|
||||
|
||||
if (ae <= 0)
|
||||
{
|
||||
@ -666,7 +666,8 @@ void TMastrino::read(const TBill& conto,
|
||||
const TDate& inizio_esercizio = esercizi[ae].inizio();
|
||||
_da_data = dd.ok() ? dd : inizio_esercizio;
|
||||
_a_data = ad.ok() ? ad : esercizi[ae].fine();
|
||||
|
||||
|
||||
const bool test_caus = !(_da_caus.blank() && _a_caus.blank());
|
||||
_da_caus = dc;
|
||||
_a_caus = ac.blank() ? "zzz" : ac;
|
||||
|
||||
@ -693,6 +694,9 @@ void TMastrino::read(const TBill& conto,
|
||||
_conto.gruppo(), _conto.conto(), _conto.sottoconto());
|
||||
TProgind pi(num_giorni, caption, FALSE, TRUE, 48);
|
||||
|
||||
// Stima dimensione mastrino
|
||||
_riga.choose_step(num_giorni);
|
||||
|
||||
// Valori dei saldi fino alla data di inizio stampa:
|
||||
// Vengono inizializzati con i saldi iniziali dell'esercizio,
|
||||
// poi verranno sommati gli importi dei movimenti che
|
||||
@ -714,6 +718,18 @@ void TMastrino::read(const TBill& conto,
|
||||
conto.put(rmov_rec);
|
||||
rmov_rec.put(RMV_DATAREG, min_data_reg);
|
||||
|
||||
const TRecfield rmov_datareg (rmov_rec, RMV_DATAREG);
|
||||
const TRecfield rmov_numreg (rmov_rec, RMV_NUMREG);
|
||||
const TRecfield rmov_gruppo (rmov_rec, RMV_GRUPPO);
|
||||
const TRecfield rmov_conto (rmov_rec, RMV_CONTO);
|
||||
const TRecfield rmov_sottoconto(rmov_rec, RMV_SOTTOCONTO);
|
||||
const TRecfield rmov_sezione (rmov_rec, RMV_SEZIONE);
|
||||
const TRecfield rmov_importo (rmov_rec, RMV_IMPORTO);
|
||||
|
||||
const TRecfield mov_datacomp (mov_rec, MOV_DATACOMP);
|
||||
const TRecfield mov_provvis (mov_rec, MOV_PROVVIS);
|
||||
const TRecfield mov_codcaus (mov_rec, MOV_CODCAUS);
|
||||
|
||||
#ifdef DBG
|
||||
long num_rec = 0;
|
||||
const clock_t clock_start = clock();
|
||||
@ -722,36 +738,41 @@ void TMastrino::read(const TBill& conto,
|
||||
for (int err = rel().read(_isgteq); err == NOERR; err = rel().next())
|
||||
{
|
||||
// Controlla di non aver superato la data limite
|
||||
const TDate data_reg = mov_rec.get(MOV_DATAREG);
|
||||
const TDate data_reg((TDate)rmov_datareg);
|
||||
if (data_reg > max_data_reg)
|
||||
break;
|
||||
|
||||
// Controlla che il conto sia ancora quello selezionato
|
||||
const TBill conto_corrente(rmov_rec);
|
||||
if (conto_corrente != conto)
|
||||
if (_conto.sottoconto() != long(rmov_sottoconto) ||
|
||||
_conto.conto() != int(rmov_conto) ||
|
||||
_conto.gruppo() != int(rmov_gruppo))
|
||||
break;
|
||||
|
||||
#ifdef DBG
|
||||
num_rec++;
|
||||
if ((num_rec & 0x7F) == 0)
|
||||
{
|
||||
TString80 msg;
|
||||
const long sec = (clock() - clock_start) / CLOCKS_PER_SEC;
|
||||
msg.format("%ld records at %ld rec/sec", num_rec, num_rec / sec);
|
||||
pi.set_text(msg);
|
||||
if (sec > 0)
|
||||
{
|
||||
TString80 msg;
|
||||
msg.format("%ld records at %ld rec/sec", num_rec, num_rec / sec);
|
||||
pi.set_text(msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Ignora i movimenti provvisori
|
||||
if (mov_rec.get_char(MOV_PROVVIS) > ' ')
|
||||
const char provvis = *(const char*)mov_provvis;
|
||||
if (provvis > ' ')
|
||||
continue;
|
||||
|
||||
const TDate data_corrente(_esercizio <= 0 ? data_reg : mov_rec.get_date(MOV_DATACOMP));
|
||||
const TDate data_corrente = _esercizio <= 0 ? data_reg : (TDate)mov_datacomp;
|
||||
if (data_corrente > _a_data)
|
||||
continue;
|
||||
|
||||
const char sezione = rmov_rec.get_char(RMV_SEZIONE);
|
||||
const real importo = rmov_rec.get(RMV_IMPORTO);
|
||||
const char sezione = *((const char*)rmov_sezione);
|
||||
const real importo((const char*)rmov_importo);
|
||||
|
||||
if (data_corrente < _da_data)
|
||||
{
|
||||
@ -773,18 +794,21 @@ void TMastrino::read(const TBill& conto,
|
||||
_pavere_per += importo;
|
||||
|
||||
// Controlla che la causale sia nei limiti
|
||||
const TString& causale = mov_rec.get(MOV_CODCAUS);
|
||||
if (causale >= _da_caus && causale <= _a_caus)
|
||||
if (test_caus)
|
||||
{
|
||||
TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino,
|
||||
rmov().recno(), mov().recno(),
|
||||
_pdare_per, _pavere_per, data_reg);
|
||||
_riga.append(r);
|
||||
const bool ok = _da_caus <= mov_codcaus && _a_caus >= mov_codcaus;
|
||||
if (!ok)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino,
|
||||
rmov().recno(), mov().recno(),
|
||||
_pdare_per, _pavere_per, data_reg);
|
||||
_riga.append(r);
|
||||
|
||||
const long giorno = data_reg - min_data_reg + 1;
|
||||
pi.setstatus(giorno);
|
||||
const long giorno = data_reg - min_data_reg + 1;
|
||||
pi.setstatus(giorno);
|
||||
}
|
||||
}
|
||||
|
||||
pi.setstatus(num_giorni); // Raramente arriva in fondo!
|
||||
|
Loading…
x
Reference in New Issue
Block a user