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:
parent
b12d6131d3
commit
d777b0b28d
@ -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
|
||||
// ad ogni stampa
|
||||
TEsercizi_contabili ese;
|
||||
|
||||
// Toglie l'ordinato fornitori dalla disponibilita
|
||||
if (p->_add_orf)
|
||||
@ -566,16 +567,16 @@ void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const ch
|
||||
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
||||
i = find_mag(annoes, codmag, livello, i))
|
||||
_disp -= rmag.row(i).get_real(MAG_ORDF);
|
||||
TEsercizi_contabili ese;
|
||||
const int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente
|
||||
if (prev > 0)
|
||||
{
|
||||
TString16 oldannoes; oldannoes.format("%04d", prev);
|
||||
TRecord_array & rmag = mag(oldannoes);
|
||||
for (int i = find_mag(oldannoes, codmag, livello); i > 0;
|
||||
i = find_mag(oldannoes, codmag, livello, i))
|
||||
_disp -= rmag.row(i).get_real(MAG_ORDF);
|
||||
}
|
||||
int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente
|
||||
while (prev > 0)
|
||||
{
|
||||
TString16 oldannoes; oldannoes.format("%04d", prev);
|
||||
TRecord_array & rmag = mag(oldannoes);
|
||||
for (int i = find_mag(oldannoes, codmag, livello); i > 0;
|
||||
i = find_mag(oldannoes, codmag, livello, i))
|
||||
_disp -= rmag.row(i).get_real(MAG_ORDF);
|
||||
prev = ese.pred(prev);
|
||||
}
|
||||
}
|
||||
|
||||
// Rimuove eventuali elementi rimasti, anche se questo metodo viene effettivamente chiamato una sola
|
||||
@ -597,54 +598,49 @@ 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
|
||||
{
|
||||
int eser = atoi(p->_anno_es);
|
||||
TRectype doc(LF_DOC);
|
||||
|
||||
doc.put(DOC_CODNUM, t.get(0));
|
||||
doc.put(DOC_ANNO, p->_year);
|
||||
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");
|
||||
calcola_ordinato_documento(doc);
|
||||
while (eser > 0)
|
||||
{
|
||||
doc.put(DOC_CODNUM, t.get(0));
|
||||
doc.put(DOC_ANNO, eser);
|
||||
doc.put(DOC_PROVV, "D");
|
||||
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.
|
||||
if (items >= 3)
|
||||
{
|
||||
int eser = atoi(p->_anno_es);
|
||||
TRectype from(LF_DOC), to(LF_DOC);
|
||||
TString filter;
|
||||
|
||||
from.zero();
|
||||
from.put(DOC_CODNUM, t.get(0));
|
||||
from.put(DOC_ANNO, p->_year);
|
||||
from.put(DOC_PROVV, "D");
|
||||
to = from;
|
||||
while (eser > 0)
|
||||
{
|
||||
from.zero();
|
||||
from.put(DOC_CODNUM, t.get(0));
|
||||
from.put(DOC_ANNO, eser);
|
||||
from.put(DOC_PROVV, "D");
|
||||
to = from;
|
||||
|
||||
for (int j=2; j<=items; j++)
|
||||
{
|
||||
filter << "(TIPODOC==\"";
|
||||
filter << t.get(j-1);
|
||||
filter << "\")||";
|
||||
}
|
||||
filter.rtrim(2);
|
||||
for (int j=2; j<=items; j++)
|
||||
{
|
||||
filter << "(TIPODOC==\"";
|
||||
filter << t.get(j-1);
|
||||
filter << "\")||";
|
||||
}
|
||||
filter.rtrim(2);
|
||||
|
||||
TRelation doc(LF_DOC);
|
||||
TCursor cur(&doc, filter, 1, &from, &to);
|
||||
TRelation doc(LF_DOC);
|
||||
TCursor cur(&doc, filter, 1, &from, &to);
|
||||
|
||||
for (cur = 0L; cur.pos() < cur.items(); ++cur)
|
||||
// Per ogni documento scorre le sue righe
|
||||
calcola_ordinato_documento(cur.curr());
|
||||
from.zero();
|
||||
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());
|
||||
for (cur = 0L; cur.pos() < cur.items(); ++cur)
|
||||
// Per ogni documento scorre le sue righe
|
||||
calcola_ordinato_documento(cur.curr());
|
||||
eser = ese.pred(eser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user