diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index 9bbc839b9..75a6cb895 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -2318,6 +2318,7 @@ long TGrid_mask::handler(WINDOW win, EVENT* ep) class TQuery_mask : public TAutomask { TGrid_mask* _gm; + TString4 _last_tipo; protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); @@ -2337,18 +2338,23 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) if (e == fe_modify) { const TString& tipo = o.get(); - if (tipo.full()) - { - TWait_cursor hourglass; - TString query; - query << "USE " << LF_PCON << " SELECT " << PCN_TMCF << "=\"" << tipo << "\""; - TISAM_recordset conti(query); - if (conti.move_first()) - { - set(F_GRUPPO, conti.get(PCN_GRUPPO).as_int(), 0x2); - set(F_CONTO, conti.get(PCN_CONTO).as_int(), 0x2); - } - } + + if (tipo != _last_tipo) + { + _last_tipo = tipo; + if (tipo.full()) + { + TWait_cursor hourglass; + TString query; + query << "USE " << LF_PCON << " SELECT " << PCN_TMCF << "=\"" << tipo << "\""; + TISAM_recordset conti(query); + if (conti.move_first()) + { + set(F_GRUPPO, conti.get(PCN_GRUPPO).as_int(), 0x2); + set(F_CONTO, conti.get(PCN_CONTO).as_int(), 0x2); + } + } + } } break; case F_CLIENTE: @@ -2445,7 +2451,7 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) return true; } -TQuery_mask::TQuery_mask(TGrid_mask* gm) : TAutomask("cg3600a"), _gm(gm) +TQuery_mask::TQuery_mask(TGrid_mask* gm) : TAutomask("cg3600a"), _gm(gm), _last_tipo("") { } void TQuery_mask::do_query()