Gestione movimenti di magazzino trasitori

git-svn-id: svn://10.65.10.50/trunk@4971 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-07-29 09:53:35 +00:00
parent 28dcf49723
commit 1450aca822
7 changed files with 64 additions and 30 deletions

View File

@ -9,6 +9,7 @@
#define F_SPESEAUT 109
#define F_TIPO 110
#define F_MOVMAG 111
#define F_STATO_MOV 112
#define F_CAUS_MAG 113
#define F_DESCAUS_MAG 114
#define F_STATO_MOV_I 112
#define F_STATO_MOV_F 113
#define F_CAUS_MAG 114
#define F_DESCAUS_MAG 115

View File

@ -123,24 +123,40 @@ BEGIN
MESSAGE TRUE ENABLE,1@
END
STRING F_STATO_MOV 1
STRING F_STATO_MOV_I 1
BEGIN
PROMPT 50 16 ""
FIELD S7
USE %STD
INPUT CODTAB F_STATO_MOV
INPUT CODTAB F_STATO_MOV_I
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_STATO_MOV CODTAB
OUTPUT F_STATO_MOV_I CODTAB
CHECKYTPE NORMAL
FLAGS "U"
GROUP 1
WARNING "Stato finale impossibile"
END
STRING F_STATO_MOV_F 1
BEGIN
PROMPT 54 16 "allo stato "
FIELD S8
COPY USE F_STATO_MOV_I
INPUT CODTAB F_STATO_MOV_F
COPY DISPLAY F_STATO_MOV_I
OUTPUT F_STATO_MOV_F CODTAB
CHECKYTPE NORMAL
FLAGS "U"
GROUP 1
STR_EXPR {(#THIS_FIELD=="") || (#THIS_FIELD >= #F_STATO_MOV_I)}
WARNING "Stato finale impossibile"
END
STRING F_CAUS_MAG 4
BEGIN
PROMPT 2 17 "Codice causale magazzino "
FIELD S8
FIELD S9
USE CAU
INPUT CODTAB F_CAUS_MAG
DISPLAY "Codice" CODTAB
@ -157,7 +173,7 @@ STRING F_DESCAUS_MAG 50
BEGIN
PROMPT 2 18 "Descrizione "
USE CAU KEY 2
INPUT S0 F_DESCAUS_MAg
INPUT S0 F_DESCAUS_MAG
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_CAUS_MAG

View File

@ -120,12 +120,10 @@ bool TCond_vendita::set_sconto( const char * exp, bool signal )
return valid;
}
void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
{
_prezzo = prezzo;
if (_prezzo != ZERO)
real TCond_vendita::normalize_valuta(const real & val, const char * val_rif)
{
real normalized = val;
if (normalized != ZERO)
{
TString16 valuta(_testa->get(F_CODVAL));
TString16 valuta_rif(val_rif);
@ -135,16 +133,24 @@ void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
if (valuta != valuta_rif)
{
if (valuta_rif.not_empty())
_prezzo *= _condv.get_real("CAMBIO");
normalized *= _condv.get_real("CAMBIO");
real cambio(_testa->get(F_CAMBIO));
if (cambio == ZERO)
cambio = 1.0;
_prezzo /= cambio;
_prezzo.round(cambio == 1.0 ? 0 : 3);
}
normalized /= cambio;
normalized.round(cambio == 1.0 ? 0 : 3);
}
}
return normalized;
}
void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
{
_prezzo = normalize_valuta(prezzo, val_rif);
if (_load_mask && _riga && _riga->id2pos(FR_PREZZO) >= 0 && _riga->field(FR_PREZZO).active())
_riga->set(FR_PREZZO, _prezzo);
}
@ -581,12 +587,8 @@ void TCond_vendita::update_omaggi(bool full)
sh.check_row(current_doc_row);
r.autosave(sh);
const real prezzo = _prezzo;
set_prezzo(_rcondv.get_real("PROMAGGIO"));
r.put("PREZZO", _prezzo);
r.autoload(sh);
_prezzo = prezzo;
const real prezzo_omaggio = normalize_valuta(_rcondv.get_real("PROMAGGIO"), _condv.get("CODVAL"));
r.put("PREZZO", prezzo_omaggio);
update = TRUE;
}
}

View File

@ -38,8 +38,10 @@ class TCond_vendita : public TObject
bool cerca(int tiporicerca);
real normalize_valuta(const real & val, const char * val_rif = "");
protected:
void set_prezzo(const real & prezzo,const char * val_rif = "");
void set_prezzo(const real & prezzo, const char * val_rif = "");
void set_provv(const real & provv);
void set_iva(const TString & codiva);
void update_omaggi(bool full);

View File

@ -489,7 +489,7 @@ TMask* TMotore_application::get_mask( int mode )
user_set_handler( riga.get_int( 0 ), riga.get_int( 1 ) );
}
TMag_livelli l("FCG");
TCodgiac_livelli l;
for ( i = MAX_GIAC_LEVEL; i > 0; i--)
{

View File

@ -230,8 +230,10 @@ public:
const TString & basesconto() const { return _basesconto;}
const TString & spese() const { return _spese;}
bool mov_mag() const { return get_bool("B1"); }
const TString & stato_mov() const {return get("S7"); }
const TString & caus_mov() const {return get("S8"); }
const TString & stato_mov_iniziale() const {return get("S7"); }
const TString & stato_mov_finale() const {return get("S8"); }
const TString & caus_mov() const {return get("S9"); }
bool stato_with_mov_mag(const TString & stato) const;
TFormula_documento * first_formula() { return succ_formula(TRUE); }
TFormula_documento * succ_formula(bool restart = FALSE);

View File

@ -153,6 +153,17 @@ void TTipo_documento::read_formule()
}
}
bool TTipo_documento::stato_with_mov_mag(const TString & stato) const
{
if (!mov_mag())
return FALSE;
const TString16 stato_finale(stato_mov_finale());
if (stato_finale.not_empty() && stato > stato_finale)
return FALSE;
const TString16 stato_iniziale(stato_mov_iniziale());
return stato >= stato_iniziale;
}
TFormula_documento * TTipo_documento::succ_formula(bool restart)
{
if (restart)
@ -650,8 +661,8 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
{
const bool nuovo = _nuovo || numero() <= 0; // E' nuovo di zecca!
const bool check_movmag = main_app().has_module(MGAUT, CHK_DONGLE) && tipo().mov_mag();
const TString16 statomag(tipo().stato_mov());
const bool do_movmag = get("STATO") >= statomag;
const TString16 stato_doc(get("STATO"));
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc);
if (nuovo && re) // quindi ...
re = FALSE; // ... non fare la rewrite