From 73ae87b0b85c8481f53318bac4a887882b237506 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 21 Apr 2009 00:07:11 +0000 Subject: [PATCH] Patch level : 10.0 286 Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Preventivi/incarichi (Dinamica) git-svn-id: svn://10.65.10.50/trunk@18741 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- pe/pe0400.cpp | 117 ++++++++++++++++++++++++++++++++++++------------ pe/prev.src | 31 ++++++------- ve/velib06a.cpp | 2 +- 3 files changed, 103 insertions(+), 47 deletions(-) diff --git a/pe/pe0400.cpp b/pe/pe0400.cpp index 32e8c50de..9b3cd2bf2 100755 --- a/pe/pe0400.cpp +++ b/pe/pe0400.cpp @@ -12,7 +12,8 @@ #define F_K F_USERFLD -#define F_DETTAGLIO F_USERFLD+1 +#define F_LIVELLO F_USERFLD+1 +#define F_DETTAGLIO F_USERFLD+2 #define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--) ////////////////////////////////////////// @@ -29,7 +30,7 @@ protected: //handler di riga: static bool pe_ritirato_handler(TMask_field& f, KEY k); static bool pe_codart_handler(TMask_field& f, KEY k); - static bool pe_umart_handler(TMask_field& f, KEY k); + static bool pe_qta_handler(TMask_field& f, KEY k); static bool ss_notify(TSheet_field& ss, int r, KEY key); @@ -92,21 +93,21 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key) switch (key) { - case K_ENTER: // modifica - { + case K_TAB: // entrata + { TRiga_documento& row = doc[r + 1]; - TMask & m = sh.sheet_row_mask(r); + TMask & row_mask = sh.sheet_row_mask(r); const int level = row.get_int(RDOC_LEVEL); const bool prodfin = level == 0; const bool price_enabled = (r + 1 == doc.physical_rows()) || (level >= doc[r + 2].get_int(RDOC_LEVEL)); short id; - m.enable(FR_PREZZO, price_enabled); - m.enable(FR_JOLLY2, price_enabled); - for (id = F_CDC1; id < F_CDC12; id++) - m.enable(id, prodfin); - for (id = F_DESCDC1; id < F_DESCDC12; id++) - m.enable(id, prodfin); + row_mask.enable(FR_PREZZO, price_enabled); + row_mask.enable(FR_JOLLY2, price_enabled); + for (id = FR_CDC1; id < FR_CDC12; id++) + row_mask.enable(id, prodfin); + for (id = FR_DESCDC1; id < FR_DESCDC12; id++) + row_mask.enable(id, prodfin); } break; case K_CTRL + K_INS: // Inserimento @@ -123,8 +124,12 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key) const int rows = doc.physical_rows(); level = father_row.get_int(RDOC_LEVEL); - if (dmsk.get_bool(F_DETTAGLIO) || (doc_row < rows && level < doc[doc_row + 1].get_int(RDOC_LEVEL))) - level++; + const int next_level = dmsk.get_int(F_LIVELLO); + if ( next_level > 0 && (doc_row == rows || level > doc[doc_row + 1].get_int(RDOC_LEVEL))) + level = (doc_row == rows || next_level - 1 >= doc[doc_row + 1].get_int(RDOC_LEVEL)) ? next_level - 1 : doc[doc_row + 1].get_int(RDOC_LEVEL); + else + if (dmsk.get_bool(F_DETTAGLIO) || (doc_row < rows && level < doc[doc_row + 1].get_int(RDOC_LEVEL))) + level++; if (level > 0) { row.put(RDOC_CODCOSTO, father_row.get(RDOC_CODCOSTO)); @@ -139,7 +144,7 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key) father_row.zero(RDOC_K); father_row.autoload(sh); sh.force_update(father_sheet_row); - for (id = F_CDC1; id < F_CDC12; id++) + for (id = FR_CDC1; id < FR_CDC12; id++) sh.disable_cell(r, sh.cid2index(id)); } } @@ -153,8 +158,11 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key) tree << '+'; tree.rpad(10, '-'); } + else + tree = " +"; row.put(RDOC_TREE, tree); row.autoload(sh); + dmsk.reset(F_LIVELLO); dmsk.reset(F_DETTAGLIO); } break; @@ -218,7 +226,7 @@ TVariable_mask * TGestione_preventivo_msk::riga_mask(int numriga) TEdit_field & k = m->add_string(FR_JOLLY2, 0, "K ", 25, 20, 25); m->set_handler(FR_CODART, pe_codart_handler); - m->set_handler(FR_UMQTA, pe_umart_handler); + m->set_handler(FR_QTA, pe_qta_handler); tree.set_field(RDOC_TREE); k.set_field(RDOC_K); } @@ -244,7 +252,7 @@ void TGestione_preventivo_msk::doc2mask(bool reload_clifo, bool force_load, bool s.enable_cell(i, s.cid2index(FR_PREZZO), price_enabled); s.enable_cell(i, s.cid2index(FR_JOLLY2), price_enabled); - for (short id = F_CDC1; id < F_CDC12; id++) + for (short id = FR_CDC1; id < FR_CDC12; id++) s.enable_cell(i, s.cid2index(id), prodfin); } //aggiorna i colori delle righe e forza l'update dello sheet @@ -266,25 +274,25 @@ bool TGestione_preventivo_msk::pe_data_handler(TMask_field& f, KEY k) bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k) { + TMask& row_mask = f.mask(); bool ok = codart_handler( f, k ); if (ok && (k == K_ENTER || k == K_TAB)) { - TMask& row_mask = f.mask(); - - if (row_mask.field(FR_JOLLY2).active()) + if (f.to_check(k, true)) { TSheet_field * sh = row_mask.get_sheet(); if (sh != NULL) { TDocumento_mask & mask = (TDocumento_mask &) sh->mask(); TDocumento & doc = mask.doc(); + bool update = false; + const int r = sh->selected(); + TRiga_documento & row = doc[r + 1]; - if (f.to_check(k, true)) + if (row_mask.field(FR_JOLLY2).active()) { - const int r = sh->selected(); const TString& codart = mask.get(FR_CODARTMAG); - TRiga_documento & row = doc[r + 1]; if (codart.full()) { @@ -298,17 +306,65 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k) if (k.blank()) k = cache().get("GMC", catmer.left(3), "S2"); } + if (k.full()) + row_mask.set(FR_JOLLY2, k); } } + if (!row_mask.field(FR_PREZZO).active()) + row_mask.set(FR_PREZZO, ""); } } } + if (k == K_F8) + { + TSheet_field * sh = row_mask.get_sheet(); + + if (sh != NULL) + { + TDocumento_mask & mask = (TDocumento_mask &) sh->mask(); + TDocumento & doc = mask.doc(); + const int rows = doc.physical_rows(); + + for (int i = 1; i <= rows; i++) + { + TRiga_documento & row = doc[i]; + const int level = row.get_int(RDOC_LEVEL); + TString16 tree = row.get(RDOC_TREE); + const bool prodfin = level == 0; + const bool price_enabled = (i == doc.physical_rows()) || (level >= doc[i + 1].get_int(RDOC_LEVEL)); + short id; + + sh->enable_cell(i - 1, sh->cid2index(FR_PREZZO), price_enabled); + sh->enable_cell(i - 1, sh->cid2index(FR_JOLLY2), price_enabled); + for (id = FR_CDC1; id < FR_CDC12; id++) + sh->enable_cell(i - 1, id, prodfin); + for (id = FR_DESCDC1; id < FR_DESCDC12; id++) + sh->enable_cell(i - 1, id, prodfin); + if (tree.blank()) + { + if (level < 10) + { + if (level > 0) + tree.fill(' ', level); + tree << '+'; + tree.rpad(10, '-'); + } + else + tree = " +"; + row.put(RDOC_TREE, tree); + row.autoload(*sh); + mask.highlight_row(i -1, COLOR_INVALID, COLOR_INVALID, true, false); + } + } + sh->force_update(); + } + } return ok; } -bool TGestione_preventivo_msk::pe_umart_handler(TMask_field& f, KEY k) +bool TGestione_preventivo_msk::pe_qta_handler(TMask_field& f, KEY k) { - bool ok = umart_handler( f, k ); + bool ok = qta_handler( f, k ); if (ok) { @@ -336,7 +392,7 @@ bool TGestione_preventivo_msk::pe_umart_handler(TMask_field& f, KEY k) TToken_string & shrow = sh->row(r); qta *= qta_prec; - shrow.add(qta.string(), sh->cid2index(FR_UMQTA)); + shrow.add(qta.string(), sh->cid2index(FR_QTA)); sh->force_update(r); row.put(RDOC_QTA, qta); f.focusdirty(); @@ -358,11 +414,13 @@ bool TGestione_preventivo_msk::pe_umart_handler(TMask_field& f, KEY k) for (int i = r + 2; i <= rows && level < doc[i].get_int(RDOC_LEVEL); i++) { TToken_string & shrow = sh->row(i - 1); - real row_qta(shrow.get(sh->cid2index(FR_UMQTA))); + real row_qta(shrow.get(sh->cid2index(FR_QTA))); row_qta *= qta; - row_qta /= old_qta; - shrow.add(row_qta.string(), sh->cid2index(FR_UMQTA)); + if (!old_qta.is_zero()) + row_qta /= old_qta; + row_qta.round(5); + shrow.add(row_qta.string(), sh->cid2index(FR_QTA)); doc[i].put(RDOC_QTA, row_qta); } row.put(RDOC_QTA, qta); @@ -379,7 +437,7 @@ void TGestione_preventivo_msk::user_set_row_handler(TMask& rm, short field, int switch(index) { case 5101: rm.set_handler(field, pe_codart_handler); break; - case 5102: rm.set_handler(field, pe_umart_handler); break; + case 5102: rm.set_handler(field, pe_qta_handler); break; default : TDocumento_mask::user_set_row_handler(rm, field, index); break; } } @@ -430,6 +488,7 @@ TMask* TGestione_preventivo_app::get_mask( int mode ) TEdit_field & k = m->add_string(F_K, sh.page(), "K ", 2, y, 25); k.set_field(DOC_K); + m->add_number(F_LIVELLO, sh.page(), "Livello Successivo ", 35, y, 1); m->add_boolean(F_DETTAGLIO, sh.page(), "Dettaglia ", 60, y); sh.enable_column(sh.cid2index(FR_JOLLY1), false); } diff --git a/pe/prev.src b/pe/prev.src index 130e43b6c..595cec951 100755 --- a/pe/prev.src +++ b/pe/prev.src @@ -155,7 +155,7 @@ CAUSMAG = S_OBBLIGATORIO //2900 CAUSMAGC = S_DISABILITATO //2900 DESCRMAG = S_NORMALE //2900 DESCRMAGC = S_DISABILITATO //2900 -DATACONS = S_NORMALE //2000 +DATACONS = S_NASCOSTO //2000 BLANK = S_DISABILITATO //4000 [DEFAULT] @@ -173,22 +173,19 @@ Col(8) = FR_DESCR Col(9) = FR_UMQTA Col(10) = FR_QTA Col(11) = FR_LORDO -Col(12) = FR_QTAEVASA -Col(13) = FR_RIGAEVASA -Col(14) = FR_DATACONS -Col(15) = FR_PREZZO -Col(16) = FR_SCONTO -Col(17) = FR_JOLLY2|K|25 -Col(18) = FR_PERCPROV -Col(19) = FR_IMPFISUN -Col(20) = FR_IMPFISSO -Col(21) = FR_PERCPROV1 -Col(22) = FR_CODIVA -Col(23) = FR_ADDIVA -Col(24) = FR_CAUS -Col(25) = FR_CODMAGC -Col(26) = FR_CODDEPC -Col(27) = FR_TIPORIGA +Col(12) = FR_PREZZO +Col(13) = FR_SCONTO +Col(14) = FR_JOLLY2|K|25 +Col(15) = FR_PERCPROV +Col(16) = FR_IMPFISUN +Col(17) = FR_IMPFISSO +Col(18) = FR_PERCPROV1 +Col(19) = FR_CODIVA +Col(20) = FR_ADDIVA +Col(21) = FR_CAUS +Col(22) = FR_CODMAGC +Col(23) = FR_CODDEPC +Col(24) = FR_TIPORIGA [RIGHE] diff --git a/ve/velib06a.cpp b/ve/velib06a.cpp index 64efd3b16..39ca8ca5c 100755 --- a/ve/velib06a.cpp +++ b/ve/velib06a.cpp @@ -1764,7 +1764,7 @@ bool codart_handler(TMask_field& f, KEY key ) { new_row.zero(RDOC_PREZZO); // new_row.autoload(sh); // Da rdoc a shee - sh.row(row).add("0", FR_PREZZO-FIRST_FIELD); + sh.row(row).add("0", sh.cid2index(FR_PREZZO)); row_mask.reset(FR_PREZZO); } row++;