Patch level : 10.0 patch 305
Files correlati : lv2 Ricompilazione Demo : [ ] Commento : Corretta la gestione delle causali di solo ritiro git-svn-id: svn://10.65.10.50/trunk@20024 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
965e22e6c4
commit
7fb4f596b6
@ -491,44 +491,62 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row(tiporiga);
|
||||
|
||||
const real quantita_noarr = qta - conguaglio;
|
||||
real quantita_arr = quantita_noarr > ZERO ? quantita_noarr : ZERO;
|
||||
//se devo arrotondare
|
||||
if (quantita_arr > ZERO && arrot)
|
||||
{
|
||||
//calcolo di quanti pezzi sforo
|
||||
long arr = quantita_arr.integer() % ppconf.integer();
|
||||
//se sforo (arr > 0) allora calcolo quanti pezzi in più gli devo dare e aggiorno la quantità
|
||||
if (arr > 0)
|
||||
if (arr > ppconf.integer() * perarr / 100) //arr <= ppconf*perarr/100 -> formula calcolo congualgio di Tassan
|
||||
{
|
||||
arr = ppconf.integer() - arr;
|
||||
quantita_arr += arr;
|
||||
}
|
||||
else
|
||||
quantita_arr -= arr;
|
||||
}
|
||||
|
||||
//scrivo le quantità
|
||||
rdoc.put(RDOC_QTA, quantita_arr); //quantità consegnata eventualmente arrotondata
|
||||
//se no scrivo le quantità sbalgiate
|
||||
if (tmp && rcont.get_bool(LVRCONDV_RITAUDTTMP))
|
||||
rdoc.put(RDOC_QTAGG1, qta); //quantità ritirata
|
||||
else
|
||||
rdoc.put(RDOC_QTAGG1, qta1); //quantità ritirata
|
||||
rdoc.put(RDOC_QTAGG2, conguaglio); //conguaglio
|
||||
rdoc.put(RDOC_QTAGG3, quantita_arr); //copia della quantità consegnata
|
||||
rdoc.put(RDOC_QTAGG4, quantita_noarr); //quantità che avrei consegnato se non arrotondavo (qta ritirata)
|
||||
rdoc.put(RDOC_GENERATA, true);
|
||||
|
||||
//causale da mettere sulle righe documento
|
||||
const TCausale_lavanderie cau(causale);
|
||||
const TString4 codcau = cau.caucol().empty() ? cau.codice() : cau.caucol();
|
||||
rdoc.put(RDOC_CODAGG1, codcau);
|
||||
|
||||
//aggiorno il conguaglio sulla riga del contratto
|
||||
if (!rcont.empty())
|
||||
aggiorna_conguaglio((TRectype&)rcont, quantita_arr - quantita_noarr);
|
||||
if(cau.is_consegna())
|
||||
{
|
||||
const real quantita_noarr = qta - conguaglio;
|
||||
real quantita_arr = quantita_noarr > ZERO ? quantita_noarr : ZERO;
|
||||
//se devo arrotondare
|
||||
if (quantita_arr > ZERO && arrot)
|
||||
{
|
||||
//calcolo di quanti pezzi sforo
|
||||
long arr = quantita_arr.integer() % ppconf.integer();
|
||||
//se sforo (arr > 0) allora calcolo quanti pezzi in più gli devo dare e aggiorno la quantità
|
||||
if (arr > 0)
|
||||
if (arr > ppconf.integer() * perarr / 100) //arr <= ppconf*perarr/100 -> formula calcolo congualgio di Tassan
|
||||
{
|
||||
arr = ppconf.integer() - arr;
|
||||
quantita_arr += arr;
|
||||
}
|
||||
else
|
||||
quantita_arr -= arr;
|
||||
}
|
||||
|
||||
//scrivo le quantità
|
||||
rdoc.put(RDOC_QTA, quantita_arr); //quantità consegnata eventualmente arrotondata
|
||||
rdoc.put(RDOC_QTAGG2, conguaglio); //conguaglio
|
||||
rdoc.put(RDOC_QTAGG3, quantita_arr); //copia della quantità consegnata
|
||||
rdoc.put(RDOC_QTAGG4, quantita_noarr); //quantità che avrei consegnato se non arrotondavo (qta ritirata)
|
||||
rdoc.put(RDOC_GENERATA, true);
|
||||
|
||||
//aggiorno il conguaglio sulla riga del contratto
|
||||
//altrimenti se il record di riga contratto è vuoto aggiorno il log
|
||||
if (!rcont.empty())
|
||||
aggiorna_conguaglio((TRectype&)rcont, quantita_arr - quantita_noarr);
|
||||
else
|
||||
{
|
||||
TString str;
|
||||
str << "L'articolo " << codart << " inserito nel documento " << doc.get(DOC_CODNUM) << "-" << doc.get(DOC_TIPODOC)
|
||||
<< " numero " << doc.get(DOC_NDOC) << " per la quantità di " << quantita_arr << " unità"
|
||||
<< " non è prsente sul contratto del cliente " << codcli;
|
||||
rep.log(1, str);
|
||||
}
|
||||
}
|
||||
|
||||
if(cau.is_ritiro())
|
||||
{
|
||||
//se no scrivo le quantità sbalgiate
|
||||
if (tmp && rcont.get_bool(LVRCONDV_RITAUDTTMP))
|
||||
rdoc.put(RDOC_QTAGG1, qta); //quantità ritirata
|
||||
else
|
||||
rdoc.put(RDOC_QTAGG1, qta1); //quantità ritirata
|
||||
}
|
||||
|
||||
|
||||
|
||||
//elaborazione sul prezzo da utilizzare
|
||||
real prezzo;
|
||||
@ -644,16 +662,6 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
|
||||
rdoc.put(RDOC_CODMAG, magazzino);
|
||||
rdoc.put(RDOC_CODMAGC, magazzinoc);
|
||||
|
||||
//se il record di riga contratto è vuoto aggiorno il log
|
||||
if (rcont.empty())
|
||||
{
|
||||
TString str;
|
||||
str << "L'articolo " << codart << " inserito nel documento " << doc.get(DOC_CODNUM) << "-" << doc.get(DOC_TIPODOC)
|
||||
<< " numero " << doc.get(DOC_NDOC) << " per la quantità di " << quantita_arr << " unità"
|
||||
<< " non è prsente sul contratto del cliente " << codcli;
|
||||
rep.log(1, str);
|
||||
}
|
||||
}
|
||||
|
||||
if (dottmp == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user