From 97e0c732039c9d28d7ab871b367ed569b8d13ec9 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 29 Aug 2009 18:56:49 +0000 Subject: [PATCH] Patch level : 10.0 410 Files correlati : pe0.exe Ricompilazione Demo : [ ] Commento Copia di tutte le righe. Campo provenienza del prezzo. git-svn-id: svn://10.65.10.50/trunk@19238 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- pe/pe0400.cpp | 56 ++++++++++++++++++++++++++++++++++----------------- pe/prev.src | 27 +++++++++++++------------ 2 files changed, 51 insertions(+), 32 deletions(-) diff --git a/pe/pe0400.cpp b/pe/pe0400.cpp index 270db2571..2827a4994 100755 --- a/pe/pe0400.cpp +++ b/pe/pe0400.cpp @@ -25,6 +25,7 @@ #define F_USEK F_USERFLD+9 #define F_REVISION F_USERFLD+10 #define F_LOAD_COSTS F_USERFLD+11 +#define F_COPIA_TUTTO F_USERFLD+12 #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--) ////////////////////////////////////////// @@ -155,7 +156,7 @@ void TGestione_preventivo_msk::update_costi_ricavi(int nrow, bool update_sheet) const int cur_level = d[nrow].get_int(RDOC_LEVEL); - while (nrow < rows && cur_level <= d[nrow + 1].get_int(RDOC_LEVEL)) + while (nrow < rows && cur_level < d[nrow + 1].get_int(RDOC_LEVEL)) nrow++; for (int i = nrow; i > 0; i--) { @@ -167,14 +168,14 @@ void TGestione_preventivo_msk::update_costi_ricavi(int nrow, bool update_sheet) const real importo = row.importo(true, false); row.put(RDOC_VALV, importo); - for (int i = level - 1; i >= 0; i--) + for (int j = level - 1; j >= 0; j--) { - real * r = (real *) valori.objptr(i); + real * r = (real *) valori.objptr(j); if (r == NULL) { r = new real; - valori.add(r, i); + valori.add(r, j); } *r += importo; } @@ -182,14 +183,14 @@ void TGestione_preventivo_msk::update_costi_ricavi(int nrow, bool update_sheet) const real costo = row.get_real(RDOC_QTA) * row.get_real(RDOC_COSTO); row.put(RDOC_VALC, costo); - for (int i = level - 1; i >= 0; i--) + for (int j = level - 1; j >= 0; j--) { - real * r = (real *) costi.objptr(i); + real * r = (real *) costi.objptr(j); if (r == NULL) { r = new real; - costi.add(r, i); + costi.add(r, j); } *r += costo; } @@ -279,6 +280,7 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key) sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY3)); father_row.zero(RDOC_COSTO); father_row.zero(RDOC_PREZZO); + father_row.zero(RDOC_PPROV); father_row.zero(RDOC_K); father_row.autoload(sh); sh.force_update(father_sheet_row); @@ -361,6 +363,7 @@ TVariable_mask * TGestione_preventivo_msk::riga_mask(int numriga) TEdit_field & tree = m->add_string(FR_JOLLY1, 0, "Albero ", 2, 20, 13, "D_"); TEdit_field & k = m->add_string(FR_JOLLY2, 0, "K ", 25, 20, 25); TEdit_field & v = m->add_currency(FR_JOLLY3, 0, "Costo", 53, 20, 15, "U"); + TEdit_field & p = m->add_string(FR_JOLLY4, 0, "", 75, 20, 1, "U"); m->set_handler(FR_CODART, pe_codart_handler); m->set_handler(FR_QTA, pe_qta_handler); @@ -370,6 +373,8 @@ TVariable_mask * TGestione_preventivo_msk::riga_mask(int numriga) tree.set_field(RDOC_TREE); k.set_field(RDOC_K); v.set_field(RDOC_COSTO); + p.set_field(RDOC_PPROV); + } return m; @@ -480,7 +485,7 @@ bool TGestione_preventivo_msk::pe_copia_handler(TMask_field& f, KEY k) mask._clipboard_provv = mask.get(F_PROVV)[0]; mask._clipboard_codnum = mask.get(F_CODNUM); mask._clipboard_anno = mask.get_int(F_ANNO); - mask._clipboard_row = mask.sfield(F_SHEET).selected() + 1; + mask._clipboard_row = f.dlg() == F_COPIA ? mask.sfield(F_SHEET).selected() + 1 : 0; } return ok; } @@ -491,8 +496,10 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k) if (k == K_SPACE) { TGestione_preventivo_msk& mask = (TGestione_preventivo_msk&)f.mask(); + const bool alldoc = mask._clipboard_row == 0; + const int cliprow = alldoc ? 1 : mask._clipboard_row; - if (mask._clipboard_row > 0) + if (cliprow > 0) { TDocumento & dest = mask.doc(); TDocumento * newdoc = &mask.doc(); @@ -509,11 +516,11 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k) const int selected_row = sh.selected() + 1; const int rows = dest.physical_rows(); const int next_level = mask.get_int(F_LIVELLO); - const int orig_level = orig[mask._clipboard_row].get_int(RDOC_LEVEL); + const int orig_level = orig[cliprow].get_int(RDOC_LEVEL); const int level = next_level > 0 ? next_level - 1 : orig_level; const int level_offset = level - orig_level; int i; - int start_row = -1; + int start_row = rows > 0 ? -1 : 1; for (i = selected_row; start_row < 0 && i <= rows; i++) { @@ -524,13 +531,14 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k) } if (start_row > 0) { - const bool shift_source_rows = (!different_doc) && start_row <= mask._clipboard_row; + const bool shift_source_rows = (!different_doc) && start_row <= cliprow; + const int nrows = orig.physical_rows(); - for (i = mask._clipboard_row; i <= orig.physical_rows(); i++) + for (i = cliprow; i <= nrows; i++) { int row_level = orig[i].get_int(RDOC_LEVEL); - if (i > mask._clipboard_row && orig_level >= row_level) + if (!alldoc && i > cliprow && orig_level >= row_level) break; const TRiga_documento & row = orig[i]; @@ -539,7 +547,7 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k) dest.copy_data(new_row, row); row_level += level_offset; new_row.put(RDOC_LEVEL, row_level); - new_row.put(RDOC_TREE, mask.build_tree_string(level)); + new_row.put(RDOC_TREE, mask.build_tree_string(row_level)); new_row.autoload(sh); start_row++; @@ -550,7 +558,6 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k) mask.highlight(); sh.force_update(); } - // mask._clipboard_row = -1; if (different_doc) delete newdoc; mask.reset(F_LIVELLO); @@ -701,9 +708,12 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k) if (has_k || !row_mask.field(FR_PREZZO).enabled()) row_mask.set(FR_PREZZO, ""); + row_mask.set(FR_JOLLY4, mask.condv().get_prov()); + if (row_mask.field(FR_JOLLY3).enabled()) { - if (row_mask.get(FR_PREZZO).blank()) + if (row_mask.get(FR_PREZZO).blank() && + row_mask.get(FR_JOLLY3).full()) mask.update_prezzo_vendita(row_mask); } else @@ -869,6 +879,7 @@ void TGestione_preventivo_msk::update_prezzo_vendita(TMask & row_mask) TCurrency_documento prezzo(costo, doc(), true); row_mask.set(FR_PREZZO, prezzo.get_num().string()); + row_mask.set(FR_JOLLY4, "K"); } bool TGestione_preventivo_msk::pe_k_handler(TMask_field& f, KEY k) @@ -924,7 +935,9 @@ bool TGestione_preventivo_msk::pe_k_handler(TMask_field& f, KEY k) val *= (2 - perc); TCurrency_documento prezzo(val, doc, true); row.put(RDOC_PREZZO, prezzo.get_num()); + row.put(RDOC_PPROV, "K"); shrow.add(prezzo.get_num().string(), sh->cid2index(FR_PREZZO)); + shrow.add("K", sh->cid2index(FR_JOLLY4)); } } mask.update_costi_ricavi(r + 1, true); @@ -955,6 +968,8 @@ bool TGestione_preventivo_msk::pe_prezzo_handler(TMask_field& f, KEY k) condv.set_riga(&row_mask); condv.ricerca(); doc[row + 1].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); + doc[row + 1].put(RDOC_PPROV, condv.get_prov()); + row_mask.reset(FR_JOLLY2); row_mask.field(FR_JOLLY2).set_focusdirty(false); } @@ -1096,13 +1111,16 @@ TMask* TGestione_preventivo_app::get_mask( int mode ) TEdit_field & k = m->add_string(F_K, sh.page(), "K ", 5, y, 25); k.set_field(DOC_K); - m->add_number(F_LIVELLO, sh.page(), "Livello Successivo ", 33, y, 1); - m->add_boolean(F_DETTAGLIO, sh.page(), "Dettaglia ", 58, y); + m->add_number(F_LIVELLO, sh.page(), "Livello Succ. ", 33, y, 1); + m->add_boolean(F_DETTAGLIO, sh.page(), "Dettaglia", 53, y); + m->add_button(F_COPIA_TUTTO, sh.page(), "~Tutto", 66, y, 1, 1, "", BMP_FILECHK); + m->set_handler(F_COPIA_TUTTO, TGestione_preventivo_msk::pe_copia_handler); m->add_button(F_COPIA, sh.page(), "~Copia", 71, y, 1, 1, "", BMP_COPY); m->set_handler(F_COPIA, TGestione_preventivo_msk::pe_copia_handler); m->add_button(F_INCOLLA, sh.page(), "~Incolla", 76, y, 1, 1, "", BMP_PASTE); m->set_handler(F_INCOLLA, TGestione_preventivo_msk::pe_incolla_handler); sh.enable_column(sh.cid2index(FR_JOLLY1), false); + sh.enable_column(sh.cid2index(FR_JOLLY4), false); } } return TMotore_application::get_mask(mode); diff --git a/pe/prev.src b/pe/prev.src index 258d2afbd..3027f0434 100755 --- a/pe/prev.src +++ b/pe/prev.src @@ -174,19 +174,20 @@ Col(9) = FR_UMQTA Col(10) = FR_QTA Col(11) = FR_LORDO Col(12) = FR_PREZZO -Col(13) = FR_JOLLY3|Costo|18 -Col(14) = FR_SCONTO -Col(15) = FR_JOLLY2|K|25 -Col(16) = FR_PERCPROV -Col(17) = FR_IMPFISUN -Col(18) = FR_IMPFISSO -Col(19) = FR_PERCPROV1 -Col(20) = FR_CODIVA -Col(21) = FR_ADDIVA -Col(22) = FR_CAUS -Col(23) = FR_CODMAGC -Col(43) = FR_CODDEPC -Col(25) = FR_TIPORIGA +Col(13) = FR_JOLLY4|Prov.|5 +Col(14) = FR_JOLLY3|Costo|18 +Col(15) = FR_SCONTO +Col(16) = FR_JOLLY2|K|25 +Col(17) = FR_PERCPROV +Col(18) = FR_IMPFISUN +Col(19) = FR_IMPFISSO +Col(20) = FR_PERCPROV1 +Col(21) = FR_CODIVA +Col(22) = FR_ADDIVA +Col(23) = FR_CAUS +Col(24) = FR_CODMAGC +Col(25) = FR_CODDEPC +Col(26) = FR_TIPORIGA [RIGHE]