From 1450aca8223a8c70657b0d8aa6e31813e9310145 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 29 Jul 1997 09:53:35 +0000 Subject: [PATCH] Gestione movimenti di magazzino trasitori git-svn-id: svn://10.65.10.50/trunk@4971 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ve/batbtip.h | 7 ++++--- ve/batbtip.uml | 26 +++++++++++++++++++++----- ve/sconti.cpp | 34 ++++++++++++++++++---------------- ve/sconti.h | 4 +++- ve/ve0100.cpp | 2 +- ve/velib.h | 6 ++++-- ve/velib03.cpp | 15 +++++++++++++-- 7 files changed, 64 insertions(+), 30 deletions(-) diff --git a/ve/batbtip.h b/ve/batbtip.h index 4bcfbfba5..99bf1dadc 100755 --- a/ve/batbtip.h +++ b/ve/batbtip.h @@ -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 diff --git a/ve/batbtip.uml b/ve/batbtip.uml index 51d9f72ec..81c4e5ba2 100755 --- a/ve/batbtip.uml +++ b/ve/batbtip.uml @@ -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 diff --git a/ve/sconti.cpp b/ve/sconti.cpp index f8aa2c5ea..2dfe2e637 100755 --- a/ve/sconti.cpp +++ b/ve/sconti.cpp @@ -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; } } diff --git a/ve/sconti.h b/ve/sconti.h index 4bbad1266..603cecaea 100755 --- a/ve/sconti.h +++ b/ve/sconti.h @@ -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); diff --git a/ve/ve0100.cpp b/ve/ve0100.cpp index dbce8cb5b..5900ba0a7 100755 --- a/ve/ve0100.cpp +++ b/ve/ve0100.cpp @@ -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--) { diff --git a/ve/velib.h b/ve/velib.h index 9373ca39b..c5c8d1ad2 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -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); diff --git a/ve/velib03.cpp b/ve/velib03.cpp index d6a21d8f4..90548f2cd 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -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