1997-06-23 14:51:53 +00:00
|
|
|
|
// oggetto TArticolo, multirecord dell'articolo di anagrafica magazzino
|
|
|
|
|
// oggetto TArticolo_giacenza, multirecord dell'articolo di magazzino
|
1997-06-27 12:58:13 +00:00
|
|
|
|
// oggetto TMov_Mag , multirecord del movimento di magazzino
|
1997-06-23 14:51:53 +00:00
|
|
|
|
// funzione di ricostruzione saldi
|
2003-04-22 14:30:52 +00:00
|
|
|
|
|
|
|
|
|
#include <fraction.h>
|
1999-04-26 15:58:05 +00:00
|
|
|
|
#include <progind.h>
|
1997-10-24 14:43:50 +00:00
|
|
|
|
|
1997-06-06 16:36:35 +00:00
|
|
|
|
#include "mglib.h"
|
2003-04-22 14:30:52 +00:00
|
|
|
|
#include "..\cg\cglib01.h"
|
|
|
|
|
#include "..\ve\veconf.h"
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include "anamag.h"
|
|
|
|
|
#include "mag.h"
|
1999-04-26 15:58:05 +00:00
|
|
|
|
#include "movmag.h"
|
|
|
|
|
#include "rmovmag.h"
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
1997-06-18 15:18:06 +00:00
|
|
|
|
// libreria per i movimenti
|
1999-04-06 15:34:39 +00:00
|
|
|
|
class TTimed_skipbox: public TTimed_breakbox
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
TTimed_skipbox(const char * message,int seconds,int x=40,int y=10);
|
|
|
|
|
~TTimed_skipbox();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
|
|
|
|
|
: TTimed_breakbox(message,seconds,x,y)
|
|
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
|
hide(DLG_OK);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
hide(DLG_CANCEL);
|
2003-02-25 14:39:02 +00:00
|
|
|
|
add_button(DLG_OK, 0, "Continua", -11, -1, 12, 2,"",0);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TTimed_skipbox::~TTimed_skipbox()
|
|
|
|
|
{}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
2003-04-22 14:30:52 +00:00
|
|
|
|
const char* const Nome_valorizz[16] =
|
1998-02-18 13:46:52 +00:00
|
|
|
|
{
|
1997-06-04 14:27:02 +00:00
|
|
|
|
"Ultimo costo", "Media ultimi costi", "Prezzo di listino",
|
1998-08-25 18:07:30 +00:00
|
|
|
|
"Costo standard", "Costo medio acquisto" ,
|
|
|
|
|
"Costo medio ponderato" ,
|
1997-06-04 14:27:02 +00:00
|
|
|
|
"FIFO annuale", "LIFO annuale",
|
|
|
|
|
"FIFO", "LIFO",
|
|
|
|
|
"FIFO Ragionieristico", "LIFO Ragionieristico"
|
|
|
|
|
} ;
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const TString & TArticolo::get_str(const char* fieldname) const
|
|
|
|
|
{
|
|
|
|
|
if (*fieldname != '#')
|
|
|
|
|
return TRectype::get_str(fieldname);
|
|
|
|
|
char * fname = (char *) fieldname + 1;
|
|
|
|
|
const int logicnum = atoi(fname);
|
|
|
|
|
const char * op1 = strchr(fname, '_');
|
|
|
|
|
int index = 0;
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (op1)
|
|
|
|
|
{
|
|
|
|
|
op1=op1+1;
|
|
|
|
|
if (*op1 == '#')
|
|
|
|
|
index = atoi(fname + 1);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const char* op2 = strstr(fname, "->");
|
|
|
|
|
CHECKS(op2, "Can't find '->' in string ", fieldname);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
op2=op2+2;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
switch (logicnum)
|
|
|
|
|
{
|
|
|
|
|
case LF_UMART:
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
index = find_um(op1);
|
|
|
|
|
if (index > 0 && op2)
|
|
|
|
|
return um().row(index).get(op2);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case LF_CODCORR:
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
index = find_codcorr(op1);
|
|
|
|
|
if (index > 0 && op2)
|
|
|
|
|
return codcorr().row(index).get(op2);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case LF_DESLIN:
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
index = find_deslin(op1);
|
|
|
|
|
if (index > 0 && op2)
|
|
|
|
|
return deslin().row(index).get(op2);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-05-04 09:59:49 +00:00
|
|
|
|
return EMPTY_STRING;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
void TArticolo::set_body_key(TRectype & rowrec)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const int logicnum = rowrec.num();
|
1998-11-04 18:04:26 +00:00
|
|
|
|
const TString& cod = codice();
|
1997-05-30 15:26:08 +00:00
|
|
|
|
|
|
|
|
|
switch (logicnum)
|
|
|
|
|
{
|
|
|
|
|
case LF_UMART:
|
1998-11-04 18:04:26 +00:00
|
|
|
|
rowrec.put(UMART_CODART, cod);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
break;
|
|
|
|
|
case LF_DESLIN:
|
1998-11-04 18:04:26 +00:00
|
|
|
|
rowrec.put(DESLIN_CODART, cod);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
break;
|
|
|
|
|
case LF_CODCORR:
|
1998-11-04 18:04:26 +00:00
|
|
|
|
rowrec.put(CODCORR_CODART, cod);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-18 15:23:13 +00:00
|
|
|
|
int TArticolo::read(TRectype & rec, word op, word lockop)
|
|
|
|
|
{
|
2003-05-29 08:01:52 +00:00
|
|
|
|
const TString& compstr = rec.get(ANAMAG_CODART);
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (op == _isequal && lockop == _nolock && codice() == compstr)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
return NOERR;
|
2003-05-29 08:01:52 +00:00
|
|
|
|
int err = _iskeyerr;
|
|
|
|
|
if (!compstr.blank())
|
|
|
|
|
{
|
|
|
|
|
put(ANAMAG_CODART, compstr);
|
|
|
|
|
err = TMultiple_rectype::read(rec, op , lockop);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
if (err != NOERR)
|
|
|
|
|
zero();
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-18 15:23:13 +00:00
|
|
|
|
int TArticolo::read(const char * cod, word op, word lockop)
|
2003-05-29 08:01:52 +00:00
|
|
|
|
{
|
1998-01-09 16:33:25 +00:00
|
|
|
|
TRectype tmp(*this);
|
|
|
|
|
tmp.put(ANAMAG_CODART,cod);
|
|
|
|
|
return read( tmp, op, lockop);
|
1997-06-18 15:23:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const TString& TArticolo::codice() const
|
|
|
|
|
{
|
|
|
|
|
((TArticolo *)this)->_codice=get(ANAMAG_CODART);
|
|
|
|
|
return _codice;
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const TString & TArticolo::descrizione(const char* lingua) const
|
|
|
|
|
{
|
|
|
|
|
if (lingua && *lingua)
|
|
|
|
|
{
|
|
|
|
|
TString16 f; f.format("#%d_%s->%s", LF_DESLIN, lingua, DESLIN_DESCR);
|
|
|
|
|
return get(f);
|
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
return get(ANAMAG_DESCR);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void TArticolo::update_ultcosti(const real& costo, const TDate& data, long numreg, int _unused_)
|
1997-06-04 14:27:02 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const TDate data1(get_date(ANAMAG_DULTCOS1));
|
|
|
|
|
const TDate data2(get_date(ANAMAG_DULTCOS2));
|
1999-05-24 13:34:11 +00:00
|
|
|
|
// modificato il 2-2-1999;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const long numreg1 = get_long(ANAMAG_NUMREG1);
|
|
|
|
|
const long numreg2 = get_long(ANAMAG_NUMREG2);
|
1999-05-24 13:34:11 +00:00
|
|
|
|
if (data >= data1 || (numreg == numreg1 && // movimento piu' recente o aggiornamento dello stesso movimento ...
|
|
|
|
|
(data > data2 || numreg > numreg2))) // ... e "data" superiore al penultimo
|
1997-06-18 15:18:06 +00:00
|
|
|
|
{
|
1999-05-24 13:34:11 +00:00
|
|
|
|
const real costo1(get_real(ANAMAG_ULTCOS1));
|
1997-06-18 15:18:06 +00:00
|
|
|
|
put(ANAMAG_ULTCOS1,costo);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
put(ANAMAG_DULTCOS1,data);
|
|
|
|
|
put(ANAMAG_NUMREG1,numreg);
|
|
|
|
|
if (numreg != numreg1 && (data > data1 || numreg > numreg1))
|
|
|
|
|
{
|
|
|
|
|
// trasforma l'ultimo costo in penultimo
|
|
|
|
|
put(ANAMAG_ULTCOS2,costo1);
|
|
|
|
|
put(ANAMAG_DULTCOS2,data1);
|
|
|
|
|
put(ANAMAG_NUMREG2,numreg1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-05-24 13:34:11 +00:00
|
|
|
|
const real costo2 = get_real(ANAMAG_ULTCOS2);
|
|
|
|
|
if (data >= data2 || numreg == numreg2 || numreg == numreg1)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
put(ANAMAG_DULTCOS2,data);
|
|
|
|
|
put(ANAMAG_ULTCOS2,costo);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
put(ANAMAG_NUMREG2,numreg);
|
|
|
|
|
}
|
|
|
|
|
if (numreg == numreg1 )
|
|
|
|
|
{
|
|
|
|
|
// trasforma il penultimo costo in ultimo
|
|
|
|
|
put(ANAMAG_ULTCOS1,costo2);
|
|
|
|
|
put(ANAMAG_DULTCOS1,data2);
|
|
|
|
|
put(ANAMAG_NUMREG1,numreg2);
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-06-04 14:27:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
void TArticolo::set_prezzo_vendita(const real& prezzo, const char* unita)
|
|
|
|
|
{
|
|
|
|
|
TPrice p; // Arrotondatore automatico
|
|
|
|
|
|
|
|
|
|
if (unita && *unita)
|
|
|
|
|
{
|
|
|
|
|
const int i = find_um(unita);
|
|
|
|
|
if (i > 0)
|
|
|
|
|
{
|
|
|
|
|
TRectype& rec = (TRectype&)um().row(i);
|
|
|
|
|
p.set_num(prezzo);
|
|
|
|
|
rec.put(UMART_PREZZO, p.get_num());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TString16 codum;
|
|
|
|
|
for (int i = um().rows(); i > 0; i--)
|
|
|
|
|
{
|
|
|
|
|
TRectype& rec = (TRectype&)um().row(i);
|
|
|
|
|
codum = rec.get(UMART_UM);
|
|
|
|
|
if (i == 1)
|
|
|
|
|
p.set_num(prezzo);
|
|
|
|
|
else
|
2003-04-22 14:30:52 +00:00
|
|
|
|
p.set_num(convert_to_um(prezzo, codum, NULL, false));
|
2000-05-05 15:25:49 +00:00
|
|
|
|
rec.put(UMART_PREZZO, p.get_num());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-04 14:27:02 +00:00
|
|
|
|
bool TArticolo::unlock()
|
|
|
|
|
{
|
2003-04-22 14:30:52 +00:00
|
|
|
|
bool rv = false;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (codice().not_empty())
|
1997-06-18 15:18:06 +00:00
|
|
|
|
{
|
2003-04-22 14:30:52 +00:00
|
|
|
|
TLocalisamfile anag(LF_ANAMAG);
|
|
|
|
|
rv = anag.read(*this, _isequal,_unlock) == NOERR;
|
1997-06-18 15:18:06 +00:00
|
|
|
|
}
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return rv;
|
1997-06-04 14:27:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
bool TArticolo::lock_and_prompt(const char * cod)
|
1997-06-04 14:27:02 +00:00
|
|
|
|
{
|
2003-04-22 14:30:52 +00:00
|
|
|
|
int err = _iskeyerr;
|
2003-02-25 14:39:02 +00:00
|
|
|
|
if (cod && *cod)
|
|
|
|
|
err = read(cod,_isequal,_testandlock);
|
|
|
|
|
|
|
|
|
|
if (err != NOERR)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2003-04-22 14:30:52 +00:00
|
|
|
|
TString mess;
|
2003-02-25 14:39:02 +00:00
|
|
|
|
if (err == _islocked)
|
|
|
|
|
{
|
2003-04-22 14:30:52 +00:00
|
|
|
|
mess << "Il record di anagrafica\ndell'articolo '" << cod << "' e' gia' usato da un altro programma.";
|
2003-02-25 14:39:02 +00:00
|
|
|
|
TTimed_skipbox bbox((const char *)mess,10);
|
|
|
|
|
while (err == _islocked)
|
|
|
|
|
{
|
|
|
|
|
bbox.run();
|
|
|
|
|
err = read(cod,_isequal,_testandlock);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
else
|
1998-01-09 16:33:25 +00:00
|
|
|
|
{
|
2003-02-25 14:39:02 +00:00
|
|
|
|
if (err == _iskeyerr)
|
2003-04-22 14:30:52 +00:00
|
|
|
|
mess << "Il codice articolo '" << cod << "' non e' valido";
|
2003-02-25 14:39:02 +00:00
|
|
|
|
else
|
|
|
|
|
if (err == _iskeynotfound)
|
2003-04-23 09:26:17 +00:00
|
|
|
|
mess << "Il record di anagrafica\ndell'articolo '"<< cod << "' non esiste.";
|
2003-02-25 14:39:02 +00:00
|
|
|
|
else
|
2003-04-22 14:30:52 +00:00
|
|
|
|
mess << "Non riesco ad accedere al\nrecord di anagrafica dell'articolo '"<< cod << "' - errore " << err << ".";
|
2003-02-25 14:39:02 +00:00
|
|
|
|
TTimed_skipbox bbox((const char *)mess,10);
|
|
|
|
|
|
|
|
|
|
bbox.run();
|
1998-01-09 16:33:25 +00:00
|
|
|
|
return FALSE;
|
2003-02-25 14:39:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1997-06-04 14:27:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-04-22 14:30:52 +00:00
|
|
|
|
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;
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
// Se from_um non specificato significa che la qta che si desidera convertire e' in UM base
|
2003-04-22 14:30:52 +00:00
|
|
|
|
// 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)
|
|
|
|
|
{
|
2003-04-23 09:26:17 +00:00
|
|
|
|
const fraction fc1( (um()[i1]).get_real(UMART_FC), UNO );
|
2003-04-22 14:30:52 +00:00
|
|
|
|
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));
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
return r;
|
|
|
|
|
}
|
1997-06-04 14:27:02 +00:00
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
TArticolo::TArticolo(const char* codice)
|
1997-05-30 15:26:08 +00:00
|
|
|
|
: TMultiple_rectype(LF_ANAMAG)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
add_file(LF_UMART,"NRIGA");
|
|
|
|
|
add_file(LF_CODCORR,"NRIGA");
|
|
|
|
|
add_file(LF_DESLIN,"NRIGA");
|
1997-05-27 11:12:10 +00:00
|
|
|
|
if (codice && *codice)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2003-05-29 08:01:52 +00:00
|
|
|
|
const int err = read(codice);
|
|
|
|
|
if (err != NOERR)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
error_box("Impossibile leggere l'articolo %s: Errore %d",codice, err);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArticolo::TArticolo(const TRectype& rec)
|
1997-05-30 15:26:08 +00:00
|
|
|
|
: TMultiple_rectype(rec)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
add_file(LF_UMART,"NRIGA");
|
|
|
|
|
add_file(LF_CODCORR,"NRIGA");
|
|
|
|
|
add_file(LF_DESLIN,"NRIGA");
|
|
|
|
|
read(rec.get(ANAMAG_CODART));
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArticolo::~TArticolo()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
1997-06-06 16:36:35 +00:00
|
|
|
|
// *****************
|
1999-05-24 13:34:11 +00:00
|
|
|
|
// TArticolo_giacenza
|
1997-06-06 16:36:35 +00:00
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const TString & TArticolo_giacenza::get_str(const char* fieldname) const
|
|
|
|
|
{
|
|
|
|
|
if (*fieldname != '#')
|
|
|
|
|
return TRectype::get_str(fieldname);
|
|
|
|
|
char * fname = (char *) fieldname + 1;
|
|
|
|
|
const int logicnum = atoi(fname);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (logicnum !=LF_MAG && logicnum !=LF_STOMAG)
|
|
|
|
|
return TArticolo::get_str(fieldname);
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const char * op1 = strchr(fname, '_');
|
|
|
|
|
int index = 0;
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (op1)
|
|
|
|
|
{
|
|
|
|
|
op1=op1+1;
|
|
|
|
|
fname = (char *) op1;
|
|
|
|
|
if (*op1 == '#')
|
|
|
|
|
index = atoi(fname + 1);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const char * op2 = strchr(fname, '_');
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (op2)
|
|
|
|
|
{
|
|
|
|
|
op2=op2+1;
|
|
|
|
|
fname = (char *) op2 + 1;
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const char * op3 = strchr(fname, '_');
|
1998-06-10 16:38:58 +00:00
|
|
|
|
if (op3)
|
|
|
|
|
op3=op3+1;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const char * op4 = strstr(fname, "->");
|
|
|
|
|
CHECKS(op4, "Can't find '->' in string ", fieldname);
|
1998-06-10 16:38:58 +00:00
|
|
|
|
op4=op4+2;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
switch (logicnum)
|
|
|
|
|
{
|
|
|
|
|
case LF_MAG:
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
index = find_mag(op1, op2, op3);
|
|
|
|
|
if (index > 0 && op3)
|
|
|
|
|
return mag(op1).row(index).get(op4);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
break;
|
1998-06-10 16:38:58 +00:00
|
|
|
|
case LF_STOMAG:
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index = 0)
|
1999-10-22 10:00:18 +00:00
|
|
|
|
index = find_storico(op1);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
if (index > 0)
|
|
|
|
|
return storico(op1).row(index).get(op4);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1998-05-04 09:59:49 +00:00
|
|
|
|
return EMPTY_STRING;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
void TArticolo_giacenza::set_body_key(TRectype & rowrec)
|
|
|
|
|
{
|
|
|
|
|
const int logicnum = rowrec.num();
|
|
|
|
|
const char * cod = (const char *) codice();
|
|
|
|
|
|
|
|
|
|
switch (logicnum)
|
|
|
|
|
{
|
|
|
|
|
case LF_STOMAG:
|
|
|
|
|
rowrec.put(STOMAG_CODART, cod);
|
|
|
|
|
rowrec.put(STOMAG_ANNOESRIF, _anno_sto);
|
|
|
|
|
break;
|
|
|
|
|
case LF_MAG:
|
|
|
|
|
rowrec.put(MAG_ANNOES, _anno_mag);
|
|
|
|
|
rowrec.put(MAG_CODART, cod);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
TArticolo::set_body_key(rowrec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza::set_anno_mag (const char * anno)
|
|
|
|
|
{
|
|
|
|
|
if (_anno_mag != anno)
|
|
|
|
|
remove_body(LF_MAG);
|
|
|
|
|
_anno_mag = anno;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza::set_anno_sto (const char * anno)
|
|
|
|
|
{
|
|
|
|
|
if (_anno_sto != anno)
|
|
|
|
|
remove_body(LF_STOMAG);
|
|
|
|
|
_anno_sto = anno;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza::zero(char c)
|
|
|
|
|
{
|
|
|
|
|
reset_anno_sto();
|
|
|
|
|
reset_anno_mag();
|
|
|
|
|
TArticolo::zero(c);
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int TArticolo_giacenza::find_mag(TRecord_array& rmag, const char * codmag, const char * livello, int from) const
|
1997-05-30 15:26:08 +00:00
|
|
|
|
{
|
|
|
|
|
const int last = rmag.last_row();
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (last > 0 && from < last)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
|
|
|
|
const int codmag_len = codmag ? strlen(codmag) : 0;
|
|
|
|
|
const int livello_len = livello ? strlen(livello) : 0;
|
|
|
|
|
|
|
|
|
|
if (codmag_len == 0 && livello_len == 0)
|
|
|
|
|
return from + 1;
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
for (int i = rmag.succ_row(from); i <= last; i = rmag.succ_row(i))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
if (codmag_len == 0 || rec.get(MAG_CODMAG).compare(codmag, codmag_len) == 0)
|
|
|
|
|
if (livello_len == 0 || rec.get(MAG_LIVELLO).compare(livello, livello_len) == 0)
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int TArticolo_giacenza::find_mag(const char * annoes, const char * codmag, const char * livello, int from) const
|
|
|
|
|
{
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
return find_mag(rmag, codmag, livello, from);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TArticolo_giacenza::find_storico(TRecord_array& rsto, const char * codmag, int from) const
|
1997-05-30 15:26:08 +00:00
|
|
|
|
{
|
1997-07-02 10:53:23 +00:00
|
|
|
|
const int last = rsto.last_row();
|
1997-12-18 17:32:55 +00:00
|
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
|
if (last > 0 && from < last)
|
1997-07-02 10:53:23 +00:00
|
|
|
|
{
|
|
|
|
|
const int codmag_len = codmag ? strlen(codmag) : 0;
|
|
|
|
|
|
|
|
|
|
if (codmag_len == 0)
|
|
|
|
|
return from + 1;
|
|
|
|
|
|
|
|
|
|
for (int i = rsto.succ_row(from); i <= last; i = rsto.succ_row(i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rsto.row(i);
|
|
|
|
|
|
|
|
|
|
if (rec.get(STOMAG_CODMAG).compare(codmag, codmag_len) == 0)
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int TArticolo_giacenza::find_storico(const char * annoesrif, const char * codmag, int from) const
|
|
|
|
|
{
|
|
|
|
|
TRecord_array & rsto = storico(annoesrif);
|
|
|
|
|
return find_storico(rsto, codmag, from);
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & TArticolo_giacenza::mag(const char * annoes) const
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
TString16 anno = annoes;
|
|
|
|
|
if (anno.blank())
|
|
|
|
|
{
|
|
|
|
|
TEsercizi_contabili ese;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
anno.format("%04d", ese.last_mag());
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
((TArticolo_giacenza*)this)->set_anno_mag(anno);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
return body(LF_MAG);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TRecord_array & TArticolo_giacenza::storico(const char * annoesrif) const
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
TString16 anno = annoesrif;
|
|
|
|
|
if (anno.blank())
|
|
|
|
|
{
|
|
|
|
|
TEsercizi_contabili ese;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
anno.format("%04d", ese.last_mag());
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
((TArticolo_giacenza *) this)->set_anno_sto(anno);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
return body(LF_STOMAG);
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
bool TArticolo_giacenza::is_last_esercizio(const char* annoes) const
|
|
|
|
|
{
|
|
|
|
|
bool yes = TRUE;
|
|
|
|
|
if (annoes && *annoes)
|
|
|
|
|
{
|
|
|
|
|
const int anno = atoi(annoes);
|
|
|
|
|
if (anno > 0)
|
|
|
|
|
{
|
|
|
|
|
TEsercizi_contabili e;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
yes = !e.esercizio(anno).chiusura_mag().ok() ;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return yes;
|
|
|
|
|
}
|
1997-05-30 15:26:08 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
bool TArticolo_giacenza::azzera_saldi(const char* cod_es, bool save_to_disk)
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
|
|
|
|
TRecord_array& rec_arr = TArticolo_giacenza::mag(cod_es);
|
|
|
|
|
|
|
|
|
|
const int last = rec_arr.last_row();
|
|
|
|
|
for (int r = last;r > 0 ; r = rec_arr.pred_row(r)) // Scorre le righe
|
|
|
|
|
{
|
|
|
|
|
TRectype& mag = rec_arr[r];
|
|
|
|
|
|
|
|
|
|
mag.put(MAG_GIAC,0);
|
|
|
|
|
mag.put(MAG_RIM,0);mag.put(MAG_VALRIM,0);
|
|
|
|
|
mag.put(MAG_ACQ,0);mag.put(MAG_VALACQ,0);
|
|
|
|
|
mag.put(MAG_ENT,0);mag.put(MAG_VALENT,0);
|
|
|
|
|
mag.put(MAG_VEN,0);mag.put(MAG_VALVEN,0);
|
|
|
|
|
mag.put(MAG_USC,0);mag.put(MAG_VALUSC,0);
|
|
|
|
|
mag.put(MAG_ORDF,0);mag.put(MAG_VALORDF,0);
|
|
|
|
|
mag.put(MAG_ORDC,0);mag.put(MAG_VALORDC,0);
|
|
|
|
|
mag.put(MAG_SCARTI,0);mag.put(MAG_VALSCARTI,0);
|
|
|
|
|
mag.put(MAG_PRODCOMP,0);
|
|
|
|
|
mag.put(MAG_PRODFIN,0);
|
|
|
|
|
mag.put(MAG_INCL,0);
|
|
|
|
|
mag.put(MAG_ACL,0);
|
|
|
|
|
mag.put(MAG_NLABEL,0);
|
|
|
|
|
}
|
1999-04-26 15:58:05 +00:00
|
|
|
|
return save_to_disk ? (rec_arr.write(TRUE) == NOERR) : TRUE;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
bool TArticolo_giacenza::riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo,
|
|
|
|
|
const char* catven, const char* codlis, bool save_to_disk)
|
1997-12-18 17:32:55 +00:00
|
|
|
|
{
|
|
|
|
|
TString codes(newes), mag, liv;
|
|
|
|
|
TRecord_array& rec_arr = TArticolo_giacenza::mag(oldes);
|
|
|
|
|
const int last = rec_arr.last_row();
|
|
|
|
|
real rim, val, giac, inpf, proc, icl, acl;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TCurrency currency(ZERO, "_FIRM");
|
1997-12-18 17:32:55 +00:00
|
|
|
|
|
|
|
|
|
rec_arr.renum_key(MAG_ANNOES, codes); // Rinumera
|
|
|
|
|
for (int r = last;r > 0 ; r = rec_arr.pred_row(r)) // Scorre le righe
|
|
|
|
|
{
|
|
|
|
|
TRectype& rec = rec_arr[r];
|
1998-08-25 18:07:30 +00:00
|
|
|
|
mag = rec.get(MAG_CODMAG); mag.cut(3);
|
1997-12-18 17:32:55 +00:00
|
|
|
|
liv = rec.get(MAG_LIVELLO);
|
|
|
|
|
giac = rec.get_real(MAG_GIAC);
|
|
|
|
|
inpf = rec.get_real(MAG_PRODFIN);
|
|
|
|
|
proc = rec.get_real(MAG_PRODCOMP);
|
|
|
|
|
acl = rec.get_real(MAG_ACL);
|
|
|
|
|
icl = rec.get_real(MAG_INCL);
|
|
|
|
|
rim = giac + inpf - proc + acl - icl;
|
|
|
|
|
switch (tipo)
|
|
|
|
|
{
|
|
|
|
|
case valorizz_costmedio:
|
|
|
|
|
val = costo_medio(oldes, mag, liv);
|
|
|
|
|
break;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
case valorizz_costmediopond:
|
|
|
|
|
val = costo_mediopond(oldes, mag, liv);
|
|
|
|
|
break;
|
1997-12-18 17:32:55 +00:00
|
|
|
|
case valorizz_ultcos:
|
|
|
|
|
val = ultimo_costo(oldes);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_mediacos:
|
|
|
|
|
val = media_costi(oldes);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_przlist:
|
|
|
|
|
val = prezzo_listino(oldes, catven, codlis);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_coststd:
|
|
|
|
|
val = costo_standard(oldes);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_FIFOa:
|
|
|
|
|
val = FIFO_annuale(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_LIFOa:
|
|
|
|
|
val = LIFO_annuale(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_FIFO:
|
|
|
|
|
val = FIFO(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_LIFO:
|
|
|
|
|
val = LIFO(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_FIFOr:
|
|
|
|
|
val = FIFO_ragionieristico(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
case valorizz_LIFOr:
|
|
|
|
|
val = LIFO_ragionieristico(oldes, mag, liv);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// Setta il prezzo al nr di decimali fissati per i prezzi della valuta corrente
|
|
|
|
|
if (tipo < valorizz_FIFOa)
|
|
|
|
|
{
|
|
|
|
|
currency.set_price(TRUE);
|
|
|
|
|
currency.set_num(val);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
val = currency.get_num();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
val *= rim;
|
|
|
|
|
|
|
|
|
|
// Setta l'importo al nr di decimali fissati per gli importi della valuta corrente
|
|
|
|
|
currency.set_price(FALSE);
|
|
|
|
|
currency.set_num(val);
|
2001-05-02 13:40:49 +00:00
|
|
|
|
val = currency.get_num();
|
1997-12-18 17:32:55 +00:00
|
|
|
|
rec.put(MAG_RIM, rim); rec.put(MAG_VALRIM, val);
|
|
|
|
|
rec.zero(MAG_ACQ); rec.zero(MAG_VALACQ);
|
|
|
|
|
rec.zero(MAG_ENT); rec.zero(MAG_VALENT);
|
|
|
|
|
rec.zero(MAG_VEN); rec.zero(MAG_VALVEN);
|
|
|
|
|
rec.zero(MAG_USC); rec.zero(MAG_VALUSC);
|
|
|
|
|
rec.zero(MAG_SCARTI);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (!riporta_ordinato())
|
|
|
|
|
{
|
2000-10-03 13:45:12 +00:00
|
|
|
|
rec.zero(MAG_ORDF); rec.zero(MAG_VALORDF);
|
|
|
|
|
rec.zero(MAG_ORDC); rec.zero(MAG_VALORDC);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
}
|
1997-12-18 17:32:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-06-18 15:35:05 +00:00
|
|
|
|
// Per non perdere le modifiche in memoria, al fine di avere i saldi riportati correttamente
|
|
|
|
|
// visto che non vengono salvati e poi riletti da disco, li si salvano nel TRecord_array
|
|
|
|
|
// dell'esercizio newes
|
|
|
|
|
if (!save_to_disk)
|
|
|
|
|
{
|
|
|
|
|
TRecord_array copia(rec_arr);
|
|
|
|
|
TRecord_array& nuovo = TArticolo_giacenza::mag(codes);
|
|
|
|
|
|
|
|
|
|
if (copia.rows() > 0)
|
|
|
|
|
nuovo = copia;
|
|
|
|
|
else
|
|
|
|
|
azzera_saldi(codes, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-18 17:32:55 +00:00
|
|
|
|
// Scrive il pastrocchio (eventualmente sovrascrive)
|
1999-04-26 15:58:05 +00:00
|
|
|
|
return save_to_disk ? (rec_arr.write(TRUE) == NOERR) : TRUE;
|
1997-12-18 17:32:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
real TArticolo_giacenza::disponibilita(const char * annoes, const char * codmag, const char * livello, bool solo_giac) const
|
|
|
|
|
{
|
|
|
|
|
real giac;
|
|
|
|
|
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rmag.row(i);
|
|
|
|
|
giac += rec.get_real(MAG_GIAC);
|
|
|
|
|
if (!solo_giac)
|
|
|
|
|
{
|
|
|
|
|
giac += rec.get_real(MAG_ORDF) - rec.get_real(MAG_ORDC);
|
|
|
|
|
giac += rec.get_real(MAG_PRODFIN) - rec.get_real(MAG_PRODCOMP);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
giac += rec.get_real(MAG_ACL) - rec.get_real(MAG_INCL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!solo_giac && !riporta_ordinato()) // Se l-ordinato viene riportato
|
|
|
|
|
{
|
|
|
|
|
TEsercizi_contabili ese;
|
|
|
|
|
const int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente
|
|
|
|
|
if (prev > 0)
|
|
|
|
|
{
|
|
|
|
|
TString16 oldannoes; oldannoes.format("%04d", prev);
|
|
|
|
|
const TRecord_array& oldrmag = mag(oldannoes);
|
|
|
|
|
for (int i = find_mag(oldannoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(oldannoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = oldrmag.row(i);
|
|
|
|
|
giac += rec.get_real(MAG_ORDF); // Sommo l'ordinato fornitori
|
|
|
|
|
giac -= rec.get_real(MAG_ORDC); // Sottraggo l'ordinato clienti
|
|
|
|
|
}
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return giac;
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real TArticolo_giacenza::ultimo_costo(const char * annoes) const
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (is_last_esercizio(annoes))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
|
|
|
|
const real costo = get_real(ANAMAG_ULTCOS1);
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return costo.is_zero() ? costo_standard(annoes) : costo;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
1997-05-30 15:26:08 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const int index = find_storico(annoes);
|
1997-06-18 15:18:06 +00:00
|
|
|
|
if (index < 0 ) return ZERO;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const real costo = storico(annoes).row(index).get_real(STOMAG_ULTCOS1);
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return costo.is_zero() ? costo_standard(annoes) : costo;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TArticolo_giacenza::media_costi(const char * annoes) const
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (is_last_esercizio(annoes))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
|
|
|
|
real costo = get_real(ANAMAG_ULTCOS1);
|
|
|
|
|
costo = (costo + get_real(ANAMAG_ULTCOS2)) / 2.0;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return costo.is_zero() ? costo_standard(annoes) : costo;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
1997-05-30 15:26:08 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const int index = find_storico(annoes);
|
1997-06-18 15:18:06 +00:00
|
|
|
|
if (index < 0 ) return ZERO;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = storico(annoes).row(index);
|
|
|
|
|
real costo = rec.get_real(STOMAG_ULTCOS1);
|
|
|
|
|
|
|
|
|
|
costo = (costo + rec.get_real(STOMAG_ULTCOS2)) / 2.0;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return costo.is_zero() ? costo_standard(annoes) : costo;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-05-28 10:14:39 +00:00
|
|
|
|
real TArticolo_giacenza::prezzo_listino(const char * annoes, const char * catven, const char * codlist) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (is_last_esercizio(annoes))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString codart=codice();
|
1998-06-10 16:38:58 +00:00
|
|
|
|
TConfig cfg(CONFIG_DITTA);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (codlist && *codlist>' ')
|
1998-06-10 16:38:58 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TCondizione_vendita cv(&cfg);
|
|
|
|
|
cv.put_listino(codlist,catven);
|
|
|
|
|
if (cv.ricerca(codart))
|
|
|
|
|
return cv.get_prezzo();
|
|
|
|
|
}
|
|
|
|
|
// se non lo trova, cerca nel prezzo indicato nelle UM
|
|
|
|
|
TString16 f;
|
|
|
|
|
f.format("#%d->%s", LF_UMART, UMART_PREZZO);
|
|
|
|
|
return get_real(f);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
1997-05-30 15:26:08 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const int index = find_storico(annoes);
|
1997-06-18 15:18:06 +00:00
|
|
|
|
if (index < 0 ) return ZERO;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
return storico(annoes).row(index).get_real(STOMAG_PRZLIST);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TArticolo_giacenza::costo_standard(const char * annoes) const
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
if (is_last_esercizio(annoes))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
return get_real(ANAMAG_COSTSTD);
|
1997-05-30 15:26:08 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
const int index = find_storico(annoes);
|
1997-06-18 15:18:06 +00:00
|
|
|
|
if (index < 0 ) return ZERO;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
return storico(annoes).row(index).get_real(STOMAG_COSTSTD);
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
real TArticolo_giacenza::costo_medio(const char * annoes, const char * codmag, const char * livello) const
|
|
|
|
|
{
|
|
|
|
|
real acq;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
real valacq;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DBG
|
|
|
|
|
if (strlen(codmag)>3)
|
|
|
|
|
NFCHECK("Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
#endif
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(annoes, codmag, livello, i))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
|
|
|
|
}
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return acq.is_zero() ? costo_standard(annoes) : valacq / acq;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
// costo medio ponderato per periodi pari alla durata dell'esercizio
|
|
|
|
|
real TArticolo_giacenza::costo_mediopond(const char * annoes, const char * codmag, const char * livello) const
|
|
|
|
|
{
|
|
|
|
|
real acq;
|
|
|
|
|
real valacq;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#ifdef DBG
|
|
|
|
|
if (strlen(codmag)>3)
|
|
|
|
|
NFCHECK("Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
#endif
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rmag.row(i);
|
|
|
|
|
|
|
|
|
|
acq += rec.get_real(MAG_ACQ) ;
|
|
|
|
|
acq += rec.get_real(MAG_RIM) ;
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALRIM);
|
|
|
|
|
}
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return acq.is_zero() ? costo_standard(annoes) : valacq / acq;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real TArticolo_giacenza::LIFO_annuale(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
real rim,valrim;
|
|
|
|
|
real acq,valacq;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real giacenza;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
valrim += rec.get_real(MAG_VALRIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
if (giacenza <= ZERO)
|
|
|
|
|
return ZERO;
|
|
|
|
|
if (giacenza > rim)
|
2003-04-22 14:30:52 +00:00
|
|
|
|
return ((giacenza - rim) * (acq.is_zero() ? costo_standard(annoes) : valacq / acq) + valrim) / giacenza;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
return valrim / rim;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real TArticolo_giacenza::FIFO_annuale(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
real rim,valrim;
|
|
|
|
|
real acq,valacq;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real giacenza;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
valrim += rec.get_real(MAG_VALRIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
if (giacenza <= ZERO)
|
|
|
|
|
return ZERO;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
if (rim.is_zero())
|
1999-10-22 10:00:18 +00:00
|
|
|
|
return ZERO;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
if (giacenza > acq)
|
|
|
|
|
return ((giacenza - acq) * (valrim / rim) + valacq) / giacenza;
|
|
|
|
|
return valacq / acq;
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real TArticolo_giacenza::LIFO(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
real rim,valrim;
|
|
|
|
|
real acq,valacq;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real giacenza;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
valrim += rec.get_real(MAG_VALRIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (giacenza <= ZERO)
|
|
|
|
|
return ZERO;
|
|
|
|
|
if (giacenza > rim)
|
|
|
|
|
return ((giacenza - rim) * (acq == ZERO ? costo_standard(annoes) : valacq / acq) + valrim) / giacenza;
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rstorico = storico(annoes);
|
1997-07-02 10:53:23 +00:00
|
|
|
|
// const int last = rstorico.last_row();
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valrim=ZERO;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
rim = giacenza;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
for (i = find_storico(annoes, codmag); i > 0; i = find_storico(annoes, codmag, i))
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TRectype & rec = rstorico[i];
|
1997-05-27 11:12:10 +00:00
|
|
|
|
const real qta = rec.get(STOMAG_QUANT);
|
|
|
|
|
|
|
|
|
|
if (qta > giacenza)
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valrim += (rec.get_real(STOMAG_VALORE)) * giacenza;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valrim += rec.get_real(STOMAG_VALORE) * qta;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
giacenza -= qta;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
return rim == ZERO ? ZERO :valrim / rim;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TArticolo_giacenza::FIFO(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
real rim,valrim;
|
|
|
|
|
real acq,valacq;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real giacenza;
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0; i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rmag.row(i);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
valrim += rec.get_real(MAG_VALRIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (giacenza <= ZERO)
|
|
|
|
|
return ZERO;
|
|
|
|
|
if (giacenza <= acq)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1997-05-27 11:12:10 +00:00
|
|
|
|
return valacq / acq;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TRecord_array & rstorico = storico(annoes);
|
|
|
|
|
const int last = rstorico.last_row();
|
1997-05-27 11:12:10 +00:00
|
|
|
|
real res = giacenza - acq;
|
|
|
|
|
rim = ZERO;
|
1997-07-02 10:53:23 +00:00
|
|
|
|
valrim = ZERO;
|
|
|
|
|
TFixed_string cmag(codmag);
|
|
|
|
|
int codmag_len = codmag ? strlen(cmag) : 0;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
for (i = last; i > 0; i--)
|
|
|
|
|
{
|
1997-05-30 15:26:08 +00:00
|
|
|
|
const TRectype & rec = rstorico.row(i);
|
1997-07-02 10:53:23 +00:00
|
|
|
|
if (codmag_len == 0 || rec.get(STOMAG_CODMAG).compare(codmag, codmag_len) == 0)
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1997-07-02 10:53:23 +00:00
|
|
|
|
const real qta = rec.get(STOMAG_QUANT);
|
|
|
|
|
|
|
|
|
|
if (qta > res)
|
|
|
|
|
{
|
|
|
|
|
rim += res;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valrim += (rec.get_real(STOMAG_VALORE)) * res;
|
1997-07-02 10:53:23 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rim += qta;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
valrim += rec.get_real(STOMAG_VALORE) * qta;
|
1997-07-02 10:53:23 +00:00
|
|
|
|
res -= qta;
|
|
|
|
|
}
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
}
|
|
|
|
|
if (rim.is_zero() || giacenza.is_zero())
|
|
|
|
|
return ZERO;
|
|
|
|
|
|
1997-05-27 11:12:10 +00:00
|
|
|
|
return ((giacenza - acq) * (valrim / rim) + valacq) / giacenza;
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
real TArticolo_giacenza::FIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-27 11:12:10 +00:00
|
|
|
|
{
|
1998-08-25 18:07:30 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3, "Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
1998-02-18 13:46:52 +00:00
|
|
|
|
return ZERO; // da implementare
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TArticolo_giacenza::LIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool giac_eff, bool valorizza_componenti) const
|
1997-05-30 15:26:08 +00:00
|
|
|
|
{
|
1998-08-25 18:07:30 +00:00
|
|
|
|
CHECK(strlen(codmag)<=3, "Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
1998-02-18 13:46:52 +00:00
|
|
|
|
return ZERO; // da implementare
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
1997-07-30 13:28:22 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
void TArticolo_giacenza::copia_storico(TRecord_array& nrstorico,const char * annoes,const char * codmag)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
CHECK(annoes && *annoes,"Copia_storico: Indicare l'anno esercizio dello storico");
|
|
|
|
|
|
|
|
|
|
TString nuovoanno(nrstorico.key().get(STOMAG_ANNOESRIF));
|
|
|
|
|
//nrstorico.destroy_rows();
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TRecord_array & rstorico = storico(annoes);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
int last = nrstorico.last_row();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int codmag_len = (codmag && *codmag) ? strlen(codmag) : 0;
|
2000-10-03 13:45:12 +00:00
|
|
|
|
int last_old = rstorico.last_row();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
|
for (int i = 1; i <= last_old; i++)
|
1999-10-22 10:00:18 +00:00
|
|
|
|
{
|
|
|
|
|
const TRectype& rst = rstorico[i];
|
|
|
|
|
if (codmag_len == 0 || rst.get(STOMAG_CODMAG).compare(codmag, codmag_len) == 0)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRectype newrec(rst);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
newrec.put(STOMAG_ANNOESRIF,nuovoanno);
|
|
|
|
|
newrec.put(STOMAG_NRIGA,++last);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
nrstorico.insert_row(newrec);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
2000-10-03 13:45:12 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
HIDDEN int sort_storico(const TObject ** a, const TObject ** b)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TRectype * rec_a = (TRectype *) *a;
|
|
|
|
|
TRectype * rec_b = (TRectype *) *b;
|
|
|
|
|
TString16 mag_a = rec_a->get(STOMAG_CODMAG);
|
|
|
|
|
int res = mag_a.compare(rec_b->get(STOMAG_CODMAG));
|
|
|
|
|
|
|
|
|
|
if (res == 0)
|
|
|
|
|
res = rec_a->get_int(STOMAG_ANNOES) - rec_b->get_int(STOMAG_ANNOES);
|
|
|
|
|
return res;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-03 13:45:12 +00:00
|
|
|
|
HIDDEN int sort_storico_rev(const TObject ** a, const TObject ** b)
|
|
|
|
|
{
|
|
|
|
|
return -sort_storico(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
void TArticolo_giacenza::add_storico(TRecord_array& nrstorico,const char * annoes,const char * codmag, const real & qta, const real & prz)
|
|
|
|
|
{
|
|
|
|
|
//CHECK(annorif && *annorif,"Add_storico: Indicare l'anno esercizio dello storico");
|
|
|
|
|
//TRecord_array & rstorico = storico(annorif);
|
2003-05-29 08:01:52 +00:00
|
|
|
|
TString8 annorif(nrstorico.key().get(STOMAG_ANNOESRIF));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
for (int i=nrstorico.last_row(); i>0; i--)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
2003-05-29 08:01:52 +00:00
|
|
|
|
TString16 mag=nrstorico[i].get(STOMAG_CODMAG);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (mag<=codmag)
|
|
|
|
|
break;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
TRectype storec(LF_STOMAG);
|
|
|
|
|
storec.put(STOMAG_ANNOESRIF,annorif);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
storec.put(STOMAG_ANNOES,annoes);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
storec.put(STOMAG_CODART,codice());
|
|
|
|
|
storec.put(STOMAG_NRIGA,i+1);
|
|
|
|
|
storec.put(STOMAG_CODMAG,codmag);
|
|
|
|
|
storec.put(STOMAG_QUANT,qta);
|
2003-05-29 08:01:52 +00:00
|
|
|
|
|
|
|
|
|
const int dec_price = storec.ndec(STOMAG_VALORE);
|
|
|
|
|
storec.put(STOMAG_VALORE, prz.string(0, dec_price));
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
nrstorico.insert_row(storec);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// annoes indica l'anno dell'esercizio da chiudere
|
|
|
|
|
void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codmag,
|
|
|
|
|
bool giac_eff, bool valorizza_componenti)
|
|
|
|
|
{
|
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
CHECK(codmag && *codmag,"Necessario indicare il magazzino");
|
|
|
|
|
|
|
|
|
|
real rim,acq,valacq,giacenza;
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
for (int i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rmag.row(i);
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString nuovoanno;
|
2003-05-29 08:01:52 +00:00
|
|
|
|
real prz;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
real qta;
|
|
|
|
|
|
|
|
|
|
TEsercizi_contabili ese;
|
|
|
|
|
nuovoanno.format("%d", ese.next(atoi(annoes)));
|
|
|
|
|
|
|
|
|
|
TRecord_array nuovo_storico(storico(nuovoanno));
|
|
|
|
|
copia_storico(nuovo_storico, annoes, codmag);
|
2000-10-03 13:45:12 +00:00
|
|
|
|
nuovo_storico.sort(sort_storico_rev);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
if (giacenza <= ZERO)
|
2002-05-08 16:25:49 +00:00
|
|
|
|
return;
|
|
|
|
|
// giacenza=ZERO;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (giacenza > rim)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
qta=giacenza-rim;
|
2003-05-29 08:01:52 +00:00
|
|
|
|
if (!acq.is_zero())
|
|
|
|
|
prz = valacq/acq;
|
|
|
|
|
add_storico(nuovo_storico,annoes,codmag,qta,prz);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
else
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
real res = rim-giacenza;
|
|
|
|
|
//TRecord_array & rstorico = storico(nuovoanno);
|
|
|
|
|
for (i = find_storico(nuovo_storico, codmag); i > 0; i = find_storico(nuovo_storico, codmag, i))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRectype & rec = nuovo_storico[i];
|
|
|
|
|
const real qta_sto=rec.get_real(STOMAG_QUANT);
|
|
|
|
|
if (qta_sto > res)
|
|
|
|
|
{
|
|
|
|
|
qta=qta_sto-res;
|
|
|
|
|
rec.put(STOMAG_QUANT,qta);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nuovo_storico.destroy_row(i);
|
|
|
|
|
res -= qta_sto;
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
nuovo_storico.pack();
|
|
|
|
|
nuovo_storico.sort(sort_storico);
|
|
|
|
|
nuovo_storico.write();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codmag,
|
|
|
|
|
bool giac_eff, bool valorizza_componenti)
|
|
|
|
|
{
|
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
CHECK(codmag && *codmag,"Necessario indicare il magazzino");
|
|
|
|
|
real rim,acq,valacq,giacenza;
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
for (int i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rmag.row(i);
|
|
|
|
|
rim += rec.get_real(MAG_RIM);
|
|
|
|
|
acq += rec.get_real(MAG_ACQ);
|
|
|
|
|
valacq += rec.get_real(MAG_VALACQ);
|
|
|
|
|
giacenza += giacenza_corretta(rec,giac_eff,valorizza_componenti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (giacenza <= ZERO)
|
|
|
|
|
return ;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TString nuovoanno;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TEsercizi_contabili ese;
|
|
|
|
|
nuovoanno.format("%d", ese.next(atoi(annoes)));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRecord_array nuovo_storico(storico(nuovoanno));
|
|
|
|
|
copia_storico(nuovo_storico, annoes, codmag);
|
2000-10-03 13:45:12 +00:00
|
|
|
|
nuovo_storico.sort(sort_storico_rev);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
real qta;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
real res = giacenza - acq;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
for (i = find_storico(nuovo_storico, codmag); i > 0; i = find_storico(nuovo_storico, codmag, i))
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TRectype & rec = nuovo_storico[i];
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const real qta_sto = rec.get(STOMAG_QUANT);
|
|
|
|
|
if (res > qta_sto)
|
|
|
|
|
{
|
|
|
|
|
res -= qta_sto;
|
|
|
|
|
} else {
|
|
|
|
|
if (res>ZERO)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
qta=res;
|
|
|
|
|
rec.put(STOMAG_QUANT, qta);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
res=ZERO;
|
|
|
|
|
} else {
|
1999-10-22 10:00:18 +00:00
|
|
|
|
nuovo_storico.destroy_row(i);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// aggiunge la quota dell'anno in corso
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// qta=giacenza-rim;
|
|
|
|
|
qta = min(giacenza, acq);
|
2003-04-22 14:30:52 +00:00
|
|
|
|
if (!qta.is_zero())
|
2000-10-03 13:45:12 +00:00
|
|
|
|
{
|
2003-05-29 08:01:52 +00:00
|
|
|
|
real prz;
|
2000-10-03 13:45:12 +00:00
|
|
|
|
if (!acq.is_zero())
|
2003-05-29 08:01:52 +00:00
|
|
|
|
prz = valacq/acq;
|
|
|
|
|
add_storico(nuovo_storico, annoes, codmag, qta, prz);
|
2000-10-03 13:45:12 +00:00
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
nuovo_storico.pack();
|
|
|
|
|
nuovo_storico.sort(sort_storico);
|
|
|
|
|
nuovo_storico.write();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
void TArticolo_giacenza::agg_storico(const char * annoes, const char * codmag,
|
|
|
|
|
bool giac_eff, bool valorizza_componenti, const real& val)
|
|
|
|
|
{
|
|
|
|
|
CHECK(strlen(codmag)<=3,"Non <20> pi<70> possibile avere valorizzazione a livello di deposito");
|
|
|
|
|
CHECK(codmag && *codmag,"Necessario indicare il magazzino");
|
|
|
|
|
|
|
|
|
|
real qta;
|
|
|
|
|
|
|
|
|
|
TRecord_array & rmag = mag(annoes);
|
|
|
|
|
for (int i = find_mag(annoes, codmag, ""); i > 0; i = find_mag(annoes, codmag, "", i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype & rec = rmag.row(i);
|
|
|
|
|
qta += giacenza_corretta(rec, giac_eff, valorizza_componenti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString nuovoanno;
|
|
|
|
|
TEsercizi_contabili ese;
|
|
|
|
|
nuovoanno.format("%d", ese.next(atoi(annoes)));
|
|
|
|
|
|
|
|
|
|
TRecord_array& nuovo_storico = storico(nuovoanno);
|
|
|
|
|
|
|
|
|
|
//nuovo_storico.destroy_rows();
|
2003-05-29 08:01:52 +00:00
|
|
|
|
add_storico(nuovo_storico, annoes, codmag, qta, ZERO);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
nuovo_storico.sort(sort_storico);
|
|
|
|
|
nuovo_storico.write();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
void TArticolo_giacenza::put_ultimo_costo(const real& costo, const TDate& data)
|
|
|
|
|
{
|
|
|
|
|
TDate d = get(ANAMAG_DULTCOS1);
|
|
|
|
|
if (data >= d)
|
|
|
|
|
{
|
|
|
|
|
if (data > d)
|
|
|
|
|
{
|
|
|
|
|
put(ANAMAG_ULTCOS2, get(ANAMAG_ULTCOS1));
|
|
|
|
|
put(ANAMAG_DULTCOS2, get(ANAMAG_DULTCOS1));
|
|
|
|
|
}
|
|
|
|
|
put(ANAMAG_DULTCOS1, data);
|
|
|
|
|
put(ANAMAG_ULTCOS1, costo);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
d = get(ANAMAG_DULTCOS2);
|
|
|
|
|
if (data >= d)
|
|
|
|
|
{
|
|
|
|
|
put(ANAMAG_ULTCOS2, costo);
|
|
|
|
|
put(ANAMAG_DULTCOS2, data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza::put_costo_standard(const real& costo)
|
|
|
|
|
{
|
|
|
|
|
put(ANAMAG_COSTSTD, costo);
|
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
// calcola la giacenza corretta dai campi Conto Lavoro e Produzione
|
2000-10-03 13:45:12 +00:00
|
|
|
|
real TArticolo_giacenza::giacenza_corretta(const TRectype& rec,bool giac_eff,bool valorizza_componenti) const
|
1997-07-30 13:28:22 +00:00
|
|
|
|
{
|
|
|
|
|
CHECK(rec.num() == LF_MAG, "Il record passato deve essere di LF_MAG");
|
|
|
|
|
real giacenza(rec.get_real(MAG_GIAC));
|
1998-08-25 18:07:30 +00:00
|
|
|
|
if (giac_eff)
|
1997-07-30 13:28:22 +00:00
|
|
|
|
{
|
2000-10-03 13:45:12 +00:00
|
|
|
|
giacenza -= rec.get_real(MAG_INCL);
|
|
|
|
|
giacenza += rec.get_real(MAG_ACL);
|
2002-12-18 10:50:44 +00:00
|
|
|
|
giacenza += valorizza_componenti ? ZERO : (rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP));
|
1997-07-30 13:28:22 +00:00
|
|
|
|
}
|
|
|
|
|
return giacenza;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
real TArticolo_giacenza::giacenza_anno(const char* codmag,
|
|
|
|
|
const char* livello,
|
|
|
|
|
int anno) const
|
|
|
|
|
{
|
|
|
|
|
TString16 annoes;
|
|
|
|
|
if (anno > 0)
|
|
|
|
|
annoes.format("%04d", anno);
|
|
|
|
|
|
|
|
|
|
const TRecord_array& rmag = mag(annoes);
|
|
|
|
|
real giac;
|
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = rmag.row(i);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (!rec.get(MAG_CODMAG).empty())
|
|
|
|
|
giac += rec.get_real("GIAC");
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
return giac;
|
|
|
|
|
}
|
1997-07-30 13:28:22 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
real TArticolo_giacenza::scorta_minima(const char* codmag,
|
|
|
|
|
const char* livello,
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int anno, bool liv_riordino) const
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 annoes;
|
|
|
|
|
if (anno > 0)
|
|
|
|
|
annoes.format("%04d", anno);
|
|
|
|
|
|
|
|
|
|
const TRecord_array& rmag = mag(annoes);
|
|
|
|
|
real sm;
|
2001-05-02 13:40:49 +00:00
|
|
|
|
// int nmag=0;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = rmag.row(i);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (!rec.get(MAG_CODMAG).empty())
|
|
|
|
|
{
|
|
|
|
|
if (liv_riordino)
|
|
|
|
|
sm += rec.get_real("LIVRIOR");
|
|
|
|
|
else
|
|
|
|
|
sm += rec.get_real("SCORTAMIN");
|
2001-05-02 13:40:49 +00:00
|
|
|
|
// nmag++;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
// if (nmag)
|
|
|
|
|
// sm = sm / nmag;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return sm;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-22 14:30:52 +00:00
|
|
|
|
long TArticolo_giacenza::lead_time(const char* codmag, const char* livello, int anno) const
|
1999-10-22 10:00:18 +00:00
|
|
|
|
{
|
|
|
|
|
TString4 annoes;
|
|
|
|
|
if (anno > 0)
|
|
|
|
|
annoes.format("%04d", anno);
|
|
|
|
|
|
|
|
|
|
const TRecord_array& rmag = mag(annoes);
|
|
|
|
|
real sm;
|
|
|
|
|
int nmag=0;
|
|
|
|
|
for (int i = find_mag(annoes, codmag, livello); i > 0;
|
|
|
|
|
i = find_mag(annoes, codmag, livello, i))
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = rmag.row(i);
|
|
|
|
|
if (!rec.get(MAG_CODMAG).empty())
|
|
|
|
|
{
|
|
|
|
|
if (rec.get_real(MAG_GIORNIRIOR).is_zero())
|
|
|
|
|
sm += get_real(ANAMAG_GIORNIRIOR);
|
|
|
|
|
else
|
|
|
|
|
sm += rec.get_real(MAG_GIORNIRIOR);
|
|
|
|
|
nmag++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (nmag)
|
2003-04-22 14:30:52 +00:00
|
|
|
|
sm /= real(nmag);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
else
|
|
|
|
|
sm = get_real(ANAMAG_GIORNIRIOR);
|
|
|
|
|
return sm.integer();
|
|
|
|
|
}
|
|
|
|
|
|
1997-05-30 15:26:08 +00:00
|
|
|
|
TArticolo_giacenza::TArticolo_giacenza(const char* codice)
|
|
|
|
|
: TArticolo(codice)
|
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
add_file(LF_MAG,"NRIGA");
|
|
|
|
|
add_file(LF_STOMAG,"NRIGA");
|
1997-05-30 15:26:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArticolo_giacenza::TArticolo_giacenza(const TRectype& rec)
|
|
|
|
|
: TArticolo(rec)
|
|
|
|
|
{
|
1998-11-04 18:04:26 +00:00
|
|
|
|
add_file(LF_MAG,"NRIGA");
|
|
|
|
|
add_file(LF_STOMAG,"NRIGA");
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
// Giacenze alla data
|
|
|
|
|
|
|
|
|
|
int TArticolo_giacenza_data::write(TBaseisamfile&) const
|
|
|
|
|
{
|
|
|
|
|
NFCHECK("Non e' possibile scrivere un Articolo con giacenza alla data");
|
|
|
|
|
return NOERR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TArticolo_giacenza_data::rewrite(TBaseisamfile& f) const
|
|
|
|
|
{ return write(f); }
|
|
|
|
|
|
|
|
|
|
int TArticolo_giacenza_data::remove(TBaseisamfile& f) const
|
|
|
|
|
{ return write(f); }
|
|
|
|
|
|
|
|
|
|
void TArticolo_giacenza_data::al(const TDate& data, const char* codmag, const char* livello,
|
|
|
|
|
TTipo_valorizz tipo, const char* catven, const char* codlis)
|
|
|
|
|
{
|
|
|
|
|
const TEsercizi_contabili esc;
|
|
|
|
|
const int anno = esc.date2esc(data);
|
|
|
|
|
const TDate inizio = esc[anno].inizio();
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TString16 annoes; annoes.format("%04d", anno);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TString16 predes;
|
|
|
|
|
|
|
|
|
|
bool reset_giac = TRUE;
|
|
|
|
|
const int anno_pred = esc.pred(anno);
|
|
|
|
|
if (anno_pred != 0)
|
|
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
|
predes.format("%04d", anno_pred);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const TDate dc = esc[anno_pred].chiusura_mag();
|
|
|
|
|
reset_giac = dc.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remove_body(LF_MAG); // Azzero la cache dei magazzini
|
|
|
|
|
|
1999-06-18 15:35:05 +00:00
|
|
|
|
if (reset_giac)
|
|
|
|
|
azzera_saldi(annoes, FALSE);
|
|
|
|
|
else
|
|
|
|
|
riporta_saldi(predes, annoes, tipo, catven, codlis, FALSE);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
TRelation rel(LF_RMOVMAG); rel.add(LF_MOVMAG, "NUMREG==NUMREG");
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
TRectype filter(LF_RMOVMAG);
|
|
|
|
|
filter.put(RMOVMAG_CODART, codice());
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (livello && *livello)
|
1999-04-26 15:58:05 +00:00
|
|
|
|
filter.put(RMOVMAG_LIVGIAC, livello);
|
|
|
|
|
if (codmag && *codmag)
|
|
|
|
|
filter.put(RMOVMAG_CODMAG, codmag);
|
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TCursor cur(&rel, "", 2, &filter, &filter, 0x2);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const long items = cur.items();
|
|
|
|
|
cur.freeze();
|
|
|
|
|
|
|
|
|
|
TProgind* pi = NULL;
|
|
|
|
|
if (items >= 10)
|
|
|
|
|
{
|
|
|
|
|
TString80 str; str << "Calcolo giacenza articolo " << codice();
|
|
|
|
|
pi = new TProgind(items, str, FALSE, TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TMov_mag* p_movmag = new TMov_mag;
|
|
|
|
|
rel.lfile(LF_MOVMAG).set_curr(p_movmag);
|
|
|
|
|
TMov_mag& movmag = *p_movmag;
|
|
|
|
|
const TRectype& rmovmag = rel.curr();
|
1999-06-18 15:35:05 +00:00
|
|
|
|
TRecord_array& rmag = mag(annoes);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
|
|
|
|
|
for (cur = 0; cur.pos() < items; ++cur)
|
|
|
|
|
{
|
|
|
|
|
if (pi) pi->addstatus(1);
|
|
|
|
|
const TDate datacomp = movmag.get(MOVMAG_DATACOMP);
|
|
|
|
|
if (datacomp >= inizio && datacomp <= data)
|
|
|
|
|
{
|
|
|
|
|
const TString16 codmag = rmovmag.get(RMOVMAG_CODMAG);
|
|
|
|
|
const TString16 livello = rmovmag.get(RMOVMAG_LIVGIAC);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
const int nrig = rmovmag.get_int(RMOVMAG_NRIG);
|
1999-06-18 15:35:05 +00:00
|
|
|
|
const int i = find_mag(annoes, codmag, livello);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
if (i >= 0) // Se il record di giacenza esiste lo aggiorno ...
|
1999-04-26 15:58:05 +00:00
|
|
|
|
{
|
|
|
|
|
TRectype& rec = (TRectype&)rmag.row(i);
|
2000-05-05 15:25:49 +00:00
|
|
|
|
movmag.update_balances(rec, nrig, +1);
|
|
|
|
|
}
|
|
|
|
|
else // ... altrimenti lo creo e poi lo aggiorno
|
|
|
|
|
{
|
|
|
|
|
TRectype& rec = rmag.row(-1, TRUE);
|
|
|
|
|
rec.put(MAG_ANNOES, annoes); // Setto i campi fondamentali!
|
|
|
|
|
rec.put(MAG_CODMAG, codmag);
|
|
|
|
|
rec.put(MAG_LIVELLO, livello);
|
1999-04-26 15:58:05 +00:00
|
|
|
|
movmag.update_balances(rec, nrig, +1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pi) delete pi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArticolo_giacenza_data::TArticolo_giacenza_data(const char* codice)
|
|
|
|
|
: TArticolo_giacenza(codice)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
TArticolo_giacenza_data::TArticolo_giacenza_data(const TRectype& rec)
|
|
|
|
|
: TArticolo_giacenza(rec)
|
|
|
|
|
{ }
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
1999-05-24 13:34:11 +00:00
|
|
|
|
// TArticolo_giacenza_loadable
|
|
|
|
|
TArticolo_giacenza_loadable::TArticolo_giacenza_loadable(const char* codice)
|
|
|
|
|
: TArticolo_giacenza_data(codice)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
TArticolo_giacenza_loadable::TArticolo_giacenza_loadable(const TRectype& rec)
|
|
|
|
|
: TArticolo_giacenza_data(rec)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
// Carica il record array delle giacenza dal file temporaneo specificato
|
|
|
|
|
void TArticolo_giacenza_loadable::load(TIsamtempfile& f)
|
|
|
|
|
{
|
|
|
|
|
TString16 annoes;
|
|
|
|
|
TString codart(codice());
|
|
|
|
|
int err;
|
|
|
|
|
// Il file temporaneo contiene le giacenze alla data per tutti
|
|
|
|
|
// gli articoli per un SOLO anno esercizio.
|
|
|
|
|
// Reperisce l'anno esercizio dal record corrente, visto che deve essere uguale su tutti
|
|
|
|
|
const TRecnotype pos = f.recno();
|
|
|
|
|
|
|
|
|
|
annoes = f.get("ANNOES");
|
|
|
|
|
f.put("CODART", codart);
|
|
|
|
|
|
|
|
|
|
remove_body(LF_MAG);
|
|
|
|
|
TRecord_array& rmag = mag(annoes);
|
|
|
|
|
rmag.destroy_rows();
|
|
|
|
|
// Scorre le giacenze del file temporaneo per questo articolo
|
|
|
|
|
for (err = f.read(_isgteq) ; err == NOERR && codart == f.get("CODART"); err = f.next())
|
|
|
|
|
rmag.add_row(f.curr());
|
|
|
|
|
|
|
|
|
|
// Ripristina la posizione
|
|
|
|
|
f.readat(pos);
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
// causali
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo) const
|
1998-11-04 18:04:26 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int index = -1;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
switch (tiposaldo)
|
1997-05-30 15:26:08 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case s_giac : index = 0; break;
|
|
|
|
|
case s_acq : index = 2; break;
|
|
|
|
|
case s_ent : index = 4; break;
|
|
|
|
|
case s_ven : index = 6; break;
|
|
|
|
|
case s_usc : index = 8; break;
|
|
|
|
|
case s_ordc : index = 10; break;
|
|
|
|
|
case s_ordf : index = 12; break;
|
|
|
|
|
case s_incl : index = 14; break;
|
|
|
|
|
case s_acl : index = 16; break;
|
|
|
|
|
case s_prodc: index = 18; break;
|
|
|
|
|
case s_prodf: index = 20; break;
|
|
|
|
|
case s_rim : index = 22; break;
|
|
|
|
|
case s_scart: index = 24; break;
|
|
|
|
|
case s_label: index = 26; break;
|
|
|
|
|
case s_user1: index = 28; break;
|
|
|
|
|
case s_user2: index = 30; break;
|
|
|
|
|
case s_user3: index = 32; break;
|
|
|
|
|
case s_user4: index = 34; break;
|
|
|
|
|
case s_user5: index = 36; break;
|
|
|
|
|
case s_user6: index = 38; break;
|
|
|
|
|
default : index = -1; break;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
1999-04-26 15:58:05 +00:00
|
|
|
|
int segno = 0;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (index >= 0)
|
1999-04-26 15:58:05 +00:00
|
|
|
|
{
|
|
|
|
|
const TString& segni = get("S2");
|
|
|
|
|
segno = atoi(segni.mid(index, 2));
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1999-04-26 15:58:05 +00:00
|
|
|
|
return segno;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
1997-05-30 15:26:08 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
bool TCausale_magazzino::is_fiscale()
|
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
bool rt = FALSE;
|
|
|
|
|
if (raggfisc().not_empty()) // Per essere fiscale deve avere il raggruppamento fiscale
|
|
|
|
|
{
|
|
|
|
|
const char tm = tipomov();
|
1999-04-26 15:58:05 +00:00
|
|
|
|
rt = tm == 'S' || tm == 'C'; // La causale deve essere Carico o Scarico...
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (rt)
|
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
const TRectype& rfc = cache().get("%RFC", raggfisc());
|
1999-04-26 15:58:05 +00:00
|
|
|
|
const char ragg = rfc.get_char("S6");
|
|
|
|
|
rt &= (ragg == 'S' || ragg == 'C'); // Ed il raggruppamento deve essere Carico o Scarico
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return rt;
|
1997-05-27 11:12:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
TCausale_magazzino::TCausale_magazzino(const char * codice):
|
2000-05-05 15:25:49 +00:00
|
|
|
|
TRectype(cache().get("%CAU", codice))
|
|
|
|
|
{ }
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
1999-06-18 15:35:05 +00:00
|
|
|
|
TCausale_magazzino::TCausale_magazzino(const TRectype &r):
|
|
|
|
|
TRectype(r)
|
|
|
|
|
{
|
|
|
|
|
CHECK(r.num() == LF_TABCOM, "Tipo record errato sulla causale di magazzino");
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
bool TCondizione_vendita::ricerca(const char * codice, const real & qta)
|
1997-06-06 16:36:35 +00:00
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
int tiporic;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
switch (_condv.get_char("TIPO"))
|
|
|
|
|
{
|
|
|
|
|
case 'L':
|
|
|
|
|
tiporic = A_LISTINI;
|
1997-06-18 15:18:06 +00:00
|
|
|
|
break;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
case 'C':
|
|
|
|
|
tiporic = A_CONTRATTI;
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
tiporic = A_OFFERTE;
|
1997-06-18 15:18:06 +00:00
|
|
|
|
break;
|
2003-04-22 14:30:52 +00:00
|
|
|
|
default:
|
|
|
|
|
tiporic = ' ';
|
1997-06-18 15:18:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
1997-06-06 16:36:35 +00:00
|
|
|
|
return cerca(tiporic,codice, qta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const real & qta, const char * um)
|
1997-06-06 16:36:35 +00:00
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// if (_condv.get("COD").empty())
|
|
|
|
|
// return FALSE;
|
|
|
|
|
bool found = FALSE;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TString80 cod; cod << codriga << "|1";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
if(config_ditta().get_bool("GES", "ve", tiporicerca))
|
1997-06-06 16:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
_condv.setkey( 1 );
|
|
|
|
|
switch( tiporicerca )
|
|
|
|
|
{
|
|
|
|
|
case A_CONTRATTI:
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case A_LISTINI:
|
|
|
|
|
{
|
|
|
|
|
_condv.put("TIPOCF", "");
|
|
|
|
|
_condv.put("CODCF", "");
|
|
|
|
|
if( !config_ditta().get_bool("GESLISCV", "ve"))
|
|
|
|
|
_condv.put("CATVEN", "");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case A_OFFERTE:
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if( _condv.read() == NOERR )
|
1997-06-06 16:36:35 +00:00
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
// si posiziona sulla riga
|
1997-06-06 16:36:35 +00:00
|
|
|
|
const bool gest_scagl = _condv.get_bool("GESTSCAGL");
|
|
|
|
|
const TString16 seqricrighe( _condv.get( "SEQRIC" ) );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-06-06 16:36:35 +00:00
|
|
|
|
for( int i = 0; !found && i < seqricrighe.len( ); i ++ )
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_rcondv.zero(' ');
|
1997-06-06 16:36:35 +00:00
|
|
|
|
_rcondv.put( "TIPO", _condv.get( "TIPO"));
|
|
|
|
|
_rcondv.put( "CATVEN", _condv.get( "CATVEN"));
|
|
|
|
|
_rcondv.put( "TIPOCF", _condv.get( "TIPOCF"));
|
|
|
|
|
_rcondv.put( "CODCF", _condv.get( "CODCF"));
|
|
|
|
|
_rcondv.put("COD", _condv.get("COD"));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if( _condv.get_bool( "GESTUM" ) )
|
|
|
|
|
_rcondv.put( "UM", (um && *um ) ? um : cache().get(LF_UMART, cod).get("UM"));
|
1997-06-06 16:36:35 +00:00
|
|
|
|
if (gest_scagl)
|
|
|
|
|
_rcondv.put("NSCAGL", 1);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1997-06-06 16:36:35 +00:00
|
|
|
|
char ricerca = seqricrighe[ i ];
|
|
|
|
|
_rcondv.put( "TIPORIGA", ricerca );
|
|
|
|
|
switch( ricerca )
|
|
|
|
|
{
|
|
|
|
|
case 'A':
|
|
|
|
|
{
|
|
|
|
|
_rcondv.put( "CODRIGA", codriga);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int err=_rcondv.read();
|
|
|
|
|
found = err == NOERR;
|
|
|
|
|
if (!found)
|
|
|
|
|
if (err=_rcondv.prev() == NOERR)
|
|
|
|
|
if (err=_rcondv.get("TIPORIGA")[0] == 'A')
|
|
|
|
|
{
|
|
|
|
|
const TString cod_found(_rcondv.get("CODRIGA"));
|
|
|
|
|
found = cod_found.compare(codriga, cod_found.len()) == 0;
|
|
|
|
|
}
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
_rcondv.put("CODRIGA", anamag().get( "RAGGFIS"));
|
|
|
|
|
_rcondv.read();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
found = _rcondv.good();
|
1997-06-06 16:36:35 +00:00
|
|
|
|
break;
|
|
|
|
|
case 'S':
|
|
|
|
|
{
|
|
|
|
|
_rcondv.put( "CODRIGA", anamag().get("GRMERC"));
|
|
|
|
|
_rcondv.read( );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
found = _rcondv.good();
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'G':
|
|
|
|
|
{
|
|
|
|
|
_rcondv.put( "CODRIGA", anamag().get("GRMERC").left(3));
|
|
|
|
|
_rcondv.read( );
|
1999-04-06 15:34:39 +00:00
|
|
|
|
found = _rcondv.good();
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// individua lo scaglione corretto in base alla quantita'
|
|
|
|
|
if (found && gest_scagl)
|
|
|
|
|
{
|
|
|
|
|
TRectype rec(_rcondv.curr());
|
|
|
|
|
int last_scagl = 0;
|
|
|
|
|
int scagl = _rcondv.get_int("NSCAGL");
|
|
|
|
|
real qta_lim(_rcondv.get_real("QLIM"));
|
|
|
|
|
while (_rcondv.good() && scagl > last_scagl && qta_lim > ZERO && qta > qta_lim)
|
|
|
|
|
{
|
|
|
|
|
if (_rcondv.next() == NOERR)
|
|
|
|
|
{
|
|
|
|
|
last_scagl = scagl;
|
|
|
|
|
scagl = _rcondv.get_int("NSCAGL");
|
|
|
|
|
qta_lim =_rcondv.get_real("QLIM");
|
|
|
|
|
rec = _rcondv.curr();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_rcondv.read(rec);
|
|
|
|
|
}
|
1997-06-18 15:18:06 +00:00
|
|
|
|
_prezzo = _rcondv.get_real("PREZZO");
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
TLocalisamfile um(LF_UMART); // Use Frate cercone when possible!
|
|
|
|
|
um.put("CODART", codriga);
|
|
|
|
|
um.put("NRIGA", 1);
|
|
|
|
|
if (um.read() == NOERR)
|
|
|
|
|
{
|
|
|
|
|
_prezzo = um.get_real("PREZZO");
|
|
|
|
|
found = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
_prezzo = ZERO;
|
|
|
|
|
*/
|
|
|
|
|
const TRectype& um = cache().get(LF_UMART, cod);
|
|
|
|
|
_prezzo = um.get_real("PREZZO");
|
2003-04-22 14:30:52 +00:00
|
|
|
|
found = !_prezzo.is_zero();
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
return found;
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TCondizione_vendita::put_condv(const char *tipocv,const char *codicecv,const char *catven,const char *tipocf,const char *codcf)
|
|
|
|
|
{
|
1999-10-22 10:00:18 +00:00
|
|
|
|
_condv.zero(' ');
|
|
|
|
|
_condv.put("TIPO",tipocv);
|
|
|
|
|
_condv.put("CATVEN",catven);
|
|
|
|
|
_condv.put("TIPOCF",tipocf);
|
|
|
|
|
_condv.put("CODCF",codcf);
|
|
|
|
|
_condv.put("COD",codicecv);
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TCondizione_vendita::put_listino(const char * codlist,const char *catven)
|
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
if( !config_ditta().get_bool("GESLISCV", "ve"))
|
|
|
|
|
put_condv("L",codlist,"","","");
|
|
|
|
|
else
|
|
|
|
|
put_condv("L",codlist,catven,"","");
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
void TCondizione_vendita::put_contratto(const char * codcontr,const char *tipocf,const char *codcf)
|
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
put_condv("C",codcontr,"",tipocf,codcf);
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
void TCondizione_vendita::put_offerta(const char * codoff)
|
|
|
|
|
{
|
1997-06-18 15:18:06 +00:00
|
|
|
|
put_condv("C",codoff,"","","");
|
1997-06-06 16:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TCondizione_vendita::TCondizione_vendita(TConfig * ditta,
|
1997-06-18 15:18:06 +00:00
|
|
|
|
TLocalisamfile * anamag, TLocalisamfile * umart)
|
1997-06-06 16:36:35 +00:00
|
|
|
|
: _condv(LF_CONDV), _rcondv(LF_RCONDV),
|
|
|
|
|
_sconti( LF_SCONTI ),
|
|
|
|
|
_anamag(anamag), _umart(umart), _config_ditta(ditta), _ivarid(FALSE)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|