Patch level : 12.0 1034
Files correlati : ve0.exe ve6.exe fatacq.ini fatacq.msk vetbeld.msk verig00.msk Commento : Corretta la funzionalità fatturare a, si deve controllare la tabella elaborazioni Aggiunto l'aggiornamento dei prezzi e delle descrizioni nella fatturazione bolle, quindi si deve controllare la tabella delle elaborazioni terminato il supporto per il reverse charge parziale
This commit is contained in:
parent
fdac7575f9
commit
05c60ff78d
@ -164,10 +164,12 @@ Col(14) = FR_IMPFISSO
|
||||
Col(15) = FR_PERCPROV1
|
||||
Col(16) = FR_CODIVA
|
||||
Col(17) = FR_ADDIVA
|
||||
Col(18) = FR_CAUS
|
||||
Col(19) = FR_CODMAGC
|
||||
Col(20) = FR_CODDEPC
|
||||
Col(21) = FR_TIPORIGA
|
||||
Col(18) = FR_REVCHARGE
|
||||
Col(19) = FR_TIPODET
|
||||
Col(20) = FR_CAUS
|
||||
Col(21) = FR_CODMAGC
|
||||
Col(22) = FR_CODDEPC
|
||||
Col(23) = FR_TIPORIGA
|
||||
|
||||
[RIGHE]
|
||||
|
||||
|
@ -1020,7 +1020,10 @@ public:
|
||||
|
||||
int find_nrow(const char * tiporiga, const char * codice, bool reverse = false, int from = -1) const;
|
||||
TRiga_documento & find_row(const char * tiporiga, const char * codice, bool reverse = false);
|
||||
|
||||
|
||||
void update_prices();
|
||||
void update_descriptions();
|
||||
|
||||
TDocumento ();
|
||||
TDocumento (const TDocumento& d);
|
||||
TDocumento(char provv, int anno, const char* codnum, long numdoc);
|
||||
|
@ -1476,6 +1476,8 @@ void TRiga_documento::autosave(TSheet_field& f)
|
||||
put( RDOC_IMPFISUN, row.get( f.cid2index(FR_IMPFISUN )) );
|
||||
put( RDOC_IMPFISSO, row.get( f.cid2index(FR_IMPFISSO )) );
|
||||
put( RDOC_CODIVA, codiva);
|
||||
put(RDOC_REVCHARGE, row.get_bool(cid2index(FR_REVCHARGE)));
|
||||
put(RDOC_TIPODET, row.get_bool(cid2index(FR_TIPODET)));
|
||||
put( RDOC_ADDIVA, row.get( f.cid2index(FR_ADDIVA )) );
|
||||
put( RDOC_ASPBENI, row.get( f.cid2index(FR_ASPBENI )) );
|
||||
put( RDOC_CAUSMAG, row.get( f.cid2index(FR_CAUS )) );
|
||||
@ -1613,6 +1615,8 @@ void TRiga_documento::autoload(TSheet_field & f)
|
||||
row.add( get( RDOC_IMPFISUN ), f.cid2index(FR_IMPFISUN ));
|
||||
row.add( get( RDOC_IMPFISSO ), f.cid2index(FR_IMPFISSO ));
|
||||
row.add( codiva, f.cid2index(FR_CODIVA ));
|
||||
row.add(get(RDOC_REVCHARGE), cid2index(FR_REVCHARGE));
|
||||
row.add(get(RDOC_TIPODET), cid2index(FR_TIPODET));
|
||||
row.add( get( RDOC_ADDIVA ), f.cid2index(FR_ADDIVA ));
|
||||
row.add( get( RDOC_ASPBENI ), f.cid2index(FR_ASPBENI ));
|
||||
row.add( get( RDOC_CAUSMAG ), f.cid2index(FR_CAUS ));
|
||||
|
@ -2569,24 +2569,9 @@ real TDocumento::imposta(bool spese, int ndec) const
|
||||
|
||||
real TDocumento::totale_doc() const
|
||||
{
|
||||
/* A pag.1 c'e' scritto di non fare cosi'
|
||||
const TString16 field(tipo().totale_doc());
|
||||
|
||||
if (field.not_empty())
|
||||
return get_real(field);
|
||||
else
|
||||
{
|
||||
real r = imponibile() + imposta();
|
||||
const int ndec = decimals();
|
||||
|
||||
r += spese_incasso(r - ritenute()), ndec);
|
||||
r += bolli(real(r - ritenute()), ndec);
|
||||
return r;
|
||||
}
|
||||
*/
|
||||
// Cosi' e' piu' ordinato, strutturato e veloce
|
||||
real r;
|
||||
const TString& field = tipo().totale_doc();
|
||||
|
||||
if (field.blank())
|
||||
{
|
||||
const int ndec = decimals();
|
||||
@ -2607,6 +2592,7 @@ real TDocumento::totale_doc() const
|
||||
real TDocumento::totale_netto() const
|
||||
{
|
||||
const TString& field = tipo().totale_netto();
|
||||
|
||||
if (field.full())
|
||||
return get_real(field);
|
||||
else
|
||||
@ -2616,6 +2602,7 @@ real TDocumento::totale_netto() const
|
||||
real TDocumento::basesconto() const
|
||||
{
|
||||
const TString& field = tipo().basesconto();
|
||||
|
||||
return field.full() ? get_real(field) : ZERO;
|
||||
}
|
||||
|
||||
@ -2684,13 +2671,16 @@ TPagamento& TDocumento::pagamento()
|
||||
{
|
||||
const char tipocf = get_char(DOC_TIPOCF);
|
||||
const long codcf = get_long(DOC_CODCF);
|
||||
|
||||
_pag.set_clifo(codcf, tipocf);
|
||||
|
||||
TDate data_in = get_date(DOC_DATAINSC);
|
||||
|
||||
if (data_in.empty())
|
||||
data_in = get_date(DOC_DATADOC);
|
||||
|
||||
const TString8 codpag(get(DOC_CODPAG));
|
||||
|
||||
if (codpag != _pag.code())
|
||||
{
|
||||
_pag.set_code(codpag);
|
||||
@ -2709,10 +2699,12 @@ TPagamento& TDocumento::pagamento()
|
||||
real TDocumento::provvigione(bool first, int ndec) const
|
||||
{
|
||||
TString16 field = agente(first).campoprovv();
|
||||
|
||||
if (field.empty())
|
||||
field = first ? tipo().totprovv() : tipo().totprovv1();
|
||||
|
||||
real val;
|
||||
real val;
|
||||
|
||||
if (field.not_empty())
|
||||
val = get_real(field);
|
||||
else
|
||||
@ -2742,6 +2734,7 @@ real TDocumento::valore(bool totale, bool lordo, int ndec) const
|
||||
void TDocumento::put_str(const char* fieldname, const char* val)
|
||||
{
|
||||
const TFixed_string fn(fieldname);
|
||||
|
||||
if (fn == DOC_TIPODOC)
|
||||
{
|
||||
const TString4 v(val);
|
||||
@ -2786,7 +2779,9 @@ void TDocumento::zero(const char * fieldname)
|
||||
{
|
||||
if (strcmp(fieldname, DOC_TIPODOC) == 0)
|
||||
reset_fields(*this);
|
||||
|
||||
TAuto_variable_rectype::zero(fieldname);
|
||||
|
||||
dirty_fields();
|
||||
}
|
||||
|
||||
@ -2798,8 +2793,6 @@ TCli_for& TDocumento::clifor(bool force_reload) const
|
||||
|
||||
if (force_reload)
|
||||
cf.read(tipo, codice);
|
||||
// if (force_reload || cf.empty() || cf.tipo() != tipo || cf.codice() != codice)
|
||||
// cf.read(tipo, codice);
|
||||
return cf;
|
||||
}
|
||||
|
||||
@ -2857,6 +2850,7 @@ TOccasionale& TDocumento::occas() const
|
||||
const TString16 occ_code = cod_occas(); // Codice occasionale in testata
|
||||
|
||||
TOccasionale& rec = (TOccasionale&)_occas;
|
||||
|
||||
if (occ_code != rec.codice())
|
||||
{
|
||||
TLocalisamfile o(LF_OCCAS);
|
||||
@ -2945,6 +2939,7 @@ TRecord_array& TDocumento::body(int logicnum) const
|
||||
TRecfield ccms(rec, RDOC_CODCMS);
|
||||
TRecfield fcms(rec, RDOC_FASCMS);
|
||||
TRecfield ccos(rec, RDOC_CODCOSTO);
|
||||
|
||||
if (codcms == ccms) ccms = "";
|
||||
if (fascms == fcms) fcms = "";
|
||||
if (codcos == ccos) ccos = "";
|
||||
@ -3007,6 +3002,7 @@ void TDocumento::update_raee()
|
||||
r1.set_descr(d);
|
||||
|
||||
const TString& um = sp.um();
|
||||
|
||||
if (um.full())
|
||||
r1.put(RDOC_UMQTA, um);
|
||||
if (cod_iva_cli.blank())
|
||||
@ -3035,6 +3031,7 @@ void TDocumento::update_raee()
|
||||
void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field* sh, bool force)
|
||||
{
|
||||
const bool updated = get_bool(DOC_SPESEUPD);
|
||||
|
||||
if (!force && updated)
|
||||
return;
|
||||
|
||||
@ -3143,7 +3140,6 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
||||
void TDocumento::update_conai_qta()
|
||||
{
|
||||
_conaiqta.destroy();
|
||||
|
||||
FOR_EACH_SELF_PHYSICAL_RDOC(i, r)
|
||||
if (r->is_merce() || r->is_omaggio())
|
||||
{
|
||||
@ -3406,6 +3402,7 @@ int TDocumento::set_row_ids()
|
||||
const int phrw = physical_rows();
|
||||
long maxid = 0L;
|
||||
int first_needed = 0;
|
||||
|
||||
for (int r = 1; r <= phrw; r++)
|
||||
{
|
||||
const TRiga_documento& row = physical_row(r);
|
||||
@ -3485,6 +3482,7 @@ void TDocumento::get_protocolli_esenzione(TString& esenzione, TString& data_esen
|
||||
TString& registrazione, TString& data_registrazione) const
|
||||
{
|
||||
TCli_for& c = clifor();
|
||||
|
||||
if (c.use_lettere())
|
||||
{
|
||||
if (c.read_lettera(get_date(DOC_DATADOC), true))
|
||||
@ -3509,6 +3507,7 @@ bool TDocumento::is_split_payment() const
|
||||
{
|
||||
bool yes = get_int(DOC_ANNO) >= 2015 && clifor().get_bool(CLI_SPLITPAY) &&
|
||||
(is_fattura() || is_nota_credito()) && !imposta().is_zero();
|
||||
|
||||
if (yes)
|
||||
{
|
||||
const TRectype& causale = cache().get(LF_CAUSALI, tipo().causale());
|
||||
@ -3828,3 +3827,32 @@ TRiga_documento & TDocumento::find_row(const char * tiporiga, const char * codic
|
||||
return empty_row(this);
|
||||
}
|
||||
|
||||
void TDocumento::update_prices()
|
||||
{
|
||||
TDocumento_mask m(tipo().codice());
|
||||
|
||||
FOR_EACH_SELF_PHYSICAL_RDOC(r, rdoc)
|
||||
rdoc->zero(RDOC_CHECKED);
|
||||
m.doc() = *this;
|
||||
m.doc2mask(false, false, false);
|
||||
m.mask2doc();
|
||||
*this = m.doc();
|
||||
}
|
||||
|
||||
void TDocumento::update_descriptions()
|
||||
{
|
||||
FOR_EACH_SELF_PHYSICAL_RDOC(r, rdoc)
|
||||
{
|
||||
const TString& codart = rdoc->get(RDOC_CODARTMAG);
|
||||
if (codart.full())
|
||||
{
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG, codart);
|
||||
TString descr = anamag.get(ANAMAG_DESCR);
|
||||
const TString& agg = anamag.get(ANAMAG_DESCRAGG);
|
||||
|
||||
if (agg.full())
|
||||
descr << '\n' << agg;
|
||||
rdoc->set_descr(descr);
|
||||
}
|
||||
}
|
||||
}
|
@ -195,7 +195,7 @@ public:
|
||||
bool pack_rif() const { return get_bool("B15"); }
|
||||
bool calcola_scarti() const { return get_bool("B11"); }
|
||||
bool reload_prices() const { return get_bool("B13"); }
|
||||
bool reload_descriptions() const { return reload_prices() && get_bool("B14"); }
|
||||
bool reload_descriptions() const { return /*reload_prices() && non serve perchè ci pensa la maschera */ get_bool("B14"); }
|
||||
const TString& num_riferimenti_in() const { return get("S11"); }
|
||||
|
||||
int intestazioni_sheet() const { return get_int("I1"); }
|
||||
@ -281,7 +281,7 @@ public:
|
||||
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||
const TDate& data_elab, bool interattivo = false);
|
||||
|
||||
bool change_clifo() { return get_bool("B14"); }
|
||||
bool change_clifo() { return get_bool("S12"); } // la maschera lo scrive come booleano
|
||||
virtual bool get_num_tip_out(const TDocumento& doc_out, TString& codnum, TString& tipodoc) const;
|
||||
|
||||
TFatturazione_bolle(const char* cod);
|
||||
|
@ -406,7 +406,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
if (change_clifo())
|
||||
{
|
||||
const char t = campione.get_char(DOC_TIPOCFFATT);
|
||||
const long codcf = campione.get_long(DOC_CODCFFATT);
|
||||
long codcf = campione.get_long(DOC_CODCFFATT);
|
||||
|
||||
if (t > ' ')
|
||||
{
|
||||
@ -414,6 +414,11 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
if (interattivo)
|
||||
doc_out[0].put(DOC_TIPOCF, t);
|
||||
}
|
||||
if (codcf == 0L)
|
||||
{
|
||||
campione.put(DOC_CODCFFATT, campione.clifor().get_long(CLI_CODCFFATT));
|
||||
codcf = campione.get_long(DOC_CODCFFATT);
|
||||
}
|
||||
if (codcf > 0L)
|
||||
{
|
||||
campione.put(DOC_CODCF, codcf);
|
||||
@ -594,22 +599,10 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
const TString& sconto = d.get(DOC_SCONTOPERC);
|
||||
d.put(DOC_SCONTOPERC, sconto);
|
||||
|
||||
if (change_clifo())
|
||||
{
|
||||
const TString4 tipodoc= d.tipo().codice();
|
||||
TDocumento_mask m(tipodoc);
|
||||
|
||||
if (reload_prices())
|
||||
{
|
||||
FOR_EACH_PHYSICAL_RDOC_BACK(d, r, rdoc)
|
||||
rdoc->zero(RDOC_CHECKED);
|
||||
}
|
||||
m.doc() = d;
|
||||
m.doc2mask(true, true);
|
||||
m.mask2doc();
|
||||
d = m.doc();
|
||||
}
|
||||
|
||||
if (reload_prices())
|
||||
d.update_prices();
|
||||
if (reload_descriptions())
|
||||
d.update_descriptions();
|
||||
if (_rowsort.full())
|
||||
d.sort_rows(_rowsort);
|
||||
}
|
||||
|
@ -167,7 +167,8 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
|
||||
for (i = 4; i > 0; i--)
|
||||
{
|
||||
const short pos = _sheet->cid2index(FR_LIV1 + i -1);
|
||||
const short pos = cid2index(FR_LIV1 + i -1);
|
||||
|
||||
if (_livelli_giac->enabled(i))
|
||||
{
|
||||
const TString& header = _livelli_giac->name(i);
|
||||
@ -183,6 +184,17 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
}
|
||||
}
|
||||
|
||||
bool is_acquisto = false;
|
||||
|
||||
if (_doc.tipo().causale().full())
|
||||
{
|
||||
const TCausale & caus = cached_causale(_doc.tipo().causale());
|
||||
|
||||
is_acquisto = caus.reg().tipo_registro() == acquisto;
|
||||
}
|
||||
if (!is_acquisto)
|
||||
_sheet->delete_column(cid2index(FR_REVCHARGE));
|
||||
|
||||
// configurazione campi
|
||||
|
||||
TConfig cfg(CONFIG_DITTA, "ve");
|
||||
|
@ -1933,14 +1933,11 @@ bool codart_handler(TMask_field& f, KEY key )
|
||||
if (pos >= 0 && row_mask.fld(pos).get().blank())
|
||||
row_mask.set(id, cart.get_peso(i));
|
||||
}
|
||||
|
||||
const int pos = row_mask.id2pos(FR_CODIVA);
|
||||
if (pos >= 0)
|
||||
iva_handler(row_mask.fld(pos), 0);
|
||||
|
||||
row_mask.check_field(FR_CODIVA);
|
||||
if (found)
|
||||
{
|
||||
TString8 caus(row_mask.get(FR_CAUS));
|
||||
|
||||
if (caus.blank())
|
||||
caus = mask.get(F_CAUSMAG);
|
||||
|
||||
@ -2161,11 +2158,8 @@ bool umart_handler( TMask_field& f, KEY key )
|
||||
|
||||
const char* const prezzo = mask.doc().tipo().calcolo_lordo() ? RDOC_PREZZOL : RDOC_PREZZO;
|
||||
mask.doc()[current_doc_row].put(prezzo, row_mask.get(FR_PREZZO));
|
||||
|
||||
const int pos = row_mask.id2pos(FR_CODIVA);
|
||||
if (pos >= 0)
|
||||
iva_handler(row_mask.fld(pos), 0);
|
||||
}
|
||||
row_mask.check_field(FR_CODIVA);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2515,11 +2509,7 @@ bool sppr_handler( TMask_field& f, KEY key )
|
||||
row_mask.set(FR_PREZZO, prezzo);
|
||||
}
|
||||
}
|
||||
|
||||
const int posiva = row_mask.id2pos(FR_CODIVA);
|
||||
if (posiva >= 0)
|
||||
iva_handler(row_mask.fld(posiva), 0);
|
||||
|
||||
row_mask.check_field(FR_CODIVA);
|
||||
if (row_mask.id2pos(FR_CDC1) >= 0 && sp.get("S1").full())
|
||||
{
|
||||
const TString80 cdc(sp.cdc());
|
||||
|
@ -1352,14 +1352,14 @@ ENDIF
|
||||
|
||||
IFDEF(X_CODIVA)
|
||||
DEFINE Y_REVCHARGE Y_CODIVA+1
|
||||
DEFINE X_TIPODET X_CODIVA+20
|
||||
DEFINE X_TIPODET X_CODIVA+30
|
||||
ENDIF
|
||||
|
||||
BOOLEAN FR_REVCHARGE
|
||||
BEGIN
|
||||
IFDEF(X_CODIVA)
|
||||
PROMPT X_CODIVA Y_REVCHARGE "Reverse charge"
|
||||
ELSE
|
||||
ELSEIF
|
||||
PROMPT 2 16 "Reverse charge"
|
||||
ENDIF
|
||||
FIELD REVCHARGE
|
||||
@ -1369,8 +1369,8 @@ STRING FR_TIPODET 1
|
||||
BEGIN
|
||||
IFDEF(X_CODIVA)
|
||||
PROMPT X_TIPODET Y_REVCHARGE "Indetraib. "
|
||||
ELSE
|
||||
PROMPT 20 16 "Indetraib. "
|
||||
ELSEIF
|
||||
PROMPT 30 16 "Indetraib. "
|
||||
ENDIF
|
||||
USE %DET
|
||||
INPUT CODTAB FR_TIPODET
|
||||
|
@ -534,7 +534,7 @@ BOOLEAN F_RELOAD_PRICES
|
||||
BEGIN
|
||||
PROMPT 45 17 "Ricarica i prezzi"
|
||||
FIELD B13
|
||||
GROUP 1
|
||||
GROUP 1 2
|
||||
MESSAGE FALSE DISABLE,F_RELOAD_DESCR
|
||||
MESSAGE TRUE ENABLE,F_RELOAD_DESCR
|
||||
END
|
||||
@ -543,7 +543,7 @@ BOOLEAN F_RELOAD_DESCR
|
||||
BEGIN
|
||||
PROMPT 45 18 "Ricarica le descrizioni"
|
||||
FIELD B14
|
||||
GROUP 1
|
||||
GROUP 1 2
|
||||
END
|
||||
|
||||
RADIOBUTTON F_PROTOCOLLO 1 38
|
||||
@ -558,7 +558,7 @@ END
|
||||
BOOLEAN F_CHGCF
|
||||
BEGIN
|
||||
PROMPT 2 19 "Aggiorna il codice cliente/fornitore"
|
||||
FIELD B13
|
||||
FIELD S12[1,1]
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user