Patch level : 12.0 1066
Files correlati : cg4.exe Commento : Le note di credito per cassa non legate a fattura non venivao liquidate dopo un anno. Interno : Diana Le note di credito 40177 40178 40179 sono state sganciate per liquidarle nma non venivano liquidate ugualmente dopo un anno.
This commit is contained in:
parent
e74a377286
commit
3cdb00e15f
@ -449,7 +449,7 @@ protected:
|
|||||||
bool print_inc_diff_log(int& rw, int tipoatt, int tipoiva);
|
bool print_inc_diff_log(int& rw, int tipoatt, int tipoiva);
|
||||||
bool print_dainc_diff_log(int& rw, int tipoatt, int tipoiva);
|
bool print_dainc_diff_log(int& rw, int tipoatt, int tipoiva);
|
||||||
bool ivadiff_chiusa(const TRectype& mov, const TDate& fine) const;
|
bool ivadiff_chiusa(const TRectype& mov, const TDate& fine) const;
|
||||||
bool sarebbe_maturata(const TRectype& mov, const TDate& inizio, const TDate& fine) const;
|
bool sarebbe_maturata(const TRectype& mov, const TDate& inizio, const TDate& fine, tipo_movimento tm2check = tm_fattura) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -33,16 +33,36 @@
|
|||||||
// ----------------------------------------------------- ******************
|
// ----------------------------------------------------- ******************
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
bool check_nreg(long nreg)
|
|
||||||
{
|
|
||||||
long __nreg[] = { 41221L, 0L };
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (__nreg[i] > 0L)
|
#define _BREAK(func, par, values) func(par, values);
|
||||||
if (__nreg[i++] == nreg)
|
#define BREAK_DBG _BREAK(check_nreg, __nreg, __values)
|
||||||
|
#define LOAD_VAL load_values()
|
||||||
|
|
||||||
|
const char * load_values()
|
||||||
|
{
|
||||||
|
TFilename dbgname;
|
||||||
|
TFilename filename("dbg");
|
||||||
|
|
||||||
|
filename << main_app().name();
|
||||||
|
dbgname.currdir();
|
||||||
|
dbgname.add(filename);
|
||||||
|
dbgname.ext("ini");
|
||||||
|
return ini_get_string(dbgname, "Main", "Values");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool check_nreg(TToken_string &nreg, TToken_string &values)
|
||||||
|
{
|
||||||
|
long reg = atol(nreg);
|
||||||
|
|
||||||
|
FOR_EACH_TOKEN(values, val)
|
||||||
|
{
|
||||||
|
if (atol(val) == reg)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define BREAK_DBG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool TLiquidazione_app::recalc_all()
|
bool TLiquidazione_app::recalc_all()
|
||||||
@ -639,6 +659,9 @@ bool TLiquidazione_app::ivadiff_chiusa(const TRectype& mov, const TDate& fine) c
|
|||||||
TRectype& rid = id.curr();
|
TRectype& rid = id.curr();
|
||||||
rid.put(MOV_NUMREG, numreg);
|
rid.put(MOV_NUMREG, numreg);
|
||||||
int err = id.read(_isgteq);
|
int err = id.read(_isgteq);
|
||||||
|
TDate data_maturazione = mov.get_date(MOV_DATADOC);
|
||||||
|
|
||||||
|
data_maturazione.addyear();
|
||||||
if (err == NOERR && rid.get_long(MOV_NUMREG) == numreg)
|
if (err == NOERR && rid.get_long(MOV_NUMREG) == numreg)
|
||||||
{
|
{
|
||||||
bool some_pag = false; // Ci sono pagamenti?
|
bool some_pag = false; // Ci sono pagamenti?
|
||||||
@ -646,7 +669,7 @@ bool TLiquidazione_app::ivadiff_chiusa(const TRectype& mov, const TDate& fine) c
|
|||||||
for (; err == NOERR && rid.get_long(MOV_NUMREG) == numreg; err = id.next())
|
for (; err == NOERR && rid.get_long(MOV_NUMREG) == numreg; err = id.next())
|
||||||
{
|
{
|
||||||
const TDate data = rid.get("DATAREGP");
|
const TDate data = rid.get("DATAREGP");
|
||||||
if (data > fine && !_end_cassa)
|
if ((data > fine || data > data_maturazione) && !_end_cassa)
|
||||||
continue;
|
continue;
|
||||||
if (data == fine && rid.get_long("NUMREGP") == numreg && !_end_cassa)
|
if (data == fine && rid.get_long("NUMREGP") == numreg && !_end_cassa)
|
||||||
continue; // Ignora pagamento automatico dopo un anno
|
continue; // Ignora pagamento automatico dopo un anno
|
||||||
@ -675,9 +698,11 @@ static TDate data_maturazione_IVA_diff(const TRectype& mov)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fattura più vecchia di un anno a ente NON pubblico
|
// Fattura più vecchia di un anno a ente NON pubblico
|
||||||
bool TLiquidazione_app::sarebbe_maturata(const TRectype& mov, const TDate& inizio, const TDate& fine) const
|
bool TLiquidazione_app::sarebbe_maturata(const TRectype& mov, const TDate& inizio, const TDate& fine, tipo_movimento tm2check) const
|
||||||
{
|
{
|
||||||
if (mov.get_int(MOV_TIPOMOV) != tm_fattura)
|
const tipo_movimento tm = (tipo_movimento) mov.get_int(MOV_TIPOMOV);
|
||||||
|
|
||||||
|
if (tm != tm2check)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const TDate data_lim = data_maturazione_IVA_diff(mov); // Data limite (un anno dopo quella di riferimento)
|
const TDate data_lim = data_maturazione_IVA_diff(mov); // Data limite (un anno dopo quella di riferimento)
|
||||||
@ -686,8 +711,9 @@ bool TLiquidazione_app::sarebbe_maturata(const TRectype& mov, const TDate& inizi
|
|||||||
|
|
||||||
// La data di riferimento sarebbe quella di consegna della merce, ma non avendola usiamo la data documento.
|
// La data di riferimento sarebbe quella di consegna della merce, ma non avendola usiamo la data documento.
|
||||||
// In assenza della data documento siamo costretti ad usare la data di registrazione
|
// In assenza della data documento siamo costretti ad usare la data di registrazione
|
||||||
const TDate data_reg = mov.get(MOV_DATAREG);
|
TDate data_reg = mov.get(MOV_DATAREG);
|
||||||
const TDate data_doc = mov.get(MOV_DATADOC);
|
TDate data_doc = mov.get(MOV_DATADOC);
|
||||||
|
|
||||||
const TDate data_rif = data_doc.ok() && data_doc < data_reg ? data_doc : data_reg;
|
const TDate data_rif = data_doc.ok() && data_doc < data_reg ? data_doc : data_reg;
|
||||||
|
|
||||||
const long giorni = fine - data_rif;
|
const long giorni = fine - data_rif;
|
||||||
@ -1121,11 +1147,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
|
|
||||||
TDate date = _mov->get(MOV_DATAREG);
|
TDate date = _mov->get(MOV_DATAREG);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
long nr = _mov->get_long(MOV_NUMREG);
|
TToken_string __nreg = _mov->get(MOV_NUMREG);
|
||||||
|
TToken_string __values = LOAD_VAL;
|
||||||
check_nreg(nr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BREAK_DBG;
|
||||||
const int liqmonth = _mov->get_int(MOV_MESELIQ);
|
const int liqmonth = _mov->get_int(MOV_MESELIQ);
|
||||||
const TString4 reg = _mov->get("REG");
|
const TString4 reg = _mov->get("REG");
|
||||||
const bool isreg = look_reg(reg);
|
const bool isreg = look_reg(reg);
|
||||||
@ -1133,9 +1159,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
const TRegistro & r = cached_registro(_reg->curr());
|
const TRegistro & r = cached_registro(_reg->curr());
|
||||||
const bool corrisp = r.corrispettivi();
|
const bool corrisp = r.corrispettivi();
|
||||||
const tiporeg tipomov = r.tipo_registro();
|
const tiporeg tipomov = r.tipo_registro();
|
||||||
// const bool corrisp = _reg->get_bool("B0");
|
// const bool corrisp = _reg->get_bool("B0");
|
||||||
// const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
|
// const tiporeg tipomov = (tiporeg)_reg->get_int("I0"); // 1=Vendite; 2=Acquisti
|
||||||
tipo_movimento tm = (tipo_movimento) _mov->get_int(MOV_TIPOMOV);
|
tipo_movimento tm = (tipo_movimento)_mov->get_int(MOV_TIPOMOV);
|
||||||
real imp_split_payment;
|
real imp_split_payment;
|
||||||
|
|
||||||
if (tm == tm_nessuno)
|
if (tm == tm_nessuno)
|
||||||
@ -1173,35 +1199,42 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
TPartite_array arrpart; // Partite interessate
|
TPartite_array arrpart; // Partite interessate
|
||||||
TPointer_array pagscatt; // Righe di pagsca interessate
|
TPointer_array pagscatt; // Righe di pagsca interessate
|
||||||
|
|
||||||
#ifdef DBG
|
BREAK_DBG;
|
||||||
check_nreg(nr);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fattrit)
|
if (fattrit)
|
||||||
dok = (atoi(_year) == datadoc.year()) && _month == 13;
|
dok = (atoi(_year) == datadoc.year()) && _month == 13;
|
||||||
|
|
||||||
if (bIsMovDiff && tm == tm_fattura)
|
if (bIsMovDiff)
|
||||||
{
|
{
|
||||||
const bool id_chiusa = ivadiff_chiusa(_mov->curr(), TDate(31,12,inizio.year()-1));
|
if ((tm == tm_fattura) || (tm == tm_nota_credito && !dok))
|
||||||
|
{
|
||||||
|
const bool id_chiusa = ivadiff_chiusa(_mov->curr(), TDate(31, 12, inizio.year() - 1));
|
||||||
if (!dok && id_chiusa)
|
if (!dok && id_chiusa)
|
||||||
continue; // Salta vecchi movimenti differiti già chiusi
|
continue; // Salta vecchi movimenti differiti già chiusi
|
||||||
|
|
||||||
// Sezione preferita per fatture decisa in base a vendita->'A' o acquisto->'D'
|
// Sezione preferita per fatture decisa in base a vendita->'A' o acquisto->'D'
|
||||||
const char sezfat = tipomov == vendita ? 'D' : 'A';
|
const char sezfat = tipomov == vendita ? 'D' : 'A';
|
||||||
const char sezpag = (sezfat=='D') ? 'A' : 'D';
|
const char sezpag = (sezfat == 'D') ? 'A' : 'D';
|
||||||
const long numreg = _mov->get_long(MOV_NUMREG);
|
const long numreg = _mov->get_long(MOV_NUMREG);
|
||||||
TDate datainc = fine;
|
TDate datainc = fine;
|
||||||
real tot_incassato, tot_da_incassare;
|
real tot_incassato, tot_da_incassare;
|
||||||
int flag_pg_nc = 0; // Ci sono pagamenti (0x1) e/o note di credito(0x2) ?
|
int flag_pg_nc = 0; // Ci sono pagamenti (0x1) e/o note di credito(0x2) ?
|
||||||
bool game_found = false;
|
bool game_found = false;
|
||||||
|
TImporto residuo;
|
||||||
|
|
||||||
|
BREAK_DBG;
|
||||||
if (has_sc)
|
if (has_sc)
|
||||||
{
|
{
|
||||||
arrpart.add_numreg(numreg);
|
arrpart.add_numreg(numreg);
|
||||||
|
|
||||||
const TPartita* p = arrpart.first();
|
const TPartita* p = arrpart.first();
|
||||||
|
|
||||||
|
if ((tm == tm_fattura) || (tm == tm_nota_credito && p->prima_fattura() < 0)) // fattura o nota di credito senza fattura
|
||||||
|
{
|
||||||
const int row = p ? p->mov2rig(numreg, 0) : 0;
|
const int row = p ? p->mov2rig(numreg, 0) : 0;
|
||||||
|
|
||||||
|
if (p != nullptr)
|
||||||
|
residuo = p->calcola_saldo_al(false, inizio);
|
||||||
|
|
||||||
game_found = row > 0;
|
game_found = row > 0;
|
||||||
if (game_found && !id_chiusa)
|
if (game_found && !id_chiusa)
|
||||||
{
|
{
|
||||||
@ -1219,12 +1252,14 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
TImporto pg_per, nc_per;
|
TImporto pg_per, nc_per;
|
||||||
bool regular_month = orizzonte >= date;
|
bool regular_month = orizzonte >= date;
|
||||||
bool first_month = regular_month && date > inizio + 1L;
|
bool first_month = regular_month && date > inizio + 1L;
|
||||||
|
|
||||||
|
BREAK_DBG;
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
check_nreg(nr);
|
|
||||||
if (rp.get_long(PART_NREG) == 100616)
|
if (rp.get_long(PART_NREG) == 100616)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
#endif
|
#endif
|
||||||
flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month;
|
flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month;
|
||||||
|
residuo += pg_per;
|
||||||
if (pagscatt.items() >= 2)
|
if (pagscatt.items() >= 2)
|
||||||
{
|
{
|
||||||
// Fondo tra loro le righe generate dallo stesso pagamento
|
// Fondo tra loro le righe generate dallo stesso pagamento
|
||||||
@ -1241,7 +1276,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (iva_diff || sarebbe_maturata(_mov->curr(), inizio + 1L, fine) || (iva_cass && _end_cassa))
|
if (iva_diff || ((abs(residuo.valore()) > UN_CENTESIMO) && sarebbe_maturata(_mov->curr(), inizio + 1L, fine, tm)) || (iva_cass && _end_cassa))
|
||||||
{
|
{
|
||||||
TPointer_array pagscaold;
|
TPointer_array pagscaold;
|
||||||
TImporto pg_tot, nc_tot;
|
TImporto pg_tot, nc_tot;
|
||||||
@ -1269,7 +1304,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
if (ps == obj)
|
if (ps == obj)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
BREAK_DBG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
@ -1293,9 +1328,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
saldo += incasso;
|
saldo += incasso;
|
||||||
saldo.normalize(sezfat);
|
saldo.normalize(sezfat);
|
||||||
incasso.normalize(sezpag);
|
incasso.normalize(sezpag);
|
||||||
if (saldo.valore() > ZERO)
|
if (saldo.valore() > ZERO || (tm == tm_nota_credito && saldo.valore() < ZERO))
|
||||||
tot_da_incassare = saldo.valore();
|
tot_da_incassare = saldo.valore();
|
||||||
if (incasso.valore() > ZERO)
|
if (incasso.valore() > ZERO || (tm == tm_nota_credito && incasso.valore() < ZERO))
|
||||||
tot_incassato = incasso.valore();
|
tot_incassato = incasso.valore();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1309,6 +1344,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!game_found) // No saldaconto o partita assente
|
if (!game_found) // No saldaconto o partita assente
|
||||||
{
|
{
|
||||||
datainc = iva_diff ? _mov->get_date(MOV_DATAINC) : TDate();
|
datainc = iva_diff ? _mov->get_date(MOV_DATAINC) : TDate();
|
||||||
@ -1317,12 +1353,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Fattura più vecchia di un anno a ente NON pubblico
|
// Fattura più vecchia di un anno a ente NON pubblico
|
||||||
if (sarebbe_maturata(_mov->curr(), inizio+1L, fine) || (iva_cass && _end_cassa))
|
if ((abs(residuo.valore()) > UN_CENTESIMO || !has_sc) && sarebbe_maturata(_mov->curr(), inizio + 1L, fine, tm) || (iva_cass && _end_cassa))
|
||||||
tot_da_incassare = _mov->get_real(MOV_TOTDOC);
|
tot_da_incassare = _mov->get_real(MOV_TOTDOC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Simulo incasso se necessario
|
// Simulo incasso se necessario
|
||||||
if (iva_cass && tot_da_incassare > ZERO) // già controllato se sarebbe_maturata(_mov->curr(), fine)
|
if (iva_cass && ((tot_da_incassare > ZERO) || (tm == tm_nota_credito && tot_da_incassare < ZERO))) // già controllato se sarebbe_maturata(_mov->curr(), fine)
|
||||||
{
|
{
|
||||||
tot_incassato = tot_da_incassare;
|
tot_incassato = tot_da_incassare;
|
||||||
|
|
||||||
@ -1331,16 +1367,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
datainc = data_end_cassa;
|
datainc = data_end_cassa;
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
else
|
else
|
||||||
int i = 1;
|
BREAK_DBG;
|
||||||
#endif
|
#endif
|
||||||
_mov->put(MOV_DATAINC, datainc);
|
_mov->put(MOV_DATAINC, datainc);
|
||||||
if (datainc < date)
|
if (datainc < date)
|
||||||
datainc = date;
|
datainc = date;
|
||||||
}
|
}
|
||||||
if (tot_incassato > ZERO && is_date_ok(datainc, month, liqmonth, year_int))
|
if ((tot_incassato > ZERO || (tm == tm_nota_credito && tot_incassato < ZERO)) && (!has_sc || abs(residuo.valore()) > UN_CENTESIMO) && is_date_ok(datainc, month, liqmonth, year_int))
|
||||||
{
|
{
|
||||||
flag_pg_nc = 0x1;
|
flag_pg_nc = 0x1;
|
||||||
TRectype* pagsca = new TRectype(LF_PAGSCA);
|
TRectype* pagsca = new TRectype(LF_PAGSCA);
|
||||||
|
|
||||||
pagsca->put(PAGSCA_TIPOC, _mov->get(MOV_TIPO));
|
pagsca->put(PAGSCA_TIPOC, _mov->get(MOV_TIPO));
|
||||||
pagsca->put(PAGSCA_SOTTOCONTO, _mov->get(MOV_CODCF));
|
pagsca->put(PAGSCA_SOTTOCONTO, _mov->get(MOV_CODCF));
|
||||||
pagsca->put(PAGSCA_ANNO, year_int);
|
pagsca->put(PAGSCA_ANNO, year_int);
|
||||||
@ -1352,6 +1389,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
}
|
}
|
||||||
if (flag_pg_nc)
|
if (flag_pg_nc)
|
||||||
dok = true;
|
dok = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* check register present, rmoviva present and date OK
|
* check register present, rmoviva present and date OK
|
||||||
@ -1415,7 +1453,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
TCodiceIVA civa(codiva);
|
TCodiceIVA civa(codiva);
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
check_nreg(nr);
|
BREAK_DBG;
|
||||||
if (tipomov == vendite)
|
if (tipomov == vendite)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
if (!bIsMovDiff && (civa.percentuale() == 20))
|
if (!bIsMovDiff && (civa.percentuale() == 20))
|
||||||
@ -1489,13 +1527,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
const bool soloiva = cached_causale(codcaus, atoi(_year)).reg().iva() != nessuna_iva && rmoviva.empty();
|
const bool soloiva = cached_causale(codcaus, atoi(_year)).reg().iva() != nessuna_iva && rmoviva.empty();
|
||||||
const TCli_for & clifo = cached_clifor(LF_MOV, _mov->curr());
|
const TCli_for & clifo = cached_clifor(LF_MOV, _mov->curr());
|
||||||
const int tp = clifo.alleg();
|
const int tp = clifo.alleg();
|
||||||
// const TRectype& clifo = cache().get_rec(LF_CLIFO, _mov->get(MOV_TIPO), _mov->get(MOV_CODCF));
|
|
||||||
// const int tp = clifo.get_int(CLI_ALLEG);
|
|
||||||
|
|
||||||
#ifdef DBG
|
|
||||||
check_nreg(nr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
BREAK_DBG;
|
||||||
if ((soloiva &&
|
if ((soloiva &&
|
||||||
(caus_reg.objptr(codcaus) != NULL || tp < 1)) &&
|
(caus_reg.objptr(codcaus) != NULL || tp < 1)) &&
|
||||||
sosp_imp != vol_affari)
|
sosp_imp != vol_affari)
|
||||||
@ -1533,9 +1566,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
const TDate datareg = _mov->get_date(MOV_DATAREG);
|
const TDate datareg = _mov->get_date(MOV_DATAREG);
|
||||||
int mesereg = liqmonth == 0 ? datareg.month() : liqmonth;
|
int mesereg = liqmonth == 0 ? datareg.month() : liqmonth;
|
||||||
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
|
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
|
||||||
#ifdef DBG
|
|
||||||
check_nreg(nr);
|
BREAK_DBG;
|
||||||
#endif
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
datafat = datareg;
|
datafat = datareg;
|
||||||
@ -1886,7 +1918,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
bool bMovDiffToAdd = true;
|
bool bMovDiffToAdd = true;
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
check_nreg(nr);
|
BREAK_DBG;
|
||||||
if (!bIsMovDiff && (civa.percentuale() == 20))
|
if (!bIsMovDiff && (civa.percentuale() == 20))
|
||||||
real p = imposta_orig / imponibile_orig * CENTO;
|
real p = imposta_orig / imponibile_orig * CENTO;
|
||||||
#endif
|
#endif
|
||||||
@ -2622,7 +2654,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
if (tipomov == vendita)
|
if (tipomov == vendita)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (codiva=="10" && !incdiff_iva.is_zero())
|
if (codiva == "10" && !incdiff_iva.is_zero())
|
||||||
{
|
{
|
||||||
const real oldv = tab->get("R29");
|
const real oldv = tab->get("R29");
|
||||||
const real newv = oldv + incdiff_iva;
|
const real newv = oldv + incdiff_iva;
|
||||||
|
@ -1570,9 +1570,19 @@ int TLiquidazione_app::print_acc_diff_xcassa(const _DescrItem& d)
|
|||||||
int i = 9;
|
int i = 9;
|
||||||
|
|
||||||
const real& totiva = d._r0;
|
const real& totiva = d._r0;
|
||||||
const real ivadiff_inc = d._r29;
|
real ivadiff_inc = d._r29;
|
||||||
const real ivadiff_pag = d._r33;
|
real ivadiff_pag = d._r33;
|
||||||
|
|
||||||
|
if (ivadiff_inc < ZERO)
|
||||||
|
{
|
||||||
|
ivadiff_pag -= ivadiff_inc;
|
||||||
|
ivadiff_inc = ZERO;
|
||||||
|
}
|
||||||
|
if (ivadiff_pag < ZERO)
|
||||||
|
{
|
||||||
|
ivadiff_inc -= ivadiff_pag;
|
||||||
|
ivadiff_pag = ZERO;
|
||||||
|
}
|
||||||
real ivaxcas_inc, ivaxcas_pag;
|
real ivaxcas_inc, ivaxcas_pag;
|
||||||
|
|
||||||
if (has_module(ICAUT))
|
if (has_module(ICAUT))
|
||||||
@ -2310,6 +2320,16 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
|||||||
xcasinc_iva_acq -= ind;
|
xcasinc_iva_acq -= ind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (xcasinc_iva < ZERO)
|
||||||
|
{
|
||||||
|
xcasinc_iva_acq -= xcasinc_iva;
|
||||||
|
xcasinc_iva = ZERO;
|
||||||
|
}
|
||||||
|
if (xcasinc_iva_acq < ZERO)
|
||||||
|
{
|
||||||
|
xcasinc_iva -= xcasinc_iva_acq;
|
||||||
|
xcasinc_iva_acq = ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
TToken_string tt(d._s0);
|
TToken_string tt(d._s0);
|
||||||
real iva_vend(tt.get(0));
|
real iva_vend(tt.get(0));
|
||||||
@ -2355,9 +2375,9 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
|||||||
if (!_is_visliq)
|
if (!_is_visliq)
|
||||||
iva_vend += rett_debt;
|
iva_vend += rett_debt;
|
||||||
set_row(rw++, FR("@11g@bIVA esigibile@r per il periodo@75g%r"), &iva_vend);
|
set_row(rw++, FR("@11g@bIVA esigibile@r per il periodo@75g%r"), &iva_vend);
|
||||||
if (!diffinc_iva.is_zero())
|
if (diffinc_iva != ZERO)
|
||||||
set_row(rw++,FR("@11g a liquidazione differita@75g%r"), &diffinc_iva);
|
set_row(rw++,FR("@11g a liquidazione differita@75g%r"), &diffinc_iva);
|
||||||
if (!xcasinc_iva.is_zero())
|
if (xcasinc_iva != ZERO)
|
||||||
set_row(rw++,FR("@11g per cassa@75g%r"), &xcasinc_iva);
|
set_row(rw++,FR("@11g per cassa@75g%r"), &xcasinc_iva);
|
||||||
if (_is_visliq)
|
if (_is_visliq)
|
||||||
set_row(rw++,FR("@11g$[r]Rettifiche IVA a debito$[n]@75g%r"), &rett_debt); // Rettifiche modificabili
|
set_row(rw++,FR("@11g$[r]Rettifiche IVA a debito$[n]@75g%r"), &rett_debt); // Rettifiche modificabili
|
||||||
@ -2367,9 +2387,9 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
|
|||||||
iva_acq += rett_cred;
|
iva_acq += rett_cred;
|
||||||
iva_acq -= cred_fattrit;
|
iva_acq -= cred_fattrit;
|
||||||
set_row(rw++, FR("@11g@bIVA detraibile@r per il periodo@58g%r"), &iva_acq);
|
set_row(rw++, FR("@11g@bIVA detraibile@r per il periodo@58g%r"), &iva_acq);
|
||||||
if (!diffinc_iva_acq.is_zero())
|
if (diffinc_iva_acq != ZERO)
|
||||||
set_row(rw++,FR("@11g a liquidazione differita@58g%r"), &diffinc_iva_acq);
|
set_row(rw++,FR("@11g a liquidazione differita@58g%r"), &diffinc_iva_acq);
|
||||||
if (!xcasinc_iva_acq.is_zero())
|
if (xcasinc_iva_acq != ZERO)
|
||||||
set_row(rw++,FR("@11g per cassa@58g%r"), &xcasinc_iva_acq);
|
set_row(rw++,FR("@11g per cassa@58g%r"), &xcasinc_iva_acq);
|
||||||
if (_is_visliq)
|
if (_is_visliq)
|
||||||
set_row(rw++,FR("@11g$[r]Rettifiche IVA a credito$[n]@58g%r"), &rett_cred);
|
set_row(rw++,FR("@11g$[r]Rettifiche IVA a credito$[n]@58g%r"), &rett_cred);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user