diff --git a/cg/cg2104.cpp b/cg/cg2104.cpp index f6c0d91b4..330ac3763 100755 --- a/cg/cg2104.cpp +++ b/cg/cg2104.cpp @@ -246,10 +246,17 @@ bool TPrimanota_application::tipopag_handler(TMask_field& f, KEY key) if ((key == K_TAB || key == K_ENTER) && f.dirty()) { TMask& m = f.mask(); - const int t = m.get_int(105); + int t = m.get_int(105); + if (t <= 0) + { + t = 1; + f.set("1"); + } const char u = m.get(106)[0]; - const TPagamento& pag = app().pagamento(); - const char* s = pag.desc_tipo(t, u); + const TPagamento& pag = app().pagamento(); + bool ok; + const char* s = pag.desc_tipo(t, u, &ok); + if (!ok) m.reset(106); m.set(107, s); } diff --git a/cg/pagament.cpp b/cg/pagament.cpp index d0beb1267..75ddaad45 100755 --- a/cg/pagament.cpp +++ b/cg/pagament.cpp @@ -744,9 +744,10 @@ const char* TPagamento::desc_tpr() const return o; } -const char* TPagamento::desc_tipo(int tipo, char ulc) const +const char* TPagamento::desc_tipo(int tipo, char ulc, bool* ok) const { - const char* o = ""; + const char* o = ""; + if (ok != NULL) *ok = TRUE; if (ulc > ' ') { const char key[] = { tipo+'0', ulc, '\0' }; @@ -754,10 +755,12 @@ const char* TPagamento::desc_tipo(int tipo, char ulc) const clr.put("CODTAB", key); const int err = clr.read(); - if (err == NOERR) - o = clr.get("S0"); + if (err == NOERR) + o = clr.get("S0"); + else if (ok != NULL) + *ok = FALSE; } - else + if (*o == '\0') { switch (tipo) { @@ -771,7 +774,7 @@ const char* TPagamento::desc_tipo(int tipo, char ulc) const case 7: o = "Tratta accettata"; break; case 8: o = "Rapporti interban. diretti"; break; case 9: o = "Bonifici"; break; - default: o = ""; break; + default: o = ""; if (ok != NULL) *ok = FALSE; break; } } return o; @@ -1322,7 +1325,7 @@ bool TPagamento::read(TTable* t, TTable* r) _int_rate = t->get_int("I3"); #ifdef USE_DEFAULT_INT_RATE - if (_int_rate == 0) _int_rate = 30; +// if (_int_rate == 0) _int_rate = 30; #endif // aggiusta _inizio secondo INSCAD; vedi mese commerciale etc. diff --git a/cg/pagament.h b/cg/pagament.h index afb37b9a3..d18e02c8f 100755 --- a/cg/pagament.h +++ b/cg/pagament.h @@ -105,7 +105,7 @@ public: const TString& name() const { return _name; } const TString& code() const { return _code; } const char* desc_tpr() const; - const char* desc_tipo(int tipo, char ulc) const; + const char* desc_tipo(int tipo, char ulc, bool* ok = NULL) const; // giorni scadenza fissi, aggiunti poi void set_fixed_scad(int a, int ind) { _fixd[ind] = a; }