diff --git a/cg/cg4300.cpp b/cg/cg4300.cpp index eb495c1b0..37fe6ce96 100755 --- a/cg/cg4300.cpp +++ b/cg/cg4300.cpp @@ -148,21 +148,30 @@ bool TLiquidazione_app::user_create() if (pnd) pnd->addstatus(1); if (is_interactive) - { - for (_nditte->first(); !_nditte->eof(); _nditte->next()) - { - if (!prefhndl->exist(_nditte_r->get_long("CODDITTA"))) - continue; - - TApplication::set_firm(_nditte_r->get_long("CODDITTA")); + { + TLocalisamfile& dt = _nditte->lfile(); + + for (dt.first(); !dt.eof(); dt.next()) + { + // no archivi + if (!prefhndl->exist(dt.get_long("CODDITTA"))) + continue; + + TApplication::set_firm(dt.get_long("CODDITTA")); + + // no parametri liquidazione + if (!look_lia()) + continue; + _n_ditte++; TToken_string* d = new TToken_string(64); // add record - d->add(_nditte_r->get("CODDITTA")); - d->add(_nditte_r->get("RAGSOC")); - d->add(look_lia() ? _lia->get("S7") : _nditte_r->get("FREQVIVA")); + d->add(dt.get("CODDITTA")); + d->add(dt.get("RAGSOC")); + d->add(_lia->get("S7")); + _nomiditte.add(d); } } @@ -176,15 +185,21 @@ bool TLiquidazione_app::user_create() { TTemp_window w(TASK_WIN); w.iconize(); - if (recalc_only) _isprint = FALSE; + if (recalc_only) + _isprint = FALSE; else printer().set_export_file(filename, is_header); + // calcola liquidazione printer().setdate(printdate); _recalc = one; TApplication::set_firm(ditta); + + if (!look_lia()) return FALSE; - _nditte->zero(); _nditte_r->put("CODDITTA", ditta); _nditte->read(); - _freqviva = (look_lia() ? _lia->get("S7") : _nditte_r->get("FREQVIVA")); + _nditte->zero(); + _nditte_r->put("CODDITTA", ditta); + _nditte->read(); + _freqviva = _lia->get("S7"); TRectype& mov = _cur->curr(); TRectype from(_cur->curr()); from.zero(); @@ -435,7 +450,8 @@ bool TLiquidazione_app::set_liquidazione() { const long firm = ((TToken_string&)_nomiditte[d]).get_long(0); if (firm == cod) - { + { + bool minchia = _ditte->checked(j); _selected.set(d, _ditte->checked(j)); break; } diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 8d05a99ee..a1ab3bacb 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -10,26 +10,30 @@ // -------------------- QUI comincia l'avventura -------------------------- bool TLiquidazione_app::recalc_all() -{ - long l; - +{ _prind = new TProgind(_selected.ones()*2, " Calcolo liquidazione... \n" " Preparazione archivi ", TRUE,TRUE,45); - for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next()) + for (int l = 0; l < _nomiditte.items(); l++) { if (_prind->iscancelled()) break; - if (_selected[l]) - { - TApplication::set_firm(_nditte->curr().get_long("CODDITTA")); + if (_selected[(long)l]) + { + TToken_string& nomeditta = (TToken_string&)_nomiditte[l]; + + _nditte->zero(); + _nditte->curr().put("CODDITTA",nomeditta.get_long(0)); + _nditte->read(); + + TApplication::set_firm(nomeditta.get_long(0)); _prind->addstatus(1); // trimestrali impropriamente selezionate per mesi intermedi - _freqviva = look_lia() ? _lia->get("S7") : _nditte->curr().get("FREQVIVA"); + _freqviva = nomeditta.get(2); if (!is_month_ok(_month)) continue; int need_refresh = FALSE; @@ -369,21 +373,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (tipomov == acquisto && intra) totintra += imposta; - // acquisti non detraibili art. 19 - if (tipodet == 9) - { - nond19_imp += imponibile; - nond19_iva += imposta; - continue; - } - // Altre cose di cui tener conto if (tipomov == acquisto && (tipocr == 1 || tipocr == 5)) // Acquisto beni per rivendita { acq_riv += imponibile; acq_riv_iva += imposta; - } + } + else if (tipomov == acquisto && tipocr == 2) // Acquisto beni ammortizzabili { @@ -491,6 +488,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) acq_pint_iva += imposta; continue; // precauzionale (in genere sono esenti IVA) } + + // acquisti non detraibili art. 19 + // possono valere per la ventilazione + if (tipodet == 9) + { + nond19_imp += imponibile; + nond19_iva += imposta; + continue; + } // ***************************************** // Fine casi particolari diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index 7ec861201..7b6119573 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -849,58 +849,51 @@ void TLiquidazione_app::set_plm(_DescrItem& d) void TLiquidazione_app::set_ptm(_DescrItem& d) { - if (d._r0.is_zero() && // acq. ammortizz. - d._r1.is_zero() && // IVA acq. ammort. - d._r2.is_zero() && // ammort. detr. 6% - d._r3.is_zero() && // IVA ammort detr. 6% - d._r4.is_zero() && // acq. beni rivendita - d._r5.is_zero() && // IVA acq. beni rivendita - d._r6.is_zero() && // acq. leasing - d._r7.is_zero() && // IVA acq. leasing - d._r8.is_zero() && // cessioni beni ammort. - d._r9.is_zero() && // IVA su cessioni ammort. - d._r10.is_zero() && // tot. esenti IVA - d._r11.is_zero() && // pro_rata - d._arr.items() == 0) - { - set_row(1,""); - set_auto_ff(TRUE); - return; - } - set_row(1,""); - set_row(2,""); - set_row(3,"ALTRI DATI RELATIVI ALLA DICHIARAZIONE@55gimponibile" - "@77gimposta@91gdetrazione"); - set_row(4,""); + bool printed = FALSE; real spgn(d._s2); real spgn_iva(d._s3); int row = 5; - if (! (d._r8.is_zero() && d._r9.is_zero())) + if (!(d._r8.is_zero() && d._r9.is_zero())) + { + printed = TRUE; set_row(row++, "Cessione beni ammortizzabili@50g%r@69g%r", &(d._r8), &(d._r9)); + } if (! (d._r4.is_zero() && d._r5.is_zero())) + { + printed = TRUE; set_row(row++, "Acquisto beni destinati alla rivendita@50g%r@69g%r", &(d._r4), &(d._r5)); + } if (! (d._r0.is_zero() && d._r1.is_zero())) + { + printed = TRUE; set_row(row++, "Acquisto beni ammortizzabili IVA detraibile@50g%r@69g%r", &(d._r0), &(d._r1)); + } if (! (spgn.is_zero() && spgn_iva.is_zero())) + { set_row(row++, "Spese generali@50g%r@69g%r", &spgn, &spgn_iva); + } if (! (d._r6.is_zero() && d._r7.is_zero())) + { + printed = TRUE; set_row(row++, "Altri beni strumentali acquisiti in leasing@50g%r@69g%r", &(d._r6), - &(d._r7)); + &(d._r7)); + } if (! (d._r2.is_zero() && d._r3.is_zero())) { + printed = TRUE; real rn = d._r2 * real(DETRAZIONE_6PERCENTO); set_row(row++, "Acquisto beni soggetti a detrazione (6%%)" "@50g%r@69g%r@86g%r", @@ -910,6 +903,7 @@ void TLiquidazione_app::set_ptm(_DescrItem& d) } if (d._f0 && !(d._r11.is_zero())) { + printed = TRUE; set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r", (const char*)(d._s0), &(d._r11)); @@ -917,11 +911,23 @@ void TLiquidazione_app::set_ptm(_DescrItem& d) // items vari per dichiarazione annuale for (int i = 0; i < d._arr.items(); i++) - { + { + printed = TRUE; _DescrItem& dd = (_DescrItem&)d._arr[i]; set_annual(dd); } + if (printed) + { + set_row(1,""); + set_row(2,""); + set_row(3,"ALTRI DATI RELATIVI ALLA DICHIARAZIONE@55gimponibile" + "@77gimposta@91gdetrazione"); + set_row(4,""); + } + else + set_row(1,""); + // form feed set_auto_ff(TRUE); }