diff --git a/mg/mg4200.cpp b/mg/mg4200.cpp index 4c2e5f2ed..3a08d9e3a 100755 --- a/mg/mg4200.cpp +++ b/mg/mg4200.cpp @@ -45,15 +45,7 @@ bool TForm_inventario::validate(TForm_item &cf, TToken_string &s) TString16 annoes(magrec.get(MAG_ANNOES)); subcode=s.get(); if (subcode=="GIAC") { - real v=magrec.get_real(MAG_GIAC); - if (!_giaceff) { - v +=magrec.get_real(MAG_ACL); - v -=magrec.get_real(MAG_INCL); - if (_valcomp) - v -=magrec.get_real(MAG_PRODCOMP); - else - v +=magrec.get_real(MAG_PRODFIN); - } + real v=curr_art().giacenza_corretta(magrec,_giaceff,_valcomp); cf.set(v.string()); } if (subcode=="VAL1") { @@ -155,43 +147,45 @@ bool TForm_inventario::valorizzazione(TForm_item &cf, TTipo_valorizz t) { TRectype & magrec=relation()->lfile(LF_MAG).curr(); TString annoes(magrec.get(MAG_ANNOES)); + real v; if (t==valorizz_ultcos) { - cf.set(curr_art().ultimo_costo(annoes).string()); + v=curr_art().ultimo_costo(annoes).string(); } if (t==valorizz_mediacos) { - cf.set(curr_art().media_costi(annoes).string()); + v=curr_art().media_costi(annoes).string(); } if (t==valorizz_przlist) { - cf.set(curr_art().prezzo_listino(annoes,_codlist,_catven).string()); + v=curr_art().prezzo_listino(annoes,_codlist,_catven).string(); } if (t==valorizz_coststd) { - cf.set(curr_art().costo_standard(annoes).string()); + v=curr_art().costo_standard(annoes).string(); } if (t==valorizz_costmedio) { const TString codmag(magrec.get(MAG_CODMAG)); const TString livello(magrec.get(MAG_LIVELLO)); - cf.set(curr_art().costo_medio(annoes,codmag,livello).string()); + v=curr_art().costo_medio(annoes,codmag,livello).string(); } if (t==valorizz_LIFO) { const TString codmag(magrec.get(MAG_CODMAG)); const TString livello(magrec.get(MAG_LIVELLO)); - cf.set(curr_art().LIFO(annoes,codmag,livello, _giaceff,_valcomp).string()); + v=curr_art().LIFO(annoes,codmag,livello, _giaceff,_valcomp).string(); } if (t==valorizz_FIFO) { const TString codmag(magrec.get(MAG_CODMAG)); const TString livello(magrec.get(MAG_LIVELLO)); - cf.set(curr_art().FIFO(annoes,codmag,livello, _giaceff,_valcomp).string()); + v=curr_art().FIFO(annoes,codmag,livello, _giaceff,_valcomp).string(); } if (t==valorizz_LIFOa) { const TString codmag(magrec.get(MAG_CODMAG)); const TString livello(magrec.get(MAG_LIVELLO)); - cf.set(curr_art().LIFO_annuale(annoes,codmag,livello, _giaceff,_valcomp).string()); + v=curr_art().LIFO_annuale(annoes,codmag,livello, _giaceff,_valcomp).string(); } if (t==valorizz_FIFOa) { const TString codmag(magrec.get(MAG_CODMAG)); const TString livello(magrec.get(MAG_LIVELLO)); - cf.set(curr_art().FIFO_annuale(annoes,codmag,livello, _giaceff,_valcomp).string()); + v=curr_art().FIFO_annuale(annoes,codmag,livello, _giaceff,_valcomp).string(); } + cf.set((v*curr_art().giacenza_corretta(magrec,_giaceff,_valcomp)).string()); return TRUE; } @@ -249,10 +243,14 @@ TStampainv_mask::TStampainv_mask(): if (!artlev.enabled()) { TMask_field &f1=field(F_RAGGCODICE); f1.reset(); f1.check();f1.hide(); + field(F_FROMLIVELLOART).hide(); + field(F_TOLIVELLOART).hide(); } if (!giaclev.enabled()) { TMask_field &f2=field(F_RAGGLIVGIAC); f2.reset(); f2.check();f2.hide(); + field(F_FROMLIVELLOGIAC).hide(); + field(F_TOLIVELLOGIAC).hide(); } } @@ -489,7 +487,7 @@ bool TStampa_inventario::set_print(int i) _form->add_colval(_mask->get_int(F_VAL6)); _form->set_parametri(_mask->get(F_CATVENLISTINO), _mask->get(F_CODLISTINO), - *_mask->get(F_REALE_GIAC)=='G', + *_mask->get(F_REALE_GIAC)=='R', *_mask->get(F_FIN_COMP)=='C' );