Patch level : 12.0 988

Files correlati     : cg2.exe
Commento            :

Aggiunta gestione dell'IVA indetraibile nel nuovo reverse charge
This commit is contained in:
Alessandro Bonazzi 2020-08-06 17:35:00 +02:00
parent c542d451ae
commit b7eac870fc
10 changed files with 230 additions and 187 deletions

View File

@ -462,7 +462,8 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (nriga >= 2 && nriga <= RIGA_REVERSE_CHARGE)
continue; // Conti per IVA detraibile e non, ritenute sociali e fiscali
const char tipo = nriga == 1 ? 'T' : ' ';
const char tipo = nriga == 1 ? cgrowtype_totale : cgrowtype_contabile;
if (nriga == 1 && tc.tipo() > ' ' && tc.ok())
m->set(F_CODCLIFOR, tc.sottoconto());
set_cgs_row(-1,zero,tc,desc,tipo);
@ -1042,7 +1043,8 @@ void TPrimanota_application::init_modify_mode(TMask& m)
for (int i = cg.items()-1; i >= 0 && _as400; i--)
{
const char rt = row_type(cg.row(i));
_as400 = rt <= ' ';
_as400 = rt <= cgrowtype_contabile;
}
}
}
@ -1456,7 +1458,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
// Roba obsoleta allo stato brado
const TBill c(row, cid2index(IVA_TIPO), 0x1);
const int rimp = bill2pos(c, 'I')+1;
const int rimp = bill2pos(c, cgrowtype_imponibile) + 1;
r.put(RMI_RIGAIMP, rimp);
c.put(r);
r.put(RMI_NAVP, row.get(cid2index(IVA_NOTAVARECF)));
@ -1487,12 +1489,19 @@ void TPrimanota_application::check_saldi()
void TPrimanota_application::write_fppro()
{
#ifdef DBG
if (!ini_get_bool(CONFIG_INSTALL, "Main", "SkipFPPRO"))
{
#endif
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
if (save_fppro() > 0 && !save_dbmov())
message_box(
"ATTENZIONE: non e' stato possibile salvare i riferimenti del documento in ingresso per questo movimento.\n"
"Movimento registrato senza collegamento ai documenti in ingresso.");
#ifdef DBG
}
#endif
}
bool TPrimanota_application::has_tot_doc(TToken_string& fppro_keys)
{
@ -2065,14 +2074,14 @@ long TPrimanota_application::calcola_m770(int tipo_coll, real& spese, real& comp
iva += imposta;
}
i = type2pos('F');
i = type2pos(cgrowtype_ritfis);
if (i >= 0)
{
TImporto imp; imp = cgs().row(i);
ritfis = imp.valore();
}
i = type2pos('S');
i = type2pos(cgrowtype_ritsoc);
if (i >= 0)
{
TImporto imp; imp = cgs().row(i);
@ -2255,8 +2264,12 @@ HIDDEN bool add_not_empty(TToken_string& str, int pos, TConfig& ini, const char*
void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{
static TString __tipi_riga;
TRelation_application::ini2mask(ini, msk, query);
bool scad_from_ini = false;
if (__tipi_riga.blank())
__tipi_riga << (char) cgrowtype_contabile << (char) cgrowtype_IVAdet << (char) cgrowtype_imponibile << (char) cgrowtype_IVAnondet << (char) cgrowtype_totale;
if (query)
{
set_not_empty(msk, F_CODCAUS, ini, MOV_CODCAUS);
@ -2318,15 +2331,17 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
}
// Genera eventuali righe per ritenute fiscali e sociali
const short frit[4] = { F_RITFIS, F_RITSOC, F_REVCHARGE, 0 };
const char trit[4] = { 'F', 'S', 'V', '\0' };
static const short __frit[4] = {F_RITFIS, F_RITSOC, F_REVCHARGE, 0};
static TString4 __trit;
if (__trit.blank())
__trit << cgrowtype_ritfis << cgrowtype_ritsoc << cgrowtype_revcharge;
for (int i = 0; frit[i]; i++)
for (int i = 0; __frit[i]; i++)
{
TEdit_field& ritfld = msk.efield(frit[i]);
TEdit_field& ritfld = msk.efield(__frit[i]);
if (!ritfld.empty() && ritfld.active())
add_cgs_ritenute(trit[i]);
add_cgs_ritenute(__trit[i]);
}
calcola_imp(); // Calcola totale imponibile ed imposte
}
@ -2335,7 +2350,9 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
for (int i = 0; ini.set_paragraph(format("%d,%d", LF_RMOV, i + 1)); i++)
{
char tipo = ini.get_char(RMV_ROWTYPE);
if (tipo < ' ') tipo = ' ';
if (tipo < cgrowtype_contabile)
tipo = cgrowtype_contabile;
TBill conto; ini2bill(ini, conto, false);
if (_as400 && conto.tipo() <= ' ')
@ -2346,18 +2363,18 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{
numrig = -1; // Normalmente aggiungi la riga in fondo
// Cerca una riga che abbia già il tipo ed il conto richiesto
if (strchr(" DINT", tipo) != nullptr)
if (strchr(__tipi_riga, tipo) != nullptr)
{
int nr = -1;
if (tipo == 'I' || tipo == ' ')
if (tipo == cgrowtype_imponibile || tipo == cgrowtype_contabile)
nr = bill2pos(conto, tipo);
else
nr = type2pos(tipo);
if (nr < 0)
tipo = ' ';
tipo = cgrowtype_contabile;
else
if (get_cgs_imp(nr).is_zero() || tipo == 'T')
if (get_cgs_imp(nr).is_zero() || tipo == cgrowtype_totale)
numrig = nr;
}
}

View File

@ -4,6 +4,7 @@
#include <diction.h>
#include <tabutil.h>
///////////////////////////////////////////////////////////
// Movimento di prima nota
///////////////////////////////////////////////////////////
@ -103,10 +104,6 @@ int TMovimentoPN::read_mov_rows()
_iva.read(ivafilter);
update_rev_charge();
_old_iva = _iva;
/*
if (_cg.rows() > 0 && _iva.rows() > 0 && cg(0).get_char(RMV_ROWTYPE) != 'T')
adjust_row_types();
*/
return _cg.rows();
}
@ -398,76 +395,76 @@ int TMovimentoPN::remove()
///////////////////////////////////////////////////////////
class TConti_array : private TAssoc_array
{
{
public: // TObject
virtual bool ok() const { return items() != 0; }
virtual bool ok() const { return items() != 0; }
public:
bool add(const TBill& conto, const real& importo);
real importo(const TBill& conto);
bool remove(const TBill& conto);
bool add_iva(bool det, const real& importo);
real importo_iva(bool det);
bool remove_iva(bool det);
bool add(const TBill& conto, const real& importo);
real importo(const TBill& conto);
bool remove(const TBill& conto);
TConti_array() {}
virtual ~TConti_array() {}
bool add_iva(bool det, const real& importo);
real importo_iva(bool det);
bool remove_iva(bool det);
TConti_array() {}
virtual ~TConti_array() {}
};
bool TConti_array::add(const TBill& conto, const real& importo)
{
const char* key = conto.string();
real* imp = (real*)objptr(key);
const char* key = conto.string();
real* imp = (real*)objptr(key);
if (imp == nullptr)
TAssoc_array::add(key, importo);
else
*imp += importo;
return imp != nullptr;
if (imp == nullptr)
TAssoc_array::add(key, importo);
else
*imp += importo;
return imp != nullptr;
}
real TConti_array::importo(const TBill& conto)
{
const char* key = conto.string();
const real* imp = (real*)objptr(key);
return imp ? *imp : ZERO;
const char* key = conto.string();
const real* imp = (real*)objptr(key);
return imp ? *imp : ZERO;
}
bool TConti_array::remove(const TBill& conto)
{
const char* key = conto.string();
return TAssoc_array::remove(key);
const char* key = conto.string();
return TAssoc_array::remove(key);
}
bool TConti_array::add_iva(bool det, const real& importo)
{
real* imp = nullptr;
real* imp = nullptr;
if (!importo.is_zero())
{
const char* const key = det ? "D" : "N";
if (!importo.is_zero())
{
const char* const key = det ? "D" : "N";
imp = (real*)objptr(key);
if (imp == nullptr)
TAssoc_array::add(key, importo);
else
*imp += importo;
}
return imp != nullptr;
imp = (real*)objptr(key);
if (imp == nullptr)
TAssoc_array::add(key, importo);
else
*imp += importo;
}
return imp != nullptr;
}
real TConti_array::importo_iva(bool det)
{
const char* const key = det ? "D" : "N";
const real* imp = (real*)objptr(key);
return imp ? *imp : ZERO;
const char* const key = det ? "D" : "N";
const real* imp = (real*)objptr(key);
return imp ? *imp : ZERO;
}
bool TConti_array::remove_iva(bool det)
{
const char* const key = det ? "D" : "N";
return TAssoc_array::remove(key);
const char* const key = det ? "D" : "N";
return TAssoc_array::remove(key);
}
real TMovimentoPN::indetraibile_al(const TString& codind, const TCausale& caus, int annodoc) const

View File

@ -13,6 +13,7 @@
#include "cg2100.h"
#include "cg2102.h"
#include "cg21sld.h"
#include "cglib.h"
#include <clifo.h>
#include <cfven.h>
@ -29,13 +30,13 @@
// Determina il tipo di una riga contabile in formato TToken_string
char TPrimanota_application::row_type(const TToken_string& s)
{
char t = ' ';
char t = cgrowtype_contabile;
if (s.full())
{
s.get(cid2index(CG_ROWTYPE), t);
if (!((t >= 'A' && t <= 'Z')||((t >= '0' && t <= '9')))) // is not alphanumeric?
t = ' ';
t = cgrowtype_contabile;
}
return t;
}
@ -274,20 +275,21 @@ TImporto TPrimanota_application::real2imp(const real& r, char row_type)
switch (row_type)
{
case 'S':
case cgrowtype_ritsoc:
dare = causale().sezione_ritsoc() == 'D';
break;
case 'V':
case cgrowtype_revcharge:
dare = causale().sezione_revcharge() == 'D';
break;
default:
dare = causale().sezione_clifo() == 'D';
if (row_type != 'T' && row_type != 'F')
if (row_type != cgrowtype_totale && row_type != cgrowtype_ritfis)
dare = !dare;
break;
}
TImporto importo(dare ? 'D' : 'A', r);
return importo;
}
@ -299,7 +301,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
int first = 0, last = 0; // Range di colonne da disabilitare
switch(tipo)
{
case 'T': // Totale documento
case cgrowtype_totale: // Totale documento
if (causale().corrispettivi())
{
last = 2;
@ -311,25 +313,25 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
cg.disable_cell(n, 6);
}
break;
case 'A': // Abbuoni attivi
case 'C': // Differenza cambio
case 'D': // IVA Detraibile
case 'F': // Ritenute Fiscali
case 'L': // Contropartita delle spese
case 'N': // IVA Non detraibile
case 'P': // Abbuoni passivi
case 'R': // Ritenute professionali
case 'S': // Ritenute Sociali
case 'V': // Reverse charge
case '2': // IVA per scissione pagamenti art.17-ter DPR 633/72
case cgrowtype_abbattivo: // Abbuoni attivi
case cgrowtype_diffcambio: // Differenza cambio
case cgrowtype_IVAdet: // IVA Detraibile
case cgrowtype_ritfis: // Ritenute Fiscali
case cgrowtype_contrspesa: // Contropartita delle spese
case cgrowtype_IVAnondet: // IVA Non detraibile
case cgrowtype_abbpassivo: // Abbuoni passivi
case cgrowtype_ritprof: // Ritenute professionali
case cgrowtype_ritsoc: // Ritenute Sociali
case cgrowtype_revcharge: // Reverse charge
case cgrowtype_IVAsplit: // IVA per scissione pagamenti art.17-ter DPR 633/72
last = 3;
break;
case 'K': // Riga cliente/fornitore per saldaconto
case cgrowtype_cliforsc: // Riga cliente/fornitore per saldaconto
if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova
break;
first = 2;
case 'I': // Imponibile o contropartita saldaconto
case '1': // Cliente per scissione pagamenti art.17-ter DPR 633/72
case cgrowtype_imponibile: // Imponibile o contropartita saldaconto
case cgrowtype_clisplit: // Cliente per scissione pagamenti art.17-ter DPR 633/72
last = 7;
break;
default:
@ -382,7 +384,7 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
row.add(conto.string(0x3));
row.add(""); // Codice decrizione
row.add(desc); // Descrizione aggiuntiva
if (tipo == 'T') // Calcolo contropartita
if (tipo == cgrowtype_totale) // Calcolo contropartita
{
TToken_string & irow = ivas().row(0);
TBill contro(irow, 5, 0x3);
@ -394,7 +396,7 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
}
else
{
const int pos = type2pos('T');
const int pos = type2pos(cgrowtype_totale);
if (pos >= 0)
{
@ -457,14 +459,14 @@ void TPrimanota_application::cgs_pack()
TToken_string& r = rows.row(i);
const char rt = row_type(r);
rowtypes_present |= (rt > ' ');
rowtypes_present |= (rt > cgrowtype_contabile);
bool kill = can_remove(r);
if (kill)
{
if (pagamento)
{
if (rt == 'K')
if (rt == cgrowtype_cliforsc)
{
kill = !partite().utilizzata(numreg, i+1);
if (kill)
@ -474,7 +476,7 @@ void TPrimanota_application::cgs_pack()
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())
if (rt == cgrowtype_totale && r.get_char(2)>='C' && curr_mask().get_real(F_TOTALE) == ZERO)
kill = false;
}
if (kill)
@ -655,7 +657,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
empty = false;
if (paga || nota)
{
if (tipo == 'K' || tipo == 'T' || a._as400)
if (tipo == cgrowtype_cliforsc || tipo == cgrowtype_totale || a._as400)
{
const int currig = i+1;
const TImporto speso = a.partite().importo_speso(numreg, currig);
@ -718,7 +720,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const TImporto imp_spe(importo.sezione(), spe.get_num());
saldaconto_val += imp_spe;
} else
if (tipo == 'K' || tipo == 'T')
if (tipo == cgrowtype_cliforsc || tipo == cgrowtype_totale)
saldaconto_val += a.partite().importo_speso(numreg, i+1, true, 0x1);
}
}
@ -726,7 +728,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
else
{
if (tipo == 'T' && a.is_fattura())
if (tipo == cgrowtype_totale && a.is_fattura())
{
const TBill c(r, 2, 0x1);
if (c.tipo() >= 'C') // Riga cliente/fornitore
@ -823,7 +825,7 @@ void TPrimanota_application::generazione_righe_cg(int r)
if (contro.ok())
{
importo.swap_section(); // Inverto la sezione D/A
set_cgs_row(1, importo, contro, "", ' ');
set_cgs_row(1, importo, contro, "", cgrowtype_contabile);
TBill conto(row, 2, 0x3);
conto.add_to(cg.row(1), 9, 0x3);
cg.force_update(1);
@ -911,7 +913,7 @@ int TPrimanota_application::crea_somma_spese(TImporto& imp)
TBill cassa; causale().bill(2, cassa);
const TString desc(causale().desc_agg(2));
imp.swap_section(); imp.normalize();
const int r = set_cgs_row(-1, imp, cassa, desc, 'L');
const int r = set_cgs_row(-1, imp, cassa, desc, cgrowtype_contrspesa);
cgs().force_update();
return r;
}
@ -1012,7 +1014,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
{
if (delete_l)
{
const int l = type2pos('L');
const int l = type2pos(cgrowtype_contrspesa);
CHECK(l >= 0, "Impossibile cancellare riga di tipo L");
cg.destroy(l);
delete_l = false;
@ -1030,7 +1032,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
switch(k)
{
case K_SPACE:
if (tipo == 'G')
if (tipo == cgrowtype_spese)
old_spesa = row;
else
old_spesa.valore() = ZERO;
@ -1039,9 +1041,10 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
if (!selecting)
{
TMask& sm = cg.sheet_mask();
sm.enable(DLG_DELREC, tipo <= ' ' || tipo == 'K' || tipo == 'G');
sm.enable(CG_RATEO, tipo <= ' ');
sm.enable(CG_RISCONTO, tipo <= ' ');
sm.enable(DLG_DELREC, tipo <= cgrowtype_contabile || tipo == cgrowtype_cliforsc || tipo == cgrowtype_spese);
sm.enable(CG_RATEO, tipo <= cgrowtype_contabile);
sm.enable(CG_RISCONTO, tipo <= cgrowtype_contabile);
if (row.empty_items())
{
selecting = true;
@ -1052,7 +1055,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
}
break;
case K_DEL:
if (tipo == 'G')
if (tipo == cgrowtype_spese)
{
if (old_spesa.is_zero())
old_spesa = row;
@ -1061,18 +1064,18 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
}
else
{
if (tipo == 'K')
if (tipo == cgrowtype_cliforsc)
a.notify_cgline_deletion(r+1);
break;
}
case K_ENTER:
if (tipo == 'G')
if (tipo == cgrowtype_spese)
{
TImporto growth; growth = row; growth -= old_spesa;
if (!growth.is_zero())
{
const int s = type2pos('L');
const int s = type2pos(cgrowtype_contrspesa);
if (s < 0)
a.crea_somma_spese(growth);
else
@ -1093,16 +1096,17 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
if (a.is_pagamento())
{
const char tipo = cg.mask().get(SK_TIPORIGA)[0];
if (tipo == 'K' || tipo == 'G')
if (tipo == cgrowtype_cliforsc || tipo == cgrowtype_spese)
{
const int k = tipo == 'K' ? 1 : RIGA_SPESE;
const int k = tipo == cgrowtype_cliforsc ? 1 : RIGA_SPESE;
TBill conto; a.causale().bill(k, conto);
const TString desc(a.causale().desc_agg(k));
const char sez = a.causale().sezione(k);
const real imp = cg.mask().get_real(K_RESIDUO);
TImporto importo(sez, imp); importo.normalize();
if (tipo == 'G')
if (tipo == cgrowtype_spese)
{
const char sezbanca = a.causale().sezione(2);
if (sezbanca == sez)
@ -1111,12 +1115,13 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
a.set_cgs_row(r, importo, conto, desc, tipo);
if (tipo == 'K')
if (tipo == cgrowtype_cliforsc)
{
for (int i = 0; i < r; i++)
{
const TToken_string& row = cg.row(i);
if (row_type(row) != 'K')
if (row_type(row) != cgrowtype_cliforsc)
{
cg.swap_rows(r, i);
cg.post_select(i);
@ -1128,7 +1133,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
{
if (!importo.is_zero())
{
const int s = type2pos('L');
const int s = type2pos(cgrowtype_contrspesa);
if (s < 0)
a.crea_somma_spese(importo);
else
@ -1152,7 +1157,7 @@ bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
{
if (app().iva() != nessuna_iva)
{
const int first = type2pos('T');
const int first = type2pos(cgrowtype_totale);
if (first >= 0)
{
TSheet_field& cg = app().cgs();
@ -1457,14 +1462,13 @@ void TPrimanota_application::ivas_pack()
rows.pack(); // Pack array
}
int TPrimanota_application::get_importi_iva(const TToken_string& row,
real& imp_det, real& iva_det,
real& imp_ind, real& iva_ind)
int TPrimanota_application::get_importi_iva(TToken_string& row, real& imp_det, real& iva_det,
real& imp_ind, real& iva_ind)
{
real imptot; row.get(0, imptot); // Importo scritto nella riga iva
TString4 zanicchi; row.get(1, zanicchi); // Codice IVA
TString4 codind; row.get(2, codind); // Codice indetraibilità
real ivatot; row.get(3, ivatot); // Imposta scritta nella riga iva
const real imptot = row.get_real(cid2index(IVA_IMPONIBILE)); // Importo scritto nella riga iva
const TString4 zanicchi = row.get(cid2index(IVA_CODIVA)); // Codice IVA
const TString4 codind = row.get(cid2index(IVA_INDETRAIBILE)); // Codice indetraibilità
const real ivatot = row.get_real(cid2index(IVA_IMPOSTA)); // Imposta scritta nella riga iva
int annodoc = app()._msk[2]->get_date(F_DATADOC).year();
if (annodoc <= 0)
@ -1476,7 +1480,7 @@ int TPrimanota_application::get_importi_iva(const TToken_string& row,
const TCausale& caus = app().causale();
const TMovimentoPN& mov = (const TMovimentoPN&)*app().get_relation();
return mov.analizza_riga_IVA(imptot, ivatot, caus, annodoc, zanicchi, codind,
imp_det, iva_det, imp_ind, iva_ind);
}
@ -1487,19 +1491,24 @@ void TPrimanota_application::add2cg_row(TSheet_field& s, TToken_string & row, TS
const TCausale& cau = a.causale();
const bool acquisto = (a.iva() == iva_acquisti);
const int last = acquisto ? 3 : 2;
const char tipi[3] = { 'N', 'D', 'V' };
static TString8 __tipi;
if (__tipi.blank())
__tipi << (char) cgrowtype_IVAnondet << (char) cgrowtype_IVAdet << (char) cgrowtype_revcharge;
real imp_det, iva_det, imp_ind, iva_ind;
const bool revcharge = row.get_bool(cid2index(IVA_REVCHARGE));
get_importi_iva(row, imp_det, iva_det, imp_ind, iva_ind);
for (int d = 0; d < last; d++)
{
const char tipod = tipi[d];
const char tipod = __tipi[d];
if (d < 2)
{
const TBill conto(row, cid2index(IVA_TIPO), 0x1);
const int pos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
const int pos = bill2pos(conto, cgrowtype_imponibile); // Riga in cui andra' l'imponibile
const TImporto imp = a.real2imp(d > 0 ? imp_det : imp_ind, tipod); // Imponibile
if (pos >= 0) // Se il conto esisteva anche prima ...
@ -1522,7 +1531,7 @@ void TPrimanota_application::add2cg_row(TSheet_field& s, TToken_string & row, TS
else
{
if (add && conto.ok() && !imp.is_zero()) // Se c'e' imponibile ...
a.set_cgs_row(-1, imp, conto, (saved_descr.objptr(d) == nullptr || saved_descr.row(d).blank()) ? cau.desc_agg(2) : saved_descr.row(d), 'I');
a.set_cgs_row(-1, imp, conto, (saved_descr.objptr(d) == nullptr || saved_descr.row(d).blank()) ? cau.desc_agg(2) : saved_descr.row(d), cgrowtype_imponibile);
}
}
// Aggiorna conto IVA sulla riga contabile
@ -1530,7 +1539,12 @@ void TPrimanota_application::add2cg_row(TSheet_field& s, TToken_string & row, TS
real imposta(d > 0 ? iva_det : iva_ind);
if (d == 2)
imposta = revcharge ? imposta : ZERO;
{
TBill billind; cau.bill(RIGA_IVA_NON_DETRAIBILE, billind);
const bool iva_ind_al_costo = !billind.ok();
imposta = revcharge ? row.get_real(cid2index(IVA_IMPOSTA)) : ZERO;
}
TImporto iva = a.real2imp(imposta, tipod); // Imponibile
TImporto i(a.get_cgs_imp(posiva));
@ -1618,7 +1632,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& s, int r, KEY k)
if (acquisto_revcharge)
{
TImporto tot_revcharge;
const int posiva = type2pos('V');
const int posiva = type2pos(cgrowtype_revcharge);
TEdit_field & revcharge = a.curr_mask().efield(F_REVCHARGE);
if (posiva >= 0)
@ -1633,27 +1647,27 @@ bool TPrimanota_application::iva_notify(TSheet_field& s, int r, KEY k)
if (m.get_int(F_ANNOIVA) >= 2015 && (tipocf == "C") && a.get_version() >= 12)
{
const int r_norm = type2pos('D');
const int r_norm = type2pos(cgrowtype_IVAdet);
const bool split_needed = r_norm >= 0 && a.is_split_payment();
if (split_needed)
{
TImporto imp_split = a.get_cgs_imp(r_norm);
const int r_split1 = type2pos('1');
const int r_split1 = type2pos(cgrowtype_clisplit);
if (r_split1 < 0)
{
const int r_tot = max(0, type2pos('T'));
const int r_tot = max(0, type2pos(cgrowtype_totale));
TToken_string row_tot = a.cgs().row(r_tot);
TBill cliente_split(row_tot, 2, 0x1); // Imposta anche tipo = Cliente
const char* desc = TR("IVA art.17-ter D.P.R. 633/1972");
a.set_cgs_row(-1, imp_split, cliente_split, desc, '1');
a.set_cgs_row(-1, imp_split, cliente_split, desc, cgrowtype_clisplit);
}
else
a.set_cgs_imp(r_split1, imp_split);
const int r_split2 = type2pos('2');
const int r_split2 = type2pos(cgrowtype_IVAsplit);
imp_split.swap_section();
if (r_split2 < 0)
@ -1662,19 +1676,19 @@ bool TPrimanota_application::iva_notify(TSheet_field& s, int r, KEY k)
TBill iva_split(row_norm, 3);
const char* desc = TR("IVA art.17-ter D.P.R. 633/1972");
a.set_cgs_row(-1, imp_split, iva_split, desc, '2');
a.set_cgs_row(-1, imp_split, iva_split, desc, cgrowtype_IVAsplit);
}
else
a.set_cgs_imp(r_split2, imp_split);
}
else
{
const int r_split2 = type2pos('2');
const int r_split2 = type2pos(cgrowtype_IVAsplit);
if (r_split2 >= 0)
a.reset_cgs_row(r_split2);
const int r_split1 = type2pos('1');
const int r_split1 = type2pos(cgrowtype_clisplit);
if (r_split1 >= 0)
a.reset_cgs_row(r_split1);
@ -1797,7 +1811,7 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (m.get(CG_ROWTYPE)[0] == 'T' && !app().causale().corrispettivi())
if (m.get(CG_ROWTYPE)[0] == cgrowtype_totale && !app().causale().corrispettivi())
{
const TString4 tipo = app().clifo(); // Tipo conto richiesto dal movimento
TString4 cf = m.get(f.dlg()-2);
@ -2713,7 +2727,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
int gruppo = 0, conto = 0;
long codice = corri ? 0L : m.get_long(F_CODCLIFOR);
TSheet_field& ss = cgs();
const int riga_totale = type2pos('T');
const int riga_totale = type2pos(cgrowtype_totale);
// Cerca di preservare il gruppo-conto-sottoconto sulla riga totale
if (riga_totale >= 0)
@ -2778,7 +2792,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
{
TToken_string& r = ss.row(riga_totale);
if (row_type(r) == 'T')
if (row_type(r) == cgrowtype_totale)
{
r.rtrim(2);
ss.enable_cell(riga_totale, 0);
@ -2799,11 +2813,10 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
if (descr.blank())
descr = m.get(F_DESCR);
TImporto imp = real2imp(m.get_real(F_TOTALE), 'T');
TImporto imp = real2imp(m.get_real(F_TOTALE), cgrowtype_totale);
set_cgs_row(riga_totale, imp.normalize(), nuovo, descr, 'T');
set_cgs_row(riga_totale, imp.normalize(), nuovo, descr, cgrowtype_totale);
}
calcola_imp(); // Ricalcola totale IVA
calcola_saldo(); // Ricalcola sbilanci
}
@ -3045,7 +3058,7 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
const bool corr = a.causale().corrispettivi();
const bool acq3 = (acquisto) && (codiva.tipo_indetraibilita() == 3 || row.get_int(2) == 3);
const bool reverse_charge_attivo = acquisto && a.causale().reverse_charge() && codiva.reverse_charge_attivo();
const bool reverse_charge_attivo = acquisto && a.causale().reverse_charge(); // se la causale e di reverse charge suppongo che il movimento lo sia e quindi metto il flag in ogni caso
real tot = a.totale_documento(); // Calcola totale documento
real imposta; // Calcola imposta
@ -3103,7 +3116,7 @@ static void force_iva_det_bill()
{
const char rtype = row->get_char(cid2index(CG_ROWTYPE));
if (rtype == 'D')
if (rtype == cgrowtype_IVAdet)
{
row->add(conto.get(0), cid2index(CG_TIPO));
row->add(conto.get(), cid2index(CG_GRUPPO));
@ -3398,14 +3411,14 @@ void TPrimanota_application::add_cgs_ritenute(char tipo)
return;
TMask& m = curr_mask();
const real imp = m.get(tipo=='F' ? F_RITFIS : (tipo=='S' ? F_RITSOC : F_REVCHARGE)); // Determina importo
const real imp = m.get(tipo== cgrowtype_ritfis ? F_RITFIS : (tipo== cgrowtype_ritsoc ? F_RITSOC : F_REVCHARGE)); // Determina importo
const int pos = type2pos(tipo); // Cerca la riga contabile
if (pos < 0) // Se non c'e' ...
{
if (!imp.is_zero()) // ... e l'importo e' valido crea una nuova riga di ritenute
{
const int riga = tipo=='F' ? RIGA_RITENUTE_FISCALI : (tipo== 'S' ? RIGA_RITENUTE_SOCIALI : RIGA_REVERSE_CHARGE);
const int riga = tipo== cgrowtype_ritfis ? RIGA_RITENUTE_FISCALI : (tipo== cgrowtype_ritsoc ? RIGA_RITENUTE_SOCIALI : RIGA_REVERSE_CHARGE);
TBill conto; causale().bill(riga, conto);
const TString desc = causale().desc_agg(riga);
@ -3422,7 +3435,7 @@ void TPrimanota_application::add_cgs_ritenute(char tipo)
if (m.insert_mode())
{
if (tipo != 'V')
if (tipo != cgrowtype_revcharge)
{
TEdit_field & iva = m.efield(F_CODIVA);
@ -3467,8 +3480,8 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
// Certified 100%
bool TPrimanota_application::ritfis_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
app().add_cgs_ritenute('F');
if (f.running_check(key))
app().add_cgs_ritenute(cgrowtype_ritfis);
return true;
}
@ -3477,8 +3490,8 @@ bool TPrimanota_application::ritfis_handler(TMask_field& f, KEY key)
// Certified 100%
bool TPrimanota_application::ritsoc_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
app().add_cgs_ritenute('S');
if (f.running_check(key))
app().add_cgs_ritenute(cgrowtype_ritsoc);
return true;
}
@ -3737,10 +3750,10 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
cg.reset();
a.add_cgs_tot(m); // Genera totale documento
if (!m.empty(F_RITFIS)) a.add_cgs_ritenute('F'); // Genera ritenute fiscali
if (!m.empty(F_RITSOC)) a.add_cgs_ritenute('S'); // Genera ritenute sociali
// if (!m.empty(F_REVCHARGE) && !m.active(F_REVCHARGE))
// a.add_cgs_ritenute('V'); // Genera reverse charge
if (!m.empty(F_RITFIS))
a.add_cgs_ritenute(cgrowtype_ritfis); // Genera ritenute fiscali
if (!m.empty(F_RITSOC))
a.add_cgs_ritenute(cgrowtype_ritsoc); // Genera ritenute sociali
TToken_string oldrow(128);
@ -3956,7 +3969,7 @@ void TPrimanota_application::set_totale(TMask& cg_msk, const shared_ptr<TPro_msk
{
totale -= rit;
cg_msk.set(F_RITFIS, rit);
app().add_cgs_ritenute('F');
app().add_cgs_ritenute(cgrowtype_ritfis);
}
else if (msk->is_doc_split())
totale = msk->get_tot_imp_riva();

View File

@ -21,10 +21,6 @@
#include "cglib.h"
#endif
#ifndef __CG2101_H
#include "cg2101.h"
#endif
#ifndef __CG2100_H
#include "cg2100.h"
#endif
@ -293,7 +289,7 @@ protected:
static TipoIVA reg2IVA(const char* registro, int anno);
static const real& cod2IVA(const TMask& m);
static real scorpora(real& imponibile, const real& percentuale);
static int get_importi_iva(const TToken_string& row, real& imp_det, real& iva_det, real& imp_ind, real& iva_ind);
static int get_importi_iva(TToken_string & row, real& imp_det, real& iva_det, real& imp_ind, real& iva_ind);
static int bill2pos(const TBill& conto, char tipo);
TipoIVA cau2IVA(const char* causale, int anno);

View File

@ -1135,10 +1135,10 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
TMask& cm = a.curr_mask();
const char tipo = m.get(CG_ROWTYPE)[0];
const bool is_nota = tipo == 'T' && a.causale().tipomov() == 2 && cm.field(F_NUMRIF).active();
const bool is_nota = tipo == cgrowtype_totale && a.causale().tipomov() == 2 && cm.field(F_NUMRIF).active();
const bool tras = a._as400 && a.causale().tipomov() > 1 && m.get(CG_TIPO).not_empty();
if (tipo == 'K' || is_nota || tras)
if (tipo == cgrowtype_cliforsc || is_nota || tras)
{
TSheet_field& s = *m.get_sheet();
const int riga = s.selected();
@ -1156,9 +1156,9 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
const TImporto importo(a.get_cgs_imp(riga));
const TImporto speso(a.partite().importo_speso(curreg, riga+1));
if (tipo == 'K' && !speso.is_zero())
if (tipo == cgrowtype_cliforsc && !speso.is_zero())
{
a.disable_cgs_cells(riga, 'K');
a.disable_cgs_cells(riga, cgrowtype_cliforsc);
a.cgs().force_update(riga);
}
@ -1226,7 +1226,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (old_importo != new_importo || old_conto != new_conto)
{
int old_riga = _easy_sal ? type2pos('I') : bill2pos(old_conto, 'I');
int old_riga = _easy_sal ? type2pos(cgrowtype_imponibile) : bill2pos(old_conto, cgrowtype_imponibile);
if (old_riga >= 0)
{
const bool empty = sub_cgs_imp(old_riga, old_importo);
@ -1237,23 +1237,27 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (!old_importo.is_zero())
{
TImporto imp = old_importo; imp.swap_section();
set_cgs_row(old_riga, imp, old_conto, "", 'I');
set_cgs_row(old_riga, imp, old_conto, "", cgrowtype_imponibile);
}
// Importo della contropartita
if (!new_importo.is_zero() && new_conto.ok())
{
int new_riga = _easy_sal ? type2pos('I') : bill2pos(new_conto, 'I');
int new_riga = _easy_sal ? type2pos(cgrowtype_imponibile) : bill2pos(new_conto, cgrowtype_imponibile);
if (new_riga < 0)
{
const int tp = somma.get_int(PART_TIPOPAG);
const int da = p.tipopag2causale(tp);
const TString descagg(causale().desc_agg(da));
new_riga = set_cgs_row(new_riga, new_importo, new_conto, descagg, 'I');
new_riga = set_cgs_row(new_riga, new_importo, new_conto, descagg, cgrowtype_imponibile);
TToken_string& cli_row = sheet.row(riga_contabile-1);
TBill contro; contro.get(cli_row, 9, 0x3);
if (!contro.ok()) // Completa controparita della riga cliente se necessario
if (!contro.ok()) // Completa controparita della riga cliente se necessario
new_conto.add_to(cli_row, 9, 0x3);
TString80 descr = cli_row.get(cid2index(CG_DESCR));
if (descr.blank()) // Compila descrizione della riga cliente se necessario
@ -1276,7 +1280,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
TToken_string& new_row = sheet.row(new_riga);
new_conto.add_to(new_row, 2, 0x3);
// Aggiorna contropartita delle righe cliente
FOR_EACH_SHEET_ROW(sheet, r, cli_row) if (row_type(*cli_row) == 'K')
FOR_EACH_SHEET_ROW(sheet, r, cli_row) if (row_type(*cli_row) == cgrowtype_cliforsc)
new_conto.add_to(*cli_row, 9, 0x3);
}
}
@ -1289,13 +1293,13 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (old_ritenute != new_ritenute)
{
const TImporto grow_ritenute(causale().sezione_ritfis(), new_ritenute - old_ritenute);
const int riga = type2pos('F');
const int riga = type2pos(cgrowtype_ritfis);
if (riga < 0)
{
TBill conto_rit; causale().bill(RIGA_PAG_RITFIS, conto_rit);
const TString desc(causale().desc_agg(RIGA_PAG_RITFIS));
set_cgs_row(riga, grow_ritenute, conto_rit, desc, 'F');
set_cgs_row(riga, grow_ritenute, conto_rit, desc, cgrowtype_ritfis);
}
else
{
@ -1310,12 +1314,13 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
if (old_ritsoc != new_ritsoc)
{
const TImporto grow_ritenute(causale().sezione_ritsoc(), new_ritsoc-old_ritsoc);
const int riga = type2pos('S');
const int riga = type2pos(cgrowtype_ritsoc);
if (riga < 0)
{
TBill conto_rit; causale().bill(RIGA_PAG_RITSOC, conto_rit);
const TString desc(causale().desc_agg(RIGA_PAG_RITSOC));
set_cgs_row(riga, grow_ritenute, conto_rit, desc, 'S');
set_cgs_row(riga, grow_ritenute, conto_rit, desc, cgrowtype_ritsoc);
}
else
{
@ -1378,7 +1383,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
// Se c'e' variazione nella differenza cambi
if (old_diffcam != new_diffcam)
{
const int riga_diffcam = type2pos('C');
const int riga_diffcam = type2pos(cgrowtype_diffcambio);
TImporto grow_diffcam(old_diffcam);
grow_diffcam -= new_diffcam;
grow_diffcam.normalize();
@ -1387,12 +1392,14 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
{
TBill conto_diffcam; causale().bill(RIGA_DIFFCAM, conto_diffcam);
const TString desc(causale().desc_agg(RIGA_DIFFCAM));
set_cgs_row(riga_diffcam, grow_diffcam, conto_diffcam, desc, 'C');
set_cgs_row(riga_diffcam, grow_diffcam, conto_diffcam, desc, cgrowtype_diffcambio);
}
else
{
const bool empty = add_cgs_imp(riga_diffcam, grow_diffcam);
if (empty)
if (empty)
sheet.destroy(riga_diffcam);
}

View File

@ -937,7 +937,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (!riga.is_fattura())
continue;
TToken_string& riga_fattura = gm.add_colored_row(sheet, 'K');
TToken_string& riga_fattura = gm.add_colored_row(sheet, cgrowtype_cliforsc);
riga_fattura.add(ri);
riga_fattura.add("");
riga_fattura.add(riga.get(PART_DATADOC));
@ -958,7 +959,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
const TRiga_scadenze& scad = riga.rata(ra);
TToken_string& row = gm.add_colored_row(sheet, 'I');
TToken_string& row = gm.add_colored_row(sheet, cgrowtype_imponibile);
row = riga_fattura;
row.add(ra, 1);
row.add(scad.get(SCAD_DATASCAD), 3);
@ -992,7 +994,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const int nrig = sum.get_int(PART_NUMRIG);
const bool linked = nreg == gm._numreg && nrig == gm._numrig;
TToken_string& row = gm.add_colored_row(sheet, linked ? 'X' : ' ');
row.add(ri);
row.add(ri);
row.add(ra);
row.add(sum.get(PART_DATADOC));
row.add(sum.get(PART_DATAPAG));
@ -1022,7 +1025,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (!rit.is_zero())
{
TToken_string& rrit = gm.add_colored_row(sheet, 'R');
TToken_string& rrit = gm.add_colored_row(sheet, cgrowtype_ritfis);
rrit.add(TR("Ritenute professionali"), 4);
gm.add_importo(rrit, rit, FALSE);
rrit.add((int)sum.tipo(), 11);
@ -1033,7 +1037,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (!soc.is_zero())
{
TToken_string& rrit = gm.add_colored_row(sheet, 'R');
TToken_string& rrit = gm.add_colored_row(sheet, cgrowtype_ritsoc);
rrit.add(TR("Ritenute sociali"), 4);
gm.add_importo(rrit, soc, FALSE);
@ -1083,8 +1087,9 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const TImporto diff(sez, pag.get_real(PAGSCA_DIFFCAM));
if (!diff.is_zero())
{
TToken_string& rdiff = gm.add_colored_row(sheet, 'C');
rdiff.add(TR("Differenza cambio"), 4);
TToken_string& rdiff = gm.add_colored_row(sheet, cgrowtype_diffcambio);
rdiff.add(TR("Differenza cambio"), 4);
if (is_totdoc)
gm.add_importo(rdiff, diff);
rdiff.add((int)sum.tipo(), 11);
@ -1126,6 +1131,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const int nrig = sum.get_int(PART_NUMRIG);
const bool linked = nreg == gm._numreg && nrig == gm._numrig;
TToken_string& row = gm.add_colored_row(sheet, linked ? 'X' : ' ');
row.add(pag.get(PAGSCA_NRIGA));
row.add(pag.get(PAGSCA_NRATA));
row.add(sum.get(PART_DATADOC));
@ -1156,7 +1162,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const TImporto rit(sez, pag.get_real(PAGSCA_RITENUTE));
if (!rit.is_zero())
{
TToken_string& row = gm.add_colored_row(sheet, 'R');
TToken_string& row = gm.add_colored_row(sheet, cgrowtype_ritprof);
row.add(TR("Ritenute professionali"), 4);
gm.add_importo(row, rit, FALSE);
row.add((int)sum.tipo(), 11);
@ -1166,7 +1173,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const TImporto soc(sum.sezione_ritsoc(), pag.get_real(PAGSCA_RITSOC));
if (!soc.is_zero())
{
TToken_string& row = gm.add_colored_row(sheet, 'R');
TToken_string& row = gm.add_colored_row(sheet, cgrowtype_ritsoc);
row.add(TR("Ritenute sociali"), 4);
gm.add_importo(row, soc, FALSE);
row.add((int)sum.tipo(), 11);
@ -1188,7 +1196,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
const char tipo_abb = pag.get_char(PAGSCA_PASSATT);
TToken_string& rabb = gm.add_colored_row(sheet, tipo_abb);
rabb.add(tipo_abb == 'A' ? TR("Abbuoni attivi") : TR("Abbuoni passivi"), 4);
rabb.add(tipo_abb == cgrowtype_abbattivo ? TR("Abbuoni attivi") : TR("Abbuoni passivi"), 4);
if (in_valuta)
{
TImporto abb_lit = abb;
@ -1215,7 +1223,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (lastrow > 0)
{
TToken_string& sp = gm.add_colored_row(sheet, 'T');
TToken_string& sp = gm.add_colored_row(sheet, cgrowtype_totale);
sp.add(TR("Saldo partita"), 4);
if (prima_valuta.in_valuta())
sp << ' ' << prima_valuta.codice();
@ -1457,7 +1466,7 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
causale.bill(caus = 2, contro); // ... prende il primo
if (contro.sottoconto() == 0L)
{
const int nrow = app().type2pos('I');
const int nrow = app().type2pos(cgrowtype_imponibile);
if (nrow >= 0)
{
@ -1851,7 +1860,8 @@ void TGame_mask::update_saldo_clifo()
append_conto(r);
COLOR back, fore;
app().type2colors('T', back, fore);
app().type2colors(cgrowtype_totale, back, fore);
partite().set_back_and_fore_color(back, fore, i);
if (i > 0) // Se ho aggiunto una riga devo decolorare la precedente
partite().set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, i-1);
@ -2249,7 +2259,7 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
{
const char tipo = m.get(CG_TIPO)[0];
const char rt = m.get(CG_ROWTYPE)[0];
if (rt == 'T' && tipo <= ' ') // Nelle note di credito DEVE essere un clifo
if (rt == cgrowtype_totale && tipo <= ' ') // Nelle note di credito DEVE essere un clifo
return false;
const int gruppo = m.get_int(CG_GRUPPO);

View File

@ -1115,7 +1115,7 @@ void TEasySolder_mask::init(const TBill& conto, long numreg, int numrig)
reset(G_TUTTE);
TBill controbill;
const int riga_i = app().type2pos('I');
const int riga_i = app().type2pos(cgrowtype_imponibile);
if (riga_i >= 0)
{
TToken_string& row = app().cgs().row(riga_i);

View File

@ -13,11 +13,11 @@
#include "../ca/calib02.h"
#include "cg2200.h"
//#include "cg2101.h"
//#include "cglib01.h"
//#include "cglib02.h"
#include "cglib.h"
class TProvvisori_msk : public TAutomask
{
char _provv; // Tipo provvisori da cancellare

View File

@ -2137,6 +2137,7 @@ int TMovimentoPN::analizza_riga_IVA(const real& imptot, const real& ivatot, cons
const bool corrispettivo = caus.corrispettivi();
TBill billind; caus.bill(RIGA_IVA_NON_DETRAIBILE, billind);
const bool iva_ind_al_costo = !billind.ok();
return analizza_IVA(imptot, ivatot, perc_ind, corrispettivo, iva_ind_al_costo,
codiva, imp_det, iva_det, imp_ind, iva_ind);
}
@ -2163,6 +2164,7 @@ void TMovimentoPN::adjust_rowtypes()
const TString4 codiva = row.get(RMI_CODIVA);
const TString4 codind = row.get(RMI_TIPODET);
real imp_det, iva_det, imp_ind, iva_ind;
analizza_riga_IVA(imponibile, imposta, causale, annodoc, codiva, codind,
imp_det, iva_det, imp_ind, iva_ind);

View File

@ -396,7 +396,8 @@ void TMovimento_contabile::adjust_rowtypes()
int tipodet = 0;
const real perc_ind = indetraibile_al(codind, causale, annodoc, tipodet);
real imp_det, iva_det, imp_ind, iva_ind;
analizza_IVA(imponibile, imposta, perc_ind, corrispettivo, iva_ind_al_costo,
analizza_IVA(imponibile, imposta, perc_ind, corrispettivo, iva_ind_al_costo,
codiva, imp_det, iva_det, imp_ind, iva_ind);
conti.add(bill, imponibile);
conti.add_iva(false, iva_ind);