Patch level : 4.0 911

Files correlati     : ve0.exe
Ricompilazione Demo : [ ]
Commento           :

Riportata la versione 3.2 1010


git-svn-id: svn://10.65.10.50/trunk@16332 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-03-17 22:00:30 +00:00
parent 5f5d0c6853
commit 2c18acdc65
8 changed files with 103 additions and 34 deletions

View File

@ -30,7 +30,6 @@
enum seltype { by_num, by_date }; enum seltype { by_num, by_date };
enum expltype { mat_base, scalare}; enum expltype { mat_base, scalare};
enum valtype { no_val, last_cost, average_cost, pond_cost, last2cost, std_cost, LIFO_annuale, LIFO_storico, FIFO_annuale, FIFO_storico ,prezzo_listino};
struct _ParmStruct struct _ParmStruct
{ {
@ -1025,6 +1024,9 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
const int rows = exp_array.items(); const int rows = exp_array.items();
real r; real r;
TString k; TString k;
TString noexplode_path("*****");
const bool dettagliata = _p->_advanced_val;
for (int i = 0; i < rows; i++) for (int i = 0; i < rows; i++)
{ {
@ -1045,11 +1047,27 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
// Il fabbisogno e': nr. componenti di questo articolo per residuo da produrre del padre // Il fabbisogno e': nr. componenti di questo articolo per residuo da produrre del padre
if (dettagliata && re.path().starts_with(noexplode_path))
r = ZERO;
else
if (_p->_fabbisogno && _p->_explosion == scalare) if (_p->_fabbisogno && _p->_explosion == scalare)
r = re.last_qta() * res2produce_by_father(re); // In UM locale... r = re.last_qta() * res2produce_by_father(re); // In UM locale...
else else
r = re.val() * res2produce_by_father(re); // In UM locale... r = re.val() * res2produce_by_father(re); // In UM locale...
if (dettagliata && tipo == 'A')
{
TArticolo_giacenza & art = TExplode_distinta_form::cache_articoli().art(re.articolo());
const valtype art_tipo = (valtype)art.get_int(ANAMAG_VALDIST);
if (art_tipo > no_val)
{
const TDate inizio_val = art.get_date(ANAMAG_DATAVDIST);
if (_p->_obs_date >= inizio_val)
noexplode_path = re.path();
}
}
if (r == ZERO) if (r == ZERO)
{ {
if (_p->_fabbisogno) // Calcolo disponibilita' if (_p->_fabbisogno) // Calcolo disponibilita'

View File

@ -25,9 +25,11 @@ class TValorizzazione_mask : public TAutomask
TAssoc_array _risultati; TAssoc_array _risultati;
TDistinta_tree _tree; TDistinta_tree _tree;
int _tipoval; valtype _tipoval;
TString4 _annoes,_catven, _codlist ; TString4 _annoes,_catven, _codlist ;
TString8 _codmag; TString8 _codmag;
TDate _data;
bool _dettagliata;
protected: protected:
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
@ -48,6 +50,8 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
if (dis.not_empty()) if (dis.not_empty())
{ {
TString80 cod = dis; TString80 cod = dis;
bool explode = true;
if (liv && *liv) if (liv && *liv)
cod << ',' << liv; cod << ',' << liv;
@ -60,16 +64,35 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
add_magcode(codmagdep, get(F_CODMAG)); add_magcode(codmagdep, get(F_CODMAG));
add_depcode(codmagdep, get(F_CODDEP)); add_depcode(codmagdep, get(F_CODDEP));
_tree.set_global("_MAGDEP", codmagdep); _tree.set_global("_MAGDEP", codmagdep);
const char tipo = _tree.get_type(dis);
valtype tipoval = _tipoval;
if (_tree.set_root(dis)) if (_dettagliata && tipo == 'A')
{
const TRectype & rec = cache().get(LF_ANAMAG, dis);
const valtype art_tipo = (valtype)rec.get_int(ANAMAG_VALDIST);
if (art_tipo > no_val)
{
const TDate inizio_val = rec.get_date(ANAMAG_DATAVDIST);
explode = _data < inizio_val;
if (!explode)
tipoval = art_tipo;
}
}
if (explode &&_tree.set_root(dis))
{ {
TArray boom; TArray boom;
// Esplosione ai materiali di base // Esplosione ai materiali di base
// raggruppati alla unita' di misura di riferimento // raggruppati alla unita' di misura di riferimento
_tree.explode(boom, TRUE, RAGGR_EXP_BASE); _tree.explode(boom, false, RAGGR_EXP_BASE, 1);
for (int r = boom.last(); r >= 0; r--) for (int r = boom.last(); r >= 0; r--)
{ {
const TRiga_esplosione& esp = (const TRiga_esplosione&)boom[r]; const TRiga_esplosione& esp = (const TRiga_esplosione&)boom[r];
const real value = esp.val() * valore(esp.articolo(), esp.giacenza()); const real value = esp.val() * valore(esp.articolo(), esp.giacenza());
total += value; total += value;
} }
@ -78,13 +101,12 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
} }
else else
{ {
const char tipo = _tree.get_type(dis);
switch (tipo) switch (tipo)
{ {
case 'A': case 'A':
{ {
const TArticolo_giacenza art(dis); const TArticolo_giacenza art(dis);
switch (_tipoval) switch (tipoval)
{ {
case 0: total = art.ultimo_costo(_annoes); break; case 0: total = art.ultimo_costo(_annoes); break;
case 1: total = art.media_costi(_annoes); break; case 1: total = art.media_costi(_annoes); break;
@ -130,9 +152,12 @@ void TValorizzazione_mask::elabora()
rec_to.put ("CODDIST", get(F_DIST_TO)); rec_to.put ("CODDIST", get(F_DIST_TO));
_annoes = get(F_ANNOES); _annoes = get(F_ANNOES);
_tipoval = get_int(F_TIPO); _tipoval = (valtype) get_int(F_TIPO);
_catven = get(F_CATVEN_LIST); _catven = get(F_CATVEN_LIST);
_codlist = get(F_CODLIST); _codlist = get(F_CODLIST);
_data = get_date(F_DATA);
_dettagliata = get_bool(F_DETTAGLIATA);
TRelation rel(LF_DIST); TRelation rel(LF_DIST);
TCursor cur(&rel); TCursor cur(&rel);

View File

@ -11,6 +11,7 @@
#define F_LINEA 110 #define F_LINEA 110
#define F_PREVIEW 111 #define F_PREVIEW 111
#define F_DETTAGLIATA 112
#define F_CATVEN_LIST 120 #define F_CATVEN_LIST 120
#define F_CODLIST 121 #define F_CODLIST 121

View File

@ -152,6 +152,11 @@ BEGIN
MESSAGE HIDE,G_LISTINO@ MESSAGE HIDE,G_LISTINO@
END END
BOOELAN F_DETTAGLIATA
BEGIN
PROMPT 2 7 "Dettagliata"
END
STRING F_CATVEN_LIST 2 STRING F_CATVEN_LIST 2
BEGIN BEGIN
PROMPT 2 7 "Cat.ven. " PROMPT 2 7 "Cat.ven. "

View File

@ -108,7 +108,9 @@ void TQuantita::copy(const TQuantita& q)
void TQuantita::convert(real& val, const TCodice_um& from_um, const TCodice_um& to_um) const void TQuantita::convert(real& val, const TCodice_um& from_um, const TCodice_um& to_um) const
{ {
CHECK(!from_um.blank() && !to_um.blank(), "Unita' di misura nulla"); // CHECK(!from_um.blank() && !to_um.blank(), "Unita' di misura nulla");
if (from_um.blank() || to_um.blank())
return;
if (from_um != to_um && !val.is_zero()) if (from_um != to_um && !val.is_zero())
{ {
const fraction& mul = get_factor(from_um); const fraction& mul = get_factor(from_um);
@ -930,7 +932,7 @@ bool TDistinta_tree::is_cyclic(const TToken_string& path) const
isola_codice((TToken_string &)_tmp); isola_codice((TToken_string &)_tmp);
if (_tmp == mycod) if (_tmp == mycod)
{ {
cyclic = TRUE; cyclic = true;
break; break;
} }
} }

View File

@ -26,6 +26,8 @@
// TCodice_articolo // TCodice_articolo
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
enum valtype { no_val, last_cost, average_cost, pond_cost, last2cost, std_cost, LIFO_annuale, LIFO_storico, FIFO_annuale, FIFO_storico ,prezzo_listino};
// Codice articolo di magazzino (equivale ad una TString20 ) // Codice articolo di magazzino (equivale ad una TString20 )
class TCodice_articolo : public TFixed_string class TCodice_articolo : public TFixed_string
{ {

View File

@ -98,7 +98,7 @@ void TPlann_sub_mask::copy_fields_from()
TSheet_field & sfld = (TSheet_field & )fld(i); TSheet_field & sfld = (TSheet_field & )fld(i);
CHECK(_m->field(dlg).is_sheet(),"Impossibile copiare un campo non sheet su uno sheet"); CHECK(_m->field(dlg).is_sheet(),"Impossibile copiare un campo non sheet su uno sheet");
TSheet_field & srcfld = _m->sfield(dlg); TSheet_field & srcfld = _m->sfield(dlg);
for (int it = 0; it < srcfld.items(); it++) for (int it = 0; it <srcfld.items(); it++)
{ {
const TToken_string & r=srcfld.row(it); const TToken_string & r=srcfld.row(it);
sfld.row(it) = r; sfld.row(it) = r;
@ -681,6 +681,20 @@ bool TPlanning_mask::carica_documenti()
} }
else else
{ {
if (skip)
{
const TRectype * doc = riga.find_original_doc();
if (doc != NULL)
{
const int stato = doc->get_int(DOC_STATO);
if (test_status(*doc, tn) < 0)
continue;
}
else
continue;
}
line = _articles.find(cli, art, liv, imp, lin, mag, magc, da_rdoc_key, true); line = _articles.find(cli, art, liv, imp, lin, mag, magc, da_rdoc_key, true);
} }
@ -770,10 +784,6 @@ bool TPlanning_mask::carica_documenti()
} }
line->qta(buck) += q.val(); line->qta(buck) += q.val();
} }
// else
// if (art == "008BTN003013CAON")
// int i = 1;
real price; real price;
find_price(get(F_TIPOCV),get(F_CODCONDV),get(F_CATVEN_CV), find_price(get(F_TIPOCV),get(F_CODCONDV),get(F_CATVEN_CV),
get(F_TIPOCF), cli, art, line->qta(buck), price); get(F_TIPOCF), cli, art, line->qta(buck), price);
@ -2330,10 +2340,10 @@ int TPlanning_mask::init_bucket0(TArticolo_giacenza &art, int r)
bool TPlanning_mask::do_test_art_row(int r, int first, int last, bool signal) bool TPlanning_mask::do_test_art_row(int r, int first, int last, bool signal)
{ {
TSheet_field& sf = sfield(F_ARTICOLI); TSheet_field& sf = sfield(F_ARTICOLI);
TMask& smask= sf.sheet_mask(); TMask & smask= sf.sheet_mask();
TToken_string& curr_row = sf.row(r); TToken_string & curr_row=sf.row(r);
TToken_string& constr_row = sf.row(first-1); TToken_string & constr_row=sf.row(first-1);
TToken_string& giac_row = sf.row(first); TToken_string & giac_row=sf.row(first);
// ********** // **********
// setta la priorita' e la linea su tutte le righe del blocco // setta la priorita' e la linea su tutte le righe del blocco

View File

@ -858,7 +858,7 @@ void TMSP_constraint::fill_sheet_row(TToken_string& row, const TMask & m, const
const TString80 da_rdoc_key(da_rdoc_key()); const TString80 da_rdoc_key(da_rdoc_key());
if (da_rdoc_key.full()) if (da_rdoc_key.full())
val << ' ' << SAFE_PIPE_CHR << ' ' << da_rdoc_key; val << '¦' << da_rdoc_key;
if ((descr == NULL || *descr == '\0') && __userflds != NULL && __userflds->full()) if ((descr == NULL || *descr == '\0') && __userflds != NULL && __userflds->full())
{ {
@ -872,12 +872,18 @@ void TMSP_constraint::fill_sheet_row(TToken_string& row, const TMask & m, const
const TString & fldval = anamag.get(fldname); const TString & fldval = anamag.get(fldname);
if (fldval.full()) if (fldval.full())
userdesc << fldval << __sep; {
if (userdesc.full())
userdesc << __sep;
userdesc << fldval;
} }
userdesc << " "; }
if (userdesc.full())
userdesc << ", ";
val.insert(userdesc); val.insert(userdesc);
} }
row.add(val, F_DESCART-FIRST_FIELD); row.add(val, F_DESCART-FIRST_FIELD);
row.add(codimp(),F_CODIMP-FIRST_FIELD);
row.add(codlin(),F_CODLIN-FIRST_FIELD); row.add(codlin(),F_CODLIN-FIRST_FIELD);
//TString8 str = _codmag.left(3); //TString8 str = _codmag.left(3);
@ -1285,7 +1291,7 @@ TMSP_constraint* TMSP_constraints::find(const TToken_string& row, bool create)
_key << str; _key << str;
_key.strip_spaces(); _key.strip_spaces();
row.get(F_DESCART-FIRST_FIELD, str); row.get(F_DESCART-FIRST_FIELD, str);
const int pos = str.find(SAFE_PIPE_CHR); const int pos = str.find('¦');
if (pos >= 0) if (pos >= 0)
_key.add(str.mid(pos +1)); _key.add(str.mid(pos +1));
@ -1416,7 +1422,7 @@ TMSP_line* TMSP_lines::find(const TToken_string& row, bool create)
} }
} }
row.get(F_DESCART-FIRST_FIELD, str); row.get(F_DESCART-FIRST_FIELD, str);
const int pos = str.find(SAFE_PIPE_CHR); const int pos = str.find('¦');
if (pos >= 0) if (pos >= 0)
_key.add(str.mid(pos +1)); _key.add(str.mid(pos +1));
@ -1707,10 +1713,10 @@ bool TLista_docref::edit_checked()
action.set("Action","MODIFY","Transaction"); action.set("Action","MODIFY","Transaction");
action.set_paragraph(format("%d",LF_DOC)); action.set_paragraph(format("%d",LF_DOC));
TToken_string & rw = row(r); TToken_string & rw = row(r);
action.set(DOC_PROVV,"D"); action.set("PROVV","D");
action.set(DOC_ANNO,rw.get(1)); action.set("ANNO",rw.get(1));
action.set(DOC_CODNUM,rw.get(2)); action.set("CODNUM",rw.get(2));
action.set(DOC_NDOC,rw.get(3)); action.set("NDOC",rw.get(3));
} }
TExternal_app editdoc(format("VE0 -1 -i%s",(const char *)ininame)); TExternal_app editdoc(format("VE0 -1 -i%s",(const char *)ininame));
editdoc.run(); editdoc.run();