Correzioni per GF
git-svn-id: svn://10.65.10.50/branches/R_10_00@22739 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
22cbabbf36
commit
aaeeb54314
@ -10,6 +10,5 @@ int main(int argc, char** argv)
|
||||
case 2: db1300(argc, argv); break; // Implosione
|
||||
default: db1100(argc, argv); break; // Esplosione
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
111
db/db1100.cpp
111
db/db1100.cpp
@ -265,8 +265,8 @@ protected:
|
||||
static void dist_header_handler(TPrinter& p);
|
||||
static void dist_footer_handler(TPrinter& p);
|
||||
virtual bool validate(TForm_item &, TToken_string &);
|
||||
void set_explosion_rows(TArray& exp_array);
|
||||
real res2produce_by_father(TRiga_esplosione& re);
|
||||
void set_explosion_rows(const TArray& exp_array);
|
||||
real res2produce_by_father(const TRiga_esplosione& re) const;
|
||||
|
||||
public:
|
||||
void print_explosion_rows();
|
||||
@ -485,17 +485,15 @@ void TArticolo_giacenza_static::calcola_ordinato_documento(TRectype& rec)
|
||||
{
|
||||
CHECK(rec.num() == LF_DOC, "E' necessario passare un record di LF_DOC");
|
||||
|
||||
TRectype from(LF_RIGHEDOC), to(LF_RIGHEDOC);
|
||||
TRectype from(LF_RIGHEDOC);
|
||||
from.put(RDOC_CODNUM, rec.get(DOC_CODNUM));
|
||||
from.put(RDOC_ANNO, rec.get(DOC_ANNO));
|
||||
from.put(RDOC_PROVV, rec.get(DOC_PROVV));
|
||||
|
||||
TString filter;
|
||||
|
||||
int nkey = 1;
|
||||
|
||||
from.zero();
|
||||
from.put(RDOC_CODNUM, rec.get(DOC_CODNUM));
|
||||
from.put(RDOC_ANNO, rec.get(DOC_ANNO));
|
||||
from.put(RDOC_PROVV, rec.get(DOC_PROVV));
|
||||
|
||||
|
||||
// Se NDOC non è settato effettua il filtro su tutti i documenti di questa numerazione
|
||||
const long ndoc = rec.get_long(DOC_NDOC);
|
||||
if (ndoc > 0)
|
||||
@ -509,25 +507,21 @@ void TArticolo_giacenza_static::calcola_ordinato_documento(TRectype& rec)
|
||||
nkey = 2;
|
||||
from.put(RDOC_CODART, codice());
|
||||
}
|
||||
|
||||
to = from;
|
||||
|
||||
|
||||
TRelation rdoc(LF_RIGHEDOC);
|
||||
TCursor cur(&rdoc, filter, nkey, &from, &to);
|
||||
TCursor cur(&rdoc, filter, nkey, &from, &from);
|
||||
const TRecnotype items = cur.items();
|
||||
|
||||
if (items > 0)
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
cur.freeze();
|
||||
TProgind *pi = NULL;
|
||||
|
||||
filter = TR("Calcolo ordinato fornitori in corso. ");
|
||||
filter = TR("Calcolo ordinato fornitori ");
|
||||
filter << rec.get(DOC_CODNUM);
|
||||
filter << "/" << codice();
|
||||
|
||||
if (items > 10)
|
||||
pi = new TProgind(items, filter, FALSE, TRUE);
|
||||
|
||||
TProgind *pi = items > 32 ? new TProgind(items, filter, FALSE, TRUE) : NULL;
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
// Calcola la qta residua
|
||||
@ -700,7 +694,7 @@ real& TArticolo_giacenza_static::static_disp(_ParmStruct* p, const char * codmag
|
||||
const int prev = ese.pred(atoi(annoes)); // Controllo anche l'anno precedente
|
||||
if (prev > 0)
|
||||
{
|
||||
TString16 oldannoes; oldannoes.format("%04d", prev);
|
||||
TString4 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))
|
||||
@ -803,13 +797,12 @@ void TExplode_distinta_form::dist_footer_handler(TPrinter& pr)
|
||||
bool TExplode_distinta_form::validate(TForm_item &f, TToken_string &t)
|
||||
{
|
||||
const TString16 subcommand(t.get(0)); // Sub-comandante Marcos
|
||||
|
||||
if (subcommand != "_DISTINTA")
|
||||
return TForm::validate(f, t);
|
||||
|
||||
const TString16 code(t.get(1)); // codice del messaggio
|
||||
TString256 valore;
|
||||
TRiga_esplosione2print& re = (TRiga_esplosione2print&) _exploded_tree[_curr_row];
|
||||
const TRiga_esplosione2print& re = (const TRiga_esplosione2print&) _exploded_tree[_curr_row];
|
||||
const char tipo = re.tipo();
|
||||
|
||||
if (code[0] != '_')
|
||||
@ -989,7 +982,7 @@ bool TExplode_distinta_form::validate(TForm_item &f, TToken_string &t)
|
||||
return true;
|
||||
}
|
||||
|
||||
real TExplode_distinta_form::res2produce_by_father(TRiga_esplosione& re)
|
||||
real TExplode_distinta_form::res2produce_by_father(const TRiga_esplosione& re) const
|
||||
{
|
||||
real r;
|
||||
|
||||
@ -1018,7 +1011,7 @@ real TExplode_distinta_form::res2produce_by_father(TRiga_esplosione& re)
|
||||
pstr = re.father(fi);
|
||||
}
|
||||
|
||||
TString16 codmag = _distinta.path_depth(pstr) < 1 ? (TString &)_d->mag() : (TString &)_p->_sl_mag;
|
||||
TString8 codmag = _distinta.path_depth(pstr) < 1 ? (TString &)_d->mag() : (TString &)_p->_sl_mag;
|
||||
if (codmag.blank()) codmag = _d->mag();
|
||||
|
||||
TString g;
|
||||
@ -1034,18 +1027,14 @@ real TExplode_distinta_form::res2produce_by_father(TRiga_esplosione& re)
|
||||
return r;
|
||||
}
|
||||
|
||||
void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
void TExplode_distinta_form::set_explosion_rows(const TArray& exp_array)
|
||||
{
|
||||
const int rows = exp_array.items();
|
||||
real r;
|
||||
TString k;
|
||||
TString noexplode_path("*****");
|
||||
TString noexplode_path("*****");
|
||||
const bool dettagliata = _p->_advanced_val;
|
||||
|
||||
|
||||
const int rows = exp_array.items();
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
TRiga_esplosione& re = (TRiga_esplosione&) exp_array[i];
|
||||
const TRiga_esplosione& re = (const TRiga_esplosione&) exp_array[i];
|
||||
const char tipo = re.tipo();
|
||||
const bool is_head = i == DIST_HEAD;
|
||||
|
||||
@ -1056,7 +1045,7 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
// Il livello di giacenza lo si prende dall'articolo distinta da esplodere
|
||||
// oppure dalla riga esplosione se non stiamo stampando la testata della distinta
|
||||
// il cod. esercizio e' calc. come sempre
|
||||
TString codmag = is_head ? _d->mag() : re.mat_base() ? (const TString&)_p->_mb_mag : (const TString&)_p->_sl_mag;
|
||||
TString8 codmag = is_head ? _d->mag() : re.mat_base() ? (const TString&)_p->_mb_mag : (const TString&)_p->_sl_mag;
|
||||
if (codmag.blank()) codmag = _d->mag();
|
||||
const TString& liv = is_head ? _d->liv() : re.giacenza();
|
||||
|
||||
@ -1064,15 +1053,19 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
|
||||
if (dettagliata && re.path().starts_with(noexplode_path))
|
||||
continue;
|
||||
else
|
||||
if (_p->_fabbisogno && _p->_explosion == scalare)
|
||||
r = re.last_qta() * res2produce_by_father(re); // In UM locale...
|
||||
else
|
||||
r = re.val() * res2produce_by_father(re); // In UM locale...
|
||||
|
||||
if (re.articolo() == "00.73.00.0010")
|
||||
int cazzone = 1;
|
||||
|
||||
real r = res2produce_by_father(re);
|
||||
if (_p->_fabbisogno && _p->_explosion == scalare)
|
||||
r *= re.last_qta(); // In UM locale...
|
||||
else
|
||||
r *= re.val(); // In UM locale...
|
||||
|
||||
if (dettagliata && tipo == 'A')
|
||||
{
|
||||
TArticolo_giacenza & art = TExplode_distinta_form::cache_articoli().art(re.articolo());
|
||||
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)
|
||||
@ -1083,7 +1076,7 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
}
|
||||
}
|
||||
|
||||
if (r == ZERO)
|
||||
if (r.is_zero())
|
||||
{
|
||||
if (_p->_fabbisogno) // Calcolo disponibilita'
|
||||
{
|
||||
@ -1104,10 +1097,8 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
for (pos = _exploded_tree.items()-1; pos>=0; pos--)
|
||||
{
|
||||
r2p = (TRiga_esplosione2print *)_exploded_tree.objptr(pos);
|
||||
if (re.articolo() == r2p->articolo() &&
|
||||
re.um() == r2p->um() &&
|
||||
(re.giacenza() == r2p->giacenza()) &&
|
||||
codmag == r2p->mag())
|
||||
if (re.articolo() == r2p->articolo() && re.um() == r2p->um() &&
|
||||
(re.giacenza() == r2p->giacenza()) && codmag == r2p->mag())
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1117,7 +1108,7 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
r2p = new TRiga_esplosione2print(re, codmag);
|
||||
_exploded_tree.add(r2p,pos);
|
||||
}
|
||||
|
||||
|
||||
r2p->set_fabbisogno(r + r2p->fabbisogno());
|
||||
|
||||
if (_p->_fabbisogno) // Calcolo disponibilita'
|
||||
@ -1152,8 +1143,8 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
} else {
|
||||
// Disponibilita, qta da ordinare e residuo vengono calcolati solo per le righe Articolo
|
||||
|
||||
real zero_ref(_p->_liv_attenzione == 'S' ? aaa.get_scmin(_p->_anno_es, codmag, liv) : ZERO);
|
||||
zero_ref = aaa.convert_to_um(zero_ref, re.um());
|
||||
const real min_ref = _p->_liv_attenzione == 'S' ? aaa.get_scmin(_p->_anno_es, codmag, liv) : ZERO;
|
||||
const real zero_ref = aaa.convert_to_um(min_ref, re.um());
|
||||
|
||||
real qta2order,disponib;
|
||||
if (is_new)
|
||||
@ -1176,11 +1167,13 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
else
|
||||
disponib -= r;
|
||||
|
||||
if (disponib > zero_ref)
|
||||
if (disponib > zero_ref && r > ZERO) // Aggiunto r>0 il 28-09-2012 per GF
|
||||
{
|
||||
disponib -= zero_ref;
|
||||
qta2order = ZERO;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
qta2order = zero_ref - disponib;
|
||||
disponib = ZERO;
|
||||
}
|
||||
@ -1212,7 +1205,7 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
|
||||
// Il valore lo calcola per qualsiasi tipo riga
|
||||
if (_p->_valorization > no_val)
|
||||
{
|
||||
k = re.path(); // I nodi sono cachati con tutto il path in modo da essere univoci
|
||||
const TString k = re.path(); // I nodi sono cachati con tutto il path in modo da essere univoci
|
||||
|
||||
if (_valori.objptr(k) == NULL)
|
||||
r2p->set_unitary_value(ZERO);
|
||||
@ -1254,7 +1247,7 @@ void TExplode_distinta_form::explode_and_print()
|
||||
|
||||
if (!_distinta.set_root(_d->cod(), _d->um(), 1.0, _d->liv()))
|
||||
return;
|
||||
|
||||
|
||||
TWait_cursor clepsy;
|
||||
|
||||
// Inizializza lo sfondo delle pagine normali se no col piffero che stampa la fincatura...
|
||||
@ -1262,11 +1255,7 @@ void TExplode_distinta_form::explode_and_print()
|
||||
_distinta.restart();
|
||||
if (_distinta.goto_root())
|
||||
{
|
||||
TArray explosion_array;
|
||||
TPrintrow p;
|
||||
TString16 fi;
|
||||
|
||||
// Reset delle righe in caso di dist separate o cambio periodo
|
||||
// Reset delle righe in caso di dist separate o cambio periodo
|
||||
if (_p->_separate_dist
|
||||
|| (_p->_separate_giac && _d->cod() != __current_art)
|
||||
|| (__current_period.ok() && _d->data_per() > __current_period))
|
||||
@ -1275,18 +1264,20 @@ void TExplode_distinta_form::explode_and_print()
|
||||
__current_art = _d->cod();
|
||||
__current_period = _d->data_per();
|
||||
|
||||
TString16 fi;
|
||||
if (_p->_vis_art) fi << 'A';
|
||||
if (_p->_vis_lav) fi << 'L';
|
||||
if (_p->_vis_vir) fi << 'V';
|
||||
if (_p->_vis_gho) fi << 'G';
|
||||
|
||||
TArray explosion_array;
|
||||
_distinta.curr_code((TCodice_articolo& )_d->cod());
|
||||
_distinta.explode(explosion_array, _p->_explosion == mat_base, _p->_group_by,
|
||||
_p->_det_lev, fi, _p->_ordering);
|
||||
_p->_det_lev, fi, _p->_ordering);
|
||||
|
||||
// Dopo l'esplosione mette in testa all'array la riga di definizione della Distinta stessa:
|
||||
// codice + UM + Fabbisogno (sostanzialmente si tratta di un TRiga_esplosione)
|
||||
explosion_array.insert(_d->head_obj(), 0);
|
||||
|
||||
|
||||
// Effettua la valorizzazione scorrendo i nodi...
|
||||
if (_p->_valorization > no_val)
|
||||
@ -1503,7 +1494,7 @@ bool TEsplosione_distinta_app::sheet_notify(TSheet_field& s, int r, KEY key)
|
||||
{
|
||||
if (key==(K_CTRL+K_INS))
|
||||
{
|
||||
TDate d(TODAY);
|
||||
const TDate d(TODAY);
|
||||
TToken_string& t = s.row(r);
|
||||
t.add(d.string(),s.cid2index(F_DATACONS));
|
||||
}
|
||||
@ -1517,7 +1508,7 @@ const int TEsplosione_distinta_app::date2period(const TDate& d)
|
||||
|
||||
for (i = 0; i<items; i++)
|
||||
{
|
||||
const TDate& limit = (TDate&)_date_array[i];
|
||||
const TDate& limit = (const TDate&)_date_array[i];
|
||||
if (d <= limit)
|
||||
break;
|
||||
}
|
||||
@ -1591,7 +1582,7 @@ bool TEsplosione_distinta_app::create()
|
||||
open_files(LF_DOC, LF_RIGHEDOC, LF_INDSP, LF_CFVEN, LF_MAG, LF_STOMAG, LF_CODCORR, 0);
|
||||
|
||||
_mask = new TMask("db1100a");
|
||||
TSheet_field& sa = (TSheet_field&) _mask->field(F_SHEETART);
|
||||
TSheet_field& sa = _mask->sfield(F_SHEETART);
|
||||
sa.sheet_mask().set_handler(F_QTA, check_articoli);
|
||||
sa.set_notify(sheet_notify);
|
||||
_mask->set(F_ARTICOLI, "X");
|
||||
|
@ -548,7 +548,7 @@ BEGIN
|
||||
ITEM "Lin."
|
||||
ITEM "Mag."
|
||||
ITEM "Dep."
|
||||
ITEM "UM@3"
|
||||
ITEM "UM"
|
||||
ITEM "Qta@12"
|
||||
ITEM "Descrizione@50"
|
||||
ITEM "Data cons.@12"
|
||||
@ -573,6 +573,7 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
MESSAGE EMPTY CLEAR,F_LIV1|CLEAR,F_LIV2|CLEAR,F_LIV3|CLEAR,F_LIV4
|
||||
MESSAGE ENABLE, F_LIV1
|
||||
ADD RUN DB0 -0
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
|
@ -1861,7 +1861,7 @@ void TRiga_esplosione::init(const TDistinta_tree& tree, bool vis_ghost, const TR
|
||||
_rdist = NULL;
|
||||
}
|
||||
|
||||
const char * TRiga_esplosione::father(const char * types)
|
||||
const char * TRiga_esplosione::father(const char * types) const
|
||||
{
|
||||
TString & _tmp_path = get_tmp_string();
|
||||
|
||||
|
@ -422,7 +422,7 @@ public:
|
||||
void set_path(const char* p) { _path = p;}
|
||||
void set_giacenza(const char* g) { _giac = g; }
|
||||
// cerca un padre o nonno di uno dei tipi passati
|
||||
const char* father(const char* types = NULL);
|
||||
const char* father(const char* types = NULL) const;
|
||||
const real& last_qta() const { return _last_qta; }
|
||||
const real& curr_qta() const { return _curr_qta; }
|
||||
const TRectype* rdist_rec() const { return _rdist;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user