Patch level : 12.0 564
Files correlati : cg4.exe Modificata la liquidazione delle fatture in ritardo Aggiunta la gestione dell'uscita dal regime di cassa Sistemata la cancellazione di IVADIFF nei mesi e in 13. git-svn-id: svn://10.65.10.50/branches/R_10_00@24468 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4a166a54ed
commit
48aeea1dba
@ -304,6 +304,7 @@ class TLiquidazione_app : public TPrint_application
|
|||||||
int _monthinatt; // mese inizio attivita' (serve per differita)
|
int _monthinatt; // mese inizio attivita' (serve per differita)
|
||||||
bool _lim_cleared;
|
bool _lim_cleared;
|
||||||
bool _definitiva;
|
bool _definitiva;
|
||||||
|
bool _end_cassa;
|
||||||
|
|
||||||
real _diff_ven_ap, _diff_ven_ap_iva, _diff_acq_ap, _diff_acq_ap_iva;
|
real _diff_ven_ap, _diff_ven_ap_iva, _diff_acq_ap, _diff_acq_ap_iva;
|
||||||
real _imposta_inc_diff_ven, _imposta_inc_cassa_ven, _imposta_inc_diff_acq, _imposta_inc_cassa_acq;
|
real _imposta_inc_diff_ven, _imposta_inc_cassa_ven, _imposta_inc_diff_acq, _imposta_inc_cassa_acq;
|
||||||
|
@ -1134,15 +1134,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
const TRectype & lia = get_lia();
|
const TRectype & lia = get_lia();
|
||||||
|
|
||||||
TDate data_end_cassa = lia.get_date("D1");
|
TDate data_end_cassa = lia.get_date("D1");
|
||||||
bool end_cassa = lia.get_bool("B5") && data_end_cassa.ok() && data_rif_cassa > data_end_cassa;
|
_end_cassa = lia.get_bool("B5") && data_end_cassa.ok() && (month < 12 && data_rif_cassa.month() == data_end_cassa.month());
|
||||||
|
|
||||||
if (!end_cassa && month > 11)
|
if (!_end_cassa && month > 11)
|
||||||
{
|
{
|
||||||
data_end_cassa = eotime;
|
data_end_cassa = eotime;
|
||||||
const TRectype & lia = get_lia(0, false, year_int + 1);
|
const TRectype & lia = get_lia(0, false, year_int + 1);
|
||||||
|
|
||||||
end_cassa = !lia.get_bool("B5");
|
_end_cassa = !lia.get_bool("B5");
|
||||||
if (end_cassa)
|
if (_end_cassa)
|
||||||
data_end_cassa = data_rif_cassa;
|
data_end_cassa = data_rif_cassa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1156,8 +1156,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
long nr = _mov->get_long(MOV_NUMREG);
|
long nr = _mov->get_long(MOV_NUMREG);
|
||||||
|
|
||||||
if (nr == 1931434 || nr == 1931437)
|
if (nr == 22060 || nr == 27710)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int liqmonth = _mov->get_int(MOV_MESELIQ);
|
const int liqmonth = _mov->get_int(MOV_MESELIQ);
|
||||||
@ -1236,10 +1236,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
nr = _mov->get_long(MOV_NUMREG);
|
nr = _mov->get_long(MOV_NUMREG);
|
||||||
|
|
||||||
if (nr == 25722 ||
|
if (nr == 22060 || nr == 27710)
|
||||||
nr == 25863 ||
|
|
||||||
nr == 27888 ||
|
|
||||||
nr == 28033)
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1256,7 +1253,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
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;
|
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;
|
||||||
@ -1283,7 +1280,13 @@ 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;
|
||||||
flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month;
|
#ifdef DBG
|
||||||
|
nr = _mov->get_long(MOV_NUMREG);
|
||||||
|
|
||||||
|
if (nr == 22060 || nr == 27710)
|
||||||
|
int i = 1;
|
||||||
|
#endif
|
||||||
|
flag_pg_nc = rp.calcola_pagato_periodo(first_month ? botime : inizio + 1L, orizzonte, pg_per, nc_per, &pagscatt) && regular_month;
|
||||||
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
|
||||||
@ -1299,7 +1302,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 || sarebbe_maturata(_mov->curr(), inizio+1L, fine) || (iva_cass && _end_cassa))
|
||||||
{
|
{
|
||||||
TPointer_array pagscaold;
|
TPointer_array pagscaold;
|
||||||
TImporto pg_tot, nc_tot;
|
TImporto pg_tot, nc_tot;
|
||||||
@ -1366,7 +1369,7 @@ 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 (sarebbe_maturata(_mov->curr(), inizio+1L, fine) || (iva_cass && _end_cassa))
|
||||||
tot_da_incassare = _mov->get_real(MOV_TOTDOC);
|
tot_da_incassare = _mov->get_real(MOV_TOTDOC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1376,7 +1379,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
tot_incassato = tot_da_incassare;
|
tot_incassato = tot_da_incassare;
|
||||||
|
|
||||||
datainc = data_maturazione_IVA_diff(_mov->curr());
|
datainc = data_maturazione_IVA_diff(_mov->curr());
|
||||||
if (iva_cass && end_cassa)
|
if (iva_cass && _end_cassa)
|
||||||
datainc = data_end_cassa;
|
datainc = data_end_cassa;
|
||||||
_mov->put(MOV_DATAINC, datainc);
|
_mov->put(MOV_DATAINC, datainc);
|
||||||
if (datainc < date)
|
if (datainc < date)
|
||||||
@ -1526,10 +1529,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
nr = _mov->get_long(MOV_NUMREG);
|
nr = _mov->get_long(MOV_NUMREG);
|
||||||
|
|
||||||
if (nr == 25722 ||
|
if (nr == 22060 || nr == 27710)
|
||||||
nr == 25863 ||
|
|
||||||
nr == 27888 ||
|
|
||||||
nr == 28033)
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1558,50 +1558,52 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
if (diff_totr == ZERO)
|
if (diff_totr == ZERO)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TDate datafat;
|
TDate datafat= _mov->get_date(MOV_DATAREG);
|
||||||
long numreg = _rmoviva->get_long(RMI_NUMREG);
|
long numreg = _rmoviva->get_long(RMI_NUMREG);
|
||||||
const TDate datareg = _mov->get_date(MOV_DATAREG);
|
sezfat = tipomov == vendita ? 'D' : 'A';
|
||||||
int mesereg = datareg.month();
|
|
||||||
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
|
|
||||||
|
|
||||||
if (!ok && (iva_cass && end_cassa && month < 13))
|
if (is_detr_diff == 1 || civa.tipo() == "NS")
|
||||||
ok = (datareg.year() < atoi(_year)) || (mesereg <= month);
|
|
||||||
if (!ok || is_detr_diff == 1 || civa.tipo() == "NS")
|
|
||||||
continue;
|
continue;
|
||||||
if (bIsMovDiff && tm == tm_fattura)
|
if (bIsMovDiff && tm == tm_fattura)
|
||||||
{
|
{
|
||||||
datafat = datareg;
|
const TDate datareg = _mov->get_date(MOV_DATAREG);
|
||||||
sezfat = tipomov == vendita ? 'D' : 'A';
|
int mesereg = datareg.month();
|
||||||
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
bool ok = is_month_ok(mesereg, month) && (atoi(_year) == datareg.year());
|
||||||
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
|
||||||
id.put("NUMPRO", 0);
|
|
||||||
id.put(PART_TIPOMOV, tm);
|
|
||||||
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
|
|
||||||
id.put("TIPOATT", rmi_tipoatt);
|
|
||||||
id.put("ANNOLIQ", datareg.year());
|
|
||||||
|
|
||||||
if (_freqviva[0] == 'T')
|
if (ok)
|
||||||
{
|
{
|
||||||
const int resto = mesereg % 3;
|
datafat = datareg;
|
||||||
if (resto > 0)
|
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
||||||
mesereg += 3-resto;
|
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
||||||
|
id.put("NUMPRO", 0);
|
||||||
|
id.put(PART_TIPOMOV, tm);
|
||||||
|
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
|
||||||
|
id.put("TIPOATT", rmi_tipoatt);
|
||||||
|
id.put("ANNOLIQ", datareg.year());
|
||||||
|
|
||||||
|
if (_freqviva[0] == 'T')
|
||||||
|
{
|
||||||
|
const int resto = mesereg % 3;
|
||||||
|
if (resto > 0)
|
||||||
|
mesereg += 3 - resto;
|
||||||
|
}
|
||||||
|
|
||||||
|
id.put("MESELIQ", mesereg);
|
||||||
|
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
||||||
|
id.put(ID_INDETR, is_detr_diff > 0);
|
||||||
|
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
||||||
|
id.put(MOV_DATAREG, _mov->get(MOV_DATADOC));
|
||||||
|
id.put(RMI_CODIVA, codiva);
|
||||||
|
id.put("SEZIONE", sezfat);
|
||||||
|
|
||||||
|
id.put("IMPORTO", diff_totr);
|
||||||
|
id.put(RMI_IMPONIBILE, diff_impr);
|
||||||
|
id.put(RMI_IMPOSTA, diff_ivar);
|
||||||
|
|
||||||
|
const int ew = id.write_rewrite();
|
||||||
|
if (ew != NOERR)
|
||||||
|
cantwrite_box(id.description());
|
||||||
}
|
}
|
||||||
|
|
||||||
id.put("MESELIQ", mesereg);
|
|
||||||
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
|
||||||
id.put(ID_INDETR, is_detr_diff > 0);
|
|
||||||
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
|
||||||
id.put(MOV_DATAREG, _mov->get(MOV_DATADOC));
|
|
||||||
id.put(RMI_CODIVA, codiva);
|
|
||||||
id.put("SEZIONE", sezfat);
|
|
||||||
|
|
||||||
id.put("IMPORTO", diff_totr);
|
|
||||||
id.put(RMI_IMPONIBILE, diff_impr);
|
|
||||||
id.put(RMI_IMPOSTA, diff_ivar);
|
|
||||||
|
|
||||||
const int ew = id.write_rewrite();
|
|
||||||
if (ew != NOERR)
|
|
||||||
cantwrite_box(id.description());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bIsMovDiff && !pagscatt.empty())
|
if (bIsMovDiff && !pagscatt.empty())
|
||||||
@ -1614,204 +1616,224 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
|||||||
{
|
{
|
||||||
const TRectype& pagsca = *(TRectype*)obj;
|
const TRectype& pagsca = *(TRectype*)obj;
|
||||||
const int nrigp = pagsca.get_int(PAGSCA_NRIGP);
|
const int nrigp = pagsca.get_int(PAGSCA_NRIGP);
|
||||||
|
TDate datapag;
|
||||||
id.zero();
|
|
||||||
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
|
||||||
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
|
||||||
CHECKD(nrigp > 0, "Invalid NRIGP ", nrigp);
|
|
||||||
id.put("NUMPRO", min(nrigp, 999));
|
|
||||||
if (id.read(_isequal, _lock) != NOERR)
|
|
||||||
{
|
|
||||||
id.zero();
|
|
||||||
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
|
||||||
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
|
||||||
id.put("NUMPRO", min(nrigp, 999));
|
|
||||||
if (id.write() != NOERR)
|
|
||||||
error_box("Errore %d in creazione record IVADIFF", id.status());
|
|
||||||
}
|
|
||||||
|
|
||||||
TDate datareg = _mov->get(MOV_DATADOC);
|
|
||||||
|
|
||||||
if (datareg < datafat)
|
|
||||||
datareg = datafat;
|
|
||||||
id.put(MOV_DATAREG, datareg);
|
|
||||||
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
|
|
||||||
id.put("TIPOATT", rmi_tipoatt);
|
|
||||||
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
|
||||||
id.put(ID_INDETR, is_detr_diff > 0);
|
|
||||||
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
|
||||||
id.put(RMI_CODIVA, codiva);
|
|
||||||
|
|
||||||
TImporto pagtmp;
|
|
||||||
bool ultimo = false;
|
|
||||||
long nregpag;
|
|
||||||
int nrigpag;
|
|
||||||
tipo_movimento tipomov_pag = tm_pagamento;
|
|
||||||
|
|
||||||
if (nrigp > 0 && nrigp < 9999)
|
if (nrigp > 0 && nrigp < 9999)
|
||||||
{
|
{
|
||||||
const TPartita& p = arrpart.partita(pagsca);
|
const TPartita& p = arrpart.partita(pagsca);
|
||||||
const TRiga_partite& rp = p.riga(nrigp);
|
const TRiga_partite& rp = p.riga(nrigp);
|
||||||
|
|
||||||
nregpag = rp.get_long(PART_NREG);
|
datapag = rp.get(PART_DATAPAG);
|
||||||
nrigpag = rp.get_int(PART_NUMRIG);
|
if (!datapag.ok())
|
||||||
tipomov_pag = rp.tipo();
|
datapag = rp.get(PART_DATADOC);
|
||||||
id.put(PART_TIPOMOV, tipomov_pag);
|
if (!datapag.ok())
|
||||||
id.put("NUMREGP", nregpag);
|
datapag = rp.get(PART_DATAREG);
|
||||||
id.put("NUMRIGP", nrigpag);
|
if (datapag < datafat)
|
||||||
TDate d = rp.get(PART_DATAPAG);
|
datapag = datafat;
|
||||||
if (!d.ok())
|
|
||||||
d = rp.get(PART_DATADOC);
|
|
||||||
if (!d.ok())
|
|
||||||
d = rp.get(PART_DATAREG);
|
|
||||||
if (d < datafat)
|
|
||||||
d = datafat;
|
|
||||||
|
|
||||||
id.put("DATAREGP", d);
|
|
||||||
id.put("ANNOLIQ", d.year());
|
|
||||||
pagtmp = p.importo_pagsca(pagsca);
|
|
||||||
pagtmp.normalize(sezpag);
|
|
||||||
ultimo = (r == pagscatt.last()) && partita_chiusa_al(p, fine);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
datapag = _mov->get_date(MOV_DATAINC);
|
||||||
|
|
||||||
|
bool ok = is_month_ok(datapag.month(), month) && (atoi(_year) == datapag.year());
|
||||||
|
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
// Falso record generato da datainc
|
// if (!ok && (iva_cass && end_cassa && month < 13))
|
||||||
nregpag = _mov->get_long(MOV_NUMREG);
|
// ok = (datareg.year() < atoi(_year)) || (mesereg <= month);
|
||||||
nrigpag = nrigp;
|
|
||||||
|
|
||||||
id.put(PART_TIPOMOV, tipomov_pag);
|
id.zero();
|
||||||
id.put("NUMREGP", nregpag);
|
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
||||||
id.put("NUMRIGP", nrigp);
|
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
||||||
id.put("DATAREGP", _mov->get(MOV_DATAINC));
|
CHECKD(nrigp > 0, "Invalid NRIGP ", nrigp);
|
||||||
id.put("ANNOLIQ", year_int);
|
id.put("NUMPRO", min(nrigp, 999));
|
||||||
pagtmp.set(sezpag, pagsca.get_real(PAGSCA_IMPORTO));
|
if (id.read(_isequal, _lock) != NOERR)
|
||||||
ultimo = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int meseliq = id.get_date("DATAREGP").month();
|
|
||||||
if (_freqviva[0] == 'T')
|
|
||||||
{
|
|
||||||
const int resto = meseliq % 3;
|
|
||||||
if (resto > 0)
|
|
||||||
meseliq += 3-resto;
|
|
||||||
}
|
|
||||||
if (is_detr_diff > 0 || civa.senza_imposta()) // indetraibile
|
|
||||||
{
|
|
||||||
const int annoliq = _mov->get_date(MOV_DATAREG).year();
|
|
||||||
const int meseliq = _mov->get_date(MOV_DATAREG).month();
|
|
||||||
|
|
||||||
id.put("ANNOLIQ", annoliq);
|
|
||||||
id.put("MESELIQ", meseliq);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
id.put("MESELIQ", meseliq);
|
|
||||||
id.put("SEZIONE", pagtmp.sezione());
|
|
||||||
|
|
||||||
const long numregp = id.get_long(ID_NUMREGP);
|
|
||||||
const int numrigp = nrigp;
|
|
||||||
real val_imp = pagtmp.valore() * diff_totr / tot;
|
|
||||||
real val_iva;
|
|
||||||
|
|
||||||
if (ultimo && (is_detr_diff == 0))
|
|
||||||
{
|
|
||||||
TRectype svidrec(id.curr());
|
|
||||||
TLocalisamfile rid(LF_IVADIFF);
|
|
||||||
const long numreg = _rmoviva->get_long(RMI_NUMREG);
|
|
||||||
const int numrig = _rmoviva->get_int(RMI_NUMRIG);
|
|
||||||
const int numpro = id.get_int(ID_NUMPRO);
|
|
||||||
|
|
||||||
rid.put(MOV_NUMREG, numreg);
|
|
||||||
rid.put(RMI_NUMRIG, numrig);
|
|
||||||
val_iva = diff_ivar;
|
|
||||||
|
|
||||||
bool pag_found = false;
|
|
||||||
|
|
||||||
int err = rid.read(_isgteq);
|
|
||||||
#ifdef DBG
|
|
||||||
if (nr == 29283)
|
|
||||||
int i = 1;
|
|
||||||
#endif
|
|
||||||
TDate orizzonte = fine; // caso tradizionale
|
|
||||||
|
|
||||||
if (iva_cass)
|
|
||||||
{
|
{
|
||||||
const TDate data_rif = data_maturazione_IVA_diff(_mov->curr());
|
id.zero();
|
||||||
if (data_rif < fine)
|
id.put(RMI_NUMREG, _rmoviva->get(RMI_NUMREG));
|
||||||
orizzonte = data_rif;
|
id.put(RMI_NUMRIG, _rmoviva->get(RMI_NUMRIG));
|
||||||
|
id.put("NUMPRO", min(nrigp, 999));
|
||||||
|
if (id.write() != NOERR)
|
||||||
|
error_box("Errore %d in creazione record IVADIFF", id.status());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; err == NOERR && rid.get_long(RMI_NUMREG) == numreg && rid.get_int(RMI_NUMRIG) == numrig; err = rid.next())
|
TDate datareg = _mov->get(MOV_DATADOC);
|
||||||
|
|
||||||
|
if (datareg < datafat)
|
||||||
|
datareg = datafat;
|
||||||
|
id.put(MOV_DATAREG, datareg);
|
||||||
|
CHECKD(rmi_tipoatt > 0, "Invalid tipo att ", rmi_tipoatt);
|
||||||
|
id.put("TIPOATT", rmi_tipoatt);
|
||||||
|
id.put("TIPOIVA", tipomov == 2 ? 2 : 1);
|
||||||
|
id.put(ID_INDETR, is_detr_diff > 0);
|
||||||
|
id.put("TIPODIFF", iva_cass ? 2 : 1);
|
||||||
|
id.put(RMI_CODIVA, codiva);
|
||||||
|
|
||||||
|
TImporto pagtmp;
|
||||||
|
bool ultimo = false;
|
||||||
|
long nregpag;
|
||||||
|
int nrigpag;
|
||||||
|
tipo_movimento tipomov_pag = tm_pagamento;
|
||||||
|
|
||||||
|
if (nrigp > 0 && nrigp < 9999)
|
||||||
{
|
{
|
||||||
const int ridnumpro = rid.get_int(ID_NUMPRO);
|
const TPartita& p = arrpart.partita(pagsca);
|
||||||
const tipo_movimento ridtipopag = (tipo_movimento) rid.get_int(PART_TIPOMOV);
|
const TRiga_partite& rp = p.riga(nrigp);
|
||||||
|
|
||||||
if (ridtipopag != tm_fattura && ridtipopag != tm_nessuno && ridnumpro != numpro)
|
nregpag = rp.get_long(PART_NREG);
|
||||||
|
nrigpag = rp.get_int(PART_NUMRIG);
|
||||||
|
tipomov_pag = rp.tipo();
|
||||||
|
id.put(PART_TIPOMOV, tipomov_pag);
|
||||||
|
id.put("NUMREGP", nregpag);
|
||||||
|
id.put("NUMRIGP", nrigpag);
|
||||||
|
/* TDate d = rp.get(PART_DATAPAG);
|
||||||
|
if (!d.ok())
|
||||||
|
d = rp.get(PART_DATADOC);
|
||||||
|
if (!d.ok())
|
||||||
|
d = rp.get(PART_DATAREG);
|
||||||
|
if (d < datafat)
|
||||||
|
d = datafat; */
|
||||||
|
|
||||||
|
id.put("DATAREGP", datapag);
|
||||||
|
id.put("ANNOLIQ", datapag.year());
|
||||||
|
pagtmp = p.importo_pagsca(pagsca);
|
||||||
|
pagtmp.normalize(sezpag);
|
||||||
|
ultimo = (r == pagscatt.last()) && partita_chiusa_al(p, fine);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Falso record generato da datainc
|
||||||
|
nregpag = _mov->get_long(MOV_NUMREG);
|
||||||
|
nrigpag = nrigp;
|
||||||
|
|
||||||
|
id.put(PART_TIPOMOV, tipomov_pag);
|
||||||
|
id.put("NUMREGP", nregpag);
|
||||||
|
id.put("NUMRIGP", nrigp);
|
||||||
|
id.put("DATAREGP", _mov->get(MOV_DATAINC));
|
||||||
|
id.put("ANNOLIQ", year_int);
|
||||||
|
pagtmp.set(sezpag, pagsca.get_real(PAGSCA_IMPORTO));
|
||||||
|
ultimo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int meseliq = id.get_date("DATAREGP").month();
|
||||||
|
if (_freqviva[0] == 'T')
|
||||||
|
{
|
||||||
|
const int resto = meseliq % 3;
|
||||||
|
if (resto > 0)
|
||||||
|
meseliq += 3 - resto;
|
||||||
|
}
|
||||||
|
if (is_detr_diff > 0 || civa.senza_imposta()) // indetraibile
|
||||||
|
{
|
||||||
|
const int annoliq = _mov->get_date(MOV_DATAREG).year();
|
||||||
|
const int meseliq = _mov->get_date(MOV_DATAREG).month();
|
||||||
|
|
||||||
|
id.put("ANNOLIQ", annoliq);
|
||||||
|
id.put("MESELIQ", meseliq);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
id.put("MESELIQ", meseliq);
|
||||||
|
id.put("SEZIONE", pagtmp.sezione());
|
||||||
|
|
||||||
|
const long numregp = id.get_long(ID_NUMREGP);
|
||||||
|
const int numrigp = nrigp;
|
||||||
|
real val_imp = pagtmp.valore() * diff_totr / tot;
|
||||||
|
real val_iva;
|
||||||
|
|
||||||
|
if (ultimo && (is_detr_diff == 0))
|
||||||
|
{
|
||||||
|
TRectype svidrec(id.curr());
|
||||||
|
TLocalisamfile rid(LF_IVADIFF);
|
||||||
|
const long numreg = _rmoviva->get_long(RMI_NUMREG);
|
||||||
|
const int numrig = _rmoviva->get_int(RMI_NUMRIG);
|
||||||
|
const int numpro = id.get_int(ID_NUMPRO);
|
||||||
|
|
||||||
|
rid.put(MOV_NUMREG, numreg);
|
||||||
|
rid.put(RMI_NUMRIG, numrig);
|
||||||
|
val_iva = diff_ivar;
|
||||||
|
|
||||||
|
bool pag_found = false;
|
||||||
|
|
||||||
|
int err = rid.read(_isgteq);
|
||||||
|
TDate orizzonte = fine; // caso tradizionale
|
||||||
|
|
||||||
|
if (iva_cass)
|
||||||
{
|
{
|
||||||
const TDate datapag = rid.get_date(ID_DATAREGP);
|
const TDate data_rif = data_maturazione_IVA_diff(_mov->curr());
|
||||||
|
if (data_rif < fine)
|
||||||
|
orizzonte = data_rif;
|
||||||
|
}
|
||||||
|
|
||||||
if (datapag <= orizzonte)
|
for (; err == NOERR && rid.get_long(RMI_NUMREG) == numreg && rid.get_int(RMI_NUMRIG) == numrig; err = rid.next())
|
||||||
|
{
|
||||||
|
const int ridnumpro = rid.get_int(ID_NUMPRO);
|
||||||
|
const tipo_movimento ridtipopag = (tipo_movimento)rid.get_int(PART_TIPOMOV);
|
||||||
|
|
||||||
|
if (ridtipopag != tm_fattura && ridtipopag != tm_nessuno && ridnumpro != numpro)
|
||||||
{
|
{
|
||||||
pag_found = true;
|
const TDate datapag = rid.get_date(ID_DATAREGP);
|
||||||
if (sezfat != sezpag)
|
|
||||||
val_iva -= rid.get_real(RMI_IMPOSTA);
|
if (datapag <= orizzonte)
|
||||||
else
|
{
|
||||||
val_iva += rid.get_real(RMI_IMPOSTA);
|
pag_found = true;
|
||||||
|
if (sezfat != sezpag)
|
||||||
|
val_iva -= rid.get_real(RMI_IMPOSTA);
|
||||||
|
else
|
||||||
|
val_iva += rid.get_real(RMI_IMPOSTA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!pag_found)
|
||||||
|
val_iva = civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
||||||
|
else
|
||||||
|
civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
||||||
|
id.curr() = svidrec;
|
||||||
}
|
}
|
||||||
if (!pag_found)
|
else
|
||||||
val_iva = civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
val_iva = civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
||||||
else
|
|
||||||
civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
|
||||||
id.curr() = svidrec;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
val_iva = civa.scorpora(val_imp, TCurrency::get_firm_dec());
|
|
||||||
|
|
||||||
id.put("IMPORTO", val_imp + val_iva);
|
id.put("IMPORTO", val_imp + val_iva);
|
||||||
|
|
||||||
id.put(RMI_IMPONIBILE, val_imp);
|
id.put(RMI_IMPONIBILE, val_imp);
|
||||||
id.put(RMI_IMPOSTA, val_iva);
|
id.put(RMI_IMPOSTA, val_iva);
|
||||||
if (is_detr_diff == 0 && tipomov_pag >= tm_pagamento) // detraibile
|
if (is_detr_diff == 0 && tipomov_pag >= tm_pagamento) // detraibile
|
||||||
{
|
|
||||||
if (tipomov == vendita)
|
|
||||||
{
|
{
|
||||||
if (iva_cass)
|
if (tipomov == vendita)
|
||||||
_imposta_inc_cassa_ven += val_iva;
|
|
||||||
else
|
|
||||||
_imposta_inc_diff_ven += val_iva;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (iva_cass)
|
|
||||||
_imposta_inc_cassa_acq += val_iva;
|
|
||||||
else
|
|
||||||
_imposta_inc_diff_acq += val_iva;
|
|
||||||
}
|
|
||||||
incdiff_imp += val_imp;
|
|
||||||
incdiff_iva += val_iva;
|
|
||||||
}
|
|
||||||
|
|
||||||
int err = id.rewrite();
|
|
||||||
|
|
||||||
if (err != NOERR)
|
|
||||||
error_box("Errore %d in aggiornamento file IVADIFF", err);
|
|
||||||
LOG_IVA_DIFF(id.curr());
|
|
||||||
|
|
||||||
// 18-06-2014 Aggiorna flag di chiusura IVADIFF solo nei mesi normali, ma lascialo stare se _isannual
|
|
||||||
const long numreg = _rmoviva->get_long(RMI_NUMREG);
|
|
||||||
if (numreg > 0 && !_isannual) // Chiude o riapre la partita
|
|
||||||
{
|
|
||||||
TISAM_recordset recset("USE IVADIFF\nFROM NUMREG=#NR\nTO NUMREG=#NR");
|
|
||||||
recset.set_var("#NR", numreg);
|
|
||||||
TLocalisamfile& id = recset.cursor()->file();
|
|
||||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
|
||||||
{
|
|
||||||
const bool chiusa = id.get_bool("CHIUSA");
|
|
||||||
if (chiusa != ultimo)
|
|
||||||
{
|
{
|
||||||
id.put("CHIUSA", ultimo);
|
if (iva_cass)
|
||||||
id.rewrite();
|
_imposta_inc_cassa_ven += val_iva;
|
||||||
|
else
|
||||||
|
_imposta_inc_diff_ven += val_iva;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (iva_cass)
|
||||||
|
_imposta_inc_cassa_acq += val_iva;
|
||||||
|
else
|
||||||
|
_imposta_inc_diff_acq += val_iva;
|
||||||
|
}
|
||||||
|
incdiff_imp += val_imp;
|
||||||
|
incdiff_iva += val_iva;
|
||||||
|
}
|
||||||
|
|
||||||
|
int err = id.rewrite();
|
||||||
|
|
||||||
|
if (err != NOERR)
|
||||||
|
error_box("Errore %d in aggiornamento file IVADIFF", err);
|
||||||
|
LOG_IVA_DIFF(id.curr());
|
||||||
|
|
||||||
|
// 18-06-2014 Aggiorna flag di chiusura IVADIFF solo nei mesi normali, ma lascialo stare se _isannual
|
||||||
|
const long numreg = _rmoviva->get_long(RMI_NUMREG);
|
||||||
|
if (numreg > 0 && !_isannual) // Chiude o riapre la partita
|
||||||
|
{
|
||||||
|
TISAM_recordset recset("USE IVADIFF\nFROM NUMREG=#NR\nTO NUMREG=#NR");
|
||||||
|
recset.set_var("#NR", numreg);
|
||||||
|
TLocalisamfile& id = recset.cursor()->file();
|
||||||
|
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||||
|
{
|
||||||
|
const bool chiusa = id.get_bool("CHIUSA");
|
||||||
|
if (chiusa != ultimo)
|
||||||
|
{
|
||||||
|
id.put("CHIUSA", ultimo);
|
||||||
|
id.rewrite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,8 +630,8 @@ void TLiquidazione_app::zero_diff(int month, const char* codatt)
|
|||||||
if (!_nditte->is_first_match(LF_ATTIV))
|
if (!_nditte->is_first_match(LF_ATTIV))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (month > 12 || (_freqviva == "T" && (month % 3) != 1)) // rischioso non farlo in tredicesima
|
// if (month > 12 || (_freqviva == "T" && (month % 3) != 1)) // rischioso non farlo in tredicesima
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
TFast_isamfile fid(LF_IVADIFF);
|
TFast_isamfile fid(LF_IVADIFF);
|
||||||
if (fid.status() != NOERR)
|
if (fid.status() != NOERR)
|
||||||
@ -641,38 +641,49 @@ void TLiquidazione_app::zero_diff(int month, const char* codatt)
|
|||||||
query << "USE IVADIFF KEY 2"; // Key 2 = ANNOLIQ+MESELIQ+...
|
query << "USE IVADIFF KEY 2"; // Key 2 = ANNOLIQ+MESELIQ+...
|
||||||
query << "\nFROM ANNOLIQ=" << _year;
|
query << "\nFROM ANNOLIQ=" << _year;
|
||||||
// Se calcolo gennaio (o marzo trimestrale) azzero tutto l'anno, altrimenti solo il mese selezionato
|
// Se calcolo gennaio (o marzo trimestrale) azzero tutto l'anno, altrimenti solo il mese selezionato
|
||||||
// if (month > (_freqviva == "T" ? 3 : 1))
|
if (month < 13)
|
||||||
query << " MESELIQ=" << month;
|
query << " MESELIQ=" << month;
|
||||||
|
|
||||||
query << "\nTO ANNOLIQ=" << _year; // Dal 18-06-2014 lascia stare l'anno prossimo!
|
query << "\nTO ANNOLIQ=" << _year; // Dal 18-06-2014 lascia stare l'anno prossimo!
|
||||||
query << " MESELIQ=" << month + (_freqviva == "T" ? 2 : 0);
|
if (month < 13)
|
||||||
|
query << " MESELIQ=" << month + (_freqviva == "T" ? 2 : 0);
|
||||||
|
|
||||||
TISAM_recordset id(query);
|
TISAM_recordset id(query);
|
||||||
|
|
||||||
TString msg;
|
TString msg;
|
||||||
msg.format("Azzeramento IVADIFF %s %s attività %s", month <= 12 ? itom(month) : "13ma", (const char*)_year, codatt);
|
msg.format("Azzeramento fatture IVADIFF %s %s attività %s", month <= 12 ? itom(month) : "13ma", (const char*)_year, codatt);
|
||||||
TProgress_monitor pi(id.items(), msg, false);
|
TProgress_monitor pi(id.items(), msg, false);
|
||||||
TLocalisamfile& file = id.cursor()->file();
|
TLocalisamfile& file = id.cursor()->file();
|
||||||
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
||||||
{
|
{
|
||||||
pi.add_status(1);
|
pi.add_status(1);
|
||||||
/* file.zero("ANNOLIQ");
|
|
||||||
file.zero("MESELIQ");
|
|
||||||
file.zero("IMPORTO");
|
|
||||||
file.zero("IMPONIBILE");
|
|
||||||
file.zero("IMPOSTA");
|
|
||||||
file.zero("DATAREG");
|
|
||||||
file.zero("NUMREGP");
|
|
||||||
file.zero("NUMRIGP");
|
|
||||||
file.zero("DATAREGP");
|
|
||||||
file.zero("DATAREGP");
|
|
||||||
file.zero("TIPOMOV");
|
|
||||||
file.zero("TIPOIVA");
|
|
||||||
file.zero("TIPOATT");
|
|
||||||
file.zero("TIPODIFF");
|
|
||||||
file.zero("CHIUSA");
|
|
||||||
file.rewrite(); */
|
|
||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
|
query = "USE IVADIFF KEY 3"; // Key 3 = DATAREGP+....
|
||||||
|
TDate inizio(1, month == 13 ? 1 : month, atoi(_year));
|
||||||
|
query << "\nFROM DATAREGP=" << inizio << "";
|
||||||
|
|
||||||
|
// Se calcolo gennaio (o marzo trimestrale) azzero tutto l'anno, altrimenti solo il mese selezionato
|
||||||
|
// if (month > (_freqviva == "T" ? 3 : 1))
|
||||||
|
|
||||||
|
TDate fine(1, month == 13 ? 12 : month + (_freqviva == "T" ? 2 : 0), atoi(_year));
|
||||||
|
fine.set_end_month();
|
||||||
|
|
||||||
|
query << "\nTO DATAREGP=" << fine; // Dal 18-06-2014 lascia stare l'anno prossimo!
|
||||||
|
// query << "\nANNOLIQ=" << eotime.year();
|
||||||
|
// query << "\nMESELIQ=" << eotime.month();
|
||||||
|
|
||||||
|
id.set(query);
|
||||||
|
id.requery();
|
||||||
|
|
||||||
|
msg.format("Azzeramento pagamenti IVADIFF %s %s attività %s", month <= 12 ? itom(month) : "13ma", (const char*)_year, codatt);
|
||||||
|
TProgress_monitor pi2(id.items(), msg, false);
|
||||||
|
TLocalisamfile& file2 = id.cursor()->file();
|
||||||
|
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
||||||
|
{
|
||||||
|
pi2.add_status(1);
|
||||||
|
file2.remove();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2545,9 +2545,10 @@ void TLiquidazione_app::set_iva_succ(int& rw)
|
|||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
|
|
||||||
query << "USE IVADIFF KEY 2"
|
query << "USE IVADIFF KEY 2";
|
||||||
<< "\nFROM ANNOLIQ=" << _year
|
if (!_end_cassa)
|
||||||
<< "\nTO ANNOLIQ=" << _year;
|
query << "\nFROM ANNOLIQ=" << _year;
|
||||||
|
query << "\nTO ANNOLIQ=" << _year;
|
||||||
TISAM_recordset id(query);
|
TISAM_recordset id(query);
|
||||||
const TDate da_datareg(1, 1, atoi(_year));
|
const TDate da_datareg(1, 1, atoi(_year));
|
||||||
const TDate a_datareg(31, 12, atoi(_year));
|
const TDate a_datareg(31, 12, atoi(_year));
|
||||||
@ -2594,8 +2595,11 @@ void TLiquidazione_app::set_iva_succ(int& rw)
|
|||||||
ven_xcas.normalize('D');
|
ven_xcas.normalize('D');
|
||||||
acq_xcas.normalize('A');
|
acq_xcas.normalize('A');
|
||||||
acq_diff.normalize('A');
|
acq_diff.normalize('A');
|
||||||
set_row(rw++,FR("@11g@bOPERAZIONI EFFETTUATE NELL'ANNO CON IMPOSTA ESIGIBILE NEGLI ANNI SUCCESSIVI@r"));
|
if (_end_cassa)
|
||||||
const real vd = ven_diff.valore();
|
set_row(rw++, FR("@11g@bOPERAZIONI EFFETTUATE FINO ALL'ANNO CON IMPOSTA ESIGIBILE NEGLI ANNI SUCCESSIVI@r"));
|
||||||
|
else
|
||||||
|
set_row(rw++, FR("@11g@bOPERAZIONI EFFETTUATE NELL'ANNO CON IMPOSTA ESIGIBILE NEGLI ANNI SUCCESSIVI@r"));
|
||||||
|
const real vd = ven_diff.valore();
|
||||||
const real vc = ven_xcas.valore();
|
const real vc = ven_xcas.valore();
|
||||||
const real vt = vc+vd;
|
const real vt = vc+vd;
|
||||||
const real ac = acq_xcas.valore();
|
const real ac = acq_xcas.valore();
|
||||||
|
@ -1309,20 +1309,7 @@ int TStampa_registri_app::stampa_prospetto_IVA(int rr, int tipo_prosp)
|
|||||||
if (tipo_prosp == 0) // Stampa il prospetto iniziale per progressivi attuali (periodo)
|
if (tipo_prosp == 0) // Stampa il prospetto iniziale per progressivi attuali (periodo)
|
||||||
{
|
{
|
||||||
reset_print();
|
reset_print();
|
||||||
/* nel fondo pagina
|
|
||||||
TString riga(_stampa_width, '-');
|
|
||||||
set_row(rr++, riga);
|
|
||||||
|
|
||||||
riga = TR("Legenda Tipo Operazione: 1=intra; 2=AF art.34 comma 3");
|
|
||||||
if (_auto_intraf)
|
|
||||||
riga << TR("; 3=intra e AF art.34 comma 3");
|
|
||||||
riga << TR("; 4=liquidazione differita");
|
|
||||||
if (has_module(ICAUT))
|
|
||||||
riga << TR("; 5=IVA per cassa");
|
|
||||||
if (_annoIVA >= 2015)
|
|
||||||
riga << TR("; 6=Scissione pagamenti art.17 ter");
|
|
||||||
set_row(rr++, riga);
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (_st_tot_fin)
|
if (_st_tot_fin)
|
||||||
{
|
{
|
||||||
@ -1555,22 +1542,23 @@ void TStampa_registri_app::set_page_tot_reg()
|
|||||||
|
|
||||||
//*****deve azzerare i totali progressivi dei riporti e segnalare all'header di non stampare
|
//*****deve azzerare i totali progressivi dei riporti e segnalare all'header di non stampare
|
||||||
//la riga di riporto
|
//la riga di riporto
|
||||||
_totali_stampati = true; //siamo in stampa totali, quindi...
|
|
||||||
_riporti = false; //inoltre non deve stapare riporti mentre stampa i totali
|
|
||||||
_totdoc_prog = _totimpn_prog = _totimps_prog = ZERO;
|
|
||||||
reset_print();
|
reset_print();
|
||||||
|
|
||||||
if (_esiste_riga_iva && _stampa)
|
if (_esiste_riga_iva && _stampa)
|
||||||
{
|
{
|
||||||
for (int tipo_prosp = 0; tipo_prosp <= 2/* (_tipo_reg == vendita ? 2 : 1) */; tipo_prosp++)
|
_totali_finali = true; //siamo in stampa totali, quindi...
|
||||||
|
for (int tipo_prosp = 0; tipo_prosp <= 2/* (_tipo_reg == vendita ? 2 : 1) */; tipo_prosp++)
|
||||||
{
|
{
|
||||||
TRiga_array& arriva = tipo_prosp == 0 ? _tot_iva_array : (tipo_prosp == 1 ? _tot_prec_iva_array : (_tipo_reg == vendita ? _riga_split : _riga_competenza));
|
TRiga_array& arriva = tipo_prosp == 0 ? _tot_iva_array : (tipo_prosp == 1 ? _tot_prec_iva_array : (_tipo_reg == vendita ? _riga_split : _riga_competenza));
|
||||||
if (arriva.empty())
|
if (arriva.empty())
|
||||||
continue;
|
continue;
|
||||||
if (!printed)
|
if (!printed)
|
||||||
{
|
{
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
rr = stampa_prospetto_IVA(rr, 0); // Intestazione prospetto IVA per aliquota
|
_totali_stampati = true; //siamo in stampa totali, quindi...
|
||||||
|
_riporti = false; //inoltre non deve stapare riporti mentre stampa i totali
|
||||||
|
_totdoc_prog = _totimpn_prog = _totimps_prog = ZERO;
|
||||||
|
rr = stampa_prospetto_IVA(rr, 0); // Intestazione prospetto IVA per aliquota
|
||||||
printed = true;
|
printed = true;
|
||||||
}
|
}
|
||||||
arriva.sort(compare_rows); //viene ordinato per codice iva
|
arriva.sort(compare_rows); //viene ordinato per codice iva
|
||||||
@ -1644,7 +1632,6 @@ void TStampa_registri_app::set_page_tot_reg()
|
|||||||
}
|
}
|
||||||
} // for
|
} // for
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printed)
|
if (printed)
|
||||||
{
|
{
|
||||||
flush();
|
flush();
|
||||||
@ -2335,6 +2322,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
_auto_intraf = false;
|
_auto_intraf = false;
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
_totali_stampati = false; //siamo al cambio periodo (mese/trimestre),quindi resetto il flag di stampa totali
|
_totali_stampati = false; //siamo al cambio periodo (mese/trimestre),quindi resetto il flag di stampa totali
|
||||||
|
_totali_finali = false;
|
||||||
_riporti = false;//e pure quello dei riporti,visto che "A Riporto" non va nella prima pagina del mese
|
_riporti = false;//e pure quello dei riporti,visto che "A Riporto" non va nella prima pagina del mese
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2466,12 +2454,12 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
set_row(_r, "@31g%6ld", codcf);
|
set_row(_r, "@31g%6ld", codcf);
|
||||||
if (meseliq > 0)
|
if (meseliq > 0)
|
||||||
set_row(_r, "@62g%02d", meseliq);
|
set_row(_r, "@62g%02d", meseliq);
|
||||||
set_row(_r, "@65g%2s", (const char*) _tipodoc);
|
set_row(_r, "@67g%2s", (const char*) _tipodoc);
|
||||||
if (fattrit)
|
if (fattrit)
|
||||||
set_row(_r, "@67gCD");
|
set_row(_r, "@69gD");
|
||||||
else
|
else
|
||||||
if (fattritind)
|
if (fattritind)
|
||||||
set_row(_r, "@67gCI");
|
set_row(_r, "@69gI");
|
||||||
if (_stampa_width == 132)
|
if (_stampa_width == 132)
|
||||||
set_row(_r, "@70g%r", &totdoc);
|
set_row(_r, "@70g%r", &totdoc);
|
||||||
else
|
else
|
||||||
@ -2618,7 +2606,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
tipo_op = "5";
|
tipo_op = "5";
|
||||||
}
|
}
|
||||||
|
|
||||||
set_row(_r, "@66g%s", (const char*)tipo_op);
|
set_row(_r, "@65g%s", (const char*)tipo_op);
|
||||||
|
|
||||||
if (_tipo_stampa == prova) //stampa di prova
|
if (_tipo_stampa == prova) //stampa di prova
|
||||||
{
|
{
|
||||||
@ -2960,16 +2948,16 @@ void TStampa_registri_app::preprocess_header()
|
|||||||
{
|
{
|
||||||
if (_stampa_width == 132)
|
if (_stampa_width == 132)
|
||||||
{
|
{
|
||||||
set_header(r,FR("@10gNum.@19gDocumento@61gMese@66gT Tipo@102gCod %c@123gT %c@128gNum"), nd1, tipo);
|
set_header(r,FR("@10gNum.@19gDocumento@61gMese@65gT Tipo@102gCod %c@123gT %c@128gNum"), nd1, tipo);
|
||||||
r++;
|
r++;
|
||||||
set_header(r, FR("Data reg. prot.@17gData@24gNumero Codice Ragione sociale/descr. liq.@66gO Doc.@74gTotale doc.@90gImponibile IVA %c@115gImposta@123g%c %c@128gReg"), nd2, cor, type);
|
set_header(r, FR("Data reg. prot.@17gData@24gNumero Codice Ragione sociale/descr. liq.@65gO Doc.@74gTotale doc.@90gImponibile IVA %c@115gImposta@123g%c %c@128gReg"), nd2, cor, type);
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
else //stampa a 198
|
else //stampa a 198
|
||||||
{
|
{
|
||||||
set_header(r,FR("Registrazione Documento@61gMese@66gT Tipo@110gCod %c@132g%c T@139gNum."), nd1, tipo, cor);
|
set_header(r,FR("Registrazione Documento@61gMese@65gT Tipo@110gCod %c@132g%c T@139gNum."), nd1, tipo, cor);
|
||||||
r++;
|
r++;
|
||||||
set_header(r, FR("Data Protocollo Data@24gNumero Codice Ragione sociale/descr. liq.@66gO Documento@80gTot.Documento@98gImponibile IVA %c@124gImposta@132g%c %c@139gReg."), nd2, type, cor);
|
set_header(r, FR("Data Protocollo Data@24gNumero Codice Ragione sociale/descr. liq.@65gO Documento@80gTot.Documento@98gImponibile IVA %c@124gImposta@132g%c %c@139gReg."), nd2, type, cor);
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2982,7 +2970,7 @@ void TStampa_registri_app::preprocess_header()
|
|||||||
{
|
{
|
||||||
if (_stampa_width == 132)
|
if (_stampa_width == 132)
|
||||||
{
|
{
|
||||||
set_header(r,FR("@10gNum.@19gDocumento@61gMese@66gT Tipo@102gCod %c@123gT %c"), nd1, tipo);
|
set_header(r,FR("@10gNum.@19gDocumento@61gMese@67gT Tipo@102gCod %c@123gT %c"), nd1, tipo);
|
||||||
if (_tipo_stampa == rif_giornale) //stampa definitiva con rif. al libro giornale
|
if (_tipo_stampa == rif_giornale) //stampa definitiva con rif. al libro giornale
|
||||||
set_header(r, FR("@128gNum."));
|
set_header(r, FR("@128gNum."));
|
||||||
r++;
|
r++;
|
||||||
@ -2994,7 +2982,7 @@ void TStampa_registri_app::preprocess_header()
|
|||||||
}
|
}
|
||||||
else //stampa a 198
|
else //stampa a 198
|
||||||
{
|
{
|
||||||
set_header(r,FR("Registrazione Documento@61gMese@66gT Tipo@110gCod %c@132g%c T"), nd1, tipo);
|
set_header(r,FR("Registrazione Documento@61gMese@67gT Tipo@110gCod %c@132g%c T"), nd1, tipo);
|
||||||
if (_tipo_stampa == rif_giornale)
|
if (_tipo_stampa == rif_giornale)
|
||||||
set_header(r, FR("@139gNum."));
|
set_header(r, FR("@139gNum."));
|
||||||
r++;
|
r++;
|
||||||
@ -3038,6 +3026,7 @@ void TStampa_registri_app::preprocess_header()
|
|||||||
// set_header(r++, riga);
|
// set_header(r++, riga);
|
||||||
set_header(r++, "");
|
set_header(r++, "");
|
||||||
_totali_stampati = false;
|
_totali_stampati = false;
|
||||||
|
_totali_finali = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3045,40 +3034,45 @@ void TStampa_registri_app::preprocess_header()
|
|||||||
void TStampa_registri_app::preprocess_footer()
|
void TStampa_registri_app::preprocess_footer()
|
||||||
{
|
{
|
||||||
reset_footer();
|
reset_footer();
|
||||||
|
if (!_totali_stampati)
|
||||||
|
{
|
||||||
|
int r = 1;
|
||||||
|
TString riga(_stampa_width);
|
||||||
|
riga.fill('-');
|
||||||
|
set_footer(r++, riga);
|
||||||
|
if (!_totali_finali)
|
||||||
|
{
|
||||||
|
if (_stampa_width == 132)
|
||||||
|
set_footer(r++, FR("@0gTotale progressivi@70g%15s@85g%15s@107g%15s"),
|
||||||
|
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
||||||
|
else
|
||||||
|
if (_stampa_width == 198)
|
||||||
|
set_footer(r++, FR("@0gTotale progressivi@78g%15s@93g%15s@116g%15s"),
|
||||||
|
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_stampa_width == 132)
|
||||||
|
set_footer(r++, FR("@0gTotale @70g%15s@85g%15s@107g%15s"),
|
||||||
|
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
||||||
|
else
|
||||||
|
if (_stampa_width == 198)
|
||||||
|
set_footer(r++, FR("@0gTotale @78g%15s@93g%15s@116g%15s"),
|
||||||
|
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
||||||
|
}
|
||||||
|
set_footer(r++, riga);
|
||||||
|
|
||||||
if (!_totali_stampati)
|
riga = TR("Legenda Tipo Operazione: 1=intra; 2=AF art.34 comma 3");
|
||||||
{
|
if (_auto_intraf)
|
||||||
int r=1;
|
riga << TR("; 3=intra e AF art.34 comma 3");
|
||||||
TString riga(_stampa_width);
|
riga << TR("; 4=liquidazione differita");
|
||||||
riga.fill('-');
|
if (has_module(ICAUT))
|
||||||
set_footer(r++, riga);
|
riga << TR("; 5=IVA per cassa");
|
||||||
|
if (_annoIVA >= 2015)
|
||||||
if (_stampa_width == 132)
|
riga << TR("; 6=Scissione pagamenti art.17 ter");
|
||||||
set_footer(r++, FR("@0gTotale progressivi@70g%15s@85g%15s@107g%15s"),
|
set_footer(r++, riga);
|
||||||
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
}
|
||||||
if (_stampa_width == 198)
|
_riporti = !_totali_finali;
|
||||||
set_footer(r++, FR("@0gTotale progressivi@78g%15s@93g%15s@116g%15s"),
|
|
||||||
_totdoc_prog.string(".2"), _totimpn_prog.string(".2"), _totimps_prog.string(".2"));
|
|
||||||
|
|
||||||
set_footer(r++, riga);
|
|
||||||
|
|
||||||
/* TString riga(_stampa_width, '-');
|
|
||||||
|
|
||||||
set_footer(r++, riga); */
|
|
||||||
riga = TR("Legenda Tipo Operazione: 1=intra; 2=AF art.34 comma 3");
|
|
||||||
if (_auto_intraf)
|
|
||||||
riga << TR("; 3=intra e AF art.34 comma 3");
|
|
||||||
riga << TR("; 4=liquidazione differita");
|
|
||||||
if (has_module(ICAUT))
|
|
||||||
riga << TR("; 5=IVA per cassa");
|
|
||||||
if (_annoIVA >= 2015)
|
|
||||||
riga << TR("; 6=Scissione pagamenti art.17 ter");
|
|
||||||
set_footer(r++, riga);
|
|
||||||
|
|
||||||
_riporti = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_riporti = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampa_registri_app::on_page_printed(int file)
|
void TStampa_registri_app::on_page_printed(int file)
|
||||||
@ -3725,7 +3719,8 @@ bool TStampa_registri_app::set_print(int n)
|
|||||||
_totimps_prog = 0;
|
_totimps_prog = 0;
|
||||||
_rows_left = 69;
|
_rows_left = 69;
|
||||||
_riporti = false;
|
_riporti = false;
|
||||||
_totali_stampati = false;
|
_totali_stampati = false;
|
||||||
|
_totali_finali = false;
|
||||||
|
|
||||||
_annoIVA = m.get_int(ANNO);//in realta' e' l'anno IVA !!!
|
_annoIVA = m.get_int(ANNO);//in realta' e' l'anno IVA !!!
|
||||||
_tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA);
|
_tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA);
|
||||||
|
@ -50,7 +50,7 @@ class TStampa_registri_app : public TPrintapp
|
|||||||
bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi, _stampa_num_pag;
|
bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi, _stampa_num_pag;
|
||||||
bool _sosp_imposta, _riep_liq;
|
bool _sosp_imposta, _riep_liq;
|
||||||
bool _st_tot_fin;
|
bool _st_tot_fin;
|
||||||
bool _riporti, _totali_stampati;
|
bool _riporti, _totali_stampati, _totali_finali;
|
||||||
char _frequiva, _tipo_riepilogativo, _freq_riepilogo;
|
char _frequiva, _tipo_riepilogativo, _freq_riepilogo;
|
||||||
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
||||||
TDate _u_data;
|
TDate _u_data;
|
||||||
|
@ -20,6 +20,7 @@ IMPORTO|4|18|3|Importo
|
|||||||
IMPONIBILE|4|18|3|Imponibile
|
IMPONIBILE|4|18|3|Imponibile
|
||||||
IMPOSTA|4|18|3|Imposta
|
IMPOSTA|4|18|3|Imposta
|
||||||
CHIUSA|8|1|0|Partita chiusa
|
CHIUSA|8|1|0|Partita chiusa
|
||||||
2
|
3
|
||||||
NUMREG+NUMRIG+NUMPRO|
|
NUMREG+NUMRIG+NUMPRO|
|
||||||
ANNOLIQ+MESELIQ+DATAREGP|X
|
ANNOLIQ+MESELIQ+DATAREGP|X
|
||||||
|
DATAREGP+ANNOLIQ+MESELIQ|X
|
||||||
|
Loading…
x
Reference in New Issue
Block a user