Correzioni su reverse charge e note di credito IVA per cassa
Gestione fatture a zero git-svn-id: svn://10.65.10.50/branches/R_10_00@23136 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
512c28b8a1
commit
88467f8086
@ -167,7 +167,7 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
|
||||
|
||||
if (clifo.good() && (t1 != t || s1 != s))
|
||||
{
|
||||
f.message_box(FR("Codice fiscale gia' utilizzato per il codice %c/%ld"),
|
||||
f.message_box(FR("Codice fiscale già utilizzato per il codice %c/%ld"),
|
||||
t, s);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
|
||||
TPrimanota_application::TPrimanota_application()
|
||||
: _rel(NULL), _mode(0), _iva(nessuna_iva), _causale(NULL), _giornale(NULL),
|
||||
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(NULL), _swap_mask(false)
|
||||
_lastreg(0), _automatico(NULL), _swap_mask(false)
|
||||
{
|
||||
memset(_msk, 0, sizeof(_msk));
|
||||
}
|
||||
@ -665,6 +665,17 @@ void TPrimanota_application::init_query_mode(TMask& m)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_last_dreg.ok())
|
||||
{
|
||||
_last_dreg = TDate(TODAY);
|
||||
TLocalisamfile mov(LF_MOV); mov.setkey(2);
|
||||
if (mov.last() == NOERR)
|
||||
{
|
||||
const TDate dr = mov.get(MOV_DATAREG);
|
||||
if (dr.year() < _last_dreg.year())
|
||||
_last_dreg = dr;
|
||||
}
|
||||
}
|
||||
m.set(F_DATAREG, _last_dreg);
|
||||
}
|
||||
|
||||
|
117
cg/cg2102.cpp
117
cg/cg2102.cpp
@ -87,23 +87,26 @@ real TPrimanota_application::totale_documento()
|
||||
const TMask& m = curr_mask();
|
||||
|
||||
real tot = m.get(F_TOTALE); // Legge totale
|
||||
|
||||
const real ritfis = m.get(F_RITFIS);
|
||||
tot += ritfis; // Somma ritenute fiscali
|
||||
tot += ritfis; // Somma ritenute fiscali
|
||||
|
||||
const real ritsoc = m.get(F_RITSOC);
|
||||
const real revcha = m.efield(F_REVCHARGE).active() ? m.get_real(F_REVCHARGE) : ZERO;
|
||||
|
||||
const bool swapt = test_swap(false); // Totale invertito ?
|
||||
const bool swaps = test_swap(true); // Ritenute sociali invertite ?
|
||||
if (swapt ^ swaps) // Somma ritenute sociali con segno
|
||||
TEdit_field& rc = m.efield(F_REVCHARGE);
|
||||
if (rc.active())
|
||||
{
|
||||
tot -= ritsoc;
|
||||
tot -= revcha;
|
||||
const real revcha = rc.get();
|
||||
tot += revcha; // Somma eventuale reverse charge
|
||||
}
|
||||
else
|
||||
|
||||
const real ritsoc = m.get(F_RITSOC);
|
||||
if (!ritsoc.is_zero())
|
||||
{
|
||||
tot += ritsoc;
|
||||
tot += revcha;
|
||||
const bool swapt = test_swap(false); // Totale invertito ?
|
||||
const bool swaps = test_swap(true); // Ritenute sociali invertite ?
|
||||
if (swapt ^ swaps) // Somma ritenute sociali con segno
|
||||
tot -= ritsoc;
|
||||
else
|
||||
tot += ritsoc;
|
||||
}
|
||||
|
||||
return tot;
|
||||
@ -226,21 +229,23 @@ void TPrimanota_application::set_cgs_imp(int n, const TImporto& imp)
|
||||
// Certified 100%
|
||||
TImporto TPrimanota_application::get_cgs_imp(int n) const
|
||||
{
|
||||
TSheet_field& s = cgs();
|
||||
|
||||
TImporto importo;
|
||||
|
||||
const TMask& m = s.sheet_mask();
|
||||
if (m.is_running() && s.selected() == n)
|
||||
|
||||
TSheet_field& s = cgs();
|
||||
if (n >= 0 && n < s.items())
|
||||
{
|
||||
const TString& imp = m.get(CG_DARE);
|
||||
if (imp.not_empty())
|
||||
importo.set('D', real(imp));
|
||||
else
|
||||
importo.set('A', real(m.get(CG_AVERE)));
|
||||
const TMask& m = s.sheet_mask();
|
||||
if (m.is_running() && s.selected() == n)
|
||||
{
|
||||
const TString& imp = m.get(CG_DARE);
|
||||
if (imp.not_empty())
|
||||
importo.set('D', real(imp));
|
||||
else
|
||||
importo.set('A', real(m.get(CG_AVERE)));
|
||||
}
|
||||
else
|
||||
importo = s.row(n);
|
||||
}
|
||||
else
|
||||
importo = s.row(n);
|
||||
|
||||
return importo;
|
||||
}
|
||||
@ -452,21 +457,30 @@ void TPrimanota_application::cgs_pack()
|
||||
|
||||
rowtypes_present |= (rt > ' ');
|
||||
|
||||
if (can_remove(r))
|
||||
bool kill = can_remove(r);
|
||||
if (kill)
|
||||
{
|
||||
bool ok = true;
|
||||
if (pagamento && rt == 'K')
|
||||
if (pagamento)
|
||||
{
|
||||
ok = !partite().utilizzata(numreg, i+1);
|
||||
if (ok)
|
||||
cg_notify(s, i, K_DEL);
|
||||
}
|
||||
if (ok)
|
||||
if (rt == 'K')
|
||||
{
|
||||
kill = !partite().utilizzata(numreg, i+1);
|
||||
if (kill)
|
||||
cg_notify(s, i, K_DEL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non eliminare lre righe cliente delle fatture a zero
|
||||
if (rt == 'T' && r.get_char(2)>='C' && curr_mask().get_real(F_TOTALE).is_zero())
|
||||
kill = false;
|
||||
}
|
||||
if (kill)
|
||||
rows.destroy(i, true);
|
||||
}
|
||||
}
|
||||
if (!pagamento && rowtypes_present) // Il pagamento e' gia' ordinato
|
||||
rows.TArray::sort(compare_rows, &app()); // Pack and sort array
|
||||
if (!pagamento && rowtypes_present) // Il pagamento e' gia' ordinato
|
||||
rows.TArray::sort(compare_rows, this); // Pack and sort array
|
||||
}
|
||||
|
||||
|
||||
@ -611,19 +625,20 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
for (int i = 0; i < cg.items(); i++)
|
||||
{
|
||||
TToken_string& r = cg.row(i);
|
||||
const char tipo = row_type(r);
|
||||
TImporto importo; importo = r;
|
||||
|
||||
if (!importo.is_zero())
|
||||
{
|
||||
TBill c(r, 2, 0x1);
|
||||
if (!c.ok())
|
||||
return f.error_box(FR("Il conto della riga %d non e' completo"), i+1);
|
||||
return f.error_box(FR("Il conto della riga %d non è completo"), i+1);
|
||||
if (m.insert_mode() && c.sospeso())
|
||||
return f.error_box(FR("Il conto della riga %d e' sospeso"), i+1);
|
||||
return f.error_box(FR("Il conto della riga %d è sospeso"), i+1);
|
||||
TBill co(r, 10, 0x0);
|
||||
if (!co.empty() && !co.ok())
|
||||
{
|
||||
const bool ok = f.yesno_box(FR("La contropartita della riga %d non e' completa:\n"
|
||||
const bool ok = f.yesno_box(FR("La contropartita della riga %d non è completa:\n"
|
||||
"Si desidera continuare ugualmente?"), i+1);
|
||||
if (!ok) return false;
|
||||
}
|
||||
@ -640,7 +655,6 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
empty = false;
|
||||
if (paga || nota)
|
||||
{
|
||||
const char tipo = row_type(r);
|
||||
if (tipo == 'K' || tipo == 'T' || a._as400)
|
||||
{
|
||||
const int currig = i+1;
|
||||
@ -700,12 +714,20 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tipo == 'T' && a.is_fattura())
|
||||
{
|
||||
const TBill c(r, 2, 0x1);
|
||||
if (c.tipo() >= 'C') // Riga cliente/fornitore
|
||||
empty = false; // Permetto movimenti a ZERO con IVA assente
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty)
|
||||
return f.error_box(TR("Il movimento non ha nessuna riga contabile con un importo"));
|
||||
return f.error_box(TR("Il movimento non ha righe contabili con un importo"));
|
||||
|
||||
if ((paga || nota) && !a._as400)
|
||||
{
|
||||
@ -2245,11 +2267,12 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
|
||||
return false;
|
||||
|
||||
bool init_provv_rev = false;
|
||||
bool mask_ok = true;
|
||||
|
||||
TPrimanota_application& a = app();
|
||||
const TCausale& k = a.causale();
|
||||
const TString& msg = c.compatible(k);
|
||||
if (msg.not_empty()) // La causale non e' compatibile
|
||||
if (msg.not_empty()) // La causale non è compatibile
|
||||
{
|
||||
if (m.insert_mode() && !a._sal_dirty)
|
||||
{
|
||||
@ -2259,19 +2282,21 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
if (!init_provv_rev)
|
||||
return error_box(msg);
|
||||
mask_ok = a._msk[c.iva() == nessuna_iva ? 1 : 2] != NULL;
|
||||
}
|
||||
|
||||
if (key == K_TAB)
|
||||
{
|
||||
a.read_caus(cau, ann);
|
||||
a.cgs().force_update();
|
||||
if (mask_ok) // Non tentare di aggiornare sheet al momento inesistente essendo la causale incompatibile
|
||||
a.cgs().force_update();
|
||||
}
|
||||
|
||||
if (init_provv_rev)
|
||||
{
|
||||
TString4 provv; provv << c.provvisorio();
|
||||
m.set(F_PROVVISORIO, provv);
|
||||
if (c.iva() != nessuna_iva)
|
||||
if (c.iva() != nessuna_iva && mask_ok)
|
||||
{
|
||||
m.set(F_SOLAIVA, c.soloiva() ? "X" : " ");
|
||||
m.efield(F_REVCHARGE).show(c.iva() == iva_acquisti && c.reverse_charge());
|
||||
@ -3025,7 +3050,7 @@ static void force_iva_det_bill()
|
||||
|
||||
TToken_string conto(contoiva.string(0x3));
|
||||
const TString80 descragg(cau.desc_agg(ri));
|
||||
const int rowtype = cgs.cid2index(CG_ROWTYPE);
|
||||
const int rt = cgs.cid2index(CG_ROWTYPE);
|
||||
const int tp = cgs.cid2index(CG_TIPO);
|
||||
const int gr = cgs.cid2index(CG_GRUPPO);
|
||||
const int co = cgs.cid2index(CG_CONTO);
|
||||
@ -3034,8 +3059,8 @@ static void force_iva_det_bill()
|
||||
|
||||
FOR_EACH_SHEET_ROW(cgs, r, row)
|
||||
{
|
||||
const TString4 type(row->get(rowtype));
|
||||
if (type == "D")
|
||||
const char rtype = row->get_char(rt);
|
||||
if (rtype == 'D')
|
||||
{
|
||||
row->add(conto.get(0), tp);
|
||||
row->add(conto.get(), gr);
|
||||
|
@ -211,9 +211,9 @@ protected:
|
||||
bool npart_is_prot() const { return _npart_is_prot; }
|
||||
|
||||
bool is_saldaconto() const { return _is_saldaconto; }
|
||||
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == 1; }
|
||||
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == 2; }
|
||||
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= 3; }
|
||||
bool is_fattura() const { return is_saldaconto() && causale().tipomov() == tm_fattura; }
|
||||
bool is_nota_credito() const { return is_saldaconto() && causale().tipomov() == tm_nota_credito; }
|
||||
bool is_pagamento() const { return is_saldaconto() && causale().tipomov() >= tm_pagamento; }
|
||||
bool activate_split_payment(TMask& m);
|
||||
bool is_split_payment() const;
|
||||
bool is_fattura_split() const;
|
||||
|
@ -283,7 +283,7 @@ const TString& TCausale::compatible(const TCausale& c) const
|
||||
if (err != NULL)
|
||||
{
|
||||
TString& msg = get_tmp_string();
|
||||
msg.format(FR("La causale e' incompatibile per %s"), err);
|
||||
msg.format(FR("Causale incompatibile per %s"), err);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include <printapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TABUTIL_H
|
||||
#include <tabutil.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CGLIB03_H
|
||||
#include "cglib03.h"
|
||||
#endif
|
||||
|
@ -226,10 +226,10 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
|
||||
if (_prind)
|
||||
{
|
||||
TString buf(80);
|
||||
buf.format( _printonly ? FR("Stampa liquidazione (mese %d %d)...\n%s:\n%s\n") :
|
||||
FR("Calcolo liquidazione (mese %d %d)...\n%s:\n%s\n"),
|
||||
month, atoi(_year), (const char*)_nditte_r->get(NDT_RAGSOC), (const char*)desatt);
|
||||
TString buf(127);
|
||||
buf.format( _printonly ? FR("Stampa liquidazione %s %d...\n%s:\n%s\n") :
|
||||
FR("Calcolo liquidazione %s %d...\n%s:\n%s\n"),
|
||||
itom(month), atoi(_year), (const char*)_nditte_r->get(NDT_RAGSOC), (const char*)desatt);
|
||||
_prind->set_text(buf);
|
||||
}
|
||||
|
||||
@ -698,8 +698,12 @@ bool TLiquidazione_app::residuo_da_liquidare(const TRectype& lastid, real& impor
|
||||
bool is_good = imponib.valore() > ZERO;
|
||||
if (!is_good)
|
||||
{
|
||||
const real totdoc = cache().get(LF_MOV, numreg, MOV_TOTDOC);
|
||||
is_good = totdoc > ZERO;
|
||||
const TRectype& mov_head = cache().get(LF_MOV, numreg);
|
||||
int good_sign = +1;
|
||||
if (mov_head.get_int(MOV_TIPOMOV) == tm_fattura && mov_head.get(MOV_TIPODOC) == "NC")
|
||||
good_sign = -1;
|
||||
const real totdoc = mov_head.get(MOV_TOTDOC);
|
||||
is_good = totdoc.sign() == good_sign;
|
||||
}
|
||||
if (is_good)
|
||||
{
|
||||
@ -1022,14 +1026,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
const TDate fromdate(1, month == 13 ? 1 : month, year_int);
|
||||
TDate t;
|
||||
TDate f74;
|
||||
|
||||
// Spiegazione dell'arcano segreto sulle agenzie viaggio:
|
||||
// non viene applicato lo stesso metodo delle ditte normali perche' si deve
|
||||
// tenere conto della DATA74TER se presente.
|
||||
// Per le agenzie di viaggio si parte da inizio anno precedente
|
||||
if (_isviaggio)
|
||||
f74 = TDate(1, 1, year_int-1);
|
||||
|
||||
if (_recalc_regis) // Vecchia selezione prima del 1998 o calcolo progressivi per stampa registri bollati
|
||||
{
|
||||
@ -1052,14 +1049,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
from.put(MOV_REG, fromreg);
|
||||
to.put(MOV_REG, toreg);
|
||||
|
||||
_cur->freeze(FALSE);
|
||||
_cur->freeze(false);
|
||||
_cur->setregion(from, to);
|
||||
|
||||
TString filter;
|
||||
//filter.format("((ANSI(DATAREG)>=%ld)&&(ANSI(DATAREG)<=%ld))", fromdate.date2ansi(), t.date2ansi());
|
||||
filter.format("(BETWEEN(DATAREG,%ld,%ld))", fromdate.date2ansi(), t.date2ansi());
|
||||
if (_isviaggio)
|
||||
{
|
||||
// Spiegazione dell'arcano segreto sulle agenzie viaggio:
|
||||
// non viene applicato lo stesso metodo delle ditte normali perche' si deve
|
||||
// tenere conto della DATA74TER se presente.
|
||||
// Per le agenzie di viaggio si parte da inizio anno precedente
|
||||
const TDate f74(1, 1, year_int-1);
|
||||
filter << format("||(BETWEEN(DATA74TER,%ld,%ld))", f74.date2ansi(), t.date2ansi());
|
||||
}
|
||||
if (_isdiff)
|
||||
filter << "||(NUM(LIQDIFF==\"X\"))";
|
||||
if (has_sc && gestione_IVAxCassa(fromdate))
|
||||
@ -1077,7 +1080,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
TString pimsg;
|
||||
pimsg << TR("Ricalcolo attività ") << trueatt << " (" << TR("mese ")
|
||||
<< (month > 12 ? "13" : itom(month)) << ')';
|
||||
<< (month > 12 ? "13" : itom(month)) << ' ' << year_int << ')';
|
||||
|
||||
TProgress_monitor pi(items, pimsg, false);
|
||||
for (; _cur->pos() < items; ++(*_cur))
|
||||
@ -1103,7 +1106,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (_mov->get_long(MOV_NUMREG) == 113678)
|
||||
if (_mov->get_long(MOV_NUMREG) == 19956)
|
||||
int cazzone = 1;
|
||||
#endif
|
||||
|
||||
@ -1141,7 +1144,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
|
||||
// Sezione preferita per fatture decisa in base a vendita->'A' o acquisto->'D'
|
||||
const char sezfat = tipomov == vendita ? 'D' : 'A';
|
||||
const char sezpag = tipomov == vendita ? 'A' : 'D';
|
||||
const char sezpag = (sezfat=='D') ? 'A' : 'D';
|
||||
const long numreg = _mov->get_long(MOV_NUMREG);
|
||||
TDate datainc;
|
||||
real tot_incassato, tot_da_incassare;
|
||||
@ -1160,7 +1163,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
flag_pg_nc = rp.calcola_pagato_periodo(inizio+1L, fine, pg, nc, &pagscatt);
|
||||
if (pagscatt.items() >= 2)
|
||||
{
|
||||
// Fondo righe generate dallo stesso pagamento
|
||||
// Fondo tra loro le righe generate dallo stesso pagamento
|
||||
for (int p = pagscatt.last(); p > 0; p--)
|
||||
{
|
||||
const TRectype& p0 = (const TRectype&)pagscatt[p];
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <anagr.h>
|
||||
@ -150,8 +151,7 @@ void TStampa_registri_app::get_dati_ditta()
|
||||
if (_cap.empty())
|
||||
_cap = anag.get(ANA_CAPRES);
|
||||
|
||||
const TRectype& dep = look_comuni (_comunefis);
|
||||
|
||||
const TRectype& dep = look_comuni(_comunefis);
|
||||
_comunefis = dep.get(COM_DENCOM);
|
||||
_provfis = dep.get(COM_PROVCOM);
|
||||
if (_comunefis.empty())
|
||||
@ -1965,7 +1965,8 @@ bool TStampa_registri_app::print_IVAxCassa(int da_month, int a_month)
|
||||
}
|
||||
|
||||
TString query;
|
||||
query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(MOV.REG=#REG)&&(STR((MESELIQ<13)&&(TIPOMOV>2)&&(MOV.TOTDOC>0)))";
|
||||
// query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(MOV.REG=#REG)&&(STR((MESELIQ<13)&&(TIPOMOV>2)&&(MOV.TOTDOC>0)))";
|
||||
query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(MOV.REG=#REG)&&(STR((MESELIQ<13)&&(TIPOMOV>2)&&(MOV.TOTDOC!=0)))"; // 17-11-2015 trasformato in MOV.TOTDOC!=0
|
||||
query << "\nBY DATAREGP DATAREG NUMPRO";
|
||||
query << "\nJOIN MOV INTO NUMREG==NUMREG";
|
||||
query << "\nJOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF";
|
||||
@ -2042,13 +2043,13 @@ bool TStampa_registri_app::print_IVAxCassa(int da_month, int a_month)
|
||||
const TRectype& rec = id.cursor()->curr();
|
||||
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
||||
{
|
||||
const TString4 codiva = rec.get("CODIVA");
|
||||
const real importo = rec.get("IMPORTO");
|
||||
const real imponibile = rec.get("IMPONIBILE");
|
||||
const real imposta = rec.get("IMPOSTA");
|
||||
const int tipodiff = rec.get_int("TIPODIFF");
|
||||
const TString4 codiva = rec.get("CODIVA");
|
||||
const real importo = rec.get("IMPORTO");
|
||||
const real imponibile = rec.get("IMPONIBILE");
|
||||
const real imposta = rec.get("IMPOSTA");
|
||||
const int tipodiff = rec.get_int("TIPODIFF");
|
||||
|
||||
TString rs = id.get("CLIFO.RAGSOC").as_string();
|
||||
TString80 rs = id.get("CLIFO.RAGSOC").as_string();
|
||||
rs.strip_double_spaces();
|
||||
TParagraph_string clifo(rs, 27);
|
||||
|
||||
@ -2312,15 +2313,17 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
||||
const bool liqdiff = !splitpay && mov.get_bool(MOV_LIQDIFF);
|
||||
const bool IVAxcassa= !splitpay && !liqdiff && mov.get_bool(MOV_IVAXCASSA);
|
||||
|
||||
TString80 descrcau = caus.get(CAU_DESCR);
|
||||
const TString80 descrcau = caus.get(CAU_DESCR);
|
||||
|
||||
real totdoc = mov.get_real(MOV_TOTDOC);
|
||||
real ritsoc = mov.get_real(MOV_RITSOC);
|
||||
real ritfis = mov.get_real(MOV_RITFIS);
|
||||
real totdoc = mov.get(MOV_TOTDOC);
|
||||
real ritsoc = mov.get(MOV_RITSOC);
|
||||
real ritfis = mov.get(MOV_RITFIS);
|
||||
real revcha = is_reverse_charge(mov.curr()) ? mov.get_real(MOV_REVCHARGE) : ZERO;
|
||||
if (totdoc < ZERO) // Controlla il segno corretto da assegnare alle ritenute
|
||||
{
|
||||
ritsoc = -ritsoc;
|
||||
ritfis = -ritfis;
|
||||
revcha = -revcha;
|
||||
}
|
||||
|
||||
if (_cur->pos() == 0)
|
||||
@ -2391,7 +2394,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
||||
_descr_doc = descr_doc();
|
||||
TString app(datadoc.string(brief, '/'));
|
||||
|
||||
totdoc += ritsoc+ritfis;
|
||||
totdoc += ritsoc+ritfis+revcha;
|
||||
|
||||
if (_st_tot_fin)
|
||||
_doc_array.add_riga(_tipodoc,_descr_doc,totdoc);
|
||||
|
@ -19,7 +19,7 @@ static int __anno;
|
||||
|
||||
bool cau_filter1 (const TRelation *r)
|
||||
{
|
||||
bool rt = FALSE;
|
||||
bool rt = false;
|
||||
const TRectype& rec = r->curr(LF_CAUSALI);
|
||||
|
||||
if (rec.get(CAU_TIPODOC) == "ST") // Solo i tipi documento STorno
|
||||
@ -39,7 +39,7 @@ bool cau_filter1 (const TRelation *r)
|
||||
return rt;
|
||||
}
|
||||
|
||||
bool cau_filter2 (const TRelation *r)
|
||||
bool cau_filter2(const TRelation *r)
|
||||
{
|
||||
bool rt = false;
|
||||
const TRectype& rec = r->curr(LF_CAUSALI);
|
||||
@ -103,7 +103,7 @@ bool TGestAutoTrasp_mask::on_key(KEY k)
|
||||
sf.enable_column(F_NUMPROT - F_CAUMOV);
|
||||
|
||||
const int items = sf.items();
|
||||
for (int i=0; i<items;i++)
|
||||
for (int i=0; i<items; i++)
|
||||
sf.disable_cell(i, F_NUMPROT - F_CAUMOV);
|
||||
|
||||
sf.enable_cell(rs, F_NUMPROT - F_CAUMOV);
|
||||
@ -116,20 +116,15 @@ bool TGestAutoTrasp_mask::on_key(KEY k)
|
||||
|
||||
void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
{
|
||||
TDate fromdate, todate;
|
||||
TString16 codreg;
|
||||
const TDate fromdate = get_date(F_DADATA);
|
||||
const TDate todate = get_date(F_ADATA);
|
||||
const TString4 codreg = get(F_CODREG);
|
||||
|
||||
fromdate = get_date(F_DADATA);
|
||||
todate = get_date(F_ADATA);
|
||||
codreg = get(F_CODREG);
|
||||
|
||||
if (fromdate.ok() && todate.ok() && codreg.not_empty())
|
||||
if (fromdate.ok() && todate.ok() && codreg.full())
|
||||
{
|
||||
TRectype fromrec(LF_MOV);
|
||||
TRectype torec(LF_MOV);
|
||||
TString filter;
|
||||
TString4 caus;
|
||||
|
||||
filter << "(REG==\"" << codreg << "\")";
|
||||
filter << "&&((STAMPATO!=\"X\")&&(REGST!=\"X\"))";
|
||||
fromrec.put(MOV_DATAREG, fromdate);
|
||||
@ -141,10 +136,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
_cur = new TCursor(_rel, filter, 2, &fromrec, &torec);
|
||||
TRectype& rc = _cur->curr();
|
||||
const TRecnotype items = _cur->items();
|
||||
TProgind* pi = NULL;
|
||||
|
||||
if (items > 10)
|
||||
pi = new TProgind(items, TR("Selezione movimenti..."), FALSE, TRUE);
|
||||
TProgress_monitor pi(items, TR("Selezione movimenti..."));
|
||||
|
||||
TLocalisamfile causali(LF_CAUSALI);
|
||||
|
||||
@ -157,9 +149,9 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
_caudef.destroy();
|
||||
for (*_cur = 0L; _cur->pos() < items; ++(*_cur))
|
||||
{
|
||||
if (pi)
|
||||
pi->addstatus(1L);
|
||||
caus = rc.get(MOV_CODCAUS);
|
||||
if (!pi.add_status(1))
|
||||
break;
|
||||
const TString4 caus = rc.get(MOV_CODCAUS);
|
||||
if (!_caudef.is_key(caus)) // Se non è stata ancora aggiunta questa causale...
|
||||
{
|
||||
TToken_string* tt = new TToken_string;
|
||||
@ -175,10 +167,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
sa.add(tt);
|
||||
}
|
||||
}
|
||||
|
||||
if (pi)
|
||||
delete pi;
|
||||
|
||||
|
||||
sf.force_update(); // Aggiorna lo sheet
|
||||
|
||||
if (items == 0)
|
||||
|
@ -286,7 +286,7 @@ bool TEsercizi_contabili::code2range(int codice, TDate& dal, TDate& al) const
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
if(codice > 1900)
|
||||
if (codice > 1900)
|
||||
{
|
||||
dal = TDate(1, 1, codice);
|
||||
al = TDate(31, 12, codice);
|
||||
@ -504,15 +504,12 @@ bool TRegistro::read_att()
|
||||
return !_att.empty();
|
||||
}
|
||||
|
||||
bool TRegistro::agenzia_viaggi()
|
||||
bool TRegistro::agenzia_viaggi() const
|
||||
{
|
||||
bool av = false;
|
||||
if (iva() == iva_vendite)
|
||||
av = _att.get_bool("REG74TER");
|
||||
return av;
|
||||
return _att.get_bool("REG74TER") && (iva() == iva_vendite);
|
||||
}
|
||||
|
||||
const TString& TRegistro::tipo_attivita()
|
||||
const TString& TRegistro::tipo_attivita() const
|
||||
{
|
||||
return _att.get("TIPOATT");
|
||||
}
|
||||
|
14
cg/cglib01.h
14
cg/cglib01.h
@ -110,9 +110,9 @@ public:
|
||||
long protocol() const { return _rec.get_long("I5"); }
|
||||
const TString& attivita() const { return _rec.get("S8"); }
|
||||
|
||||
bool agenzia_viaggi();
|
||||
const TString& tipo_attivita();
|
||||
bool attivita_mista() { const char a = tipo_attivita()[0]; return a == 'E'; }
|
||||
bool agenzia_viaggi() const;
|
||||
const TString& tipo_attivita() const;
|
||||
bool attivita_mista() const { const char a = tipo_attivita()[0]; return a == 'E'; }
|
||||
|
||||
void set_prorata(int annodoc, const real& pro);
|
||||
real prorata(int annodoc);
|
||||
@ -193,15 +193,15 @@ public: // TObject
|
||||
public:
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, int r = -1)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(NULL),
|
||||
_sezione(' '), _sospeso(FALSE)
|
||||
_sezione(' '), _sospeso(false)
|
||||
{ set(g,c,s,t,d,r);}
|
||||
|
||||
TBill(TToken_string& tgcsd, int from, int mode = 0)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(FALSE)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(false)
|
||||
{ get(tgcsd, from, mode); }
|
||||
|
||||
TBill(const TRectype& rec, bool contro = FALSE)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(FALSE)
|
||||
TBill(const TRectype& rec, bool contro = false)
|
||||
: _descrizione(NULL), _sezione(' '), _sospeso(false)
|
||||
{ get(rec, contro); }
|
||||
|
||||
TBill(const TBill& b)
|
||||
|
@ -162,7 +162,7 @@ static bool mov_has_imposte(const TRectype& mov)
|
||||
bool is_reverse_charge(const TRectype& mov)
|
||||
{
|
||||
const TRectype& rcs = cache().get(LF_CAUSALI, mov.get(MOV_CODCAUS));
|
||||
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
|
||||
const int rsi = rcs.get_int(CAU_REGSPIVA); // Regime speciale IVA
|
||||
return rsi == 13 || rsi == 50 || rsi == 51; // Reverse charge!
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user