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
|
// 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,16 +567,16 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rimuove eventuali elementi rimasti, anche se questo metodo viene effettivamente chiamato una sola
|
// 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
|
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);
|
||||||
|
|
||||||
doc.put(DOC_CODNUM, t.get(0));
|
while (eser > 0)
|
||||||
doc.put(DOC_ANNO, p->_year);
|
{
|
||||||
doc.put(DOC_PROVV, "D");
|
doc.put(DOC_CODNUM, t.get(0));
|
||||||
|
doc.put(DOC_ANNO, eser);
|
||||||
calcola_ordinato_documento(doc);
|
doc.put(DOC_PROVV, "D");
|
||||||
|
calcola_ordinato_documento(doc);
|
||||||
doc.put(DOC_CODNUM, t.get(0));
|
eser = ese.pred(eser);
|
||||||
doc.put(DOC_ANNO, p->_year - 1);
|
}
|
||||||
doc.put(DOC_PROVV, "D");
|
|
||||||
calcola_ordinato_documento(doc);
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|
||||||
from.zero();
|
while (eser > 0)
|
||||||
from.put(DOC_CODNUM, t.get(0));
|
{
|
||||||
from.put(DOC_ANNO, p->_year);
|
from.zero();
|
||||||
from.put(DOC_PROVV, "D");
|
from.put(DOC_CODNUM, t.get(0));
|
||||||
to = from;
|
from.put(DOC_ANNO, eser);
|
||||||
|
from.put(DOC_PROVV, "D");
|
||||||
|
to = from;
|
||||||
|
|
||||||
for (int j=2; j<=items; j++)
|
for (int j=2; j<=items; j++)
|
||||||
{
|
{
|
||||||
filter << "(TIPODOC==\"";
|
filter << "(TIPODOC==\"";
|
||||||
filter << t.get(j-1);
|
filter << t.get(j-1);
|
||||||
filter << "\")||";
|
filter << "\")||";
|
||||||
}
|
}
|
||||||
filter.rtrim(2);
|
filter.rtrim(2);
|
||||||
|
|
||||||
TRelation doc(LF_DOC);
|
TRelation doc(LF_DOC);
|
||||||
TCursor cur(&doc, filter, 1, &from, &to);
|
TCursor cur(&doc, filter, 1, &from, &to);
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user