diff --git a/ve/ve0200.cpp b/ve/ve0200.cpp index 20e3de876..5ed8a326d 100755 --- a/ve/ve0200.cpp +++ b/ve/ve0200.cpp @@ -1,24 +1,9 @@ #include -#ifndef __CHECKS_H -#include -#endif - -#ifndef __CONFAPP_H #include -#endif - -#ifndef __MSKSHEET_H #include -#endif - -#ifndef __RELATION_H #include -#endif - -#ifndef __TABUTIL_H #include -#endif #include "veconf.h" @@ -274,9 +259,7 @@ bool TConf_vendite::user_create( ) conf.set( "EdMask", "ve0200h", "ve"); break; default: - fatal_box( SINTASSI ); - return false; - break; + return fatal_box( SINTASSI ); } return true; } @@ -284,7 +267,6 @@ bool TConf_vendite::user_create( ) int ve0200(int argc, char* argv[]) { TConf_vendite appc; - if( argc < 3 ) fatal_box( SINTASSI ); appc.run(argc, argv, "Parametri gestione vendite"); diff --git a/ve/ve0200e.uml b/ve/ve0200e.uml index 34557e08d..41e6cbf01 100755 --- a/ve/ve0200e.uml +++ b/ve/ve0200e.uml @@ -8,7 +8,7 @@ PAGE "Contabilizzazione" 0 0 0 0 GROUPBOX DLG_NULL 78 7 BEGIN -PROMPT 1 1 "@bRicerca primaria del conto di costo ricavo" + PROMPT 1 1 "@bRicerca primaria del conto di costo ricavo" END LIST F_RICERCACR1 2 50 @@ -137,15 +137,14 @@ GROUP 3 //WARNING "La sequenza di ricerca per anagrafica deve indicare quattro tipi diversi" END -BOOLEAN F_SCONTO_LORDO +GROUPBOX DLG_NULL 78 4 BEGIN - PROMPT 2 14 "Contabilizzazione merci al lordo " - FIELD CONTSCLOR + PROMPT 1 14 "@bStorno omaggi" END STRING F_IVASTORNO 4 BEGIN - PROMPT 2 15 "Cod. IVA storno art. omaggio " + PROMPT 2 15 "Cod. IVA " FIELD IVASTO USE %IVA FLAGS "U" @@ -157,9 +156,57 @@ BEGIN OUTPUT F_IVASTORNO CODTAB END +NUMBER F_OMACODCONG 3 +BEGIN + PROMPT 24 15 "Conto " + FIELD OMACODCON(1) + USE LF_PCON + INPUT GRUPPO F_OMACODCONG + INPUT CONTO F_OMACODCONC + INPUT SOTTOCONTO F_OMACODCONS + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_OMACODCONG GRUPPO + OUTPUT F_OMACODCONC CONTO + OUTPUT F_OMACODCONS SOTTOCONTO + OUTPUT F_OMACODCOND DESCR + CHECKTYPE NORMAL +END + +NUMBER F_OMACODCONC 3 +BEGIN + PROMPT 37 15 "" + FIELD OMACODCON(2) + COPY ALL F_OMACODCONG + CHECKTYPE NORMAL +END + +NUMBER F_OMACODCONS 6 +BEGIN + PROMPT 44 15 "" + FIELD OMACODCON(3) + COPY ALL F_OMACODCONG + CHECKTYPE NORMAL +END + +STRING F_OMACODCOND 50 +BEGIN + PROMPT 24 16 "" + USE LF_PCON KEY 2 + INPUT DESCR F_OMACODCOND + DISPLAY "Descrizione@50" DESCR + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_OMACODCONG + CHECKTYPE NORMAL +END + LISTBOX F_FLDVALMAT 17 BEGIN - PROMPT 2 16 "Campo per i valore dei materiali " + PROMPT 2 18 "Campo per i valore dei materiali " FIELD FldValMat ITEM "|Nessuno" ITEM "ULTCOS1|Ultimo Costo" @@ -187,15 +234,21 @@ BEGIN ITEM "USER20|Campo Utente 20" END +BOOLEAN F_SCONTO_LORDO +BEGIN + PROMPT 2 19 "Contabilizzazione merci al lordo " + FIELD CONTSCLOR +END + BOOLEAN F_CHECKPREVCONT BEGIN - PROMPT 2 17 "Controlla che i documenti precedenti siano contabilizzati" + PROMPT 42 19 "Controllo contabilizzazione documenti precedenti" FIELD CHECKPREVCONT END STRING F_CMSCNTFIELD 10 BEGIN - PROMPT 2 18 "Campo commesse per reperire la causale" + PROMPT 2 20 "Campo commesse per reperire la causale" FLAGS "U" FIELD CMSCNTFIELD END diff --git a/ve/veconf.h b/ve/veconf.h index 4b9423300..05ba3a640 100755 --- a/ve/veconf.h +++ b/ve/veconf.h @@ -118,6 +118,10 @@ #define F_CHECKPREVCONT 112 #define F_CMSCNTFIELD 113 #define F_FLDVALMAT 114 +#define F_OMACODCONG 115 +#define F_OMACODCONC 116 +#define F_OMACODCONS 117 +#define F_OMACODCOND 120 // Campi per ve0200f.uml #define F_IMPSPINC1 101 diff --git a/ve/velib04b.cpp b/ve/velib04b.cpp index f7905fb29..fe84edcc5 100755 --- a/ve/velib04b.cpp +++ b/ve/velib04b.cpp @@ -139,8 +139,11 @@ int TMovimentoPN_VE::set_cg_rec(int n, const TImporto& imp, const TBill& conto, rec.put(RMV_NUMREG,numreg); rec.put(RMV_DATAREG,datareg); } - rec.put(RMV_SEZIONE,imp.sezione()); - rec.put(RMV_IMPORTO,imp.valore()); + + TImporto normimp(imp); + normimp.normalize(); + rec.put(RMV_SEZIONE,normimp.sezione()); + rec.put(RMV_IMPORTO,normimp.valore()); conto.put(rec); rec.put(RMV_DESCR, desc); @@ -310,8 +313,7 @@ void TMovimentoPN_VE::add_row_re(int i) if (conto.ok() && !imponibile.is_zero()) { - const TImporto val(real2imp(imponibile, 'I')); - + const TImporto val(real2imp(imponibile, 'I')); if (newpos < 0) set_cg_rec(-1, val, conto, _caus->desc_agg(2), ' '); else @@ -532,8 +534,9 @@ static TToken_string* _search_seq = NULL; // Gli utlimi 6 fanno parte della ricerca per costi ricavi, in particolare AR,GM,SM e RF // non possono essere interrotti da CV o CC. Ad es. CA|CF|AR|CV|GM|CC|RF non e' valida come stringa // di ricerca. -static TString16 _ivasto; // Codice IVA per storno articoli Omaggio -static bool _contsclor; // Contabilizza sconti al netto o al lordo (sconti suddiviso per ogni contropartita) +static TString4 _iva_sto; // Codice IVA per storno articoli Omaggio +static TBill _conto_sto; // Conto per storno articoli Omaggio +static bool _contsclor; // Contabilizza sconti al netto o al lordo (sconti suddiviso per ogni contropartita) //static bool _loaded = false;// Flag per evitare di caricare i parametri pił di una volta static TCausale *_caus = NULL; // causale del documento corrente @@ -549,10 +552,10 @@ protected: TObject* dup() const { return new TIVA_array(*this); } public: - error_type add(const TRiga_documento & r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = 1.0); - error_type add(const TRiga_documento * r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = 1.0) { return add(*r, conto, ndec, p);} - error_type add_omaggi(const TRiga_documento & r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = 1.0); - error_type add_omaggi(const TRiga_documento * r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = 1.0) { return add_omaggi(*r, conto, ndec, p);} + error_type add(const TRiga_documento& r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = UNO); + error_type add(const TRiga_documento* r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = UNO) { return add(*r, conto, ndec, p);} + error_type add_omaggi(const TRiga_documento& r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = UNO); + error_type add_omaggi(const TRiga_documento* r, const TBill& conto, const int ndec = ALL_DECIMALS, const real & p = UNO) { return add_omaggi(*r, conto, ndec, p);} void set_caus(TCausale * caus) { _caus = caus; } TIVA_array() {} @@ -567,19 +570,24 @@ void TIVA_array::copy(const TIVA_array & a) _caus = a._caus; } -error_type TIVA_array::add_omaggi(const TRiga_documento & r, const TBill& conto, const int ndec, const real & p) +error_type TIVA_array::add_omaggi(const TRiga_documento& r, const TBill& conto, const int ndec, const real& p) { - if (_ivasto.empty()) + if (_iva_sto.blank()) return ivasto_error; add(r, conto, ndec, p); TRiga_documento r_storno(r); r_storno.set_tipo("01"); - r_storno.put(RDOC_CODIVA, _ivasto); + r_storno.put(RDOC_CODIVA, _iva_sto); real prezzo = r_storno.get_real(RDOC_PREZZO); prezzo = -prezzo; r_storno.put(RDOC_PREZZO, prezzo); - add(r_storno, conto, ndec, p); + + if (_conto_sto.ok()) + add(r_storno, _conto_sto, ndec, p); + else + add(r_storno, conto, ndec, p); + return no_error; } @@ -588,7 +596,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i const TTipo_riga_documento & t = r.tipo(); TString80 key; const TCodiceIVA& tiva = r.iva(); - TString16 cod(tiva.codice()); + const TString4 cod(tiva.codice()); TBill c(conto); int ord = 0; int detr = 0; @@ -877,7 +885,12 @@ bool TContabilizzazione::load_parameters() _contsclor = conf.get_bool("CONTSCLOR","ve"); - _ivasto = conf.get("IVASTO","ve"); + _iva_sto = conf.get("IVASTO","ve"); + + gr = conf.get_int("OMACODCON","ve",1); + co = conf.get_int("OMACODCON","ve",2); + so = conf.get_long("OMACODCON","ve",3); + _conto_sto.set(gr,co,so); gr = conf.get_int("SPINCODCONA","ve",1); co = conf.get_int("SPINCODCONA","ve",2);