diff --git a/cg/cg0100.cpp b/cg/cg0100.cpp index 4a9d053c1..1aa1af234 100755 --- a/cg/cg0100.cpp +++ b/cg/cg0100.cpp @@ -63,14 +63,16 @@ int CG0100_application::read(TMask& m) } int CG0100_application::rewrite(const TMask& m) - { - TRelation *r = get_relation(); - - m.autosave(*r); - int sezivd = m.get_int(FLD_CM1_SEZIVD); TString16 sez; - + + TRelation *r = get_relation(); + m.autosave(*r); + + if (!m.field(FLD_CM1_CODTABANALISI).enabled()) + r->curr().zero(PCN_CODCBL); + + int sezivd = m.get_int(FLD_CM1_SEZIVD); if (sezivd == 6 || sezivd == 7) { sez.format("%d", sezivd - 5); @@ -83,6 +85,8 @@ int CG0100_application::rewrite(const TMask& m) r->lfile().put(PCN_SEZIVDOPP, sez); } const int err = r->rewrite(); + +/* Lasciamo stare i sottoconti che ci pensano da soli ad azzerare PCN_CODCBL if (err == NOERR) { const long sottoconto = m.get_long(FLD_CM1_SOTTOCONTO); @@ -112,18 +116,21 @@ int CG0100_application::rewrite(const TMask& m) } } } +*/ return err; } int CG0100_application::write(const TMask& m) - { - TRelation *r = get_relation(); TString16 sez; + TRelation *r = get_relation(); m.autosave(*r); + + if (!m.field(FLD_CM1_CODTABANALISI).enabled()) + r->curr().zero(PCN_CODCBL); + int sezivd = m.get_int(FLD_CM1_SEZIVD); - if (sezivd == 6 || sezivd == 7) { sez.format("%d", sezivd - 5); @@ -135,6 +142,7 @@ int CG0100_application::write(const TMask& m) sez.format("%d", sezivd - 5); r->lfile().put(PCN_SEZIVDOPP, sez); } + return r->write(); } @@ -220,9 +228,7 @@ HIDDEN bool tmcf_handler(TMask_field& f, KEY key) return TRUE; } - void CG0100_application::init_insert_mode(TMask& m) - { const int gruppo = atoi(m.get(FLD_CM1_GRUPPO)); const int conto = atoi(m.get(FLD_CM1_CONTO)); @@ -300,7 +306,6 @@ void CG0100_application::init_insert_mode(TMask& m) } else { - m.enable(FLD_CM1_CODTABANALISI); m.enable(FLD_CM1_DESCRANALISI); } diff --git a/cg/cg2103.cpp b/cg/cg2103.cpp index dd2221027..0ec1bb3ee 100755 --- a/cg/cg2103.cpp +++ b/cg/cg2103.cpp @@ -218,7 +218,7 @@ void TCausale::calcIVA() error_box("Tipo documento '%s' incompatibile con tipo registro", (const char*)td); i = iva_errata; } - c = tpd.get_bool("B0"); + c = tpd.get_bool("B0"); // B0 flag corrispettivi } else error_box("Tipo documento sconosciuto: '%s'", (const char*)td); }