Patch level : 10.0 558
Files correlati : tc0.exe Ricompilazione Demo : [ ] Commento : Tabelle di riclassificazione team system e trasferimento sermetra git-svn-id: svn://10.65.10.50/trunk@19838 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6ee7801b05
commit
1aa50b29d0
@ -1034,6 +1034,21 @@ void TDocumento::sort_rows(const char* key)
|
|||||||
__key = NULL;
|
__key = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static real doc_inventory_qta(const TCausale_magazzino & cau, const TString & codart, const TString & codmag,
|
||||||
|
const TString & livello, int anno, const real & qta)
|
||||||
|
{
|
||||||
|
const real giac = cached_article_balances(codart).giacenza_anno(codmag, livello, anno);
|
||||||
|
|
||||||
|
real q = qta - giac;
|
||||||
|
switch (cau.sgn(s_giac))
|
||||||
|
{
|
||||||
|
case 1: break;
|
||||||
|
case -1: q = -q; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||||
{
|
{
|
||||||
TDocumento& myself = *((TDocumento *)this);
|
TDocumento& myself = *((TDocumento *)this);
|
||||||
@ -1078,6 +1093,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
{
|
{
|
||||||
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc) && get(DOC_CAUSMAG).not_empty();
|
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc) && get(DOC_CAUSMAG).not_empty();
|
||||||
long num_movmag = get_long(DOC_MOVMAG);
|
long num_movmag = get_long(DOC_MOVMAG);
|
||||||
|
bool diff_inv = get_bool("DIFFINV");
|
||||||
|
|
||||||
TMov_mag_doc mov;
|
TMov_mag_doc mov;
|
||||||
TLocalisamfile m(LF_MOVMAG);
|
TLocalisamfile m(LF_MOVMAG);
|
||||||
@ -1124,7 +1140,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
mov.put(MOVMAG_DATAREG, d);
|
mov.put(MOVMAG_DATAREG, d);
|
||||||
mov.put(MOVMAG_DATACOMP, d);
|
mov.put(MOVMAG_DATACOMP, d);
|
||||||
mov.put(MOVMAG_DOCPROVV, get(DOC_PROVV));
|
mov.put(MOVMAG_DOCPROVV, get(DOC_PROVV));
|
||||||
mov.put(MOVMAG_ANNODOC, get(DOC_ANNO));;
|
mov.put(MOVMAG_ANNODOC, get(DOC_ANNO));
|
||||||
mov.put(MOVMAG_CODNUM, get(DOC_CODNUM));
|
mov.put(MOVMAG_CODNUM, get(DOC_CODNUM));
|
||||||
long numdoc = get_long(DOC_NDOC);
|
long numdoc = get_long(DOC_NDOC);
|
||||||
if (numdoc <= 0L)
|
if (numdoc <= 0L)
|
||||||
@ -1170,6 +1186,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
TString8 cod_caus_riga;
|
TString8 cod_caus_riga;
|
||||||
TDistinta_tree dist;
|
TDistinta_tree dist;
|
||||||
TCodice_articolo codart;
|
TCodice_articolo codart;
|
||||||
|
const int anno = get_int(DOC_ANNO);
|
||||||
|
|
||||||
for (i = 1; i <= physical_rows(); i++)
|
for (i = 1; i <= physical_rows(); i++)
|
||||||
{
|
{
|
||||||
@ -1195,7 +1212,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
r.put(RDOC_MOVMAG, r_num);
|
r.put(RDOC_MOVMAG, r_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
const real qta = scarica_residuo ? r.qtaresidua_mag(): r.quantita_mag();
|
real qta = scarica_residuo ? r.qtaresidua_mag(): r.quantita_mag();
|
||||||
|
|
||||||
if (r_num == num_movmag && !qta.is_zero())
|
if (r_num == num_movmag && !qta.is_zero())
|
||||||
{
|
{
|
||||||
@ -1205,7 +1222,8 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
|
|
||||||
rm.put(RMOVMAG_IMPIANTO, r.get(RDOC_IMPIANTO));
|
rm.put(RMOVMAG_IMPIANTO, r.get(RDOC_IMPIANTO));
|
||||||
rm.put(RMOVMAG_LINEA, r.get(RDOC_LINEA));
|
rm.put(RMOVMAG_LINEA, r.get(RDOC_LINEA));
|
||||||
rm.put(RMOVMAG_CODMAG, r.get(RDOC_CODMAG));
|
const TString8 codmag = r.get(RDOC_CODMAG);
|
||||||
|
rm.put(RMOVMAG_CODMAG, codmag);
|
||||||
if (articolo && (cod_caus_riga.full() ? cached_causale_magazzino(cod_caus_riga).scarica_alternativi() : scarica_alt))
|
if (articolo && (cod_caus_riga.full() ? cached_causale_magazzino(cod_caus_riga).scarica_alternativi() : scarica_alt))
|
||||||
{
|
{
|
||||||
const TRectype art = cache().get(LF_ANAMAG, codart);
|
const TRectype art = cache().get(LF_ANAMAG, codart);
|
||||||
@ -1215,9 +1233,14 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
codart = alt;
|
codart = alt;
|
||||||
}
|
}
|
||||||
rm.put(RMOVMAG_CODART, codart);
|
rm.put(RMOVMAG_CODART, codart);
|
||||||
rm.put(RMOVMAG_LIVGIAC, r.get(RDOC_LIVELLO));
|
const TString livello = r.get(RDOC_LIVELLO);
|
||||||
|
rm.put(RMOVMAG_LIVGIAC, livello);
|
||||||
rm.put(RMOVMAG_UM, r.get(RDOC_UMQTA));
|
rm.put(RMOVMAG_UM, r.get(RDOC_UMQTA));
|
||||||
|
|
||||||
|
if (diff_inv)
|
||||||
|
qta = doc_inventory_qta((cod_caus_riga.full() ? cached_causale_magazzino(cod_caus_riga) : caus), codart,
|
||||||
|
codmag, livello, anno, qta);
|
||||||
|
|
||||||
rm.put(RMOVMAG_QUANT, qta);
|
rm.put(RMOVMAG_QUANT, qta);
|
||||||
|
|
||||||
TCurrency_documento prezzo(r.prezzo(TRUE, FALSE), *this, TRUE);
|
TCurrency_documento prezzo(r.prezzo(TRUE, FALSE), *this, TRUE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user