Gestione descrizione IVA cee in stampa fatture
Correzioni varie a lettere d'intento git-svn-id: svn://10.65.10.50/branches/R_10_00@22830 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
12d9139ed1
commit
56c30da236
@ -65,27 +65,24 @@ TRectype& TCli_for::vendite() const
|
|||||||
return (TRectype &) _ven_rec;
|
return (TRectype &) _ven_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCli_for::read_lettera(const TDate & data, bool extended)
|
bool TCli_for::read_lettera(const TDate& data, bool extended)
|
||||||
{
|
{
|
||||||
|
if (use_lettere())
|
||||||
if (_use_lettere)
|
|
||||||
{
|
{
|
||||||
if (data != _last_data || _extended != extended)
|
if (data != _last_data || _extended != extended)
|
||||||
{
|
{
|
||||||
_letint.zero();
|
_letint.zero();
|
||||||
TRelation * r = new TRelation(LF_LETINT);
|
TRelation r(LF_LETINT);
|
||||||
TRectype to(r->curr());
|
|
||||||
|
|
||||||
to.put(LETINT_ANNO, data.year());
|
TRectype to(r.curr());
|
||||||
to.put(LETINT_CODCLI, codice());
|
to.put(LETINT_CODCLI, codice());
|
||||||
|
to.put(LETINT_ANNO, data.year());
|
||||||
|
|
||||||
TRectype from(to);
|
TRectype from(to);
|
||||||
|
|
||||||
from.put(LETINT_ANNO, data.year() - 1);
|
from.put(LETINT_ANNO, data.year() - 1);
|
||||||
|
|
||||||
TCursor c(r, "", 2 ,&from, &to);
|
TCursor c(&r, "", 2, &from, &to);
|
||||||
const int items = c.items();
|
const int items = c.items();
|
||||||
|
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
TDate dal;
|
TDate dal;
|
||||||
@ -97,7 +94,7 @@ bool TCli_for::read_lettera(const TDate & data, bool extended)
|
|||||||
|
|
||||||
const int tipo = c.curr().get_int(LETINT_TIPOOP);
|
const int tipo = c.curr().get_int(LETINT_TIPOOP);
|
||||||
|
|
||||||
if (tipo == 3)
|
if (tipo == 3) // Nel periodo
|
||||||
{
|
{
|
||||||
dal = c.curr().get_date(LETINT_DAL);
|
dal = c.curr().get_date(LETINT_DAL);
|
||||||
al = c.curr().get_date(LETINT_AL);
|
al = c.curr().get_date(LETINT_AL);
|
||||||
@ -163,7 +160,7 @@ int TCli_for::remove(TBaseisamfile& f) const
|
|||||||
const int err = vendite().remove(v);
|
const int err = vendite().remove(v);
|
||||||
if (err != NOERR && err != _iskeynotfound)
|
if (err != NOERR && err != _iskeynotfound)
|
||||||
return err;
|
return err;
|
||||||
return TMultiple_rectype:: remove(f);
|
return TMultiple_rectype::remove(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCli_for::init()
|
void TCli_for::init()
|
||||||
|
@ -19,7 +19,7 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
TOOLBAR "botbar" 0 -2 0 2
|
TOOLBAR "botbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_SAVEREC 10 2
|
BUTTON DLG_SAVEREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -200,6 +200,7 @@ TDoc_recordset::TDoc_recordset(const TRecordset& doc, const TString& old_query)
|
|||||||
rows.sort(compare_rdocs);
|
rows.sort(compare_rdocs);
|
||||||
}
|
}
|
||||||
_doc->set_riga_conai();
|
_doc->set_riga_conai();
|
||||||
|
_doc->set_riga_tic();
|
||||||
|
|
||||||
// Posiziona correttamente anche il cursore principale
|
// Posiziona correttamente anche il cursore principale
|
||||||
*cursor() = 0L;
|
*cursor() = 0L;
|
||||||
|
@ -378,10 +378,12 @@ void TMask_anamag::set_parametered_fields()
|
|||||||
enable_page(PAGE_GIACENZE,gestmag);
|
enable_page(PAGE_GIACENZE,gestmag);
|
||||||
enable_page(PAGE_STORICO,gestmag);
|
enable_page(PAGE_STORICO,gestmag);
|
||||||
|
|
||||||
|
/* Obsoleto
|
||||||
// abilita la visualizzazione dei campi per la vendita al dettaglio
|
// abilita la visualizzazione dei campi per la vendita al dettaglio
|
||||||
const bool dettaglio = app().has_module(VDAUT);
|
const bool dettaglio = app().has_module(VDAUT);
|
||||||
|
|
||||||
show(-G_VD, dettaglio);
|
show(-G_VD, dettaglio);
|
||||||
|
*/
|
||||||
|
|
||||||
// abilita la visualizzazione dei campi distinti per i livelli articolo
|
// abilita la visualizzazione dei campi distinti per i livelli articolo
|
||||||
set_handler(F_CODART, handle_codice);
|
set_handler(F_CODART, handle_codice);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@
|
|||||||
#define G_CATVEN 6
|
#define G_CATVEN 6
|
||||||
#define G_CONVEN 7
|
#define G_CONVEN 7
|
||||||
#define G_RAGGFISC 8
|
#define G_RAGGFISC 8
|
||||||
#define G_VD 9
|
// #define G_VD 9 Vendite al dettaglio Obsolete
|
||||||
#define G_LV 10
|
#define G_LV 10
|
||||||
|
|
||||||
// definizioni per l'archivio di misura articoli
|
// definizioni per l'archivio di misura articoli
|
||||||
|
@ -257,6 +257,7 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
/*
|
||||||
STRING F_REPARTO 3
|
STRING F_REPARTO 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "Reparto "
|
PROMPT 1 6 "Reparto "
|
||||||
@ -313,6 +314,7 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
GROUP G_VD
|
GROUP G_VD
|
||||||
END
|
END
|
||||||
|
*/
|
||||||
|
|
||||||
STRING F_CATCONV 3
|
STRING F_CATCONV 3
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -207,7 +207,6 @@ BEGIN
|
|||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
DISPLAY "Cambio" S4
|
DISPLAY "Cambio" S4
|
||||||
OUTPUT FA_CODVAL CODTAB
|
OUTPUT FA_CODVAL CODTAB
|
||||||
OUTPUT FA_CONTROEURO B1
|
|
||||||
OUTPUT FA_CAMBIO S4
|
OUTPUT FA_CAMBIO S4
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
MESSAGE EMPTY CLEAR,FA_CAMBIO|CLEAR,FA_DATACAM|DISABLE,FA_DATACAM
|
MESSAGE EMPTY CLEAR,FA_CAMBIO|CLEAR,FA_DATACAM|DISABLE,FA_DATACAM
|
||||||
@ -220,14 +219,6 @@ BEGIN
|
|||||||
FIELD CAMBIO
|
FIELD CAMBIO
|
||||||
END
|
END
|
||||||
|
|
||||||
/*
|
|
||||||
BOOLEAN FA_CONTROEURO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 42 1 "Contro Euro"
|
|
||||||
FIELD CONTROEURO
|
|
||||||
END
|
|
||||||
*/
|
|
||||||
|
|
||||||
DATA FA_DATACAM
|
DATA FA_DATACAM
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 61 1 "Data "
|
PROMPT 61 1 "Data "
|
||||||
|
@ -403,7 +403,7 @@ real TDocumento::spese_incasso(real & imp, int ndec, TTipo_importo t) const
|
|||||||
if (t == _lordo || t == _imposta)
|
if (t == _lordo || t == _imposta)
|
||||||
{
|
{
|
||||||
TString4 codiva_es; iva_esente(codiva_es);
|
TString4 codiva_es; iva_esente(codiva_es);
|
||||||
const real iva_spese(TRiga_documento::iva(codiva_es.full() ? (const TString &)codiva_es : codiva_spese()).imposta(imp_spese, ndec));
|
const real iva_spese = TRiga_documento::iva(codiva_es.full() ? (const TString&)codiva_es : codiva_spese()).imposta(imp_spese, ndec);
|
||||||
if (t == _lordo)
|
if (t == _lordo)
|
||||||
imp_spese += iva_spese;
|
imp_spese += iva_spese;
|
||||||
else
|
else
|
||||||
@ -432,7 +432,7 @@ void TDocumento::iva_esente(TString& codiva_es) const
|
|||||||
for (int r = 1; codiva_es.empty() && r <= rows; r++)
|
for (int r = 1; codiva_es.empty() && r <= rows; r++)
|
||||||
{
|
{
|
||||||
const TRiga_documento& riga = ((TDocumento*)this)->row(r);
|
const TRiga_documento& riga = ((TDocumento*)this)->row(r);
|
||||||
const TString4 str_codiva(riga.get(RDOC_CODIVA));
|
const TString4 str_codiva = riga.get(RDOC_CODIVA);
|
||||||
|
|
||||||
if (str_codiva.full())
|
if (str_codiva.full())
|
||||||
{
|
{
|
||||||
@ -868,7 +868,7 @@ void TDocumento::set_riga_sconto()
|
|||||||
{
|
{
|
||||||
_tipo_riga_sc = "08";
|
_tipo_riga_sc = "08";
|
||||||
conf.set("TRSCONTI", _tipo_riga_sc);
|
conf.set("TRSCONTI", _tipo_riga_sc);
|
||||||
warning_box(FR("Il tipo riga sconti di testa non risultava impostato.\n L'applicazione usera' automaticamente il tipo %s"), (const char*) _tipo_riga_sc);
|
warning_box(FR("Il tipo riga sconti di testa non risultava impostato.\n L'applicazione userà automaticamente il tipo %s"), (const char*) _tipo_riga_sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_sconto = new TRiga_documento(this, _tipo_riga_sc);
|
_sconto = new TRiga_documento(this, _tipo_riga_sc);
|
||||||
@ -883,18 +883,18 @@ void TDocumento::update_esenzione()
|
|||||||
if (clifor().use_lettere())
|
if (clifor().use_lettere())
|
||||||
{
|
{
|
||||||
bool to_update = false;
|
bool to_update = false;
|
||||||
const TString8 codiva = codesiva();
|
const TString4 codiva = codesiva();
|
||||||
for (int i = physical_rows(); !to_update && i > 0; i--)
|
for (int i = physical_rows(); !to_update && i > 0; i--)
|
||||||
{
|
{
|
||||||
const TString & cod = row(i).get(RDOC_CODIVA);
|
const TString & cod = row(i).get(RDOC_CODIVA);
|
||||||
|
|
||||||
to_update = cod.full() && cod != codiva;
|
to_update = cod.full() && cod != codiva;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to_update)
|
if (to_update)
|
||||||
for (int i = physical_rows(); i > 0; i--)
|
for (int i = physical_rows(); i > 0; i--)
|
||||||
{
|
{
|
||||||
TRiga_documento & rdoc = row(i);
|
TRiga_documento & rdoc = row(i);
|
||||||
const TString & cod = rdoc.get(RDOC_CODIVA);
|
const TString& cod = rdoc.get(RDOC_CODIVA);
|
||||||
|
|
||||||
if (cod.full())
|
if (cod.full())
|
||||||
{
|
{
|
||||||
@ -902,41 +902,37 @@ void TDocumento::update_esenzione()
|
|||||||
rdoc.put(RDOC_CODIVA, codiva);
|
rdoc.put(RDOC_CODIVA, codiva);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCodiceIVA i(cod);
|
const TCodiceIVA i(cod);
|
||||||
const bool plafond = i.get_int("S3") > 0;
|
const bool plafond = i.get_int("S3") > 0;
|
||||||
|
|
||||||
if (plafond)
|
if (plafond)
|
||||||
{
|
{
|
||||||
TString codivarow;
|
TString4 codivarow;
|
||||||
|
|
||||||
if (rdoc.is_merce())
|
if (rdoc.is_merce())
|
||||||
codivarow =cached_article(rdoc.get(RDOC_CODARTMAG)).get(ANAMAG_CODIVA);
|
codivarow =cached_article(rdoc.get(RDOC_CODARTMAG)).get(ANAMAG_CODIVA);
|
||||||
else
|
else
|
||||||
if (rdoc.is_spese())
|
if (rdoc.is_spese())
|
||||||
{
|
{
|
||||||
TSpesa_prest s(rdoc.get(RDOC_CODART));
|
const TSpesa_prest s(rdoc.get(RDOC_CODART));
|
||||||
|
|
||||||
codivarow = s.cod_iva();
|
codivarow = s.cod_iva();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (rdoc.is_prestazione())
|
if (rdoc.is_prestazione())
|
||||||
{
|
{
|
||||||
TSpesa_prest p(rdoc.get(RDOC_CODART), 'P');
|
TSpesa_prest p(rdoc.get(RDOC_CODART), 'P');
|
||||||
|
|
||||||
codivarow = p.cod_iva();
|
codivarow = p.cod_iva();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (rdoc.is_risorsa())
|
if (rdoc.is_risorsa())
|
||||||
{
|
{
|
||||||
TSpesa_prest r(rdoc.get(RDOC_CODART), 'R');
|
TSpesa_prest r(rdoc.get(RDOC_CODART), 'R');
|
||||||
|
|
||||||
codivarow = r.cod_iva();
|
codivarow = r.cod_iva();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (rdoc.is_attrezzatura())
|
if (rdoc.is_attrezzatura())
|
||||||
{
|
{
|
||||||
TSpesa_prest a(rdoc.get(RDOC_CODART), 'A');
|
TSpesa_prest a(rdoc.get(RDOC_CODART), 'A');
|
||||||
|
|
||||||
codivarow = a.cod_iva();
|
codivarow = a.cod_iva();
|
||||||
}
|
}
|
||||||
if (codivarow.full())
|
if (codivarow.full())
|
||||||
@ -965,17 +961,19 @@ void TDocumento::set_riga_esenzione()
|
|||||||
if (esente)
|
if (esente)
|
||||||
{
|
{
|
||||||
esente = false;
|
esente = false;
|
||||||
const TString8 codiva = codes.codice();
|
const TString4 codiva = codes.codice();
|
||||||
for (int i = physical_rows(); !esente && i > 0; i--)
|
for (int i = physical_rows(); !esente && i > 0; i--)
|
||||||
esente = row(i).get(RDOC_CODIVA) == codiva;
|
esente = row(i).get(RDOC_CODIVA) == codiva;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!esente)
|
if (!esente)
|
||||||
{
|
{
|
||||||
if(_esenzione != NULL)
|
if (_esenzione != NULL)
|
||||||
|
{
|
||||||
delete _esenzione;
|
delete _esenzione;
|
||||||
_esenzione = NULL;
|
_esenzione = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static TString4 _tipo_riga_es;
|
static TString4 _tipo_riga_es;
|
||||||
@ -2181,7 +2179,6 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
const bool fatt_comm = tipo().fattura_commerciale();
|
const bool fatt_comm = tipo().fattura_commerciale();
|
||||||
|
|
||||||
TString4 codiva_es;
|
TString4 codiva_es;
|
||||||
|
|
||||||
iva_esente(codiva_es);
|
iva_esente(codiva_es);
|
||||||
for (int i = items; i > 0; i--)
|
for (int i = items; i > 0; i--)
|
||||||
{
|
{
|
||||||
@ -2293,7 +2290,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
|||||||
|
|
||||||
if (!val.is_zero())
|
if (!val.is_zero())
|
||||||
{
|
{
|
||||||
const TString& codiva = codiva_es.full() ? (const TString &) codiva_es : codiva_spese();
|
const TString& codiva = codiva_es.full() ? (const TString&)codiva_es : codiva_spese();
|
||||||
TRiepilogo_iva* ri = (TRiepilogo_iva*)table.objptr(codiva);
|
TRiepilogo_iva* ri = (TRiepilogo_iva*)table.objptr(codiva);
|
||||||
if (ri == NULL && codiva.full())
|
if (ri == NULL && codiva.full())
|
||||||
{
|
{
|
||||||
@ -2732,7 +2729,7 @@ void TDocumento::update_raee()
|
|||||||
r1.put(RDOC_UMQTA, um);
|
r1.put(RDOC_UMQTA, um);
|
||||||
if (cod_iva_cli.blank())
|
if (cod_iva_cli.blank())
|
||||||
{
|
{
|
||||||
const TString & codiva = sp.cod_iva();
|
const TString& codiva = sp.cod_iva();
|
||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
r1.put(RDOC_CODIVA, codiva);
|
r1.put(RDOC_CODIVA, codiva);
|
||||||
}
|
}
|
||||||
@ -2941,7 +2938,7 @@ void TDocumento::update_conai()
|
|||||||
// Genera nuove righe
|
// Genera nuove righe
|
||||||
if (cli_add_conai)
|
if (cli_add_conai)
|
||||||
{
|
{
|
||||||
const TString4 cod_iva_cli = codesiva() ;
|
const TString4 cod_iva_cli = codesiva();
|
||||||
TSpesa_prest sp;
|
TSpesa_prest sp;
|
||||||
|
|
||||||
FOR_EACH_CONFIGURED_CONAI_CLASS(ct) if (!updated[ct])
|
FOR_EACH_CONFIGURED_CONAI_CLASS(ct) if (!updated[ct])
|
||||||
@ -2961,7 +2958,7 @@ void TDocumento::update_conai()
|
|||||||
const TString& s = conai_sp.row(ct);
|
const TString& s = conai_sp.row(ct);
|
||||||
|
|
||||||
if (sp.read(s) != NOERR)
|
if (sp.read(s) != NOERR)
|
||||||
message_box(FR("Il codice spesa CONAI %s specificato nei parametri ditta e' assente: '%s'"),
|
message_box(FR("Il codice spesa CONAI %s specificato nei parametri ditta è assente: '%s'"),
|
||||||
conai_material(ct), (const char*)s);
|
conai_material(ct), (const char*)s);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3106,17 +3103,24 @@ int TDocumento::tipo_riclassificato() const
|
|||||||
const TString& TDocumento::codesiva() const
|
const TString& TDocumento::codesiva() const
|
||||||
{
|
{
|
||||||
TCli_for& c = clifor();
|
TCli_for& c = clifor();
|
||||||
const TString4 codiva(c.vendite().get(CFV_ASSFIS));
|
|
||||||
TCodiceIVA i(codiva);
|
|
||||||
const bool plafond = i.get_int("S3") > 0;
|
|
||||||
|
|
||||||
if (!c.use_lettere() || c.read_lettera(get_date(DOC_DATADOC)))
|
const TString& codiva = c.vendite().get(CFV_ASSFIS);
|
||||||
return c.vendite().get(CFV_ASSFIS);
|
if (!c.use_lettere())
|
||||||
|
return codiva;
|
||||||
|
|
||||||
|
const TCodiceIVA i(codiva);
|
||||||
|
if (!i.has_plafond()) // Era presente nella 3.x, poi è sparito nella 10, ora torna nella 11.0 (7-3-2013)
|
||||||
|
return codiva;
|
||||||
|
|
||||||
|
const TDate datadoc = get(DOC_DATADOC);
|
||||||
|
if (c.read_lettera(datadoc))
|
||||||
|
return c.vendite().get(CFV_ASSFIS); // codiva may be lost
|
||||||
|
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento::get_protocolli_esenzione(TString & esenzione, TString & data_esenzione,
|
void TDocumento::get_protocolli_esenzione(TString& esenzione, TString& data_esenzione,
|
||||||
TString & registrazione, TString & data_registrazione) const
|
TString& registrazione, TString& data_registrazione) const
|
||||||
{
|
{
|
||||||
TCli_for& c = clifor();
|
TCli_for& c = clifor();
|
||||||
if (c.use_lettere())
|
if (c.use_lettere())
|
||||||
|
@ -23,7 +23,7 @@ TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
|||||||
TFatturazione_bolle::TFatturazione_bolle(const TRectype& rec)
|
TFatturazione_bolle::TFatturazione_bolle(const TRectype& rec)
|
||||||
: TElaborazione(rec)
|
: TElaborazione(rec)
|
||||||
{
|
{
|
||||||
TString cod(rec.get("CODTAB"));
|
const TString8 cod = rec.get("CODTAB");
|
||||||
TString80 name; name.format("AGGFLD(%s)", cod);
|
TString80 name; name.format("AGGFLD(%s)", cod);
|
||||||
|
|
||||||
_lista_campi = ini_get_string(CONFIG_DITTA, "ve", name);
|
_lista_campi = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||||
@ -383,36 +383,43 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
TToken_string s("", '=');
|
TToken_string s("", '=');
|
||||||
for (s = _lista_campi.get(0); s.full(); s = _lista_campi.get())
|
for (s = _lista_campi.get(0); s.full(); s = _lista_campi.get())
|
||||||
{
|
{
|
||||||
TString16 oname(s.get());
|
const TString16 oname(s.get());
|
||||||
TString16 iname(s.get());
|
TString16 iname(s.get());
|
||||||
|
|
||||||
if (oname == RDOC_CODIVA)
|
if (oname == RDOC_CODIVA)
|
||||||
{
|
{
|
||||||
const int rows = campione.physical_rows();
|
const int rows = campione.physical_rows();
|
||||||
const TString8 codesiva = campione.codesiva();
|
const TString4 codesiva = campione.codesiva();
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(campione, i, rdoc)
|
FOR_EACH_PHYSICAL_RDOC(campione, i, rdoc)
|
||||||
|
{
|
||||||
|
// Elabora solo righe articolo, spese o prestazioni valide
|
||||||
|
if (!rdoc->is_descrizione())
|
||||||
{
|
{
|
||||||
if (codesiva.full())
|
if (codesiva.full())
|
||||||
|
{
|
||||||
|
if (rdoc->imponibile().is_zero())
|
||||||
|
rdoc->zero(RDOC_CODIVA);
|
||||||
|
else
|
||||||
rdoc->put(RDOC_CODIVA, codesiva);
|
rdoc->put(RDOC_CODIVA, codesiva);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rdoc->is_articolo())
|
if (rdoc->is_articolo())
|
||||||
{
|
{
|
||||||
const TArticolo_giacenza & art = rdoc->articolo();
|
const TArticolo_giacenza& art = rdoc->articolo();
|
||||||
const TString8 codiva = art.get(ANAMAG_CODIVA);
|
const TString& codiva = art.get(ANAMAG_CODIVA);
|
||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
rdoc->put(RDOC_CODIVA, codiva);
|
rdoc->put(RDOC_CODIVA, codiva);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
if ((rdoc->is_spese() || rdoc->is_prestazione()))
|
if ((rdoc->is_spese() || rdoc->is_prestazione()))
|
||||||
{
|
{
|
||||||
const TSpesa_prest & s = rdoc->spesa();
|
const TSpesa_prest& s = rdoc->spesa();
|
||||||
const TString8 codiva = s.cod_iva();
|
const TString& codiva = s.cod_iva();
|
||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
rdoc->put(RDOC_CODIVA, codiva);
|
rdoc->put(RDOC_CODIVA, codiva);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4135,7 +4135,7 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
|||||||
break;
|
break;
|
||||||
case nr_reg_error:
|
case nr_reg_error:
|
||||||
msg.format("Rilevato un numero di registrazione errato contabilizzando il documento %s/%ld."
|
msg.format("Rilevato un numero di registrazione errato contabilizzando il documento %s/%ld."
|
||||||
"Verificare l'integrita' del file movimenti.",(const char*)numerazione,numero);
|
"Verificare l'integrità del file movimenti.",(const char*)numerazione,numero);
|
||||||
break;
|
break;
|
||||||
case nr_doc_error:
|
case nr_doc_error:
|
||||||
msg.format("Rilevato un numero di documento errato contabilizzando il documento %s/%ld."
|
msg.format("Rilevato un numero di documento errato contabilizzando il documento %s/%ld."
|
||||||
@ -4143,7 +4143,7 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
|||||||
break;
|
break;
|
||||||
case chg_stat_error:
|
case chg_stat_error:
|
||||||
msg.format("Rilevato un errore cambiando lo stato al documento %s/%ld."
|
msg.format("Rilevato un errore cambiando lo stato al documento %s/%ld."
|
||||||
"Verificare l'integrita' del file documenti.",(const char*)numerazione,numero);
|
"Verificare l'integrità del file documenti.",(const char*)numerazione,numero);
|
||||||
break;
|
break;
|
||||||
case clifo_error:
|
case clifo_error:
|
||||||
msg.format("Rilevato un errore caricando le informazioni del Cli/Fo sul documento %s/%ld."
|
msg.format("Rilevato un errore caricando le informazioni del Cli/Fo sul documento %s/%ld."
|
||||||
|
@ -244,7 +244,7 @@ int TDocumentoEsteso::readat(TBaseisamfile& file, TRecnotype nrec, word lockop)
|
|||||||
|
|
||||||
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
|
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
|
||||||
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
||||||
_conai(NULL)
|
_conai(NULL), _tic(NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
// Inizializza i parametri di default
|
// Inizializza i parametri di default
|
||||||
@ -253,25 +253,29 @@ TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec)
|
|||||||
|
|
||||||
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm)
|
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm)
|
||||||
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
: TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
||||||
_conai(NULL)
|
_conai(NULL), _tic(NULL)
|
||||||
{
|
{
|
||||||
_parm = parm;
|
_parm = parm;
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumentoEsteso::TDocumentoEsteso()
|
TDocumentoEsteso::TDocumentoEsteso()
|
||||||
: TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
: TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1),
|
||||||
_conai(NULL)
|
_conai(NULL), _tic(NULL)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TDocumentoEsteso::~TDocumentoEsteso()
|
TDocumentoEsteso::~TDocumentoEsteso()
|
||||||
{ }
|
{
|
||||||
|
if (_conai) delete _conai;
|
||||||
|
if (_tic) delete _tic;
|
||||||
|
}
|
||||||
|
|
||||||
void TDocumentoEsteso::set_riga_conai()
|
void TDocumentoEsteso::set_riga_conai()
|
||||||
{
|
{
|
||||||
if(_conai != NULL)
|
if (_conai != NULL)
|
||||||
|
{
|
||||||
delete _conai;
|
delete _conai;
|
||||||
_conai = NULL;
|
_conai = NULL;
|
||||||
|
}
|
||||||
if (rows() > 0)
|
if (rows() > 0)
|
||||||
{
|
{
|
||||||
const bool has_conai = (tipo().add_conai() && clifor().vendite().get_bool(CFV_CONAIASS));
|
const bool has_conai = (tipo().add_conai() && clifor().vendite().get_bool(CFV_CONAIASS));
|
||||||
@ -287,10 +291,51 @@ void TDocumentoEsteso::set_riga_conai()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRiga_documento & TDocumentoEsteso::row(int index)
|
void TDocumentoEsteso::set_riga_tic()
|
||||||
{
|
{
|
||||||
if (index == TDocumento::rows() + 1)
|
if (_tic != NULL)
|
||||||
return * _conai;
|
{
|
||||||
|
delete _tic;
|
||||||
|
_tic = NULL;
|
||||||
|
}
|
||||||
|
if (get_int(DOC_ANNO) >= 2013 && is_fattura())
|
||||||
|
{
|
||||||
|
FOR_EACH_PHYSICAL_RDOC(*this, r, rdoc) if (!rdoc->is_descrizione())
|
||||||
|
{
|
||||||
|
const TString& cod = rdoc->get(RDOC_CODIVA);
|
||||||
|
if (cod.full() && !rdoc->imponibile().is_zero())
|
||||||
|
{
|
||||||
|
const TCodiceIVA iva(cod);
|
||||||
|
TString4 tic; tic.format("%04d", iva.get_int("I1"));
|
||||||
|
if (tic != "0000")
|
||||||
|
{
|
||||||
|
_tic = new TRiga_documento(this, "05");
|
||||||
|
_tic->put(RDOC_DESCR, cache().get("%TIC", tic, "S0"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TDocumentoEsteso::rows() const
|
||||||
|
{
|
||||||
|
int n = TDocumento::rows();
|
||||||
|
if (_conai) n++;
|
||||||
|
if (_tic) n++;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRiga_documento& TDocumentoEsteso::row(int index)
|
||||||
|
{
|
||||||
|
const int n = TDocumento::rows();
|
||||||
|
if (index > n)
|
||||||
|
{
|
||||||
|
if (_conai != NULL && _tic != NULL)
|
||||||
|
return index == n+1 ? *_conai : *_tic;
|
||||||
|
else
|
||||||
|
return _conai ? *_conai : *_tic;
|
||||||
|
}
|
||||||
return TDocumento::row(index);
|
return TDocumento::row(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ class TDocumentoEsteso : public TDocumento
|
|||||||
{
|
{
|
||||||
// Parametri del documento
|
// Parametri del documento
|
||||||
dec_parm _parm; // Parametri per gli arrotondamenti
|
dec_parm _parm; // Parametri per gli arrotondamenti
|
||||||
TRiga_documento * _conai;
|
TRiga_documento* _conai;
|
||||||
|
TRiga_documento* _tic;
|
||||||
|
|
||||||
// membri per il calcolo del riepilogo IVA
|
// membri per il calcolo del riepilogo IVA
|
||||||
|
|
||||||
@ -68,11 +69,11 @@ public:
|
|||||||
// pertanto i non imponibili avranno selettore 1 e gli esenti selettore 4.
|
// pertanto i non imponibili avranno selettore 1 e gli esenti selettore 4.
|
||||||
// per avere esenti + non soggetti il selettore sara' 20 e cosi' via.
|
// per avere esenti + non soggetti il selettore sara' 20 e cosi' via.
|
||||||
real tot_imponibili(byte selector);
|
real tot_imponibili(byte selector);
|
||||||
virtual int rows() const { return TDocumento::rows() + ((_conai != NULL) ? 1 : 0); }
|
virtual int rows() const;
|
||||||
virtual TRiga_documento & row(int index);
|
virtual TRiga_documento& row(int index);
|
||||||
|
|
||||||
void set_riga_conai();
|
void set_riga_conai();
|
||||||
|
void set_riga_tic();
|
||||||
|
|
||||||
// Funzioni per settare i parametri
|
// Funzioni per settare i parametri
|
||||||
void set_decimals(dec_parm & parm) { _parm = parm ; }
|
void set_decimals(dec_parm & parm) { _parm = parm ; }
|
||||||
|
@ -311,7 +311,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main_app().has_module(CUAUT))
|
if (main_app().has_module(CTAUT))
|
||||||
{
|
{
|
||||||
if (_ges_ca && id2pos(F_CUP) > 0)
|
if (_ges_ca && id2pos(F_CUP) > 0)
|
||||||
{
|
{
|
||||||
|
@ -2777,7 +2777,7 @@ bool codcms_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main_app().has_module(CUAUT) && (key == K_TAB && f.focusdirty()))
|
if (main_app().has_module(CTAUT) && (key == K_TAB && f.focusdirty()))
|
||||||
{
|
{
|
||||||
TToken_string key;
|
TToken_string key;
|
||||||
static TRecord_cache __cfcm(LF_CFCMS, 4);
|
static TRecord_cache __cfcm(LF_CFCMS, 4);
|
||||||
@ -3279,7 +3279,7 @@ bool TNar_mask::show_note()
|
|||||||
const TRecnotype items = cur.items();
|
const TRecnotype items = cur.items();
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
close();
|
// close(); // Pare un doppione rispetto alla close() precedente
|
||||||
cur.freeze();
|
cur.freeze();
|
||||||
const TRectype& curr = rel.curr();
|
const TRectype& curr = rel.curr();
|
||||||
TSheet_field& sheet = sfield(N_NOTES);
|
TSheet_field& sheet = sfield(N_NOTES);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user