Patch level : 10.0 638

Files correlati     : db1.exe
Ricompilazione Demo : [ ]
Commento            :

Nel calcolo dettagliato dell'ordinato fornitori vengo no considerati tutti gli esercizi e non solo gli ultimi 2.


git-svn-id: svn://10.65.10.50/trunk@20121 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-02-15 17:32:56 +00:00
parent b12d6131d3
commit d777b0b28d

View File

@ -557,6 +557,7 @@ void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const ch
{ {
// Calcolo del dettaglio ordinato fornitori, chiamata UNA sola volta per ogni articolo // Calcolo del dettaglio ordinato fornitori, chiamata UNA sola volta per ogni articolo
// ad ogni stampa // ad ogni stampa
TEsercizi_contabili ese;
// Toglie l'ordinato fornitori dalla disponibilita // Toglie l'ordinato fornitori dalla disponibilita
if (p->_add_orf) if (p->_add_orf)
@ -566,15 +567,15 @@ void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const ch
for (int i = find_mag(annoes, codmag, livello); i > 0; for (int i = find_mag(annoes, codmag, livello); i > 0;
i = find_mag(annoes, codmag, livello, i)) i = find_mag(annoes, codmag, livello, i))
_disp -= rmag.row(i).get_real(MAG_ORDF); _disp -= rmag.row(i).get_real(MAG_ORDF);
TEsercizi_contabili ese; int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente
const int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente while (prev > 0)
if (prev > 0)
{ {
TString16 oldannoes; oldannoes.format("%04d", prev); TString16 oldannoes; oldannoes.format("%04d", prev);
TRecord_array & rmag = mag(oldannoes); TRecord_array & rmag = mag(oldannoes);
for (int i = find_mag(oldannoes, codmag, livello); i > 0; for (int i = find_mag(oldannoes, codmag, livello); i > 0;
i = find_mag(oldannoes, codmag, livello, i)) i = find_mag(oldannoes, codmag, livello, i))
_disp -= rmag.row(i).get_real(MAG_ORDF); _disp -= rmag.row(i).get_real(MAG_ORDF);
prev = ese.pred(prev);
} }
} }
@ -597,28 +598,30 @@ void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const ch
if (items == 2) // Un solo tipo documento: scorre solo le righe di questa numerazione if (items == 2) // Un solo tipo documento: scorre solo le righe di questa numerazione
{ {
int eser = atoi(p->_anno_es);
TRectype doc(LF_DOC); TRectype doc(LF_DOC);
while (eser > 0)
{
doc.put(DOC_CODNUM, t.get(0)); doc.put(DOC_CODNUM, t.get(0));
doc.put(DOC_ANNO, p->_year); doc.put(DOC_ANNO, eser);
doc.put(DOC_PROVV, "D");
calcola_ordinato_documento(doc);
doc.put(DOC_CODNUM, t.get(0));
doc.put(DOC_ANNO, p->_year - 1);
doc.put(DOC_PROVV, "D"); doc.put(DOC_PROVV, "D");
calcola_ordinato_documento(doc); calcola_ordinato_documento(doc);
eser = ese.pred(eser);
}
} }
else // Se invece vi sono piu' tipi doc. per questa numerazione e' necessario considerare le testate doc. else // Se invece vi sono piu' tipi doc. per questa numerazione e' necessario considerare le testate doc.
if (items >= 3) if (items >= 3)
{ {
int eser = atoi(p->_anno_es);
TRectype from(LF_DOC), to(LF_DOC); TRectype from(LF_DOC), to(LF_DOC);
TString filter; TString filter;
while (eser > 0)
{
from.zero(); from.zero();
from.put(DOC_CODNUM, t.get(0)); from.put(DOC_CODNUM, t.get(0));
from.put(DOC_ANNO, p->_year); from.put(DOC_ANNO, eser);
from.put(DOC_PROVV, "D"); from.put(DOC_PROVV, "D");
to = from; to = from;
@ -636,15 +639,8 @@ void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const ch
for (cur = 0L; cur.pos() < cur.items(); ++cur) for (cur = 0L; cur.pos() < cur.items(); ++cur)
// Per ogni documento scorre le sue righe // Per ogni documento scorre le sue righe
calcola_ordinato_documento(cur.curr()); calcola_ordinato_documento(cur.curr());
from.zero(); eser = ese.pred(eser);
from.put(DOC_CODNUM, t.get(0)); }
from.put(DOC_ANNO, p->_year - 1);
from.put(DOC_PROVV, "D");
to = from;
cur.setregion(from, to);
for (cur = 0L; cur.pos() < cur.items(); ++cur)
// Per ogni documento scorre le sue righe
calcola_ordinato_documento(cur.curr());
} }
} }