Patch level : 12.0 802

Files correlati     : fp0.exe
Commento            :
- (monitor passive - f1) Corretto messaggio dopo contabilizzazione
- Corretta procedura aggiornamento fornitore
This commit is contained in:
Simone Palacino 2019-05-28 11:15:37 +02:00
parent 8ea3aa8696
commit 244580ee9a

View File

@ -53,7 +53,7 @@ protected:
// Tasto nuovo: apre nuovo fornitore valorizzando già i dati dalla fattura // Tasto nuovo: apre nuovo fornitore valorizzando già i dati dalla fattura
void new_forn(); void new_forn();
// Tasto aggiorna: aggiorna cliente che non corrisponde. // Tasto aggiorna: aggiorna cliente che non corrisponde.
void aggiorna_forn(); bool aggiorna_forn();
void salva_for() const; void salva_for() const;
void clean_ini(const TString& filename) const; void clean_ini(const TString& filename) const;
void run_cg0(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 #ifdef DBG
remove_string.cut(0) << filename << "*.ini"; remove_string.cut(0) << filename << "*.ini";
#else #else
remove_string.cut(0) << _tmp_dir << "\\" << filename << "*.*"; remove_string.cut(0) << _tmp_dir << "\\" << filename << "*.ini";
#endif #endif
remove_files(remove_string, false); 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 void TPassive_mask::run_cg0(const TString& filename) const
{ {
static TString run_string; 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(); TExternal_app(run_string).run();
} }
@ -611,7 +615,7 @@ void TPassive_mask::log_contab()
if (elem_save > 0) if (elem_save > 0)
{ {
if (elem_save == 1) 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 else
msg << "Sono stati registrati " << elem_save << " documenti."; msg << "Sono stati registrati " << elem_save << " documenti.";
if (elem_save > 1) if (elem_save > 1)
@ -688,6 +692,7 @@ void TPassive_mask::new_forn()
TSheet_field& sf = sfield(F_ERR); TSheet_field& sf = sfield(F_ERR);
static const TString newf = "fpnewf"; static const TString newf = "fpnewf";
clean_ini(newf); clean_ini(newf);
FOR_EACH_SHEET_ROW(sf, nr, row) FOR_EACH_SHEET_ROW(sf, nr, row)
{ {
const TString denom = row->get(sf.cid2index(S_RAGSERR)); const TString denom = row->get(sf.cid2index(S_RAGSERR));
@ -710,7 +715,11 @@ void TPassive_mask::new_forn()
TString num; num.format("%04d", nr); TString num; num.format("%04d", nr);
TFilename newf_ini; 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"); TConfig forn_conf(newf_ini, "Transaction");
@ -736,11 +745,12 @@ void TPassive_mask::new_forn()
sf.force_update(); sf.force_update();
} }
void TPassive_mask::aggiorna_forn() bool TPassive_mask::aggiorna_forn()
{ {
TSheet_field& sf = sfield(F_ERR); TSheet_field& sf = sfield(F_ERR);
static const TString newf = "fpaggf"; static const TString newf = "fpaggf";
clean_ini(newf); clean_ini(newf);
int count = 0;
FOR_EACH_SHEET_ROW(sf, nr, row) FOR_EACH_SHEET_ROW(sf, nr, row)
{ {
const TString denom = row->get(sf.cid2index(S_RAGSERR)); const TString denom = row->get(sf.cid2index(S_RAGSERR));
@ -752,6 +762,7 @@ void TPassive_mask::aggiorna_forn()
if (row->starts_with("X") && cod_forn == no_match_cf) if (row->starts_with("X") && cod_forn == no_match_cf)
{ {
count++;
TLocalisamfile clifo(LF_CLIFO); TLocalisamfile clifo(LF_CLIFO);
clifo.setkey(5); clifo.setkey(5);
clifo.put(CLI_TIPOCF, 'F'); clifo.put(CLI_TIPOCF, 'F');
@ -769,7 +780,11 @@ void TPassive_mask::aggiorna_forn()
{ {
TString num; num.format("%04d", nr); TString num; num.format("%04d", nr);
TFilename newf_ini; TFilename newf_ini;
#ifdef DBG
newf_ini << newf << num << ".ini";
#else
newf_ini.tempdir() << "\\" << newf << num << ".ini"; newf_ini.tempdir() << "\\" << newf << num << ".ini";
#endif
TConfig forn_conf(newf_ini, "Transaction"); TConfig forn_conf(newf_ini, "Transaction");
forn_conf.set("Action", "MODIFY"); forn_conf.set("Action", "MODIFY");
@ -778,13 +793,20 @@ void TPassive_mask::aggiorna_forn()
forn_conf.set("TIPOCF", "F"); forn_conf.set("TIPOCF", "F");
forn_conf.set("COFI", row->get(sf.cid2index(S_CODFIERR))); forn_conf.set("COFI", row->get(sf.cid2index(S_CODFIERR)));
forn_conf.set("CODCF", clifo.get(CLI_CODCF)); forn_conf.set("CODCF", clifo.get(CLI_CODCF));
TString codsdi; codsdi << row_elenco_fatt.get(16);
row->add("", 0); 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(); 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: case DLG_RECALC:
if (e == fe_button) if (e == fe_button)
if (curr_page() == elenco_err) if (curr_page() == elenco_err)
aggiorna_forn(); if (aggiorna_forn())
fill();
break; break;
case DLG_EXPORT: case DLG_EXPORT:
if (e == fe_button && curr_page() == elenco_fe) if (e == fe_button && curr_page() == elenco_fe)