From 244580ee9a58a709a2f65f88764f209abea307ee Mon Sep 17 00:00:00 2001 From: Simone Palacino Date: Tue, 28 May 2019 11:15:37 +0200 Subject: [PATCH] Patch level : 12.0 802 Files correlati : fp0.exe Commento : - (monitor passive - f1) Corretto messaggio dopo contabilizzazione - Corretta procedura aggiornamento fornitore --- src/fp/fp0400.cpp | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/src/fp/fp0400.cpp b/src/fp/fp0400.cpp index 217b0da18..46a5062ee 100644 --- a/src/fp/fp0400.cpp +++ b/src/fp/fp0400.cpp @@ -53,7 +53,7 @@ protected: // Tasto nuovo: apre nuovo fornitore valorizzando giĆ  i dati dalla fattura void new_forn(); // Tasto aggiorna: aggiorna cliente che non corrisponde. - void aggiorna_forn(); + bool aggiorna_forn(); void salva_for() const; void clean_ini(const TString& filename) const; void run_cg0(const TString& filename) const; @@ -512,7 +512,7 @@ void TPassive_mask::clean_ini(const TString& filename) const #ifdef DBG remove_string.cut(0) << filename << "*.ini"; #else - remove_string.cut(0) << _tmp_dir << "\\" << filename << "*.*"; + remove_string.cut(0) << _tmp_dir << "\\" << filename << "*.ini"; #endif remove_files(remove_string, false); } @@ -520,7 +520,11 @@ void TPassive_mask::clean_ini(const TString& filename) const void TPassive_mask::run_cg0(const TString& filename) const { static TString run_string; - run_string.cut(0) << "cg0 -1 -i" << _tmp_dir << "\\" << filename << "*" << ".ini" << " /u" << user(); +#ifdef DBG + run_string.cut(0) << "cg0 -1 -i" << filename << "*.ini" << " /u" << user(); +#else + run_string.cut(0) << "cg0 -1 -i" << _tmp_dir << "\\" << filename << "*.ini" << " /u" << user(); +#endif TExternal_app(run_string).run(); } @@ -611,7 +615,7 @@ void TPassive_mask::log_contab() if (elem_save > 0) { if (elem_save == 1) - msg << "Il documento n. '" << doc_saved[0] << "' e' stata registrato."; + msg << "Il documento n. '" << doc_saved[0] << "' e' stato registrato."; else msg << "Sono stati registrati " << elem_save << " documenti."; if (elem_save > 1) @@ -688,6 +692,7 @@ void TPassive_mask::new_forn() TSheet_field& sf = sfield(F_ERR); static const TString newf = "fpnewf"; clean_ini(newf); + FOR_EACH_SHEET_ROW(sf, nr, row) { const TString denom = row->get(sf.cid2index(S_RAGSERR)); @@ -710,7 +715,11 @@ void TPassive_mask::new_forn() TString num; num.format("%04d", nr); TFilename newf_ini; - newf_ini.tempdir() << "\\" << newf << num << ".ini"; +#ifdef DBG + newf_ini << newf << num << ".ini"; +#else + newf_ini.tempdir() << "\\" << newf << num << ".ini"; +#endif TConfig forn_conf(newf_ini, "Transaction"); @@ -736,11 +745,12 @@ void TPassive_mask::new_forn() sf.force_update(); } -void TPassive_mask::aggiorna_forn() +bool TPassive_mask::aggiorna_forn() { TSheet_field& sf = sfield(F_ERR); static const TString newf = "fpaggf"; clean_ini(newf); + int count = 0; FOR_EACH_SHEET_ROW(sf, nr, row) { const TString denom = row->get(sf.cid2index(S_RAGSERR)); @@ -749,9 +759,10 @@ void TPassive_mask::aggiorna_forn() const int& n_row_elenco = forn_err.fatt_err; // Prendo che numero di riga a cui mi riferisco in fatture TSheet_field& f_docs = sfield(F_DOCS); // Prendo SheetField da elenco fatture TToken_string& row_elenco_fatt = f_docs.row(n_row_elenco); // Prendo riga dall'elenco delle fatture - + if (row->starts_with("X") && cod_forn == no_match_cf) { + count++; TLocalisamfile clifo(LF_CLIFO); clifo.setkey(5); clifo.put(CLI_TIPOCF, 'F'); @@ -769,7 +780,11 @@ void TPassive_mask::aggiorna_forn() { TString num; num.format("%04d", nr); TFilename newf_ini; +#ifdef DBG + newf_ini << newf << num << ".ini"; +#else newf_ini.tempdir() << "\\" << newf << num << ".ini"; +#endif TConfig forn_conf(newf_ini, "Transaction"); forn_conf.set("Action", "MODIFY"); @@ -778,13 +793,20 @@ void TPassive_mask::aggiorna_forn() forn_conf.set("TIPOCF", "F"); forn_conf.set("COFI", row->get(sf.cid2index(S_CODFIERR))); forn_conf.set("CODCF", clifo.get(CLI_CODCF)); - - row->add("", 0); + TString codsdi; codsdi << row_elenco_fatt.get(16); + if (!codsdi.empty() && codsdi != "0000000") + { + forn_conf.set_paragraph("17"); + forn_conf.set("PADESTIN", codsdi); + } } } + row->add("", 0); } - run_cg0(newf); + if (count) + run_cg0(newf); sf.force_update(); + return count; } @@ -869,7 +891,8 @@ bool TPassive_mask::on_field_event(TOperable_field& o, TField_event e, long joll case DLG_RECALC: if (e == fe_button) if (curr_page() == elenco_err) - aggiorna_forn(); + if (aggiorna_forn()) + fill(); break; case DLG_EXPORT: if (e == fe_button && curr_page() == elenco_fe)