From dbdb890a48325dddcc9d5883bb17e05b3993bef1 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 18 Sep 2009 15:14:51 +0000 Subject: [PATCH] Patch level : 10.0 418 Files correlati : ve0.exe ve1.exe ve5.exe ve6.ex tutti profili riga tutti i profili documento Ricompilazione Demo : [ ] Commento MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implementazione calcolo CONAI con un campo e le sottocategorie per ogni tipo di imballo, sulle righe documento. Verificae che i profili personalizzati di documento e di riga continuino a funzionare. Doceve necessita, bisogna: per I profili documento personalizzati sostituire il campo 500 (sheet) con il campo seguente SPREADSHEET 500 BE PR 2 8 "" IT "Lordo@5" IT "Tipo riga@2" IT "Mag. @3" IT "Dep.@2" IT "Codice Articolo@20" IT "Codice\nLivello 1@9" IT "Codice\nLivello 2@9" IT "Codice\nLivello 3@9" IT "Codice\nLivello 4@9" IT "Descrizione@50" IT "UM@2" IT "Quantita'@11" IT "Prezzo@18" IT "Quantita'\nEvasa@11" IT "Evasa@1" IT "Tara@15" IT "Peso Netto@15" IT "N.Colli@7" IT "Da evadere@1" IT "Sconto@25" IT "Perc.\nProvv.@5" IT "Imp.Fisso unitario@1" IT "Importo Fisso@18" IT "Codice\nIVA@4" IT "Addebito IVA@1" IT "Aspetto beni@3" IT "Causale\nMagazzino@12" IT "Magazzino\nCollegato@9" IT "Deposito\nCollegato@9" IT "Data\nconsegna@10" IT "Cod. Art. Mag.@20" IT "Controllato@11" IT "Quantita'\nagg. 1@13" IT "Quantita'\nagg. 2@13" IT "Quantita'\nagg. 3@13" IT "Quantita'\nagg. 4@13" IT "Quantita'\nagg. 5@13" IT "Impianto@8" IT "Linea@5" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "CDC 1@20" IT "Codice aggiuntivo 1@20" IT "Codice aggiuntivo 2@20" IT "Detraibilità@12" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Jolly@20" IT "Riduzione prezzo@18" IT "2a Perc.\nProvv.@5" IT "Sottocategoria\nACCIAIO@4" IT "Peso unitario\nACCIAIO@13" IT "Sottocategoria\nALLUMINIO@4" IT "Peso unitario\nALLUMINIO@13" IT "Sottocategoria\nCARTA@4" IT "Peso unitario\nCARTA@13" IT "Sottocategoria\nPLASTICA@4" IT "Peso unitario\nPLASTIC... git-svn-id: svn://10.65.10.50/trunk@19309 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ve/ve0300b.dat | 13 ++++++ ve/vearea.men | 1 + ve/veconf.h | 3 +- ve/velib.h | 8 +++- ve/velib02.cpp | 99 +++++++++++++++++++++++++++++--------------- ve/velib06.cpp | 65 +++++++++++++++++++++++++++++ ve/velib06a.cpp | 26 ++++++++++++ ve/vepriv.h | 1 + ve/verig.h | 17 +++++++- ve/verig.uml | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ ve/verig00.uml | 1 + ve/verig01.uml | 1 + ve/verig09.uml | 1 + ve/verig13.uml | 1 + ve/verig14.uml | 1 + ve/verig23.uml | 1 + ve/vetbscc.h | 3 ++ ve/vetbscc.uml | 60 +++++++++++++++++++++++++++ 18 files changed, 373 insertions(+), 36 deletions(-) create mode 100755 ve/vetbscc.h create mode 100755 ve/vetbscc.uml diff --git a/ve/ve0300b.dat b/ve/ve0300b.dat index c17dbfe83..4eecd13b5 100755 --- a/ve/ve0300b.dat +++ b/ve/ve0300b.dat @@ -64,3 +64,16 @@ JOLLY9|2|20|Jolly|20 JOLLY10|2|20|Jolly|20 RIDPREZZO|3|18|Riduzione prezzo|18 PERCPROV|3|502|2a Perc.\nProvv.|5 +SCAACC|2|4|Sottocategoria\nACCIAIO|4 +PUNACC|3|1305|Peso unitario\nACCIAIO|13 +SCAALL|2|4|Sottocategoria\nALLUMINIO|4 +PUNALL|3|1305|Peso unitario\nALLUMINIO|13 +SCACAR|2|4|Sottocategoria\nCARTA|4 +PUNCAR|3|1305|Peso unitario\nCARTA|13 +SCAPLA|2|4|Sottocategoria\nPLASTICA|4 +PUNPLA|3|1305|Peso unitario\nPLASTICA|13 +SCALEG|2|4|Sottocategoria\nLEGNO|4 +PUNLEG|3|1305|Peso unitario\nLEGNO|13 +SCAVET|2|4|Sottocategoria\nVETRO|4 +PUNVET|3|1305|Peso unitario\nVETRO|13 + diff --git a/ve/vearea.men b/ve/vearea.men index c9d519bf5..36e1ed25d 100755 --- a/ve/vearea.men +++ b/ve/vearea.men @@ -59,6 +59,7 @@ Item_13 = "Banche di presentazione", "ef0 -6 BNP", "F" Item_14 = "Zone", "ba3 -0 ZON", "F" Item_15 = "Fatture da emettere/ricevere", "ve0 -6 &MRE", "F" Item_16 = "Conti ricavo dei materiali", "ve0 -6 &CMT", "F" +Item_17 = "Sottocategorie CONAI", "ve0 -6 &SCC", "F" [ACQVEN_005] Caption = "Tabelle contabili" diff --git a/ve/veconf.h b/ve/veconf.h index 60f427061..976d7cb48 100755 --- a/ve/veconf.h +++ b/ve/veconf.h @@ -55,6 +55,7 @@ #define F_CONFPLA 148 #define F_CONFLEG 149 #define F_CONFVET 150 +#define F_PRICEOMAGGI 151 // Campi per ve0200b.uml #define F_GESAGE 101 @@ -117,7 +118,6 @@ #define F_CMSCNTFIELD 113 #define F_FLDVALMAT 114 - // Campi per ve0200f.uml #define F_IMPSPINC1 101 #define F_IMPSPINC2 102 @@ -279,6 +279,7 @@ #define F_EAN8 212 #define F_EAN13 213 #define F_EAN8CIN 214 +#define F_IVA_OBBL 215 // Campi per ve0200h.uml diff --git a/ve/velib.h b/ve/velib.h index cdd9ef080..3612986be 100755 --- a/ve/velib.h +++ b/ve/velib.h @@ -17,6 +17,10 @@ class TViswin; #include "../ve/clifor.h" #endif +#ifndef __VERIG_H +#include "../ve/verig.h" +#endif + #ifndef __RELAPP_H #include #endif @@ -467,8 +471,10 @@ public: const char * get_conai_contr_name(int type); bool conai_configured_type(int type); const char * get_conai_peso_name(int type); -const char * get_conai_cat_name(int type); +short get_conai_peso_field(int type); const char * get_conai_sottocat_name(int type); +short get_conai_sottocat_field(int type); +int id2conai_type(short id); class TRiga_documento : public TAuto_variable_rectype // velib02 { diff --git a/ve/velib02.cpp b/ve/velib02.cpp index cc170d239..4f37a7c8f 100755 --- a/ve/velib02.cpp +++ b/ve/velib02.cpp @@ -815,16 +815,12 @@ real TRiga_documento::qtaresidua_mag() const if (conai_configured_type(type)) return __conai_peso_names[type]; - return "QTAGG1"; + return ""; } - const char * get_conai_cat_name(int type) + short get_conai_peso_field(int type) { - const char* const __conai_cat_names[] = {"CATACC", "CATALL", "CATCAR", "CATPLA", "CATLEG", "CATVET"}; - - if (conai_configured_type(type)) - return __conai_cat_names[type]; - return "CODAGG1"; + return FR_PUNACC + 2 * type; } const char * get_conai_sottocat_name(int type) @@ -833,33 +829,33 @@ real TRiga_documento::qtaresidua_mag() const if (conai_configured_type(type)) return __conai_scat_names[type]; - return "CODAGG2"; + return ""; } -real TRiga_documento::calc_conai_qta(int type) const -{ - real qta = get_real(RDOC_QTA); + short get_conai_sottocat_field(int type) + { + return FR_SCAACC + 2 * type; + } - if (is_merce()) - { - const char * contr = get_conai_contr_name(type); - const bool has_formula = ((TTipo_riga_documento &)tipo()).has_formula(contr); + int id2conai_type(short id) + { + return (int) (id - FR_SCAACC) / 2; + } + + +real TRiga_documento::calc_conai_qta(int type) const +{ + real qta = ZERO; + + if (is_merce() && conai_configured_type(type)) + { TArticolo & art = articolo(); const TString4 um = get(RDOC_UMQTA); - const bool configured = conai_configured_type(type); - qta = art.convert_to_um(qta, NULL, um); - - if (configured) - qta *= get_real(get_conai_peso_name(type)); - else - if (has_formula) - qta *= get_real(contr); - else - qta *= art.get_real(contr); + qta = art.convert_to_um(get_real(RDOC_QTA), NULL, um); + qta *= get_real(get_conai_peso_name(type)); } - - return qta; + return qta; } bool TRiga_documento::is_evasa() const @@ -1139,6 +1135,25 @@ void TRiga_documento::autosave(TSheet_field& f) break; } } + for (short id = FR_SCAACC; id <= FR_PUNVET; id++) + { + const int pos = m.id2pos(id); + + if (pos > 0) + { + const TFieldref* fld = m.fld(pos).field(); + + if (fld != NULL) + { + const char* val = row.get(f.cid2index(id)); + + if (val != NULL) + fld->write(val, *this); + else + fld->write(EMPTY_STRING, *this); + } + } + } } } @@ -1237,14 +1252,32 @@ void TRiga_documento::autoload(TSheet_field & f) { const TFieldref* fld = m.fld(pos).field(); - if (fld != NULL) - { + if (fld != NULL) + { + const int idx = f.cid2index(id); + + row.add(fld->read(*this), idx); + } + } + } + + for (short id = FR_SCAACC; id <= FR_PUNVET; id++) + { + const int pos = m.id2pos(id); + + if (pos > 0) + { + const TFieldref* fld = m.fld(pos).field(); + + if (fld != NULL) + { const int idx = f.cid2index(id); - row.add(fld->read(*this), idx); - } - } - }} + row.add(fld->read(*this), idx); + } + } + } +} TArticolo & TRiga_documento::articolo() const { diff --git a/ve/velib06.cpp b/ve/velib06.cpp index 55bd59dc6..0768da592 100755 --- a/ve/velib06.cpp +++ b/ve/velib06.cpp @@ -509,6 +509,71 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet) to_delete.set(0L); to_delete.reset(1); + for (i = 0; i < 5; i++) + { + const short posc = get_conai_sottocat_field(i); + const short posp = get_conai_peso_field(i); + const int colc = sheet.cid2index(posc); + const int colp = sheet.cid2index(posp); + + if (conai_configured_type(i)) + { + sheet.sheet_mask().show(posc); + sheet.sheet_mask().show(posp); + sheet.sheet_mask().set_handler(posp, peso_conai_handler); + to_delete.reset(colc); + if (colonne.find(format("%d", posc)) < 0) + colonne.add(posc); + to_delete.reset(colp); + if (colonne.find(format("%d", posp)) < 0) + colonne.add(posp); + } + else + { + sheet.sheet_mask().hide(posc); + sheet.sheet_mask().hide(posp); + to_delete.set(colc); + int p = colonne.find(format("%d", posc)); + + if (p > 0) + p--; + if (p >= 0) + { + int p1 = p; + while (isdigit(colonne[p1])) + p1++; + if (colonne[p1] == '|') + p1++; + else + if (colonne[p] == '|') + p--; + const TString c(colonne.mid(p1)); + colonne.cut(p); + colonne << c; + } + + to_delete.set(colp); + p = colonne.find(format("%d", posp)); + + if (p > 0) + p--; + if (p >= 0) + { + int p1 = p; + while (isdigit(colonne[p1])) + p1++; + if (colonne[p1] == '|') + p1++; + else + if (colonne[p] == '|') + p--; + const TString c(colonne.mid(p1)); + colonne.cut(p); + colonne << c; + } + } + } + if (!to_delete[sheet.cid2index(FR_CODDEP)]) sheet.enable_column(FR_CODDEP, _ges_dep && _ges_mag); if (!to_delete[sheet.cid2index(FR_CODMAG)]) diff --git a/ve/velib06a.cpp b/ve/velib06a.cpp index eeee19a20..99b525d8f 100755 --- a/ve/velib06a.cpp +++ b/ve/velib06a.cpp @@ -1690,6 +1690,18 @@ bool codart_handler(TMask_field& f, KEY key ) else mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); + for (int type = 0; type < 5; type++) + { + if (conai_configured_type(type)) + { + const short id = get_conai_peso_field(type); + const int pos = row_mask.id2pos(id); + + if (pos >= 0 && row_mask.fld(pos).get().blank()) + row_mask.fld(pos).set(anamag.get(get_conai_contr_name(type))); + } + } + const int pos = row_mask.id2pos(FR_CODIVA); if (pos >= 0) @@ -2841,3 +2853,17 @@ bool gen_livelli_handler(TMask_field& f, KEY key ) } return true; } + +bool peso_conai_handler(TMask_field& f, KEY key ) +{ + if (key == K_F8) + { + const TString & codart = f.mask().get(FR_CODARTMAG); + TArticolo & articolo = cached_article(codart); + const short id = f.dlg(); + const int type = id2conai_type(id); + + f.set(articolo.get(get_conai_contr_name(type))); + } + return true; +} \ No newline at end of file diff --git a/ve/vepriv.h b/ve/vepriv.h index 4b6474741..f42c17d0b 100755 --- a/ve/vepriv.h +++ b/ve/vepriv.h @@ -35,6 +35,7 @@ bool cms_mag_handler(TMask_field& f, KEY key); bool evasion_check_handler( TMask_field& f, KEY key ); bool distinta_link_handler(TMask_field& f, KEY key ); bool gen_livelli_handler(TMask_field& f, KEY key ); +bool peso_conai_handler(TMask_field& f, KEY key ); bool codcms_handler(TMask_field &f, KEY key); bool numdocrif_hndl(TMask_field& field, KEY key); diff --git a/ve/verig.h b/ve/verig.h index d94c69914..9120704ef 100755 --- a/ve/verig.h +++ b/ve/verig.h @@ -107,8 +107,23 @@ #define FR_RIDPREZZO 165 #define FR_PERCPROV1 166 +//campi CONAI + +#define FR_SCAACC 167 +#define FR_PUNACC 168 +#define FR_SCAALL 169 +#define FR_PUNALL 170 +#define FR_SCACAR 171 +#define FR_PUNCAR 172 +#define FR_SCAPLA 173 +#define FR_PUNPLA 174 +#define FR_SCALEG 175 +#define FR_PUNLEG 176 +#define FR_SCAVET 177 +#define FR_PUNVET 178 + // Ultimo campo fittizio -#define FR_END 167 +#define FR_END 179 #define MAX_COLUMNS FR_END-FR_LORDO diff --git a/ve/verig.uml b/ve/verig.uml index 11b462a26..8f418e926 100755 --- a/ve/verig.uml +++ b/ve/verig.uml @@ -2078,6 +2078,113 @@ ENDIF END ENDIF +#ifdef IS_MERCE +ENDPAGE + +PAGE "Pag.4" -1 -1 MASK_WIDTH MASK_HEIGHT + +GROUPBOX DLG_NULL 78 8 +BEGIN + PROMPT 1 0 "CONAI" +END + +STRING FR_SCAACC 4 +BEGIN + PROMPT 2 1 "Sottocategoria ACCIAIO " + USE &SCC SELECT CODTAB[1,2]=="AC" + INPUT CODTAB FR_SCAACC + DISPLAY "Sottocategoria" CODTAB[3,4] + DISPLAY "Descrizione@50" S0 + OUTPUT FR_SCAACC CODTAB + FIELD SCAACC +END + +NUMBER FR_PUNACC 13 5 +BEGIN + PROMPT 40 1 "Peso unitario " + FIELD PUNACC +END + +STRING FR_SCAALL 4 +BEGIN + PROMPT 2 2 "Sottocategoria ALLUMINIO " + USE &SCC SELECT CODTAB[1,2]=="AL" + INPUT CODTAB FR_SCAALL + COPY DISPLAY FR_SCAACC + OUTPUT FR_SCAALL CODTAB + FIELD SCAALL +END + +NUMBER FR_PUNALL 13 5 +BEGIN + PROMPT 40 2 "Peso unitario " + FIELD PUNALL +END + +STRING FR_SCACAR 4 +BEGIN + PROMPT 2 3 "Sottocategoria CARTA " + USE &SCC SELECT CODTAB[1,2]=="CA" + INPUT CODTAB FR_SCACAR + COPY DISPLAY FR_SCAACC + OUTPUT FR_SCACAR CODTAB + FIELD SCACAR +END + +NUMBER FR_PUNCAR 13 5 +BEGIN + PROMPT 40 3 "Peso unitario " + FIELD PUNCAR +END + +STRING FR_SCAPLA 4 +BEGIN + PROMPT 2 4 "Sottocategoria PLASTICA " + USE &SCC SELECT CODTAB[1,2]=="PL" + INPUT CODTAB FR_SCAPLA + COPY DISPLAY FR_SCAACC + OUTPUT FR_SCAPLA CODTAB + FIELD SCAPLA +END + +NUMBER FR_PUNPLA 13 5 +BEGIN + PROMPT 40 4 "Peso unitario " + FIELD PUNPLA +END + +STRING FR_SCALEG 4 +BEGIN + PROMPT 2 5 "Sottocategoria LEGNO " + USE &SCC SELECT CODTAB[1,2]=="LE" + INPUT CODTAB FR_SCALEG + COPY DISPLAY FR_SCAACC + OUTPUT FR_SCALEG CODTAB + FIELD SCALEG +END + +NUMBER FR_PUNLEG 13 5 +BEGIN + PROMPT 40 5 "Peso unitario " + FIELD PUNLEG +END + +STRING FR_SCAVET 4 +BEGIN + PROMPT 2 6 "Sottocategoria VETRO " + USE &SCC SELECT CODTAB[1,2]=="VE" + INPUT CODTAB FR_SCAVET + COPY DISPLAY FR_SCAACC + OUTPUT FR_SCAVET CODTAB + FIELD SCAVET +END + +NUMBER FR_PUNVET 13 5 +BEGIN + PROMPT 40 6 "Peso unitario " + FIELD PUNVET +END +#endif #ifndef FULL_SCREEN ENDPAGE diff --git a/ve/verig00.uml b/ve/verig00.uml index 9fda5ffdd..36f5012f1 100755 --- a/ve/verig00.uml +++ b/ve/verig00.uml @@ -2,6 +2,7 @@ #define FULL_SCREEN #define PAGE_2 +#define IS_MERCE DEFINE_FIELD(CODMAG) DEFINE_FIELD(DESMAG) diff --git a/ve/verig01.uml b/ve/verig01.uml index 7de04c551..26e058ecf 100755 --- a/ve/verig01.uml +++ b/ve/verig01.uml @@ -1,6 +1,7 @@ #include "verigdef.h" #define FULL_SCREEN +#define IS_MERCE // else // #define MASK_WIDTH 60 // #define MASK_HEIGHT 14 diff --git a/ve/verig09.uml b/ve/verig09.uml index 769c58049..d4e3388db 100755 --- a/ve/verig09.uml +++ b/ve/verig09.uml @@ -1,6 +1,7 @@ #include "verigdef.h" #define FULL_SCREEN +#define IS_MERCE // else // #define MASK_WIDTH 60 // #define MASK_HEIGHT 14 diff --git a/ve/verig13.uml b/ve/verig13.uml index 60d0c1bce..86a5e9b33 100755 --- a/ve/verig13.uml +++ b/ve/verig13.uml @@ -1,6 +1,7 @@ #include "verigdef.h" #define FULL_SCREEN +#define IS_MERCE // else // #define MASK_WIDTH 60 // #define MASK_HEIGHT 14 diff --git a/ve/verig14.uml b/ve/verig14.uml index 2fb71d38d..74bbfaafe 100755 --- a/ve/verig14.uml +++ b/ve/verig14.uml @@ -1,6 +1,7 @@ #include "verigdef.h" #define FULL_SCREEN +#define IS_MERCE // else // #define MASK_WIDTH 60 // #define MASK_HEIGHT 14 diff --git a/ve/verig23.uml b/ve/verig23.uml index e978e3db8..feab3c531 100755 --- a/ve/verig23.uml +++ b/ve/verig23.uml @@ -1,6 +1,7 @@ #include "verigdef.h" #define FULL_SCREEN +#define IS_MERCE // else // #define MASK_WIDTH 60 // #define MASK_HEIGHT 14 diff --git a/ve/vetbscc.h b/ve/vetbscc.h new file mode 100755 index 000000000..74c09ec6c --- /dev/null +++ b/ve/vetbscc.h @@ -0,0 +1,3 @@ +#define SCC_CATEGORIA 101 +#define SCC_CODICE 102 +#define SCC_DESCR 103 diff --git a/ve/vetbscc.uml b/ve/vetbscc.uml new file mode 100755 index 000000000..61d46864f --- /dev/null +++ b/ve/vetbscc.uml @@ -0,0 +1,60 @@ +#include "vetbscc.h" + +TOOLBAR "Toolbar" 0 0 0 2 + +#include + +ENDPAGE + +PAGE "Sottocategorie CONAI" 0 0 0 0 + +GROUPBOX DLG_NULL 78 5 +BEGIN + PROMPT 1 0 "" + FLAGS "R" +END + +LIST SCC_CATEGORIA 2 10 +BEGIN + PROMPT 2 1 "Categoria " + FIELD CODTAB[1,2] + KEY 1 + ITEM "AC|Acciaio" + ITEM "AL|Alluminio" + ITEM "CA|Carta" + ITEM "PL|Plastica" +END + +NUMBER SCC_CODICE 2 +BEGIN + PROMPT 2 3 "Codice " + FIELD CODTAB[3,4] + KEY 1 + USE &SCC + FLAGS "Z" + INPUT CODTAB[1,2] SCC_CATEGORIA + INPUT CODTAB[3,4] SCC_CODICE + DISPLAY "Categoria" CODTAB[1,2] + DISPLAY "Codice@8" CODTAB[3,4] + DISPLAY "Descrizione@50" S0 + OUTPUT SCC_CODICE CODTAB[3,4] + CHECKTYPE REQUIRED +END + +STRING SCC_DESCR 50 +BEGIN + PROMPT 2 5 "Descrizione " + FIELD S0 + KEY 2 + USE &SCC KEY 2 + INPUT S0 SCC_DESCR + DISPLAY "Descrizione@50 " S0 + DISPLAY "Categoria" CODTAB[1,2] + DISPLAY "Codice@8" CODTAB[3,4] + COPY OUTPUT SCC_CODICE + CHECKTYPE REQUIRED +END + +ENDPAGE +ENDMASK +