Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21869 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4b7440e83f
commit
11be059f44
@ -605,6 +605,10 @@ CONTO_OMAGGI=8|15|22
|
||||
320=C
|
||||
I50=B
|
||||
|
||||
[CausaliMagazzino]
|
||||
// causali magazzino per apertura
|
||||
APERTURA=APE
|
||||
|
||||
// parametri generali della maschera (dns user password)
|
||||
[Main]
|
||||
201 = OS1_HAR
|
||||
|
@ -25,9 +25,11 @@ class THardy_movmag : public THardy_transfer
|
||||
int _anno; // parametri per la query
|
||||
TDate _dadata, _adata; // parametri per la query
|
||||
int _protocollo; // numero protocollo del mov.mag.
|
||||
TToken_string _cauape; // causali di magazzino per apertura
|
||||
|
||||
protected:
|
||||
bool scrivi_righe(TMov_mag& mov);
|
||||
bool scrivi_righe_lotti(TMov_mag& mov, const TRecordset& rigamov);
|
||||
bool scrivi_testata(const TRecordset& recset, TMov_mag& mov);
|
||||
void recset2rec(const TODBC_recordset& recset, TRectype& rec, const TString_array& lista_campi);
|
||||
void conto2campo(const TString& hd_tipoc, const TString& hd_key, TString4& tipoc, int& gr, int& co, long& so);
|
||||
@ -219,29 +221,75 @@ bool THardy_movmag::scrivi_righe(TMov_mag& mov)
|
||||
TString8 codcaus = mov.get(MOVMAG_CODCAUS);
|
||||
for (bool ok=recset_righe.move_first();ok;ok=recset_righe.move_next())
|
||||
{
|
||||
TRectype& rmov = mov.new_row();
|
||||
TString8 codcaus_riga = recset_righe.get("IdCausale").as_string();
|
||||
if (codcaus != codcaus_riga)
|
||||
rmov.put(RMOVMAG_CODCAUS, codcaus_riga);
|
||||
const int codmag = recset_righe.get("IdMagazzino1").as_int();
|
||||
bool ins_riga = true;
|
||||
if (_cauape.find(codcaus_riga)>=0)
|
||||
ins_riga = !(scrivi_righe_lotti(mov, recset_righe));
|
||||
if (ins_riga)
|
||||
{
|
||||
TRectype& rmov = mov.new_row();
|
||||
TString8 codcaus_riga = recset_righe.get("IdCausale").as_string();
|
||||
if (codcaus != codcaus_riga)
|
||||
rmov.put(RMOVMAG_CODCAUS, codcaus_riga);
|
||||
const int codmag = recset_righe.get("IdMagazzino1").as_int();
|
||||
rmov.put(RMOVMAG_CODMAG, format("%02d", codmag));
|
||||
rmov.put(RMOVMAG_CODART, recset_righe.get("IdProdotto").as_string());
|
||||
rmov.put(RMOVMAG_QUANT, recset_righe.get("Quantita").as_string());
|
||||
TString4 um = recset_righe.get("IdUmDoc").as_string();
|
||||
if (um.blank())
|
||||
{
|
||||
TString80 key = recset_righe.get("IdProdotto").as_string();
|
||||
key << "|1";
|
||||
um = cache().get(LF_UMART, key, UMART_UM);
|
||||
}
|
||||
rmov.put(RMOVMAG_UM, um);
|
||||
rmov.put(RMOVMAG_PREZZO, recset_righe.get("PrezzoMov").as_string());
|
||||
const int kmovmag = recset_righe.get("KMovmag").as_int();
|
||||
TString80 idlotto;
|
||||
get_lotto(kmovmag, idlotto);
|
||||
rmov.put(RMOVMAG_LIVGIAC, idlotto);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// legge righe del movmag e le scrive nel TMov_mag
|
||||
bool THardy_movmag::scrivi_righe_lotti(TMov_mag& mov, const TRecordset& rigamov)
|
||||
{
|
||||
TString80 codart = rigamov.get("IdProdotto").as_string();
|
||||
int codmag = rigamov.get("IdMagazzino1").as_int();
|
||||
TString query_lotti;
|
||||
query_lotti << query_header();
|
||||
query_lotti << "SELECT * "
|
||||
"FROM dbo.LottiSaldi "
|
||||
"WHERE Esercizio=";
|
||||
query_lotti << _anno;
|
||||
query_lotti << " AND IdProdotto=";
|
||||
query_lotti << codart;
|
||||
query_lotti << " AND IdMagazzino=";
|
||||
query_lotti << codmag;
|
||||
query_lotti << " AND RIQta<>0";
|
||||
TODBC_recordset recset_lotti(query_lotti);
|
||||
TLocalisamfile rmov(LF_RMOVMAG);
|
||||
TRectype& rec_rmov = rmov.curr();
|
||||
for (bool ok=recset_lotti.move_first();ok;ok=recset_lotti.move_next())
|
||||
{
|
||||
TRectype& rmov = mov.new_row();
|
||||
rmov.put(RMOVMAG_CODMAG, format("%02d", codmag));
|
||||
rmov.put(RMOVMAG_CODART, recset_righe.get("IdProdotto").as_string());
|
||||
rmov.put(RMOVMAG_QUANT, recset_righe.get("Quantita").as_string());
|
||||
TString4 um = recset_righe.get("IdUmDoc").as_string();
|
||||
rmov.put(RMOVMAG_CODART, codart);
|
||||
rmov.put(RMOVMAG_QUANT, recset_lotti.get("RIQta").as_string());
|
||||
TString4 um = rigamov.get("IdUmDoc").as_string();
|
||||
if (um.blank())
|
||||
{
|
||||
TString80 key = recset_righe.get("IdProdotto").as_string();
|
||||
TString80 key = codart;
|
||||
key << "|1";
|
||||
um = cache().get(LF_UMART, key, UMART_UM);
|
||||
}
|
||||
rmov.put(RMOVMAG_UM, um);
|
||||
rmov.put(RMOVMAG_PREZZO, recset_righe.get("PrezzoMov").as_string());
|
||||
const int kmovmag = recset_righe.get("KMovmag").as_int();
|
||||
TString80 idlotto;
|
||||
get_lotto(kmovmag, idlotto);
|
||||
rmov.put(RMOVMAG_LIVGIAC, idlotto);
|
||||
rmov.put(RMOVMAG_PREZZO, rigamov.get("PrezzoMov").as_string());
|
||||
rmov.put(RMOVMAG_LIVGIAC, recset_lotti.get("IdLotto").as_string());
|
||||
}
|
||||
return true;
|
||||
return (recset_lotti.items()>0);
|
||||
}
|
||||
|
||||
void THardy_movmag::get_lotto(const int kmovmag, TString& idlotto)
|
||||
@ -261,6 +309,7 @@ void THardy_movmag::get_lotto(const int kmovmag, TString& idlotto)
|
||||
bool THardy_movmag::trasferisci()
|
||||
{
|
||||
TConfig& ini = config();
|
||||
_cauape = ini.get("APERTURA", "CausaliMagazzino");
|
||||
|
||||
// query su testate movimenti
|
||||
TString16 dastr, astr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user