cg0200.cpp Corretto check finale sul codice fiscale e partita iva

cg3600.cpp    Migliorata leggermente lettura mastrini


git-svn-id: svn://10.65.10.50/trunk@4005 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-12-13 14:09:05 +00:00
parent d6ccbd7567
commit c298dc12fd
2 changed files with 54 additions and 49 deletions

View File

@ -181,29 +181,46 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
} }
HIDDEN bool cofi_handler(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) if (key == K_TAB)
{ {
const TString s1(f.get()); const TString& s1 = f.get();
if (s1.not_empty()) 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") if (m.get(F_ALLEG) != "4")
return no_dup_fis(f, key); ok = no_dup_fis(f, key);
} }
return TRUE;
return ok;
} }
HIDDEN bool paiv_handler(TMask_field& f, KEY key) HIDDEN bool paiv_handler(TMask_field& f, KEY key)
{ {
if (f.to_check(key) && f.mask().get(F_ALLEG) != "4") bool ok = TRUE;
return no_dup_iva(f, key); const TMask& m = f.mask();
return TRUE;
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) bool TClifo_application::tipo_handler(TMask_field& f, KEY key)
@ -404,8 +421,6 @@ int TClifo_application::read(TMask& m)
{ {
TRelation_application::read(m); TRelation_application::read(m);
m.field(F_COFI).set_dirty(3);
m.field(F_PAIV).set_dirty(3);
if (_gesven) if (_gesven)
{ {
TToken_string riga(240); TToken_string riga(240);

View File

@ -669,7 +669,7 @@ void TMastrino::read(const TBill& conto,
const bool test_caus = !(_da_caus.blank() && _a_caus.blank()); const bool test_caus = !(_da_caus.blank() && _a_caus.blank());
_da_caus = dc; _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; const TDate& min_data_reg = _da_data;
TDate max_data_reg; TDate max_data_reg;
@ -735,6 +735,8 @@ void TMastrino::read(const TBill& conto,
const clock_t clock_start = clock(); const clock_t clock_start = clock();
#endif #endif
TDate ultimo_giorno; // memorizza ultima data registrazione utilizzata
for (int err = rel().read(_isgteq); err == NOERR; err = rel().next()) for (int err = rel().read(_isgteq); err == NOERR; err = rel().next())
{ {
// Controlla di non aver superato la data limite // Controlla di non aver superato la data limite
@ -805,9 +807,13 @@ void TMastrino::read(const TBill& conto,
rmov().recno(), mov().recno(), rmov().recno(), mov().recno(),
_pdare_per, _pavere_per, data_reg); _pdare_per, _pavere_per, data_reg);
_riga.append(r); _riga.append(r);
const long giorno = data_reg - min_data_reg + 1; if (data_reg > ultimo_giorno)
pi.setstatus(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_fore_color(COLOR col);
void set_colors(COLOR back, COLOR fore); void set_colors(COLOR back, COLOR fore);
short get_column() const; short get_column() const { return _xiev->v.cell_request.col_nbr; }
short get_size() const; 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) { } TGrid_cell(XI_EVENT* xiev) : _xiev(xiev) { }
virtual ~TGrid_cell() { } virtual ~TGrid_cell() { }
@ -1802,17 +1809,6 @@ void TGrid_cell::set_colors(COLOR back, COLOR fore)
_xiev->v.cell_request.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 // TGrid_field
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -2144,10 +2140,9 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
if (riga.tipo() == riga_mastrino) if (riga.tipo() == riga_mastrino)
{ {
const TRectype& mov = _mastrino.testata(rec); const TRectype& mov = _mastrino.testata(rec);
TString80 text; TFixed_string text(cell.get_buffer(), cell.get_size());
text = riga.data().string(); text = riga.data().string();
text << ' ' << mov.get(MOV_DATACOMP); text << ' ' << mov.get(MOV_DATACOMP);
cell.set(text);
} }
break; break;
case 102: case 102:
@ -2169,38 +2164,36 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
else else
{ {
const TRectype& rmov = _mastrino.riga(rec); const TRectype& rmov = _mastrino.riga(rec);
TString16 text; TFixed_string text(cell.get_buffer(), cell.get_size());
text.format("%03d.%03d.%06ld", text.format("%03d.%03d.%06ld",
rmov.get_int(RMV_GRUPPO), rmov.get_int(RMV_GRUPPO),
rmov.get_int(RMV_CONTO), rmov.get_int(RMV_CONTO),
rmov.get_long(RMV_SOTTOCONTO)); rmov.get_long(RMV_SOTTOCONTO));
cell.set(text);
} }
break; break;
case 104: case 104:
if (riga.tipo() == riga_mastrino) if (riga.tipo() == riga_mastrino)
{ {
const TRectype& mov = _mastrino.testata(rec); 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()) if (text.empty())
{ {
const TRectype& rmov = _mastrino.riga(rec); const TRectype& rmov = _mastrino.riga(rec);
cell.set(rmov.get(RMV_DESCR)); text = rmov.get(RMV_DESCR);
} }
else
cell.set(text);
} }
else else
{ {
const TRectype& rmov = _mastrino.riga(rec); 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()) if (text.empty())
{ {
const TBill conto(rmov); const TBill conto(rmov);
cell.set(conto.descrizione()); text = conto.descrizione();
} }
else
cell.set(text);
} }
break; break;
case 105: case 105:
@ -2221,19 +2214,17 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
if (riga.tipo() == riga_mastrino) if (riga.tipo() == riga_mastrino)
{ {
const TRectype& mov = _mastrino.testata(rec); 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_NUMDOC); text.left_just(7);
text << ' ' << mov.get(MOV_PROTIVA); text << ' ' << mov.get(MOV_PROTIVA);
cell.set(text);
} }
break; break;
case 108: case 108:
{ {
const TRectype& rmov = _mastrino.riga(rec); 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_real(RMV_IMPORTO).string(".");
text << ' ' << rmov.get(RMV_SEZIONE); text << ' ' << rmov.get(RMV_SEZIONE);
cell.set(text);
} }
break; break;
case 109: case 109:
@ -2251,10 +2242,9 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
TImporto imp = riga.saldo(); TImporto imp = riga.saldo();
imp += _mastrino.saldo_iniziale(); imp += _mastrino.saldo_iniziale();
imp.normalize(); imp.normalize();
TString80 text; TFixed_string text(cell.get_buffer(), cell.get_size());
text = imp.valore().string("."); text = imp.valore().string(".");
text << ' ' << imp.sezione(); text << ' ' << imp.sezione();
cell.set(text);
} }
} }
break; break;