diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 65a40813f..ea33a7294 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -1928,9 +1928,13 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query) if (numrig < 0 || !(cg.cell_disabled(numrig, 0) && cg.cell_disabled(numrig, 1))) { - TImporto import(ini.get_char(RMV_SEZIONE), real(ini.get(RMV_IMPORTO))); - if (!import.is_zero()) - import.add_to(riga, 0); // Dare/Avere 101-102 + TString4 sez = ini.get(RMV_SEZIONE); sez.strip("\""); + if (sez == "A" || sez == "D") + { + TImporto import(sez[0], real(ini.get(RMV_IMPORTO))); + if (!import.is_zero()) + import.add_to(riga, 0); // Dare/Avere 101-102 + } } if (numrig < 0 || !cg.cell_disabled(numrig, 3)) diff --git a/cg/cg4300.h b/cg/cg4300.h index 0ebb80a18..b751728c8 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -265,7 +265,6 @@ class TLiquidazione_app : public TPrint_application bool _isricacq; // ricalcolo imposte acq. riv (par. ditta) bool _isdifferita; // liquidazione differita e mese != 13 bool _isdiffacc; // liq. differita (usato per stampa registri) - bool _isagr98; // TRUE se l'anno e' > 1997 e si sta calcolando una attivita' agricola bool _recalc_only; // solo ricalcolo progressivi bool _recalc_regis; // solo ricalcolo progressivi per registri bool _calcall; // tutte le ditte nessuna esclusa diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 2ab4b9461..a849c5867 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -286,7 +286,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) _isviaggio = ndt_att.get_bool("REG74TER"); _isagricolo = ndt_att.get_bool("REGAGR"); - _isagr98 = _isagricolo && atoi(_year) >= 1998; _isvent = false; if (!_recalc_regis && tipoatt == 1 && waspla && month == 13) @@ -542,7 +541,7 @@ void TLiquidazione_app::zero_att(int month, const char* codatt) } // Azzera i progressivi per il prospetto agricolo dal 1998 - if (_isagr98) + if (_isagricolo) { for (_pia->first(); !_pia->eof(); _pia->next()) { @@ -1086,7 +1085,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (_isviaggio) { - if (tipomov == vendita && _mov->get(MOV_DATA74TER).not_empty()) + if (tipomov == vendita && _mov->get_date(MOV_DATA74TER).ok()) date = _mov->get_date(MOV_DATA74TER); if (date.year() != year_int) // Controlla anno di appartenenza, altrimenti is_date_ok potrebbe non funzionare continue; @@ -1953,24 +1952,21 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) agr_1i += agr_imp; // Nuovo regime agricolo dal 1998: si sommino per codice iva di compensazione (da reperire su PCON) - if (_isagr98) - { - TString ivacomp("00"); // Se non esiste o non si trova il conto questo e' il default (fa un poco schifo ma e' cosi') + TString ivacomp("00"); // Se non esiste o non si trova il conto questo e' il default (fa un poco schifo ma e' cosi') - if (_cur->is_first_match(-AGR_PCON1)) // Esiste il conto ? - // Bien, allora controlliamo se e' un ricavo... - if (_pcon_1_r->get_int(PCN_INDBIL) == 4) - if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ? - { - if (look_iva(_pcon_2_r->get(PCN_IVACOMP))) - ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione - } - look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste - real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna... - _pia->put("R0", pia_imp); - _pia->put("B0", true); // Seguo l'esempio dei PIM per il ricalcolo acquisti alla fine del ciclo - _pia->rewrite(); // infine scrive - } + if (_cur->is_first_match(-AGR_PCON1)) // Esiste il conto ? + // Bien, allora controlliamo se e' un ricavo... + if (_pcon_1_r->get_int(PCN_INDBIL) == 4) + if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ? + { + if (look_iva(_pcon_2_r->get(PCN_IVACOMP))) + ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione + } + look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste + real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna... + _pia->put("R0", pia_imp); + _pia->put("B0", true); // Seguo l'esempio dei PIM per il ricalcolo acquisti alla fine del ciclo + _pia->rewrite(); // infine scrive } else if (tipoagr == 2 && is_not_fs) { @@ -2495,7 +2491,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) // Ricalcola le imposte per regime agricolo dal 1998 (PIA) - if (_isagr98) + if (_isagricolo) { for (_pia->first(); !_pia->eof(); _pia->next()) { @@ -2516,7 +2512,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) } } - /* + /* rediito_ * calcola il lercio prorata * solo se liq. periodica */ @@ -2624,12 +2620,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) acquisti_iva += agr_7 * pdetr; round_al_centesimo(acquisti_iva); } - - if (_isagr98) - { - _plm->put("R13", agr_detIA); - acquisti_iva += agr_detIA; - } + + // Dal 1998 + _plm->put("R13", agr_detIA); + acquisti_iva += agr_detIA; } _plm->put("R12", _prorata.percentuale(_year)); // per comodita' in stampa diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index 4f33cd055..33d0eec34 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -105,7 +105,8 @@ int TLiquidazione_app::previous_month(int m) const if (_freqviva == "M") return m == 1 ? 1 : m - 1; else - return m == 3 ? 3 : m - 3; + //return m == 3 ? 3 : m - 3; // Cambiato il 10/11/2014 + return m <= 6 ? 3 : m >= 10 ? 9 : 6; } bool TLiquidazione_app::is_date_ok(const TDate& d, int month, int liqmonth, int year) const @@ -623,17 +624,15 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) // deve rifarsi la delega con l'ESTRAZIONE VERSAMENTI // io l'ho lasciato per rispetto del lavoro altrui - long ditta = _nditte->curr().get_long("CODDITTA"); + const long ditta = _nditte->curr().get_long("CODDITTA"); _del->zero(); (*_del_ditta) = format("%05ld", ditta); (*_del_anno) = _year; (*_del_mese) = format("%02d", month); (*_del_tipo) = format("%1d", type); - TString16 ctab = _del->get("CODTAB"); - _del->read(); - - bool ok = _del->good(); + const TString16 ctab = _del->get("CODTAB"); + bool ok = _del->read() == NOERR; if (!ok && create) { @@ -834,17 +833,19 @@ real TLiquidazione_app::credito_prec(int month) // ritorna l'appropriato credito precedente al mese in corso { real c = ZERO; + if (!(_freqviva =="M" || is_trim(month))) // Aggiunto il 10/11/2014 + return c; const bool lia_ok = look_lia(); - const bool old_age = /*atoi(_year) < 2000 ||*/ _lia->get("S9") != "NV"; + const bool credito_visibile = _lia->get("S9") != "NV"; if (is_first_month(month)) { // credito inizio anno if (lia_ok) { - // Dal 2000 se S8="NV" il credito precedente non esiste piu' - if (old_age) + // Dal 2000 se S9="NV" il credito precedente non esiste piu' + if (credito_visibile) c = _lia->get_real("R0"); } // e' positivo o 0 @@ -852,13 +853,13 @@ real TLiquidazione_app::credito_prec(int month) else { c = result_liq(previous_month(month)); - if (c.sign() < 0) - c = abs(c); + if (c < ZERO) + c = -c; else c = ZERO; - // Dal 2000 se S8="NV" il credito trasferito non esiste piu' - if (old_age) + // Dal 2000 se S9="NV" il credito trasferito non esiste piu' + if (credito_visibile) { // Nel caso di trimestrali considera dal trimestre corrispondente a // quello impostato+1. Ad es. se m == 1 considera dal I trim. (m=3) @@ -880,7 +881,7 @@ real TLiquidazione_app::credito_costo_prec(int month) // ritorna l'appropriato credito di costo precedente al mese in corso // (travel agency only) { - real c(0.0); + real c = ZERO; if (is_first_month(month) || month == 13) { // credito inizio anno diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 3d00eb7ef..1a25af71f 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -19,15 +19,10 @@ #define IS_PRORATA 0x0001 // minchietta per prospetto ventilazione -class _vDesc : public TObject +struct _vDesc : public TObject { -public: TString4 _codiva; - real _acq; - real _vnd; - real _viv; - _vDesc() {} - virtual ~_vDesc() {} + real _acq, _vnd, _viv; }; const char* const sep = @@ -91,14 +86,7 @@ void TLiquidazione_app::set_page(int file, int cnt) set_grand(d); break; case LIQACC: -/* Obsoleto - if (atoi(_year) >= 2000) - set_liqacc_2000(d); - else - set_liqacc_1999(d); - */ set_liqacc_2000(d); - break; case ACCONTO: set_acconto_p(d); @@ -282,10 +270,11 @@ void TLiquidazione_app::describe_plafond(int month, const char* codatt) void TLiquidazione_app::describe_ventilation(int month, const char* codatt) { - if (!_isvent || _isagricolo || _isviaggio) return; + if (!_isvent || _isagricolo || _isviaggio) + return; _DescrItem* d = new _DescrItem(VENTILA); - TString att(codatt); + TString16 att = codatt; look_plm(month, att); @@ -304,7 +293,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) real imponibile = _pim->get_real("R0"); real imposta = _pim->get_real("R1"); tiporeg tipomov = (tiporeg)_reg->get_long("I0"); - TString tipoiva = _iva->get("S1"); + TString4 tipoiva = _iva->get("S1"); if (_year != *_pim_anno || (month == 13 && mese < 13)) continue; @@ -389,22 +378,20 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt) { _DescrItem* d = new _DescrItem(REGAGR); - if (_isagr98) // Setta l'array interno con tutti gli items relativi alla tabella PIA + // Setta l'array interno con tutti gli items relativi alla tabella PIA + TArray& agr_array = d->_arr; + for (_pia->first(); !_pia->eof(); _pia->next()) // Scorre i progressivi agricoli { - TArray& agr_array = d->_arr; - for (_pia->first(); !_pia->eof(); _pia->next()) // Scorre i progressivi agricoli + if (strcmp((const char*)*_pia_codatt, codatt) == 0 && + is_month_plain(atoi(*_pia_mese)) && _year == *_pia_anno) // E sono gia' in ordine di codice... { - if (strcmp((const char*)*_pia_codatt, codatt) == 0 && - is_month_plain(atoi(*_pia_mese)) && _year == *_pia_anno) // E sono gia' in ordine di codice... - { - _DescrItem* p = new _DescrItem(PROGAGR); - p->_r0 = _pia->get_real("R0"); // Imponibile - p->_r1 = _pia->get_real("R1"); // Imposta - p->_s0 = *_pia_codord; // Codice iva ordinario - p->_s1 = *_pia_codcom; // Codice iva compensazione - if (p->_r0 != ZERO || p->_r1 != ZERO) - agr_array.add(p); // Aggiunge il fottuto item agricolo - } + _DescrItem* p = new _DescrItem(PROGAGR); + p->_r0 = _pia->get_real("R0"); // Imponibile + p->_r1 = _pia->get_real("R1"); // Imposta + p->_s0 = *_pia_codord; // Codice iva ordinario + p->_s1 = *_pia_codcom; // Codice iva compensazione + if (p->_r0 != ZERO || p->_r1 != ZERO) + agr_array.add(p); // Aggiunge il fottuto item agricolo } } @@ -1342,7 +1329,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) if (_stampa_vers) //solo se sono a debito if (look_del(month,month == 13 ? 2 : 1)) { - if (_del->get_bool("B0")) + if (_del->get_bool("B0")) // Stampata? { //_del->S2 descr. ufficio iva/concessione //_del->S1 descrizione banca @@ -1361,7 +1348,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) { d->_s4 = "ACC"; TToken_string t; - if (_del->get_bool("B0")) + if (_del->get_bool("B0")) // Stampata? { //_del->S2 descr. ufficio iva/concessione //_del->S1 descrizione banca @@ -2812,10 +2799,11 @@ void TLiquidazione_app::set_grand(_DescrItem& d) } // prospettino versamento else if (di._flags == DELEGA) - { + { + const bool acconto = di._s4 == "ACC"; int rr = rw; int cont = 10; - if (di._s4 == "ACC") + if (acconto) { TToken_string ac(di._s5); if (!ac.empty_items() && _stampa_vers) @@ -2829,20 +2817,17 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_bookmark(TR("Riepilogo versamenti"), _firm_bookmark); - TString dt = di._d0.string(); - TString vr; imp2string(di._r0, vr); - - if (di._s4 == "ACC") // Acconto + if (acconto) // Acconto { TToken_string ac(di._s5); if (!ac.empty_items()) { - TString dt (ac.get(4)); + TString16 dt (ac.get(4)); real app (ac.get(3)); - TString vr; imp2string(app, vr); - TString con (ac.get(0)); - TString abi (ac.get(1)); - TString cab (ac.get(2)); + TString16 vr; imp2string(app, vr); + TString4 con (ac.get(0)); + TString8 abi (ac.get(1)); + TString8 cab (ac.get(2)); set_row(rw++, TR("- ACCONTO DICEMBRE -")); set_row(rw, FR(" Versamento di %s effettuato il %s"), @@ -2858,11 +2843,12 @@ void TLiquidazione_app::set_grand(_DescrItem& d) if (_stampa_vers) { - set_row(rw, FR(" Versamento di %s effettuato il %s"), - (const char*)vr, - (const char*)dt); - set_row(rw++, FR("@68gCod Conc.: %3s"),(const char*)di._s0); - set_row(rw++, FR("@68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s"),(const char*)di._s1,(const char*)di._s2); + TString16 dt = di._d0.string(); + TString16 vr; imp2string(di._r0, vr); + set_row(rw, FR(" Versamento di %s effettuato il %s"), + (const char*)vr, (const char*)dt); + set_row(rw++, FR("@68gCod Conc.: %3s"),(const char*)di._s0); + set_row(rw++, FR("@68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s"),(const char*)di._s1,(const char*)di._s2); } } } @@ -2988,9 +2974,6 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) { set_print_zero(TRUE); - const bool is1998 = atoi(_year) >= 1998; - CHECK(is1998 == _isagr98, "Mucca pazza!"); - real& agr_1 = d._r0; real& agr_2 = d._r1; real& agr_3 = d._r2; @@ -3007,7 +2990,7 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) real ara = agr_5 + agr_6; real arn = agr_3 + agr_4; real agr_ven = agr_1 + agr_2; - real ivadt_amm = agr_3 + ivadt + (is1998 ? iva_detIA : agr_1); + real ivadt_amm = agr_3 + ivadt + iva_detIA; set_bookmark(TR("Prospetto regime agricolo"), _att_bookmark); int r = 1; @@ -3064,17 +3047,14 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) set_row(r++, ""); set_row(r++, "@56g%r", &agr_7); - riga.format(FR("Iva ammessa in detrazione sugli acquisti promiscui@%dg%%s"),xl - corr - ln/2); + riga.format(FR("IVA ammessa in detrazione sugli acquisti promiscui@%dg%%s"),xl - corr - ln/2); set_row(r++, riga, (const char*)middle); corr = dn.len() % 2 == 0 ? 0 : 1; riga.format("@%dg%%s",xl - corr - dn.len()/2); set_row(r++, riga, (const char*)dn); set_row(r++, ""); - if (is1998) - { - set_row(r++, FR("Iva ammessa in detrazione I parte tabella A@56g%r"),&iva_detIA); - set_row(r++, ""); - } + set_row(r++, FR("Iva ammessa in detrazione I parte tabella A@56g%r"),&iva_detIA); + set_row(r++, ""); set_row(r++, FR("Totale iva ammessa in detrazione@56g%r"),&ivadt_amm); // Last pain... diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 0374f9815..7b5ff518c 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -399,7 +399,7 @@ bool TLiquidazione_app::video_conferma(const real& newimp, const real& intr, _del->remove(); else { - _del->put("B0", ""); + _del->put("B0", false); _del->put("R0",newimp); _del->put("R1",intr); _del->put("R2",narr); diff --git a/cg/cg4500b.uml b/cg/cg4500b.uml index ad73a2971..c38b3ec12 100755 --- a/cg/cg4500b.uml +++ b/cg/cg4500b.uml @@ -31,9 +31,11 @@ BEGIN VALIDATE FIXLEN_FUNC 4 END -STRING F_FREQUENZA 1 +LIST F_FREQUENZA 1 16 BEGIN - PROMPT 2 5 "Frequenza versamenti (M/T) " + PROMPT 2 5 "Frequenza versamenti " + ITEM "M|Mensile" + ITEM "T|Trimestrale" FLAGS "U" HELP "Indicare la frequenza delle liquidazioni IVA per il nuovo esercizio" END diff --git a/cg/cg4501.cpp b/cg/cg4501.cpp index 4ea68a3c6..9db14ae7b 100755 --- a/cg/cg4501.cpp +++ b/cg/cg4501.cpp @@ -68,14 +68,10 @@ void TAp_iva::libro_unico() bool TAp_iva::apertura_iva() { - TString16 codlia; - - TString4 annoiva; annoiva.format("%04d", _annoiva); - //viene aggiornata la tabella LIA (liquidazione iva annuale) TTable tablia ("%LIA"); - codlia.format("%05ld%04d", get_firm(), _annoiva); + TString16 codlia; codlia.format("%05ld%04d", get_firm(), _annoiva); tablia.put ("CODTAB", codlia); if (tablia.read() == NOERR) tablia.remove(); @@ -94,7 +90,7 @@ bool TAp_iva::apertura_iva() tablia.put("B2", _is_minagr); tablia.zero("R0"); - if (tablia.get_bool("B5")) // IVA per casssa + if (tablia.get_bool("B5")) // IVA per cassa { tablia.put("D0", TDate( 1, 1, _annoiva)); tablia.put("D1", TDate(31,12, _annoiva)); @@ -109,6 +105,7 @@ bool TAp_iva::apertura_iva() TRelation reg("REG"); TRectype & tabreg = reg.curr(); + TString4 annoiva; annoiva.format("%04d", _annoiva); tabreg.put ("CODTAB", annoiva); TCursor cur_reg(®, "", 1, &tabreg, &tabreg); @@ -133,7 +130,7 @@ bool TAp_iva::apertura_iva() const int tiporeg = tabreg.get_int("I0"); if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg==3)||(tiporeg==9)) { - TString16 cod = tabreg.get("CODTAB"); + TString8 cod = tabreg.get("CODTAB"); cod.overwrite(annoiva); tabreg.put("CODTAB", cod); diff --git a/cg/cg4a00.cpp b/cg/cg4a00.cpp index 368b362d5..093d9b89d 100755 --- a/cg/cg4a00.cpp +++ b/cg/cg4a00.cpp @@ -24,24 +24,16 @@ bool cau_filter1 (const TRelation *r) if (rec.get(CAU_TIPODOC) == "ST") // Solo i tipi documento STorno { - TTable& reg = (TTable&) r->lfile("REG"); - TString16 cod; - - cod << __anno; - cod << rec.get(CAU_REG); - reg.put("CODTAB", cod); - if (reg.read() == NOERR ) + TString16 cod; cod << __anno << rec.get(CAU_REG); + const TRectype& reg = cache().get("REG", cod); + const bool b1 = reg.get_bool("B1"); + const int i9 = reg.get_int("I9"); + if (b1 && i9 <= 1) // Il registro deve avere la X di sospensione NORMALE { - const int i9 = reg.get_int("I9"); - const bool b1 = reg.get_bool("B1"); - if (i9 == 1 || i9 == 0 && b1) // Il registro deve avere la X di sospensione NORMALE - { - TLocalisamfile & rcau = r->lfile(LF_RCAUSALI); // La riga 1 (gia' posizionata nella relazione) deve essere di tipo cliente - - if (rcau.get(RCA_TIPOCF) == "C") - rt = TRUE; - } - } + cod.format("%s|1", (const char*)rec.get(CAU_CODCAUS)); + const TRectype& rcau = cache().get(LF_RCAUSALI, cod); + rt = rcau.get_char(RCA_TIPOCF) == 'C'; + } } return rt; @@ -49,18 +41,14 @@ bool cau_filter1 (const TRelation *r) bool cau_filter2 (const TRelation *r) { - bool rt = FALSE; + bool rt = false; const TRectype& rec = r->curr(LF_CAUSALI); const TString& tipo = rec.get(CAU_TIPODOC); if (tipo == "FV" || tipo == "NC") // Solo i tipi documento Fatture Vendita { - TTable& reg = (TTable&) r->lfile("REG"); - TString16 cod; - cod << __anno; - cod << rec.get(CAU_REG); - reg.put("CODTAB", cod); - if (reg.read() == NOERR) - rt = !reg.get_bool("B1"); + TString16 cod; cod << __anno << rec.get(CAU_REG); + const TRectype& reg = cache().get("REG", cod); + rt = !reg.get_bool("B1"); } return rt; @@ -140,7 +128,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id) TRectype fromrec(LF_MOV); TRectype torec(LF_MOV); TString filter; - TString16 caus; + TString4 caus; filter << "(REG==\"" << codreg << "\")"; filter << "&&((STAMPATO!=\"X\")&&(REGST!=\"X\"))"; @@ -211,12 +199,10 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon __anno = e == fe_modify ? atoi(o.get().right(4)) : 0; set(F_ANNO, __anno); - TCursor* cur1 = efield(F_CAUS).browse()->cursor(); - + TCursor* cur1 = efield(F_CAUS).browse()->cursor(); cur1->set_filterfunction(cau_filter1, TRUE); TCursor* cur2 = sfield(F_SHEET_CAUSALI).sheet_mask().efield(F_CAUDEF).browse()->cursor(); - cur2->set_filterfunction(cau_filter2, TRUE); if (e == fe_modify) @@ -350,8 +336,7 @@ void TGestAutoTrasp_mask::write_movs() for (int i=0; irun() != K_QUIT) { - if (yesno_box(TR("Procedo con la creazione dei movimenti?"))) + if (yesno_box(TR("Procedere con la creazione dei movimenti?"))) { _msk->write_movs(); _msk->reset(); diff --git a/cg/cg4a00a.uml b/cg/cg4a00a.uml index 07ad1d685..dc4fa189f 100755 --- a/cg/cg4a00a.uml +++ b/cg/cg4a00a.uml @@ -2,15 +2,7 @@ TOOLBAR "topbar" 0 0 0 2 -BUTTON DLG_OK 10 2 -BEGIN - PROMPT -12 -1 "" -END - -BUTTON DLG_QUIT 10 2 -BEGIN - PROMPT -22 -1 "" -END +#include ENDPAGE @@ -65,12 +57,14 @@ END STRING F_CODREG 3 BEGIN PROMPT 2 6 "Codice registro " - USE REG SELECT ((B1=="X")&&((I9==1)||(I9==0))) - INPUT CODTAB[1,4] F_ANNO + USE REG SELECT (B1=="X")&&(I9<=1) + INPUT CODTAB[1,4] F_ANNO SELECT INPUT CODTAB[5,7] F_CODREG DISPLAY "Anno " CODTAB[1,4] DISPLAY "Codice " CODTAB[5,7] DISPLAY "Descrizione @40" S0 + DISPLAY "Sosp.@4C" B1 + DISPLAY "Tipo Sosp.@10" I9 OUTPUT F_CODREG CODTAB[5,7] OUTPUT F_DESREG S0 FLAGS "U" @@ -100,9 +94,7 @@ STRING F_CAUS 3 BEGIN PROMPT 2 10 "Causale di storno " FLAGS "UZ" - USE LF_CAUSALI - JOIN REG INTO CODTAB==TIPODOC - JOIN LF_RCAUSALI INTO CODCAUS==CODCAUS NRIGA=="1" + USE LF_CAUSALI SELECT TIPODOC="ST" INPUT CODCAUS F_CAUS DISPLAY "Codice" CODCAUS DISPLAY "Descrizione@50" DESCR @@ -112,6 +104,7 @@ BEGIN OUTPUT F_DESCRCAUS DESCR CHECKTYPE REQUIRED WARNING "Causale indicata non completa od errata" + ADD RUN cg0 -4 END STRING F_DESCRCAUS 50 40 @@ -160,7 +153,7 @@ BEGIN PROMPT 1 4 "Caus. mov. definitivo " FLAGS "UZ" USE LF_CAUSALI - JOIN REG INTO CODTAB==TIPODOC + JOIN REG INTO CODTAB[1,4]=-#ANNO CODTAB[5,7]=REG INPUT CODCAUS F_CAUDEF DISPLAY "Codice" CODCAUS DISPLAY "Descrizione@50" DESCR @@ -170,7 +163,7 @@ BEGIN OUTPUT F_DESCAUDEF DESCR[1,15] OUTPUT F_CAUDEFREG REG CHECKTYPE NORMAL - WARNING "La causale definitiva e' obbligatoria" + WARNING "La causale definitiva è obbligatoria" END STRING F_DESCAUDEF 15 diff --git a/cg/cg5100a.uml b/cg/cg5100a.uml index 7c1f854db..05e226025 100755 --- a/cg/cg5100a.uml +++ b/cg/cg5100a.uml @@ -8,7 +8,7 @@ ENDPAGE /* page1 */ -PAGE "Parametri ditta" 0 0 0 2 +PAGE "Parametri ditta" 0 2 0 0 NUMBER FLD_ANLIIV 4 BEGIN diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index 92a6b232f..b187430c6 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -1,10 +1,7 @@ #include -#include -#include #include #include #include -#include #include #include #include @@ -55,27 +52,23 @@ void Visliq_app::set_freqviva() _freqviva = _lia->get("S7"); else { - TString key; - - key.format("%ld", get_firm()); - - const TRectype & ditta = cache().get(LF_NDITTE, key); - + const TRectype& ditta = cache().get(LF_NDITTE, get_firm()); _freqviva = ditta.get("FREQVIVA"); } } bool Visliq_app::create() { - _firm = get_firm(); - TDate oggi(TODAY); - _year = oggi.year(); open_files(LF_TABCOM, LF_TAB, LF_NDITTE, 0); + const TDate oggi(TODAY); + _year = oggi.year(); + _firm = get_firm(); + _nditte = new TRelation(LF_NDITTE); - _ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"), - HR("Cod.@5|Ragione Sociale@50|Vers.")); - _from_one = FALSE; + _ditte = new TArray_sheet(-1, -1, 76, 20, TR("Selezione Ditte"), + HR("Codice|Ragione Sociale@50|Vers.")); + _from_one = false; _del = new TTable("%DEL"); _lia = new TTable("%LIA"); _lim = new TTable("LIM"); @@ -128,7 +121,7 @@ bool Visliq_app::ch_year_handler(TMask_field& f, KEY key) app().build_ditte_sheet(); app().reset_fields(); } - return TRUE; + return true; } @@ -165,9 +158,9 @@ bool Visliq_app::select_butt(TMask& m) m.field(F_RAGSOC).set(row.get(1)); set_freqviva(row.get(2)); set_mask_freq(m); - return TRUE; + return true; } - return FALSE; + return false; } void Visliq_app::build_nomiditte() @@ -225,7 +218,7 @@ void Visliq_app::set_mask_freq(TMask& m) bool Visliq_app::sheet_action(TSheet_field& s, int r, KEY k) { if (k == K_ENTER) - app()._sh_dirty = TRUE; + app()._sh_dirty = true; // non si possono cancellare o aggiungere righe return (k != K_DEL && k != K_INS); } @@ -233,7 +226,7 @@ bool Visliq_app::sheet_action(TSheet_field& s, int r, KEY k) bool Visliq_app::vers_action(TSheet_field& s, int r, KEY k) { if (k == K_ENTER) - app()._sv_dirty = TRUE; + app()._sv_dirty = true; // non si possono cancellare o aggiungere righe return (k != K_DEL && k != K_INS); } @@ -243,7 +236,7 @@ const char* Visliq_app::link_handler(TMask& m, { // con click visualizza, con double click modifica TString st(txt); - bool iscred = FALSE; + bool iscred = false; static int group; int firstfoc = 0; @@ -288,14 +281,14 @@ void Visliq_app::main_loop() // handlers bool Visliq_app::set_ditta(TMask_field& f, KEY k) { - bool found = TRUE; + bool found = true; if (k == K_F9) return app().select_butt(f.mask()); if (k == K_TAB && f.focusdirty()) { - found = FALSE; + found = false; TString ditta = f.get(); TArray_sheet* sh = app().get_ditte_sheet(); for (int i = 0; i < sh->items(); i++) @@ -309,7 +302,7 @@ bool Visliq_app::set_ditta(TMask_field& f, KEY k) f.mask().field(F_RAGSOC).set(row.get(1)); app().set_freqviva(row.get(2)); app().set_mask_freq(f.mask()); - found = TRUE; + found = true; } else { @@ -327,14 +320,14 @@ bool Visliq_app::set_ditta(TMask_field& f, KEY k) bool Visliq_app::set_ragsoc(TMask_field& f, KEY k) { - bool found = TRUE; + bool found = true; if (k == K_F9) return app().select_butt(f.mask()); if (k == K_TAB && f.focusdirty()) { - found = FALSE; + found = false; TString ditta = f.get(); TArray_sheet* sh = app().get_ditte_sheet(); for (int i = 0; i < sh->items(); i++) @@ -349,7 +342,7 @@ bool Visliq_app::set_ragsoc(TMask_field& f, KEY k) f.mask().field(F_RAGSOC).set(row.get(1)); app().set_freqviva(row.get(2)); app().set_mask_freq(f.mask()); - found = TRUE; + found = true; break; } } @@ -362,7 +355,7 @@ bool Visliq_app::set_ragsoc(TMask_field& f, KEY k) bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k) { - if (k != K_SPACE) return TRUE; + if (k != K_SPACE) return true; TMask& m = *(app().get_main_mask()); TSheet_field& sh = m.sfield(F_VISLIQ1); @@ -370,29 +363,31 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k) int sel = sh.selected(); int month = sh.selected()+1; TToken_string& tt = sh.row(sh.selected()); - if (sh.items() == 4) month *= 3; + if (sh.items() == 4) + month *= 3; - bool ok = FALSE; + bool ok = false; //if (m.dirty() || sh.sheet_mask().dirty()) if (m.field(F_CREDPREC).dirty() || app()._sh_dirty || app()._sv_dirty) { - KEY k = yesnocancel_box(TR("Registrazione modifiche effettuate?")); + KEY k = yesnocancel_box(TR("Registrare le modifiche effettuate?")); if (k == K_YES) app().write_general(m); else if (k == K_NO) app().read_general(m); ok = (k == K_YES || k == K_NO); } - else ok = TRUE; + else + ok = true; TMask& sm = sh.sheet_mask(); if (ok) { if (sm.is_running()) sm.stop_run(K_ENTER); app().vis_one(month); - const bool new_age_2000 = (app()._year >= 2000) && (app()._lia->get("S9") == "NV"); - if (new_age_2000) + const bool non_vis_ma_comp = app()._lia->get("S9") == "NV"; + if (non_vis_ma_comp) app().read_general(m); } @@ -423,13 +418,13 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k) sv.force_update(sel == (sh.items() - 1) ? sel -1 : sel); } - return TRUE; + return true; } bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k) { - if (k != K_SPACE) return TRUE; + if (k != K_SPACE) return true; TMask& m = *(app().get_main_mask()); TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ2); @@ -439,9 +434,9 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k) month *= 3; // click su acconto - if (month > 12) return TRUE; + if (month > 12) return true; - bool ok = FALSE; + bool ok = false; //if (m.dirty()) if (m.field(F_CREDPREC).dirty() || app()._sh_dirty || app()._sv_dirty) { @@ -452,7 +447,7 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k) app().read_general(m); ok = k == K_YES || k == K_NO; } - else ok = TRUE; + else ok = true; TMask& sv = sh.sheet_mask(); if (ok) @@ -477,7 +472,7 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k) sh.force_update(sel); } - return TRUE; + return true; } @@ -509,7 +504,7 @@ void Visliq_app::vis_liq() set_firm(dtt); TIva_round ir; - ir.set_default_iva_mode(_year, FALSE); + ir.set_default_iva_mode(_year, false); const int month = m.get_int(_freqviva == "M" ? F_MONTHS : F_TRIMS); _is_annual = (month == 13); @@ -527,7 +522,7 @@ void Visliq_app::vis_liq() bool Visliq_app::vis_all() { if (!look_lia()) - return FALSE; + return false; // mask diverse per trimestrale e annuale _mask = new TMask(_freqviva == "M" ? "cg5500b" : "cg5500c"); @@ -545,8 +540,8 @@ bool Visliq_app::vis_all() sh.sheet_mask().set_handler(100,sel_mese_sh1); sv.sheet_mask().set_handler(100,sel_mese_sh2); - const bool new_age_2000 = (_year >= 2000) && (_lia->get("S9") == "NV"); - const bool new_print_2000 = _year >= 2000; + const bool new_print_2000 = true; // _year >= 2000; + const bool new_age_2000 = _lia->get("S9") == "NV"; TMask& shm = sh.sheet_mask(); for (int id = 103; shm.id2pos(id) > 0; id++) @@ -564,28 +559,27 @@ bool Visliq_app::vis_all() // fill the mask in read_general(*_mask); - for (bool stop = FALSE; !stop;) + for (bool stop = false; !stop;) { - KEY k = _mask->run(); - + KEY k = _mask->run(); switch(k) { case K_ESC: case K_QUIT: if (_mask->dirty()) { - KEY k = yesnocancel_box(TR("Registrazione modifiche effettuate?")); - + KEY k = yesnocancel_box(TR("Registrare le modifiche effettuate?")); if (k == K_YES) write_general(*_mask); else read_general(*_mask); if (k == K_YES || k == K_NO) - stop = TRUE; + stop = true; break; } - else stop = TRUE; + else + stop = true; break; case K_SAVE: // write values @@ -601,7 +595,7 @@ bool Visliq_app::vis_all() _vers_sheet = NULL; _liq_sheet = NULL; - return TRUE; + return true; } @@ -610,7 +604,7 @@ bool Visliq_app::vis_one(int m) begin_wait(); TMask msk("cg5500d"); - bool recorded = TRUE; + bool recorded = true; TString nomem(TR("Liquidazione IVA ")); nomem << itoname(m); @@ -643,12 +637,12 @@ bool Visliq_app::vis_one(int m) TExternal_app liq("cg4 -2"); end_wait(); - TProgind* pp = new TProgind(10,TR("Estrazione liquidazione: prego attendere"),FALSE,FALSE); + TProgind* pp = new TProgind(10,TR("Estrazione liquidazione: prego attendere"),false,false); liq.run(); if (liq.exitcode()) { beep(); - return FALSE; + return false; } look_lim(m); @@ -711,7 +705,7 @@ bool Visliq_app::vis_one(int m) delete pp; TViswin & vsw = brw.vis_win(); - bool is_delega = FALSE; + bool is_delega = false; real vers; TDate date; TString abi(5), cab(5), con(3); @@ -732,10 +726,10 @@ bool Visliq_app::vis_one(int m) end_wait(); - bool l_mod = FALSE; - bool d_mod = FALSE; + bool l_mod = false; + bool d_mod = false; - _from_one = TRUE; + _from_one = true; for(;;) { @@ -768,16 +762,16 @@ bool Visliq_app::vis_one(int m) if (msk.field(F_RETTIFICA).dirty() || msk.field(F_DEBCRE).dirty()) { rettifica = n_rettifica; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_ACCONTO).dirty()) { acconto = n_acconto; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_RIMBORSO).dirty()) { - bool ok = TRUE; + bool ok = true; if (!n_rimborso.is_zero()) { const bool old_rim = !rimborso.is_zero(); @@ -789,70 +783,70 @@ bool Visliq_app::vis_one(int m) if (ok) { rimborso = n_rimborso; - l_mod = TRUE; + l_mod = true; } else { msk.field(F_RIMBORSO).set(rimborso.string()); - msk.field(F_RIMBORSO).set_dirty(FALSE); + msk.field(F_RIMBORSO).set_dirty(false); } } if (msk.field(F_DESCR1).dirty()) { desc1 = n_desc1; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_DESCR2).dirty()) { desc2 = n_desc2; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_DESCR3).dirty()) { desc3 = n_desc3; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_DELDATE).dirty()) { date = n_date; - d_mod = TRUE; + d_mod = true; } if (msk.field(F_DELIMP).dirty()) { real itt = _lim->get_real("R10"); vers = n_vers; - d_mod = TRUE; + d_mod = true; } if (msk.field(F_DELABI).dirty()) { abi = n_abi; - d_mod = TRUE; + d_mod = true; } if (msk.field(F_DELCAB).dirty()) { cab = n_cab; - d_mod = TRUE; + d_mod = true; } if (msk.field(F_DELCON).dirty()) { con = n_con; - d_mod = TRUE; + d_mod = true; } if (msk.field(F_VARIMP).dirty() || msk.field(F_VARIMP_DC).dirty()) { varimp = n_varimp; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_IMPNONVER).dirty()) { impnonver = n_impnonver; - l_mod = TRUE; + l_mod = true; } if (msk.field(F_CREDSPEC).dirty()) { credspec = n_credspec; - l_mod = TRUE; + l_mod = true; } if (recorded) recorded = !(d_mod || l_mod); @@ -866,8 +860,8 @@ bool Visliq_app::vis_one(int m) { { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); } if (d_mod) { write_del(); } - l_mod = d_mod = FALSE; - recorded = TRUE; + l_mod = d_mod = false; + recorded = true; } if (k == K_QUIT) { @@ -878,8 +872,8 @@ bool Visliq_app::vis_one(int m) { if (l_mod) { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); } if (d_mod) { write_del(); } - l_mod = d_mod = FALSE; - recorded = TRUE; + l_mod = d_mod = false; + recorded = true; } if (kk == K_YES || kk == K_NO) break; @@ -924,7 +918,7 @@ HIDDEN void replace_number(TViswin* vsw, long rig, real num, int tab) else { const TCurrency c(num); - str = c.string(TRUE); + str = c.string(true); str.right_just(15); } vsw->replace(rig, str, tab); @@ -1093,25 +1087,25 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver long lvers = -1l; long line = vsw->search(TR("CALCOLO LIQUIDAZIONE D'IMPOSTA"), x); int wasdebt = ris.sign(); - long lrisd = vsw->search(TR("RISULTATO"), x, line, TRUE); // RISULTATO a debito - long lrisc = vsw->search(TR("RISULTATO"), x, lrisd+1, TRUE); // credito - long lrettc = vsw->search(TR("Rettifiche IVA a credito"),x,line,TRUE); - long lrettd = vsw->search(TR("Rettifiche IVA a debito"), x,line,TRUE); - long lacct = vsw->search(TR("Versamento acconto dicembre"),x,line,TRUE); - long lintr = vsw->search(TR("Interesse"),x,line,TRUE); - long livdv = vsw->search(TR("IVA DOVUTA"),x,line,TRUE); - long lrivr = vsw->search(TR("Versamenti effettuati"),x,line,TRUE); - long lvari = vsw->search(TR("Variazioni d'imposta"),x,line,TRUE); - long limnv = vsw->search(TR("Imposta non versata"),x,line,TRUE); - long lcicd = vsw->search(TR("Credito IVA compensabile detratto"),x,line,TRUE); - long iadoc = vsw->search(TR("IVA a debito o a credito per il periodo"),x,line,TRUE); - long lrimb = vsw->search(iadoc > 0 ? TR("Rimborsi") : TR("Iva chiesta a rimborso"),x,line,TRUE); + long lrisd = vsw->search(TR("RISULTATO"), x, line, true); // RISULTATO a debito + long lrisc = vsw->search(TR("RISULTATO"), x, lrisd+1, true); // credito + long lrettc = vsw->search(TR("Rettifiche IVA a credito"),x,line,true); + long lrettd = vsw->search(TR("Rettifiche IVA a debito"), x,line,true); + long lacct = vsw->search(TR("Versamento acconto dicembre"),x,line,true); + long lintr = vsw->search(TR("Interesse"),x,line,true); + long livdv = vsw->search(TR("IVA DOVUTA"),x,line,true); + long lrivr = vsw->search(TR("Versamenti effettuati"),x,line,true); + long lvari = vsw->search(TR("Variazioni d'imposta"),x,line,true); + long limnv = vsw->search(TR("Imposta non versata"),x,line,true); + long lcicd = vsw->search(TR("Credito IVA compensabile detratto"),x,line,true); + long iadoc = vsw->search(TR("IVA a debito o a credito per il periodo"),x,line,true); + long lrimb = vsw->search(iadoc > 0 ? TR("Rimborsi") : TR("Iva chiesta a rimborso"),x,line,true); if (wasdebt != 0) lvers = vsw->search(wasdebt < 0 ? TR("CREDITO ATTUALE") : TR("IVA DA VERSARE"), - x, line, TRUE); + x, line, true); if (lvers == -1l) - lvers = vsw->search(TR("IVA A DEBITO DA NON VERSARE"), x, line, TRUE); + lvers = vsw->search(TR("IVA A DEBITO DA NON VERSARE"), x, line, true); if (lvers == -1l) lvers = lrisc+1l; @@ -1154,7 +1148,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver vsw->replace(iadoc, " ", tab2); - iadoc = vsw->search(TR("IVA dovuta o a credito per il periodo"),x,line,TRUE); + iadoc = vsw->search(TR("IVA dovuta o a credito per il periodo"),x,line,true); v = risul + credspec; if (v < ZERO) { @@ -1168,7 +1162,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver vsw->replace(iadoc, " ", tab2); TString256 ln; - long lcrs = vsw->search(TR("Crediti speciali"),x,line,TRUE); + long lcrs = vsw->search(TR("Crediti speciali"),x,line,true); if (credspec.is_zero()) vsw->replace(lcrs, " ", 58); @@ -1177,7 +1171,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver const bool print_intr = _freqviva == "T" && intr != 0.0; const char* desc_inter = TR("Interessi dovuti per liquidazioni trimestrali"); - lintr = vsw->search(desc_inter, x, line, TRUE); + lintr = vsw->search(desc_inter, x, line, true); if (print_intr) { @@ -1198,7 +1192,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver vsw->replace(lintr, ln, 11); } - long idv = vsw->search(TR("IMPORTO DA"), x, iadoc, TRUE); + long idv = vsw->search(TR("IMPORTO DA"), x, iadoc, true); if (idv < 0) idv = iadoc+6; @@ -1222,7 +1216,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (risul.sign() < 0) // Significa che in questo momento il risultato e' a credito { TCurrency rabs(-risul); - TString16 str = rabs.string(TRUE); str.right_just(15); + TString16 str = rabs.string(true); str.right_just(15); ln.overwrite(TR("CREDITO ATTUALE"), 23); ln.overwrite(str, 58); @@ -1267,7 +1261,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver ln.overwrite(TR("IVA DA VERSARE"), 23); TCurrency rabs(risul); - TString16 str = rabs.string(TRUE); str.right_just(15); + TString16 str = rabs.string(true); str.right_just(15); ln.overwrite(str, 75); } vsw->replace(lvers, ln, 0); @@ -1427,12 +1421,12 @@ void Visliq_app::write_liq() void Visliq_app::write_del() { - bool wasdel = FALSE; + bool wasdel = false; int month = atoi(*_lim_mese); - TString abi(_lim->get("S4")); - TString cab(_lim->get("S5")); - TString con(_lim->get("S6")); + TString8 abi(_lim->get("S4")); + TString8 cab(_lim->get("S5")); + TString4 con(_lim->get("S6")); TDate date(_lim->get("D0")); real vers(_lim->get_real("R8")); real intr(_lim->get_real("R10")); @@ -1440,25 +1434,22 @@ void Visliq_app::write_del() if (vers.is_zero() && (wasdel = look_del(month,1))) { _del->remove(); - _del->rewrite(); // ??? + //_del->rewrite(); // ??? return; } if (!wasdel) - look_del(month,1,TRUE); // Crea delega + look_del(month,1,true); // Crea delega - real inter(0.0); + real inter; if (!intr.is_zero()) { // riapplica il tasso di interesse - // se trimestrale e' stato scorporato rispetto - // all'eventuale input utente - inter = vers*real(100.0)/(real(100.0)+intr); + // se trimestrale e' stato scorporato rispetto all'eventuale input utente + inter = vers*CENTO/(CENTO+intr); inter = vers - inter; inter.ceil(); - if (_year >= 2000) - round_imposta(inter); } _del->put("R0",vers); @@ -1467,8 +1458,9 @@ void Visliq_app::write_del() _del->put("S7",abi); _del->put("S8",cab); _del->put("S9",con); + _del->put("B0", true); // Preimposta flag di stampato, altrimenti viene ignorato dalla liquidazione 04-12-2014 - int ctri = _freqviva == "M" ? 6000 + month : 6030 + (month/3); + const int ctri = _freqviva == "M" ? 6000 + month : 6030 + (month/3); _del->put("S6", ctri); _del->rewrite(); @@ -1477,15 +1469,15 @@ void Visliq_app::write_del() void Visliq_app::read_general(TMask& m) { - TString abi(5); - TString cab(5); - TString cnc(5); + TString8 abi; + TString8 cab; + TString4 cnc; const int step = _freqviva == "M" ? 1 : 3; - const bool new_age_2000 = (_year >= 2000) && (_lia->get("S9") == "NV"); + const bool new_age_2000 = _lia->get("S9") == "NV"; TSheet_field& sh = m.sfield(F_VISLIQ1); TSheet_field& sv = m.sfield(F_VISLIQ2); - TMask_field & crprec = m.field(F_CREDPREC); + TMask_field& crprec = m.field(F_CREDPREC); if (new_age_2000) crprec.set_prompt(TR("Credito compensabile inizio anno ")); @@ -1495,18 +1487,14 @@ void Visliq_app::read_general(TMask& m) crprec.set(cr_res.string()); if (new_age_2000) cr_res -= _lia->get_real("R15"); - // set sheet - int i; - - for (i = step; i < 13; i+=step) + for (int i = step; i < 13; i+=step) { - int row = (i/step) - 1; - if (!is_month_ok(i)) continue; + const int row = (i/step) - 1; if (!look_lim(i)) { if (sh.items() < row) @@ -1584,29 +1572,28 @@ void Visliq_app::read_general(TMask& m) if (m <= 0) continue; versamenti[m-1] += _del->get_real("R0"); - date[m-1] = _del->get_date("D0"); - banche[m-1].add(_del->get("S7"),0); - banche[m-1].add(_del->get("S8"),1); - banche[m-1].add(_del->get("S9"),2); + date[m-1] = _del->get_date("D0"); + TToken_string& b = banche[m-1]; + b.add(_del->get("S7"),0); + b.add(_del->get("S8"),1); + b.add(_del->get("S9"),2); } // Sheet versamenti TString nomemese; sv.destroy(); - for (i = 1; i <= 13; i++) + for (int i = 1; i <= 13; i++) { if (!is_month_ok(i) && i != 13) continue; - TToken_string tt; nomemese = itoname(i == 13 ? 12 : i); - if (nomemese == "4 Trimestre") - nomemese = "4 Tr."; - + nomemese = TR("4 Tr."); if (i == 12) nomemese << TR(" acconto"); if (i == 13) nomemese << TR(" saldo"); + TToken_string tt; tt.add(nomemese,0); // mese tt.add(date[i-1].string(),1); // data vers. tt.add(banche[i-1].get(0),2); // azienda @@ -1616,11 +1603,11 @@ void Visliq_app::read_general(TMask& m) sv.row(-1) = tt; if (i == 12) - sv.enable_cell(sv.items() - 1, -1, FALSE); + sv.enable_cell(sv.items() - 1, -1, false); } - // sh.enable_column(0, FALSE); - // sv.enable_column(0, FALSE); + // sh.enable_column(0, false); + // sv.enable_column(0, false); sh.force_update(); sv.force_update(); @@ -1629,16 +1616,16 @@ void Visliq_app::read_general(TMask& m) _vers_rows = sv.rows_array(); _liq_rows = sh.rows_array(); - m.field(F_CREDPREC).set_dirty(FALSE); - m.field(F_VISLIQ1).set_dirty(_sh_dirty=FALSE); - m.field(F_VISLIQ2).set_dirty(_sv_dirty=FALSE); + m.field(F_CREDPREC).set_dirty(false); + m.field(F_VISLIQ1).set_dirty(_sh_dirty=false); + m.field(F_VISLIQ2).set_dirty(_sv_dirty=false); } void Visliq_app::write_general(TMask& m) { - TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1); - TSheet_field& sv = (TSheet_field&)m.field(F_VISLIQ2); - const bool new_age_2000 = (_year >= 2000) && (_lia->get("S9") == "NV"); + TSheet_field& sh = m.sfield(F_VISLIQ1); + TSheet_field& sv = m.sfield(F_VISLIQ2); + const bool new_age_2000 = _lia->get("S9") == "NV"; if (m.field(F_CREDPREC).dirty()) { @@ -1660,7 +1647,7 @@ void Visliq_app::write_general(TMask& m) // indicatore ricalcolo crediti e debiti OK int step = _freqviva == "M" ? 1 : 3; - bool carry = TRUE; + bool carry = true; bool was_lim; TMask& shm = sh.sheet_mask(); TMask& svm = sv.sheet_mask(); @@ -1705,10 +1692,10 @@ void Visliq_app::write_general(TMask& m) TDate ndate(tt_vn.get(1)); TString odbcr(tt_lo.get(5)); TString ndbcr(tt_ln.get(5)); - TString oabi (tt_vo.get(2)); - TString nabi (tt_vn.get(2)); - TString ocab (tt_vo.get(3)); - TString ncab (tt_vn.get(3)); + TString8 oabi (tt_vo.get(2)); + TString8 nabi (tt_vn.get(2)); + TString8 ocab (tt_vo.get(3)); + TString8 ncab (tt_vn.get(3)); TString ocon (tt_vo.get(4)); TString ncon (tt_vn.get(4)); TString descr(tt_ln.get(9)); @@ -1723,22 +1710,22 @@ void Visliq_app::write_general(TMask& m) real nacct (vn.get(5)); TDate aodate(vo.get(1)); TDate andate(vn.get(1)); - TString aoabi (vo.get(2)); - TString anabi (vn.get(2)); - TString aocab (vo.get(3)); - TString ancab (vn.get(3)); + TString8 aoabi (vo.get(2)); + TString8 anabi (vn.get(2)); + TString8 aocab (vo.get(3)); + TString8 ancab (vn.get(3)); TString aocon (vo.get(4)); TString ancon (vn.get(4)); was_lim = look_lim(i); if (!was_lim) - carry = FALSE; // blocca riporto crediti e debiti + carry = false; // blocca riporto crediti e debiti // ricalcola crediti e debiti se non ci sono // liquidazioni non calcolate in mezzo if (carry) { - bool rt_mod = FALSE, rm_mod = FALSE, vr_mod = FALSE; + bool rt_mod = false, rm_mod = false, vr_mod = false; real risl = _lim->get_real("R0"); real vers = _lim->get_real("R8"); @@ -1749,7 +1736,7 @@ void Visliq_app::write_general(TMask& m) // e crea/aggiorna la delega if (i == 12) { - bool ac_mod = FALSE; + bool ac_mod = false; if (oacct != nacct) { risc -= oacct; @@ -1757,14 +1744,14 @@ void Visliq_app::write_general(TMask& m) risl += oacct; risl -= nacct; _lim->put("R11", nacct); - ac_mod = TRUE; + ac_mod = true; } if (ndate != odate || anabi != aoabi || ancab != aocab || ancon != aocon) - ac_mod = TRUE; + ac_mod = true; // write delega acconto if (ac_mod) { - look_del(12,7,TRUE); + look_del(12,7,true); _del->put("R0",nacct); _del->put("R1",""); _del->put("S7",anabi); @@ -1778,11 +1765,9 @@ void Visliq_app::write_general(TMask& m) // ricalcola versamenti se occorre // e crea/aggiorna le deleghe if (nvers != overs) - { - vr_mod = TRUE; - } - if (vr_mod || ndate != odate || nabi != oabi || - ncab != ocab || ncon != ocon) + vr_mod = true; + + if (vr_mod || ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon) { _lim->put("R8", nvers); _lim->put("D0", ndate); @@ -1790,7 +1775,7 @@ void Visliq_app::write_general(TMask& m) _lim->put("S5", ncab); _lim->put("S6", ncon); write_del(); - vr_mod = TRUE; + vr_mod = true; } // se modificate rettifiche @@ -1859,16 +1844,14 @@ void Visliq_app::write_general(TMask& m) if (nrimb != orimb && !_from_one) { // check compatibilità - bool ok = TRUE; + bool ok = true; if (!nrimb.is_zero()) { if (risc <= risd) - ok = yesno_box(FR("Il risultato IVA non evidenzia crediti nel mese %d. Si conferma " - " il rimborso?"), i); + ok = yesno_box(FR("Il risultato IVA non evidenzia crediti nel mese %d. Si conferma il rimborso?"), i); if (!_lim->get_bool("B2") && ok) - ok = yesno_box(FR("Non risulta diritto al rimborso per il mese %d. Si conferma" - " il rimborso?"), i); + ok = yesno_box(FR("Non risulta diritto al rimborso per il mese %d. Si conferma il rimborso?"), i); } if (ok) @@ -1920,7 +1903,7 @@ void Visliq_app::write_general(TMask& m) else { // salva i valori modificati senza fare controlli - // e rimetti a lui i suoi debiti mettendo B0 a FALSE + // e rimetti a lui i suoi debiti mettendo B0 a false if (was_lim) { if (orett != nrett) @@ -1952,7 +1935,7 @@ void Visliq_app::write_general(TMask& m) // sh.force_update(row); } - _from_one = FALSE; + _from_one = false; } // for mese liq. (riga sheet) sh.force_update(); @@ -1962,10 +1945,10 @@ void Visliq_app::write_general(TMask& m) set_vers_rows(sv); set_liq_rows(sh); - // m.dirty() deve ritornare FALSE - m.field(F_CREDPREC).set_dirty(FALSE); - m.field(F_VISLIQ1).set_dirty(_sh_dirty=FALSE); - m.field(F_VISLIQ2).set_dirty(_sv_dirty=FALSE); + // m.dirty() deve ritornare false + m.field(F_CREDPREC).set_dirty(false); + m.field(F_VISLIQ1).set_dirty(_sh_dirty=false); + m.field(F_VISLIQ2).set_dirty(_sv_dirty=false); } diff --git a/cg/cg5500b.uml b/cg/cg5500b.uml index 06c234b6c..f283e9d09 100755 --- a/cg/cg5500b.uml +++ b/cg/cg5500b.uml @@ -9,16 +9,7 @@ PICTURE TOOL_SAVEREC MESSAGE EXIT,K_SAVE END -BUTTON DLG_CANCEL 10 2 -BEGIN -PROMPT -23 -1 "" -END - -BUTTON DLG_QUIT 10 2 -BEGIN -PROMPT -33 -1 "" -MESSAGE EXIT,K_QUIT -END +#include ENDPAGE @@ -51,9 +42,9 @@ BEGIN PROMPT 1 5 "Credito compensabile inizio anno " END -SPREADSHEET F_VISLIQ1 78 +SPREADSHEET F_VISLIQ1 -2 -1 BEGIN - PROMPT 1 7 "Liquidazione" + PROMPT 0 7 "Liquidazione" ITEM "Mese@10" ITEM "Risultato@15" ITEM "D/C@3" @@ -63,7 +54,7 @@ BEGIN ITEM "Credito\nutilizzato IVA@15" ITEM "Credito\nutilizzato F24@15" ITEM "Credito IVA\nresiduo@15" - ITEM "Descrizione@35" + ITEM "Descrizione@50" END ENDPAGE diff --git a/cg/cg5500d.uml b/cg/cg5500d.uml index 0ded82539..6afc1f403 100755 --- a/cg/cg5500d.uml +++ b/cg/cg5500d.uml @@ -60,9 +60,9 @@ BEGIN ITEM "13|Annuale" END -BROWSEFILE F_VISFLQ 78 10 +BROWSEFILE F_VISFLQ -3 -1 BEGIN - PROMPT 1 4 "" + PROMPT 0 4 "" END /* gruppo 1: edit rimborso */ diff --git a/cg/cg5501.cpp b/cg/cg5501.cpp index 6ffe9b373..3a0d33c20 100755 --- a/cg/cg5501.cpp +++ b/cg/cg5501.cpp @@ -1,4 +1,5 @@ #include "cg5500.h" + #include bool Visliq_app::look_lim(int m) diff --git a/cg/cg6900.cpp b/cg/cg6900.cpp index 84ff714a1..e3e1b3ccd 100755 --- a/cg/cg6900.cpp +++ b/cg/cg6900.cpp @@ -154,7 +154,7 @@ void TInv_cont::main_loop() TString data (msk->get(F_DATALIM)); if (_scelta == 'S') { - app = riconverti_data(data,FALSE); + app = riconverti_data(data,false); str.format("%03d%6s", num, (const char*) app); aggiorna_marker(str,14); } @@ -195,8 +195,8 @@ void TInv_cont::main_loop() TFilename floppy,percorso; int num_disk; - bool ok = FALSE; - bool abbandona = FALSE; + bool ok = false; + bool abbandona = false; do { k = mask->run(); @@ -256,8 +256,8 @@ void TInv_cont::main_loop() if (!continua) return; // Nel caso in cui l'utente decida di annullare l'operazione - setta_tabella_studio(*msk,FALSE); //Aggiorna la tabella studio per invio - setta_tabella_ditta(*msk," ",FALSE); //Aggiorna la tabella ditta per invio + setta_tabella_studio(*msk,false); //Aggiorna la tabella studio per invio + setta_tabella_ditta(*msk," ",false); //Aggiorna la tabella ditta per invio setta_parametri_record(" "); //Aggiorna parametri contabili ditta _tras_file.open(_header); @@ -293,8 +293,8 @@ void TInv_cont::main_loop() TFilename floppy,percorso; int num_disk; - bool ok = FALSE; - bool abbandona = FALSE; + bool ok = false; + bool abbandona = false; do { k = mask->run(); @@ -352,8 +352,8 @@ void TInv_cont::main_loop() if (!continua) return; // Nel caso in cui l'utente decida di annullare l'operazione - setta_tabella_studio(*msk,FALSE); //Aggiorna la tabella studio per invio - setta_tabella_ditta(*msk," ",FALSE); //Aggiorna la tabella ditta per invio + setta_tabella_studio(*msk,false); //Aggiorna la tabella studio per invio + setta_tabella_ditta(*msk," ",false); //Aggiorna la tabella ditta per invio setta_parametri_record(" "); //Aggiorna parametri contabili ditta _tras_file.open(_header); @@ -374,7 +374,7 @@ void TInv_cont::main_loop() delete mask; } - _tras_file.remove_all(FALSE); + _tras_file.remove_all(false); ::remove(_marker); _trasf = ""; _trasf = firm2dir(0); @@ -586,13 +586,13 @@ bool TInv_cont::leggi_header() { _control_rec = _tras_file.record(); if (!record_controllo()) - return FALSE; + return false; } else - return FALSE; + return false; } else - return FALSE; + return false; return TRUE; } @@ -602,7 +602,7 @@ bool TInv_cont::record_controllo() const /* TString tiporecord = _control_rec.sub(0,2); if (tiporecord != " 1") - return FALSE; + return false; return TRUE; */ const TString& tiporecord = _control_rec.sub(0,2); @@ -649,19 +649,19 @@ bool TInv_cont::sub_controlli() if (_ditta == ditta_trasfer) { if (!prefix().exist(_ditta)) - return FALSE; + return false; if (!tabella_ditta()) - return FALSE; + return false; } else - return FALSE; + return false; if (!controlla_stato_invio()) - return FALSE; + return false; if (!numero_data()) - return FALSE; + return false; return TRUE; } @@ -722,7 +722,7 @@ bool TInv_cont::tabella_ditta() return TRUE; } - return FALSE; + return false; } bool TInv_cont::controlla_stato_invio() @@ -733,13 +733,13 @@ bool TInv_cont::controlla_stato_invio() _std = conf.get("FlStInv"); if (_stato != _std) - return FALSE; + return false; else { TString uselab = _tras_file.ult_file(); if (_stato == "D" && uselab != "") - return FALSE; + return false; } return TRUE; @@ -752,7 +752,7 @@ bool TInv_cont::numero_data() TDate data (str); if (_num != num || data != _data) - return FALSE; + return false; return TRUE; } @@ -966,7 +966,7 @@ void TInv_cont::crea_record_controllo(TMask& m) _tras_file.open(_header); else { - _tras_file.open(_header, true); //Metto il parametro TRUE (che di default e' FALSE), perche' voglio creare un file che non e' ancore esistente + _tras_file.open(_header, true); //Metto il parametro TRUE (che di default e' false), perche' voglio creare un file che non e' ancore esistente buffer.spaces(); buffer.overwrite(" 1",0); //Tipo record @@ -1061,7 +1061,7 @@ bool TInv_cont::invio_tempfile(TMask& m) _tras_file.write_control_rec(_control_rec,1024); _tras_file.close(); - setta_tabella_ditta(m,"D",FALSE); + setta_tabella_ditta(m,"D",false); setta_parametri_record("D"); return TRUE; @@ -1142,7 +1142,7 @@ void TInv_cont::causali2tempfile(TString& key, TMask& m) _tras_file.write_control_rec(_control_rec,size); _tras_file.close(); -// setta_tabella_ditta(m,"D",FALSE); +// setta_tabella_ditta(m,"D",false); // setta_parametri_record("D"); } @@ -1195,7 +1195,7 @@ void TInv_cont::clifo2tempfile(TString& key, TMask& m) _tras_file.open(_header); long items = _clifo->items(); - _prog = new TProgind(items,"Invio Clienti / Fornitori in corso... Prego attendere.",FALSE); + _prog = new TProgind(items,"Invio Clienti / Fornitori in corso... Prego attendere.",false); _clifo->setkey(1); @@ -1264,7 +1264,7 @@ void TInv_cont::clifo2tempfile(TString& key, TMask& m) _tras_file.write_control_rec(_control_rec,size); _tras_file.close(); -// setta_tabella_ditta(m,"D",FALSE); +// setta_tabella_ditta(m,"D",false); // setta_parametri_record(m,"D"); } @@ -1276,7 +1276,7 @@ void TInv_cont::pcon2tempfile(TString& key, TMask& m) _tras_file.open(_header); long items = _pcon->items(); - _prog = new TProgind(items,"Invio Piano dei Conti in corso... Prego attendere.",FALSE); + _prog = new TProgind(items,"Invio Piano dei Conti in corso... Prego attendere.",false); _pcon->setkey(1); @@ -1351,7 +1351,7 @@ void TInv_cont::pcon2tempfile(TString& key, TMask& m) _tras_file.write_control_rec(_control_rec,size); _tras_file.close(); -// setta_tabella_ditta(m,"D",FALSE); +// setta_tabella_ditta(m,"D",false); // setta_parametri_record(m,"D"); } @@ -1396,7 +1396,7 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m) _tras_file.open(_header); long items = _mov->items(); - _prog = new TProgind(items,"Invio movimenti di Primanota in corso... Prego attendere.",FALSE); + _prog = new TProgind(items,"Invio movimenti di Primanota in corso... Prego attendere.",false); _mov->setkey(1); @@ -1477,7 +1477,7 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m) _tras_file.write_control_rec(_control_rec,size); _tras_file.close(); -// setta_tabella_ditta(m,"D",FALSE); +// setta_tabella_ditta(m,"D",false); // setta_parametri_record(m,"D"); } @@ -1522,7 +1522,7 @@ void TInv_cont::movIVA2tempfile(const TString& key, TMask& m) _tras_file.open(_header); const long items = _rmoviva->items(); - _prog = new TProgind(items, TR("Invio movimenti Iva"), FALSE); + _prog = new TProgind(items, TR("Invio movimenti Iva"), false); _rmoviva->setkey(1); @@ -1623,7 +1623,7 @@ void TInv_cont::movIVA2tempfile(const TString& key, TMask& m) _tras_file.write_control_rec(_control_rec,size); _tras_file.close(); -// setta_tabella_ditta(m,"D",FALSE); +// setta_tabella_ditta(m,"D",false); // setta_parametri_record(m,"D"); } @@ -1654,7 +1654,7 @@ void TInv_cont::movSC2tempfile(TString& key, TMask& m) _tras_file.open(_header); const long items = _part->items(); - _prog = new TProgind(items, TR("Invio movimenti di Saldaconto."), FALSE); + _prog = new TProgind(items, TR("Invio movimenti di Saldaconto."), false); _part->setkey(1); diff --git a/cg/cgmenu.men b/cg/cgmenu.men index beae6b69e..3ed57028b 100755 --- a/cg/cgmenu.men +++ b/cg/cgmenu.men @@ -11,7 +11,6 @@ Item_05 = "Stampa tabelle studio", [CGMENU_006] Item_06 = "Scelta contabilità", [CGMENU_013] Item_07 = "IVA", [CGMENU_010] Item_08 = "Parametri di studio", "cg5 -0", "" -Item_09 = "Gestione Libro Unico", [CGMENU_014] Item_10 = "Invio", [CGMENU_019] Item_11 = "Ricezione", [CGMENU_020] Item_12 = "Trasferimenti di contabilità", @@ -152,18 +151,6 @@ Item_04 = "Gestione versamenti F24", Item_05 = "Operazioni di inizio fine es.", [CGMENU_021] Item_06 = "Servizio", [CGMENU_016] -[CGMENU_014] -Caption = "Gestione libro unico" -Picture = -Module = 7 -Flags = "" -Item_01 = "Gestione libro unico", "ba3 -0 %lbu", "" -Item_02 = "Gestione indici libro unico", "ba3 -8", "" -Item_03 = "Tabella vidimazioni", "ba3 -0 %vid", "" -Item_04 = "Stampa indici libro unico", "ba3 -5", "" -Item_05 = "Stampa indici libro unico per ditta", "ba3 -5 A", "" -Item_06 = "Ripristino indici libro unico", "cg5 -4 inl", "F" - [CGMENU_016] Caption = "Servizi" Picture =