Corretta gestione note di credito 2012 e provati inferiori a 3600 Euro
git-svn-id: svn://10.65.10.50/branches/R_10_00@22644 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fa23d3722d
commit
225725bb5a
@ -132,13 +132,13 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
if (a.codice_fiscale().blank() && a.partita_IVA().blank() && a.italiano())
|
||||
return segnala_riga(alleg, em_no_allegato, log);
|
||||
|
||||
const int anno = alleg.get_int(ALL_ANNO);
|
||||
|
||||
if (fe_is_nota_variazione(alleg))
|
||||
{
|
||||
TRectype& a = (TRectype&)alleg; // Triste necessità
|
||||
|
||||
if (!send_all && ignora <= em_importo_limite)
|
||||
{
|
||||
const int anno = alleg.get_int(ALL_ANNO);
|
||||
const real importo = abs(alleg.get_real(ALL_IMPORTO));
|
||||
if (importo < fe_importo_limite(anno))
|
||||
{
|
||||
@ -147,19 +147,22 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
}
|
||||
}
|
||||
|
||||
if (ignora == em_incluso)
|
||||
if (ignora <= em_importo_limite)
|
||||
{
|
||||
TDate datarett = a.get(ALL_DATARETT);
|
||||
if (datarett.ok())
|
||||
{
|
||||
if (datarett.year() < 2010)
|
||||
const int a = datarett.year();
|
||||
if (a < 2010 || a > anno)
|
||||
ignora = segnala_riga(alleg, em_data_limite, log);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int anno = alleg.get_int(ALL_ANNO) - 1;
|
||||
a.put(ALL_DATARETT, TDate(31, 12, anno));
|
||||
if (anno < 2010)
|
||||
const TDate datareg = a.get(ALL_DATAREG);
|
||||
const int ar = datareg.year();
|
||||
if (ar == anno)
|
||||
a.put(ALL_DATARETT, TDate(31, 12, anno-1));
|
||||
else
|
||||
ignora = segnala_riga(alleg, em_data_limite, log);
|
||||
}
|
||||
|
||||
@ -173,7 +176,6 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
const TString80 contratto = get_base_contract(alleg);
|
||||
if (ignora <= em_importo_limite)
|
||||
{
|
||||
const int anno = alleg.get_int(ALL_ANNO);
|
||||
TExclusion_mode new_mode = (alleg.get_real(ALL_IMPORTO) < fe_importo_limite(anno)) ? em_importo_limite : em_incluso;
|
||||
if (new_mode == em_importo_limite && contratto.full())
|
||||
{
|
||||
@ -187,7 +189,7 @@ TExclusion_mode TDati_rilevanti_array::add(const TRectype& alleg, bool send_all,
|
||||
}
|
||||
}
|
||||
|
||||
if (!send_all && ignora != em_incluso)
|
||||
if (ignora > em_importo_limite || (!send_all && ignora == em_importo_limite))
|
||||
return ignora;
|
||||
|
||||
// Creo un nuovo record
|
||||
@ -260,6 +262,7 @@ void TDati_rilevanti_array::add(TArray& fatture, TArray& note, bool send_all, TL
|
||||
const TRectype& fatt = *(const TRectype*)pfatt;
|
||||
add(fatt, send_all, log);
|
||||
}
|
||||
|
||||
// Aggiunge note
|
||||
FOR_EACH_ARRAY_ITEM(note, nn, pnot)
|
||||
{
|
||||
@ -774,6 +777,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
}
|
||||
|
||||
controlla_mov(mov_rec);
|
||||
const TDate datareg = mov_rec.get(MOV_DATAREG);
|
||||
if (fe_is_nota_variazione(mov_rec))
|
||||
{
|
||||
const TDate datarett = mov_rec.get(MOV_DATARETT);
|
||||
@ -782,7 +786,6 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
}
|
||||
else
|
||||
{
|
||||
const TDate datareg = mov_rec.get(MOV_DATAREG);
|
||||
if (datareg.year() == anno) // Scarta fatture dell'anno dopo
|
||||
elabora_movimento(mov_rec, falleg);
|
||||
}
|
||||
@ -968,11 +971,14 @@ bool TDati_rilevanti_msk::send_fatt(const TRectype& alleg, TDati_rilevanti_set&
|
||||
const TString& paiv = anag.partita_IVA();
|
||||
if (paiv.blank())
|
||||
{
|
||||
const real tot = real(importo+imposta);
|
||||
if (tot < 3600) // Limite imposto dal programma di controllo dal 2011 in poi
|
||||
return false;
|
||||
operaz.new_rec("1"); // Operazioni con soggetti residenti non titolari di partita IVA
|
||||
operaz.set(2, anag.codice_fiscale());
|
||||
operaz.set(3, alleg.get(ALL_DATAREG));
|
||||
operaz.set(4, alleg.get(ALL_MODPAG));
|
||||
operaz.set(5, real(importo+imposta));
|
||||
operaz.set(5, tot);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1113,7 +1119,8 @@ bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
if (send_all || !data[a].get_int(ALL_IGNORA))
|
||||
const TExclusion_mode em = (TExclusion_mode)data[a].get_int(ALL_IGNORA);
|
||||
if (em == em_incluso || (em == em_importo_limite && send_all))
|
||||
send_rec(data[a], recset);
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
}
|
||||
|
||||
_tipo = ' '; // Non faccio assunzioni sulla persona fisica
|
||||
|
||||
|
||||
// Persona Fisica?
|
||||
if (rec.get_char(CLI_TIPOAPER) == 'F' || rec.get(CLI_DATANASC).not_empty())
|
||||
{
|
||||
@ -299,6 +299,11 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_cofi = rec.get(CLI_COFI);
|
||||
if (rec.get(CLI_PAIV).not_empty())
|
||||
_paiv = rec.get(CLI_PAIV);
|
||||
|
||||
// Ci sono anagrafiche con codice fiscale numerico e partita IVA vuota!
|
||||
if (_paiv.blank() && pi_check("", _cofi))
|
||||
_paiv = _cofi;
|
||||
|
||||
build_ind_res(rec, CLI_INDCF, CLI_CIVCF);
|
||||
|
||||
// Prevale sempre la ragione sociale del cliente: "Il cliente ha sempre ragione".
|
||||
|
Loading…
x
Reference in New Issue
Block a user