diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 6d85016f0..324d830ef 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -181,29 +181,46 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key) } HIDDEN bool cofi_handler(TMask_field& f, KEY key) - { - if (f.to_check(key)) + bool ok = TRUE; + + TMask& m = f.mask(); + if (key == K_ENTER && !f.dirty() && !m.query_mode()) + { + ok = ((TEdit_field&)f).validate(key); + f.set_dirty(); + } + + if (ok && f.to_check(key)) { if (key == K_TAB) { - const TString s1(f.get()); - + const TString& s1 = f.get(); if (s1.not_empty()) - f.mask().set(F_TIPOPERS, isdigit(s1[0]) ? "G" : "F"); + m.set(F_TIPOPERS, isdigit(s1[0]) ? "G" : "F"); } - if (f.mask().get(F_ALLEG) != "4") - return no_dup_fis(f, key); + if (m.get(F_ALLEG) != "4") + ok = no_dup_fis(f, key); } - return TRUE; + + return ok; } HIDDEN bool paiv_handler(TMask_field& f, KEY key) - { - if (f.to_check(key) && f.mask().get(F_ALLEG) != "4") - return no_dup_iva(f, key); - return TRUE; + bool ok = TRUE; + const TMask& m = f.mask(); + + if (key == K_ENTER && !f.dirty() && !m.query_mode()) + { + ok = ((TEdit_field&)f).validate(key); + f.set_dirty(); + } + + if (ok && f.to_check(key) && m.get(F_ALLEG) != "4") + ok = no_dup_iva(f, key); + + return ok; } bool TClifo_application::tipo_handler(TMask_field& f, KEY key) @@ -404,8 +421,6 @@ int TClifo_application::read(TMask& m) { TRelation_application::read(m); - m.field(F_COFI).set_dirty(3); - m.field(F_PAIV).set_dirty(3); if (_gesven) { TToken_string riga(240); diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index 8fa7572b2..8e7ec624e 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -669,7 +669,7 @@ void TMastrino::read(const TBill& conto, const bool test_caus = !(_da_caus.blank() && _a_caus.blank()); _da_caus = dc; - _a_caus = ac.blank() ? "zzz" : ac; + _a_caus = ac.blank() ? "zzz" : ac; // Se vuota sceglie la massima causale const TDate& min_data_reg = _da_data; TDate max_data_reg; @@ -735,6 +735,8 @@ void TMastrino::read(const TBill& conto, const clock_t clock_start = clock(); #endif + TDate ultimo_giorno; // memorizza ultima data registrazione utilizzata + for (int err = rel().read(_isgteq); err == NOERR; err = rel().next()) { // Controlla di non aver superato la data limite @@ -805,9 +807,13 @@ void TMastrino::read(const TBill& conto, rmov().recno(), mov().recno(), _pdare_per, _pavere_per, data_reg); _riga.append(r); - - const long giorno = data_reg - min_data_reg + 1; - pi.setstatus(giorno); + + if (data_reg > ultimo_giorno) + { + const long giorno = data_reg - min_data_reg + 1; + pi.setstatus(giorno); + ultimo_giorno = data_reg; + } } } @@ -944,8 +950,9 @@ public: void set_fore_color(COLOR col); void set_colors(COLOR back, COLOR fore); - short get_column() const; - short get_size() const; + short get_column() const { return _xiev->v.cell_request.col_nbr; } + short get_size() const { return _xiev->v.cell_request.len; } + char* get_buffer() { return _xiev->v.cell_request.s; } TGrid_cell(XI_EVENT* xiev) : _xiev(xiev) { } virtual ~TGrid_cell() { } @@ -1802,17 +1809,6 @@ void TGrid_cell::set_colors(COLOR back, COLOR fore) _xiev->v.cell_request.color = fore; } -short TGrid_cell::get_column() const -{ - return _xiev->v.cell_request.col_nbr; -} - -short TGrid_cell::get_size() const -{ - return _xiev->v.cell_request.len; -} - - /////////////////////////////////////////////////////////// // TGrid_field /////////////////////////////////////////////////////////// @@ -2144,10 +2140,9 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) if (riga.tipo() == riga_mastrino) { const TRectype& mov = _mastrino.testata(rec); - TString80 text; + TFixed_string text(cell.get_buffer(), cell.get_size()); text = riga.data().string(); text << ' ' << mov.get(MOV_DATACOMP); - cell.set(text); } break; case 102: @@ -2169,38 +2164,36 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) else { const TRectype& rmov = _mastrino.riga(rec); - TString16 text; + TFixed_string text(cell.get_buffer(), cell.get_size()); text.format("%03d.%03d.%06ld", rmov.get_int(RMV_GRUPPO), rmov.get_int(RMV_CONTO), rmov.get_long(RMV_SOTTOCONTO)); - cell.set(text); } break; case 104: if (riga.tipo() == riga_mastrino) { const TRectype& mov = _mastrino.testata(rec); - const TString& text = mov.get(MOV_DESCR); + + TFixed_string text(cell.get_buffer(), cell.get_size()); + text = mov.get(MOV_DESCR); if (text.empty()) { const TRectype& rmov = _mastrino.riga(rec); - cell.set(rmov.get(RMV_DESCR)); + text = rmov.get(RMV_DESCR); } - else - cell.set(text); } else { const TRectype& rmov = _mastrino.riga(rec); - const TString& text = rmov.get(RMV_DESCR); + TFixed_string text(cell.get_buffer(), cell.get_size()); + text = rmov.get(RMV_DESCR); if (text.empty()) { const TBill conto(rmov); - cell.set(conto.descrizione()); + text = conto.descrizione(); } - else - cell.set(text); } break; case 105: @@ -2221,19 +2214,17 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) if (riga.tipo() == riga_mastrino) { const TRectype& mov = _mastrino.testata(rec); - TString80 text; + TFixed_string text(cell.get_buffer(), cell.get_size()); text = mov.get(MOV_NUMDOC); text.left_just(7); text << ' ' << mov.get(MOV_PROTIVA); - cell.set(text); } break; case 108: { const TRectype& rmov = _mastrino.riga(rec); - TString80 text; + TFixed_string text(cell.get_buffer(), cell.get_size()); text = rmov.get_real(RMV_IMPORTO).string("."); text << ' ' << rmov.get(RMV_SEZIONE); - cell.set(text); } break; case 109: @@ -2251,10 +2242,9 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) TImporto imp = riga.saldo(); imp += _mastrino.saldo_iniziale(); imp.normalize(); - TString80 text; + TFixed_string text(cell.get_buffer(), cell.get_size()); text = imp.valore().string("."); text << ' ' << imp.sezione(); - cell.set(text); } } break;