Patch level : 2.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunta possibilita' di arrotondare le quantita' in base all'unita' di misura git-svn-id: svn://10.65.10.50/trunk@11044 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4ef1edaea9
commit
178b7799a7
@ -96,12 +96,6 @@ TMask_movmag::TMask_movmag(TMov_mag * m_m)
|
||||
TSheet_field &fld_righe = sfield(F_RIGHE);
|
||||
|
||||
// setta le colonne in base all'abilitazione dei livelli di giacenza
|
||||
/*
|
||||
livelli_giacenza().set_sheetcolumn(fld_righe,F_LIV1,1);
|
||||
livelli_giacenza().set_sheetcolumn(fld_righe,F_LIV2,2);
|
||||
livelli_giacenza().set_sheetcolumn(fld_righe,F_LIV3,3);
|
||||
livelli_giacenza().set_sheetcolumn(fld_righe,F_LIV4,4);
|
||||
*/
|
||||
livelli_giacenza().set_sheet_columns(fld_righe,F_LIV1);
|
||||
|
||||
// abilita i controlli
|
||||
@ -262,14 +256,14 @@ bool TMask_movmag::qta_inventory(real & qta)
|
||||
if (codcau.blank())
|
||||
codcau = get(F_CODCAUS);
|
||||
if (codcau.blank())
|
||||
return message_box("La causale non e' indicata");
|
||||
return error_box("La causale non e' indicata");
|
||||
|
||||
TCausale_magazzino cau = cache().get("%CAU",codcau);
|
||||
switch (cau.sgn(s_giac))
|
||||
{
|
||||
case 1: break;
|
||||
case -1: qta = - qta; break;
|
||||
default: message_box("La causale indicata non movimenta la giacenza");
|
||||
default: message_box("La causale indicata non movimenta la giacenza");
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -379,6 +373,8 @@ bool TMask_movmag::handle_giacattuale(TMask_field &f, KEY k)
|
||||
}
|
||||
TString16 codmag(maskrighe.get(F_CODMAG));
|
||||
codmag.insert(maskrighe.get(F_CODDEP),3);
|
||||
|
||||
/* vecchio modo instabile
|
||||
real tmpreal=maskrighe.get_real(F_UMFC);
|
||||
if (!tmpreal.is_zero())
|
||||
{
|
||||
@ -388,7 +384,15 @@ bool TMask_movmag::handle_giacattuale(TMask_field &f, KEY k)
|
||||
tmpreal=art.disponibilita(maskmov.get(F_ANNOES),codmag,codliv,TRUE)/tmpreal;
|
||||
}
|
||||
f.set(tmpreal.string());
|
||||
|
||||
*/
|
||||
const TString& um = maskrighe.get(F_UM);
|
||||
if (um.not_empty())
|
||||
{
|
||||
TArticolo_giacenza & art = maskmov.curr_art();
|
||||
real disp = art.disponibilita(maskmov.get(F_ANNOES),codmag,codliv,TRUE);
|
||||
disp = art.convert_to_um(disp, um, NULL, false);
|
||||
f.set(disp.string());
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
13
mg/mglib.h
13
mg/mglib.h
@ -57,7 +57,7 @@ typedef enum {
|
||||
riga_nongenerata=' ' // immissione direttta del mov.
|
||||
} TTipo_rigamovmag;
|
||||
|
||||
extern char* Nome_valorizz[16];
|
||||
extern const char* const Nome_valorizz[16];
|
||||
|
||||
typedef enum {
|
||||
valorizz_ultcos,
|
||||
@ -107,10 +107,13 @@ public:
|
||||
void update_ultcosti(const real& costo, const TDate& data, long numreg, int numrig);
|
||||
void set_prezzo_vendita(const real& prezzo, const char* um = NULL);
|
||||
|
||||
int find_um(const char * um, int from = 0) const { return find(LF_UMART, UMART_UM, um, from); }
|
||||
int find_deslin(const char * deslin, int from = 0) const { return find(LF_DESLIN, DESLIN_CODLIN, deslin, from); }
|
||||
int find_codcorr(const char * codcorr, int from = 0) const { return find(LF_CODCORR, CODCORR_CODARTALT, codcorr, from); }
|
||||
real convert_to_um(const real& v, const char * to_um, const char* from_um = NULL);
|
||||
int find_um(const char * um, int from = 0) const;
|
||||
int find_deslin(const char * deslin, int from = 0) const;
|
||||
int find_codcorr(const char * codcorr, int from = 0) const;
|
||||
|
||||
static void round_um(real& v, const char* to_um);
|
||||
real convert_to_um(const real& v, const char* to_um, const char* from_um = NULL, bool arrotonda = true);
|
||||
|
||||
TRecord_array & um() const { return body(LF_UMART); }
|
||||
TRecord_array & deslin() const { return body(LF_DESLIN); }
|
||||
TRecord_array & codcorr() const { return body(LF_CODCORR); }
|
||||
|
176
mg/mglib02.cpp
176
mg/mglib02.cpp
@ -2,22 +2,19 @@
|
||||
// oggetto TArticolo_giacenza, multirecord dell'articolo di magazzino
|
||||
// oggetto TMov_Mag , multirecord del movimento di magazzino
|
||||
// funzione di ricostruzione saldi
|
||||
#include <currency.h>
|
||||
#include <dongle.h>
|
||||
#include <modaut.h>
|
||||
|
||||
#include <fraction.h>
|
||||
#include <progind.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "mglib.h"
|
||||
#include "..\cg\cglib01.h"
|
||||
#include "..\ve\veconf.h"
|
||||
|
||||
#include "anamag.h"
|
||||
#include "mag.h"
|
||||
#include "movmag.h"
|
||||
#include "rmovmag.h"
|
||||
|
||||
#include "..\cg\cglib01.h"
|
||||
#include "..\ve\veconf.h"
|
||||
|
||||
// libreria per i movimenti
|
||||
class TTimed_skipbox: public TTimed_breakbox
|
||||
{
|
||||
@ -37,7 +34,7 @@ TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
|
||||
TTimed_skipbox::~TTimed_skipbox()
|
||||
{}
|
||||
|
||||
char* Nome_valorizz[16] =
|
||||
const char* const Nome_valorizz[16] =
|
||||
{
|
||||
"Ultimo costo", "Media ultimi costi", "Prezzo di listino",
|
||||
"Costo standard", "Costo medio acquisto" ,
|
||||
@ -47,8 +44,6 @@ char* Nome_valorizz[16] =
|
||||
"FIFO Ragionieristico", "LIFO Ragionieristico"
|
||||
} ;
|
||||
|
||||
HIDDEN TString16 _mg_null_str;
|
||||
|
||||
const TString & TArticolo::get_str(const char* fieldname) const
|
||||
{
|
||||
if (*fieldname != '#')
|
||||
@ -222,7 +217,7 @@ void TArticolo::set_prezzo_vendita(const real& prezzo, const char* unita)
|
||||
if (i == 1)
|
||||
p.set_num(prezzo);
|
||||
else
|
||||
p.set_num(convert_to_um(prezzo, codum));
|
||||
p.set_num(convert_to_um(prezzo, codum, NULL, false));
|
||||
rec.put(UMART_PREZZO, p.get_num());
|
||||
}
|
||||
}
|
||||
@ -230,31 +225,33 @@ void TArticolo::set_prezzo_vendita(const real& prezzo, const char* unita)
|
||||
|
||||
bool TArticolo::unlock()
|
||||
{
|
||||
bool rv;
|
||||
bool rv = false;
|
||||
if (codice().not_empty())
|
||||
{
|
||||
static TLocalisamfile *anag=NULL; if (anag==NULL) anag= new TLocalisamfile(LF_ANAMAG);
|
||||
/*
|
||||
static TLocalisamfile *anag=NULL;
|
||||
if (anag==NULL)
|
||||
anag= new TLocalisamfile(LF_ANAMAG);
|
||||
rv=(anag->read(*this, _isequal,_unlock)==NOERR);
|
||||
return rv;
|
||||
*/
|
||||
TLocalisamfile anag(LF_ANAMAG);
|
||||
rv = anag.read(*this, _isequal,_unlock) == NOERR;
|
||||
}
|
||||
return FALSE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool TArticolo::lock_and_prompt(const char * cod)
|
||||
{
|
||||
TString mess;
|
||||
int err;
|
||||
|
||||
int err = _iskeyerr;
|
||||
if (cod && *cod)
|
||||
err = read(cod,_isequal,_testandlock);
|
||||
else
|
||||
err = _iskeyerr;
|
||||
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString mess;
|
||||
if (err == _islocked)
|
||||
{
|
||||
mess << "Il record di anagrafica\ndell'articolo ''" << cod << "'' e' gia' usato da un altro programma.";
|
||||
mess << "Il record di anagrafica\ndell'articolo '" << cod << "' e' gia' usato da un altro programma.";
|
||||
TTimed_skipbox bbox((const char *)mess,10);
|
||||
while (err == _islocked)
|
||||
{
|
||||
@ -265,12 +262,12 @@ bool TArticolo::lock_and_prompt(const char * cod)
|
||||
else
|
||||
{
|
||||
if (err == _iskeyerr)
|
||||
mess << "Il codice articolo ''" << cod << "'' non e' valido";
|
||||
mess << "Il codice articolo '" << cod << "' non e' valido";
|
||||
else
|
||||
if (err == _iskeynotfound)
|
||||
mess << "Il record di anagrafica\ndell'articolo ''"<< cod << "'' non esiste.";
|
||||
else
|
||||
mess << "Non riesco ad accedere al\nrecord di anagrafica dell'articolo ''"<< cod << "'' - errore " << err << ".";
|
||||
mess << "Non riesco ad accedere al\nrecord di anagrafica dell'articolo '"<< cod << "' - errore " << err << ".";
|
||||
TTimed_skipbox bbox((const char *)mess,10);
|
||||
|
||||
bbox.run();
|
||||
@ -280,17 +277,80 @@ bool TArticolo::lock_and_prompt(const char * cod)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
real TArticolo::convert_to_um(const real& v, const char * to_um, const char * from_um)
|
||||
{
|
||||
int TArticolo::find_um(const char* um, int from) const
|
||||
{
|
||||
return find(LF_UMART, UMART_UM, um, from);
|
||||
}
|
||||
|
||||
int TArticolo::find_deslin(const char * deslin, int from) const
|
||||
{
|
||||
return find(LF_DESLIN, DESLIN_CODLIN, deslin, from);
|
||||
}
|
||||
|
||||
int TArticolo::find_codcorr(const char * codcorr, int from) const
|
||||
{
|
||||
return find(LF_CODCORR, CODCORR_CODARTALT, codcorr, from);
|
||||
}
|
||||
|
||||
// Funzione statica utilizzabile da tutti
|
||||
void TArticolo::round_um(real& r, const char* to_um)
|
||||
{
|
||||
if (to_um && *to_um)
|
||||
{
|
||||
const TRectype& baseum = cache().get("%UMS", to_um);
|
||||
if (baseum.get_bool("B0"))
|
||||
{
|
||||
const int dec = baseum.get_int("I0");
|
||||
r.round(dec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
real TArticolo::convert_to_um(const real& v, const char* to_um, const char* from_um, bool arrotonda)
|
||||
{
|
||||
// Inutile convertire valori nulli ed
|
||||
// altrettanto inutile convertire un'unica unita' di misura
|
||||
if (v.is_zero() || um().rows() <= 1)
|
||||
return v;
|
||||
|
||||
// Se from_um non specificato significa che la qta che si desidera convertire e' in UM base
|
||||
const int i1 = find_um(to_um);
|
||||
const int i2 = (from_um != NULL) ? find_um(from_um) : 0;
|
||||
TRecord_array& u = um();
|
||||
const real fc1 = i1 > 0 ? ((TRectype&)u[i1]).get_real("FC") : 1.00; // Fattore di conversione
|
||||
const real fc2 = i2 > 0 ? ((TRectype&)u[i2]).get_real("FC") : 1.00;
|
||||
const real r = (v * fc2) / fc1;
|
||||
// TBI: ricerca sulla tabella UMS nel caso di um non presenti in LF_UMART
|
||||
|
||||
// Gli indici delle unita; di misura valide partono da 1
|
||||
int i1 = (to_um && *to_um) ? find_um(to_um) : 1;
|
||||
int i2 = (from_um && *from_um) ? find_um(from_um) : 1;
|
||||
if (i1 == i2) // Inutile convertire in se stessi
|
||||
return v;
|
||||
|
||||
fraction f(v, UNO);
|
||||
// Se l'unita' di partenza NON e' quella base, converti in quella base
|
||||
if (i2 != 1)
|
||||
{
|
||||
fraction fc2(1, 1);
|
||||
if (i2 > 0)
|
||||
fc2 = (um()[i2]).get_real(UMART_FC);
|
||||
else
|
||||
{
|
||||
// Tentativo estremo di usare le unita' di misura comuni
|
||||
const TRectype& fromum = cache().get("%UMS", from_um);
|
||||
if (fromum.get("S7") == to_um)
|
||||
{
|
||||
fc2 = fromum.get_real(UMART_FC);
|
||||
i1 = 1; // La conversione termina qui: non moltiplicare per fc1!
|
||||
}
|
||||
}
|
||||
f *= fc2;
|
||||
}
|
||||
// Se l'unita' di destinazione NON e' quella base converti
|
||||
if (i1 > 1)
|
||||
{
|
||||
const fraction fc1 = (um()[i1]).get(UMART_FC);
|
||||
f /= fc1;
|
||||
}
|
||||
|
||||
real r = f;
|
||||
// Se devi arrotondare ad un'unita' valida ... fallo!
|
||||
if (arrotonda && i1 > 0)
|
||||
round_um(r, um()[i1].get(UMART_UM));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -302,7 +362,7 @@ TArticolo::TArticolo(const char* codice)
|
||||
add_file(LF_DESLIN,"NRIGA");
|
||||
if (codice && *codice)
|
||||
{
|
||||
int err=read(codice);
|
||||
const int err=read(codice);
|
||||
if (err!=NOERR)
|
||||
error_box("Impossibile leggere l'articolo %s: Errore %d",codice, err);
|
||||
}
|
||||
@ -687,14 +747,14 @@ real TArticolo_giacenza::ultimo_costo(const char * annoes) const
|
||||
if (is_last_esercizio(annoes))
|
||||
{
|
||||
const real costo = get_real(ANAMAG_ULTCOS1);
|
||||
return costo == ZERO ? costo_standard(annoes) : costo;
|
||||
return costo.is_zero() ? costo_standard(annoes) : costo;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int index = find_storico(annoes);
|
||||
if (index < 0 ) return ZERO;
|
||||
const real costo = storico(annoes).row(index).get_real(STOMAG_ULTCOS1);
|
||||
return costo == ZERO ? costo_standard(annoes) : costo;
|
||||
return costo.is_zero() ? costo_standard(annoes) : costo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -704,7 +764,7 @@ real TArticolo_giacenza::media_costi(const char * annoes) const
|
||||
{
|
||||
real costo = get_real(ANAMAG_ULTCOS1);
|
||||
costo = (costo + get_real(ANAMAG_ULTCOS2)) / 2.0;
|
||||
return costo == ZERO ? costo_standard(annoes) : costo;
|
||||
return costo.is_zero() ? costo_standard(annoes) : costo;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -714,7 +774,7 @@ real TArticolo_giacenza::media_costi(const char * annoes) const
|
||||
real costo = rec.get_real(STOMAG_ULTCOS1);
|
||||
|
||||
costo = (costo + rec.get_real(STOMAG_ULTCOS2)) / 2.0;
|
||||
return costo == ZERO ? costo_standard(annoes) : costo;
|
||||
return costo.is_zero() ? costo_standard(annoes) : costo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -776,7 +836,7 @@ real TArticolo_giacenza::costo_medio(const char * annoes, const char * codmag, c
|
||||
acq += rec.get_real(MAG_ACQ);
|
||||
valacq += rec.get_real(MAG_VALACQ);
|
||||
}
|
||||
return acq == ZERO ? costo_standard(annoes) : valacq / acq;
|
||||
return acq.is_zero() ? costo_standard(annoes) : valacq / acq;
|
||||
}
|
||||
|
||||
// costo medio ponderato per periodi pari alla durata dell'esercizio
|
||||
@ -800,7 +860,7 @@ real TArticolo_giacenza::costo_mediopond(const char * annoes, const char * codma
|
||||
valacq += rec.get_real(MAG_VALACQ);
|
||||
valacq += rec.get_real(MAG_VALRIM);
|
||||
}
|
||||
return acq == ZERO ? costo_standard(annoes) : valacq / acq;
|
||||
return acq.is_zero() ? costo_standard(annoes) : valacq / acq;
|
||||
}
|
||||
|
||||
real TArticolo_giacenza::LIFO_annuale(const char * annoes, const char * codmag, const char * livello,
|
||||
@ -824,7 +884,7 @@ real TArticolo_giacenza::LIFO_annuale(const char * annoes, const char * codmag,
|
||||
if (giacenza <= ZERO)
|
||||
return ZERO;
|
||||
if (giacenza > rim)
|
||||
return ((giacenza - rim) * (acq == ZERO ? costo_standard(annoes) : valacq / acq) + valrim) / giacenza;
|
||||
return ((giacenza - rim) * (acq.is_zero() ? costo_standard(annoes) : valacq / acq) + valrim) / giacenza;
|
||||
return valrim / rim;
|
||||
}
|
||||
|
||||
@ -849,7 +909,7 @@ real TArticolo_giacenza::FIFO_annuale(const char * annoes, const char * codmag,
|
||||
}
|
||||
if (giacenza <= ZERO)
|
||||
return ZERO;
|
||||
if (rim == ZERO)
|
||||
if (rim.is_zero())
|
||||
return ZERO;
|
||||
if (giacenza > acq)
|
||||
return ((giacenza - acq) * (valrim / rim) + valacq) / giacenza;
|
||||
@ -1163,7 +1223,7 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma
|
||||
// aggiunge la quota dell'anno in corso
|
||||
// qta=giacenza-rim;
|
||||
qta = min(giacenza, acq);
|
||||
if (qta != ZERO)
|
||||
if (!qta.is_zero())
|
||||
{
|
||||
TPrice prz;
|
||||
|
||||
@ -1298,9 +1358,7 @@ real TArticolo_giacenza::scorta_minima(const char* codmag,
|
||||
return sm;
|
||||
}
|
||||
|
||||
long TArticolo_giacenza::lead_time(const char* codmag,
|
||||
const char* livello,
|
||||
int anno) const
|
||||
long TArticolo_giacenza::lead_time(const char* codmag, const char* livello, int anno) const
|
||||
{
|
||||
TString4 annoes;
|
||||
if (anno > 0)
|
||||
@ -1323,13 +1381,12 @@ long TArticolo_giacenza::lead_time(const char* codmag,
|
||||
}
|
||||
}
|
||||
if (nmag)
|
||||
sm = sm / nmag;
|
||||
sm /= real(nmag);
|
||||
else
|
||||
sm = get_real(ANAMAG_GIORNIRIOR);
|
||||
return sm.integer();
|
||||
}
|
||||
|
||||
|
||||
TArticolo_giacenza::TArticolo_giacenza(const char* codice)
|
||||
: TArticolo(codice)
|
||||
{
|
||||
@ -1346,7 +1403,6 @@ TArticolo_giacenza::TArticolo_giacenza(const TRectype& rec)
|
||||
|
||||
// Giacenze alla data
|
||||
|
||||
|
||||
int TArticolo_giacenza_data::write(TBaseisamfile&) const
|
||||
{
|
||||
NFCHECK("Non e' possibile scrivere un Articolo con giacenza alla data");
|
||||
@ -1547,20 +1603,22 @@ TCausale_magazzino::TCausale_magazzino(const TRectype &r):
|
||||
CHECK(r.num() == LF_TABCOM, "Tipo record errato sulla causale di magazzino");
|
||||
}
|
||||
|
||||
const real CENTO=real(100.0);
|
||||
|
||||
bool TCondizione_vendita::ricerca(const char * codice, const real & qta)
|
||||
{
|
||||
int tiporic;
|
||||
switch (_condv.get_char("TIPO")) {
|
||||
case 'L':
|
||||
tiporic=A_LISTINI;
|
||||
switch (_condv.get_char("TIPO"))
|
||||
{
|
||||
case 'L':
|
||||
tiporic = A_LISTINI;
|
||||
break;
|
||||
case 'C':
|
||||
tiporic=A_CONTRATTI;
|
||||
case 'C':
|
||||
tiporic = A_CONTRATTI;
|
||||
break;
|
||||
case 'O':
|
||||
tiporic = A_OFFERTE;
|
||||
break;
|
||||
case 'O':
|
||||
tiporic=A_OFFERTE;
|
||||
default:
|
||||
tiporic = ' ';
|
||||
break;
|
||||
}
|
||||
return cerca(tiporic,codice, qta);
|
||||
@ -1695,7 +1753,7 @@ bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const r
|
||||
*/
|
||||
const TRectype& um = cache().get(LF_UMART, cod);
|
||||
_prezzo = um.get_real("PREZZO");
|
||||
found = _prezzo != ZERO;
|
||||
found = !_prezzo.is_zero();
|
||||
}
|
||||
|
||||
return found;
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
const TString& um() const {return _um;}
|
||||
const real& quant() const {return _quant;}
|
||||
const real& prezzo() const {return _prezzo;}
|
||||
void set(const TString& cau,const TString& um,const real q, const real p);
|
||||
void set(const TString& cau,const TString& um,const real& q, const real& p);
|
||||
int operator==(TLine_movmag &);
|
||||
|
||||
virtual TObject* dup() const { return new TLine_movmag(*this); }
|
||||
@ -44,7 +44,7 @@ public:
|
||||
virtual ~TLine_movmag() {};
|
||||
};
|
||||
|
||||
void TLine_movmag ::set(const TString& cau,const TString& um,const real q, const real p)
|
||||
void TLine_movmag ::set(const TString& cau,const TString& um,const real& q, const real& p)
|
||||
{
|
||||
_codcaus=cau;
|
||||
_um=um;
|
||||
@ -463,7 +463,7 @@ bool TMov_mag::lock_anamag(const char *codart)
|
||||
return TRUE;
|
||||
|
||||
TString mess;
|
||||
mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.";
|
||||
mess << "Il record di anagrafica dell'articolo '"<< codart << "' risulta essere già in uso.";
|
||||
TTimed_breakbox bbox((const char *)mess,10);
|
||||
|
||||
key = bbox.run();
|
||||
@ -513,7 +513,7 @@ int TMov_mag::update_balances()
|
||||
|
||||
if (causmag.update_ultcos())
|
||||
{
|
||||
const real prezzo = curr_art.convert_to_um(line_mov.prezzo(), line_mov.um());
|
||||
const real prezzo = curr_art.convert_to_um(line_mov.prezzo(), line_mov.um(), NULL, false);
|
||||
curr_art.update_ultcosti(prezzo,get_date("DATACOMP"), get_long("NUMREG"),nriga++);
|
||||
curr_art.rewrite();
|
||||
}
|
||||
@ -582,27 +582,33 @@ int TMov_mag::update_balances()
|
||||
// in base alla causale e alla modifica fatta (con segno + o -)
|
||||
int TMov_mag::update_balances(TRectype & magrec, const TLine_movmag &l,int rett_sign)
|
||||
{
|
||||
const TCausale_magazzino& caus = causale(l.codcaus());
|
||||
TLocalisamfile umart(LF_UMART);
|
||||
real diff,diff_val;
|
||||
|
||||
umart.setkey(2);
|
||||
umart.put(UMART_CODART,magrec.get(MAG_CODART));
|
||||
umart.put(UMART_UM , l.um());
|
||||
umart.read();
|
||||
real fc=umart.get_real("FC");
|
||||
|
||||
const int err = umart.read();
|
||||
|
||||
const real fc = err == NOERR ? umart.get_real(UMART_FC) : 1.0;
|
||||
const real qt = l.quant();
|
||||
|
||||
diff=real(rett_sign) * qt * fc;
|
||||
diff_val= real(rett_sign) * qt * l.prezzo();
|
||||
real diff = real(rett_sign) * qt * fc;
|
||||
if (err == NOERR && fc != 1.0)
|
||||
{
|
||||
umart.setkey(1);
|
||||
umart.put(UMART_CODART,magrec.get(MAG_CODART));
|
||||
umart.put(UMART_NRIGA , 1);
|
||||
if (umart.read() == NOERR)
|
||||
TArticolo::round_um(diff, umart.get(UMART_UM));
|
||||
}
|
||||
|
||||
real diff_val = real(rett_sign) * qt * l.prezzo();
|
||||
|
||||
// Se è una causale che movimenta il valore ma la qta è 0
|
||||
// anche diff_val avrà lo stesso valore, impostando 0 di conseguenza
|
||||
// anche nei campi relativi a VALACQ, VALRIM etc etc.
|
||||
// Quindi al limite come controllo finale su movimenti che movimentano la qta
|
||||
// nel caso il calcolo dia proprio ZERO, impostiamo diff_val all'importo del valore stesso
|
||||
const TCausale_magazzino& caus = causale(l.codcaus());
|
||||
if (qt == ZERO && caus.update_val())
|
||||
diff_val = real(rett_sign) * l.prezzo();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user