Patch level : 3.2.1700
Files correlati : ve0.exe ve6.exe Ricompilazione Demo : [ ] Commento : La fatturazione bolle se sono attivate le lettere d'intento aggioran il codcie IVA nella fattura se non e' corretto. git-svn-id: svn://10.65.10.50/branches/R_10_00@22320 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a3df789f3d
commit
70df6de698
@ -71,7 +71,7 @@ bool TCli_for::read_lettera(const TDate & data, bool extended)
|
||||
|
||||
if (_use_lettere)
|
||||
{
|
||||
if (data != _last_data)
|
||||
if (data != _last_data || _extended != extended)
|
||||
{
|
||||
_letint.zero();
|
||||
TRelation * r = new TRelation(LF_LETINT);
|
||||
@ -128,6 +128,7 @@ bool TCli_for::read_lettera(const TDate & data, bool extended)
|
||||
_lettera_found = data <= al;
|
||||
}
|
||||
_last_data = data;
|
||||
_extended = extended;
|
||||
}
|
||||
}
|
||||
return _lettera_found;
|
||||
@ -295,7 +296,7 @@ void TCli_for::cli2doc(TDocumento & doc)
|
||||
|
||||
|
||||
TCli_for::TCli_for(char tipo, long codice) : TMultiple_rectype( LF_CLIFO ), _ven_rec(LF_CFVEN),
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false)
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false), _extended(false)
|
||||
{
|
||||
init();
|
||||
add_file(LF_INDSP, IND_CODIND);
|
||||
@ -304,7 +305,7 @@ TCli_for::TCli_for(char tipo, long codice) : TMultiple_rectype( LF_CLIFO ), _ven
|
||||
}
|
||||
|
||||
TCli_for::TCli_for(const TRectype & rec) : TMultiple_rectype(rec), _ven_rec(LF_CFVEN),
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false)
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false), _extended(false)
|
||||
{
|
||||
init();
|
||||
add_file(LF_INDSP, IND_CODIND);
|
||||
@ -312,7 +313,7 @@ TCli_for::TCli_for(const TRectype & rec) : TMultiple_rectype(rec), _ven_rec(LF_C
|
||||
}
|
||||
|
||||
TCli_for::TCli_for(const TCli_for & c) : TMultiple_rectype(c), _ven_rec(c._ven_rec),
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false)
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false), _extended(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ class TCli_for : public TMultiple_rectype
|
||||
TRectype _letint;
|
||||
TDate _last_data;
|
||||
bool _use_lettere;
|
||||
bool _extended;
|
||||
bool _lettera_found;
|
||||
|
||||
|
||||
|
@ -855,6 +855,7 @@ public:
|
||||
void copy_contents(const TDocumento& src, bool copy_header = true);
|
||||
|
||||
void set_fields(TAuto_variable_rectype & rec);
|
||||
void update_esenzione();
|
||||
void set_riga_esenzione();
|
||||
bool ha_riga_sconto() const { return _sconto != NULL; }
|
||||
bool ha_riga_esenzione() const { return _esenzione != NULL; }
|
||||
|
@ -881,6 +881,76 @@ void TDocumento::set_riga_sconto()
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento::update_esenzione()
|
||||
{
|
||||
if (clifor().use_lettere())
|
||||
{
|
||||
bool to_update = false;
|
||||
const TString8 codiva = codesiva();
|
||||
for (int i = physical_rows(); !to_update && i > 0; i--)
|
||||
{
|
||||
const TString & cod = row(i).get(RDOC_CODIVA);
|
||||
|
||||
to_update = cod.full() && cod != codiva;
|
||||
}
|
||||
if (to_update)
|
||||
for (int i = physical_rows(); i > 0; i--)
|
||||
{
|
||||
TRiga_documento & rdoc = row(i);
|
||||
const TString & cod = rdoc.get(RDOC_CODIVA);
|
||||
|
||||
if (cod.full())
|
||||
{
|
||||
if (codiva.full())
|
||||
rdoc.put(RDOC_CODIVA, codiva);
|
||||
else
|
||||
{
|
||||
TCodiceIVA i(cod);
|
||||
const bool plafond = i.get_int("S3") > 0;
|
||||
|
||||
if (plafond)
|
||||
{
|
||||
TString codivarow;
|
||||
|
||||
if (rdoc.is_merce())
|
||||
codivarow =cached_article(rdoc.get(RDOC_CODARTMAG)).get(ANAMAG_CODIVA);
|
||||
else
|
||||
if (rdoc.is_spese())
|
||||
{
|
||||
TSpesa_prest s(rdoc.get(RDOC_CODART));
|
||||
|
||||
codivarow = s.cod_iva();
|
||||
}
|
||||
else
|
||||
if (rdoc.is_prestazione())
|
||||
{
|
||||
TSpesa_prest p(rdoc.get(RDOC_CODART), 'P');
|
||||
|
||||
codivarow = p.cod_iva();
|
||||
}
|
||||
else
|
||||
if (rdoc.is_risorsa())
|
||||
{
|
||||
TSpesa_prest r(rdoc.get(RDOC_CODART), 'R');
|
||||
|
||||
codivarow = r.cod_iva();
|
||||
}
|
||||
else
|
||||
if (rdoc.is_attrezzatura())
|
||||
{
|
||||
TSpesa_prest a(rdoc.get(RDOC_CODART), 'A');
|
||||
|
||||
codivarow = a.cod_iva();
|
||||
}
|
||||
if (codivarow.full())
|
||||
rdoc.put(RDOC_CODIVA, codivarow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento::set_riga_esenzione()
|
||||
{
|
||||
TCli_for & c = clifor();
|
||||
|
@ -585,6 +585,12 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
else
|
||||
d.put("FATID", 0);
|
||||
}
|
||||
for (int i = doc_out.items() - 1; i >=0; i--) // Aggiorna esenzione
|
||||
{
|
||||
TDocumento& d = doc_out[i];
|
||||
|
||||
d.update_esenzione();
|
||||
}
|
||||
return doc_out.items() > 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user