Migliorata contabilizzazione movimenti con reverse-charge
git-svn-id: svn://10.65.10.50/branches/R_10_00@22873 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
72d15b6093
commit
539e01f28a
@ -27,6 +27,7 @@ TCursor& TMotore_application::get_filtered_cursor() const
|
||||
|
||||
bool TMotore_application::can_I_write(const TRelation* rel) const
|
||||
{
|
||||
/*
|
||||
static int err = -1;
|
||||
if (err < 0)
|
||||
{
|
||||
@ -56,6 +57,8 @@ bool TMotore_application::can_I_write(const TRelation* rel) const
|
||||
}
|
||||
|
||||
return yes;
|
||||
*/
|
||||
return TRelation_application::can_I_write(rel);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,8 +108,20 @@ bool TAggiornaIBAN_msk::elabora()
|
||||
const TString8 abi = doc.get(DOC_CODABIA);
|
||||
const TString8 cab = doc.get(DOC_CODCABA);
|
||||
const TString80 iban = doc.get(DOC_IBAN);
|
||||
if (abi.blank() && cab.blank() && iban.blank())
|
||||
if (abi.blank() && cab.blank())
|
||||
{
|
||||
if (iban.full() && iban.len() < 24)
|
||||
{
|
||||
doc.zero(DOC_IBAN);
|
||||
if (definitiva)
|
||||
{
|
||||
int err = doc.rewrite(docs);
|
||||
if (err != NOERR)
|
||||
log.log(2, TR("Impossibile aggiornare il documento"));
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
int err = iban_check(iban, ibaner);
|
||||
if (err == 0 && iban.starts_with("IT") && iban.mid(5, 5) == abi && iban.mid(10, 5) == cab)
|
||||
|
@ -2428,7 +2428,7 @@ real TDocumento::totale_doc() const
|
||||
real TDocumento::totale_netto() const
|
||||
{
|
||||
const TString& field = tipo().totale_netto();
|
||||
if (field.not_empty())
|
||||
if (field.full())
|
||||
return get_real(field);
|
||||
else
|
||||
return imponibile() + imposta();
|
||||
|
@ -498,9 +498,9 @@ bool TElaborazione_esterna::elabora(TLista_documenti& doc_in, TLista_documenti&
|
||||
const TDate& data_elab, bool interattivo)
|
||||
{
|
||||
if (applicazione_esterna().blank())
|
||||
return error_box("Non e' stato specificato il nome del'applicazione esterna");
|
||||
CHECK(doc_in.items() == 1, "Si deve specificare uno e un solo documento in entrata");
|
||||
CHECK(doc_out.items() <= 1, "Si deve specificare uno e un solo documento in uscita");
|
||||
return error_box("Non è stato specificato il nome del'applicazione esterna");
|
||||
CHECK(doc_in.items() == 1, "Si deve specificare un solo documento in entrata");
|
||||
CHECK(doc_out.items() <= 1, "Si deve specificare un solo documento in uscita");
|
||||
TFilename name; name.temp("ext");
|
||||
|
||||
TString16 par;
|
||||
|
10
ve/velib04.h
10
ve/velib04.h
@ -418,7 +418,10 @@ class TContabilizzazione : public TElaborazione // velib04b
|
||||
TBill _conto_errato; // Conto da visualizzare in messaggio d'errore
|
||||
bool _check_prev_cont; // Controllare se il documento precedente e' stato contabilizzato
|
||||
TString16 _fld_cms_cont; // Campo delle commesse per reperire la causale
|
||||
|
||||
|
||||
private:
|
||||
void init(); // Called by constructors only
|
||||
|
||||
protected:
|
||||
// Carica i parametri dalla configurazione
|
||||
bool load_parameters();
|
||||
@ -435,7 +438,7 @@ protected:
|
||||
error_type compile_head_mov_re(TDocumento&);
|
||||
bool spalma_spese() const { return get_int("I2") != 0; }
|
||||
// Funzione per distribuire le spese
|
||||
void split_sp_amount(const real & amount, int decimals);
|
||||
void split_sp_amount(const real & amount, int decimals) const;
|
||||
// Funzione per ricercare il conto di costo/ricavo
|
||||
error_type search_costo_ricavo(TBill& conto, const TRiga_documento& r, real & amount_to_split, const real & valore);
|
||||
// Funzione per ricercare il conto di costo/ricavo materiali
|
||||
@ -482,6 +485,7 @@ protected:
|
||||
error_type write_intra(TDocumento&);
|
||||
error_type write_anal(TDocumento& doc, const TMovimentoPN& mv);
|
||||
error_type write_percip(TDocumento& doc, const TMovimentoPN& movimento);
|
||||
error_type write_regolarizzazione(const TDocumento& doc, TMovimentoPN& mov_rego);
|
||||
TRecnotype kill_righe_percip(TIsam_handle logic, char tipopercip, long codpercip, long nprog) const;
|
||||
|
||||
// Aggiorna i saldi
|
||||
@ -624,7 +628,7 @@ class TContabilizzazione_analitica : public TElaborazione // velib04f
|
||||
protected:
|
||||
bool find_conti_iva_indetraibile(const TRiga_documento& riga, const TBill & bill, TString_array& conti, int annoes, const char tipomov, bool & pareggio);
|
||||
bool spalma_spese() const { return get_int("I2") != 0; }
|
||||
void split_sp_amount(TAnal_mov & mov, bool pareggio, const TImporto & totdoc, const TBit_array & spese, const real & amount, const real & no_ca_amount, int decimals);
|
||||
void split_sp_amount(TAnal_mov & mov, bool pareggio, const TImporto & totdoc, const TBit_array & spese, const real & amount, const real & no_ca_amount, int decimals) const;
|
||||
bool find_conti(const TRiga_documento& riga, TString_array& conti, int annoes, bool riclassifica_fdr_fde, const char tipomov, real & amount_to_split, real & no_ca_amount, const real & valore, bool & pareggio);
|
||||
void init();
|
||||
|
||||
|
243
ve/velib04b.cpp
243
ve/velib04b.cpp
@ -29,7 +29,7 @@ void TMovimentoPN_VE::destroy_iva_row(int i)
|
||||
|
||||
TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
|
||||
{
|
||||
CHECK(_caus,"Orgggssbb..._caus pointer is NULL!");
|
||||
CHECK(_caus, "Orgggssbb..._caus pointer is NULL!");
|
||||
bool dare = false;
|
||||
if (row_type == 'S')
|
||||
dare = _caus->sezione_ritsoc() == 'D';
|
||||
@ -438,7 +438,7 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
|
||||
ok = c.ok();
|
||||
if (ok)
|
||||
{
|
||||
const TString80 d(_caus->desc_agg(RIGA_RITENUTE_FISCALI));
|
||||
const TString80 d = _caus->desc_agg(RIGA_RITENUTE_FISCALI);
|
||||
const char rowtype = 'F';
|
||||
set_cg_rec(-1, real2imp(head.get_real(MOV_RITFIS), rowtype), c, d, rowtype);
|
||||
}
|
||||
@ -447,9 +447,8 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
|
||||
}
|
||||
else
|
||||
{
|
||||
real ritfis = head.get_real(MOV_RITFIS);
|
||||
|
||||
if (ritfis != ZERO)
|
||||
const real ritfis = head.get_real(MOV_RITFIS);
|
||||
if (!ritfis.is_zero())
|
||||
{
|
||||
TBill c; _caus->bill(RIGA_RITENUTE_FISCALI, c);
|
||||
ok = c.ok();
|
||||
@ -463,9 +462,8 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
|
||||
return 1;
|
||||
}
|
||||
|
||||
real ritsoc = head.get_real(MOV_RITSOC);
|
||||
|
||||
if (ritsoc != ZERO)
|
||||
const real ritsoc = head.get_real(MOV_RITSOC);
|
||||
if (!ritsoc.is_zero())
|
||||
{
|
||||
TBill c; _caus->bill(RIGA_RITENUTE_SOCIALI, c);
|
||||
ok = c.ok();
|
||||
@ -723,48 +721,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
|
||||
return no_error;
|
||||
}
|
||||
|
||||
|
||||
TContabilizzazione::TContabilizzazione(const char* cod)
|
||||
: TElaborazione(cod), _auto_data(false)
|
||||
{
|
||||
_fcaus = new TLocalisamfile(LF_CAUSALI);
|
||||
_frcaus = new TLocalisamfile(LF_RCAUSALI);// Per far andare TCausale
|
||||
_attiv = new TLocalisamfile(LF_ATTIV); // Altrimenti TRegistro non va!
|
||||
_part = new TLocalisamfile(LF_PARTITE);
|
||||
_scad = new TLocalisamfile(LF_SCADENZE);
|
||||
_pags = new TLocalisamfile(LF_PAGSCA); // Per far funzionare TPartita
|
||||
_intra = new TLocalisamfile(LF_INTRA);
|
||||
_rintra = new TLocalisamfile(LF_RINTRA);
|
||||
_occas = new TLocalisamfile(LF_OCCAS);
|
||||
_docfile = new TLocalisamfile(LF_DOC);
|
||||
_rdocfile = new TLocalisamfile(LF_RIGHEDOC); // Per far funzionare TDocumento,TPartita ecc..
|
||||
_anamag = new TLocalisamfile(LF_ANAMAG);
|
||||
_saldi = new TLocalisamfile(LF_SALDI);
|
||||
|
||||
_cpg = new TTable("%CPG");
|
||||
_val = new TTable("%VAL");
|
||||
_prs = new TTable("PRS");
|
||||
_spp = new TTable("SPP");
|
||||
_caa = new TTable("CAA");
|
||||
_cra = new TTable("CRA");
|
||||
_gmc = new TTable("GMC");
|
||||
_rfa = new TTable("RFA");
|
||||
_cve = new TTable("CVE");
|
||||
_cco = new TTable("CCO");
|
||||
_clifo = new TRelation(LF_CLIFO);
|
||||
_clifo->add(LF_CFVEN,"TIPOCF=TIPOCF|CODCF=CODCF");
|
||||
_righe_iva = new TIVA_array;
|
||||
|
||||
_nump_iva = get_bool("B4");
|
||||
_can_write = true;
|
||||
_error = no_error;
|
||||
_nrow = 0;
|
||||
_total_docs = 0L;
|
||||
_caus = NULL;
|
||||
}
|
||||
|
||||
TContabilizzazione::TContabilizzazione(const TRectype& rec)
|
||||
: TElaborazione(rec), _auto_data(false), _viswin(NULL)
|
||||
void TContabilizzazione::init()
|
||||
{
|
||||
_fcaus = new TLocalisamfile(LF_CAUSALI);
|
||||
_frcaus = new TLocalisamfile(LF_RCAUSALI);// Per far andare TCausale
|
||||
@ -795,14 +752,22 @@ TContabilizzazione::TContabilizzazione(const TRectype& rec)
|
||||
_righe_iva = new TIVA_array;
|
||||
|
||||
_nump_iva = get_bool("B4");
|
||||
_auto_data = false;
|
||||
|
||||
_can_write = true;
|
||||
_error = no_error;
|
||||
_nrow = 0;
|
||||
_total_docs = 0L;
|
||||
_caus = NULL;
|
||||
_viswin = NULL;
|
||||
}
|
||||
|
||||
TContabilizzazione::TContabilizzazione(const char* cod) : TElaborazione(cod)
|
||||
{ init(); }
|
||||
|
||||
TContabilizzazione::TContabilizzazione(const TRectype& rec) : TElaborazione(rec)
|
||||
{ init(); }
|
||||
|
||||
TContabilizzazione::~TContabilizzazione()
|
||||
{
|
||||
delete _clifo;
|
||||
@ -1206,7 +1171,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_nump_iva == 1) // Reperisce l'ultimo numero di protocollo dal registro IVA
|
||||
if (_nump_iva) // Reperisce l'ultimo numero di protocollo dal registro IVA
|
||||
{
|
||||
ult_prot = registro.protocol() + 1;
|
||||
if (ult_prot <= 0)
|
||||
@ -1329,7 +1294,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
if (_caus->iva() == iva_acquisti)
|
||||
{
|
||||
const TString& tdoc_cont = doc.tipo().totale_doc_cont();
|
||||
if (tdoc_cont.not_empty())
|
||||
if (tdoc_cont.full())
|
||||
totdocval.set_num(doc.get_real(tdoc_cont));
|
||||
|
||||
if (_caus->intra())
|
||||
@ -1342,7 +1307,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
|
||||
codvali = _clifo->curr().get("VALINTRA");
|
||||
cambioi = cambio;
|
||||
if (codvali.not_empty() && codvali != codval)
|
||||
if (codvali.full() && codvali != codval)
|
||||
{
|
||||
mov_rec.put(MOV_CODVALI,codvali);
|
||||
TExchange c(codvali);
|
||||
@ -1353,7 +1318,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
{
|
||||
codvali = codval;
|
||||
cambioi = cambio;
|
||||
if (_caus->valintra() && codvali.empty())
|
||||
if (_caus->valintra() && codvali.blank())
|
||||
{
|
||||
codvali = TCurrency::get_firm_val();
|
||||
if (codvali.empty())
|
||||
@ -1374,7 +1339,6 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
mov_rec.put(MOV_CORRVALUTA,corrval.get_num());
|
||||
|
||||
TDate dataintra = data_reg;
|
||||
|
||||
if (doc.tipo().nota_credito())
|
||||
{
|
||||
TDate d = doc.get_date(DOC_DATADOCRIF);
|
||||
@ -1383,6 +1347,18 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
}
|
||||
mov_rec.put(MOV_DATACOMPI, dataintra);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int reg_spec = _caus->regime_speciale();
|
||||
if (reg_spec == 13 || reg_spec == 50 || reg_spec == 51) // reverse charge
|
||||
{
|
||||
TCurrency_documento imposta(doc.imposta(), doc);
|
||||
totdocval -= imposta;
|
||||
|
||||
imposta.change_to_firm_val();
|
||||
mov_rec.put(MOV_RITFIS, imposta.get_num());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1399,21 +1375,20 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
|
||||
if (codvali.empty())
|
||||
codvali = TCurrency::get_euro_val();
|
||||
cambioi = 1.00;
|
||||
cambioi = UNO;
|
||||
}
|
||||
|
||||
mov_rec.put(MOV_CODVALI,codvali);
|
||||
mov_rec.put(MOV_CAMBIOI,cambioi);
|
||||
corrlire.change_to_firm_val();
|
||||
mov_rec.put(MOV_CORRLIRE,corrlire.get_num());
|
||||
mov_rec.put(MOV_CORRLIRE, corrlire.get_num());
|
||||
if (_caus->valintra())
|
||||
mov_rec.put(MOV_CORRVALUTA,corrval.get_num());
|
||||
mov_rec.put(MOV_CORRVALUTA, corrval.get_num());
|
||||
|
||||
TDate dataintra = data_reg;
|
||||
|
||||
if (doc.tipo().nota_credito())
|
||||
{
|
||||
TDate d = doc.get_date(DOC_DATADOCRIF);
|
||||
const TDate d = doc.get_date(DOC_DATADOCRIF);
|
||||
if (d.ok())
|
||||
dataintra = d;
|
||||
}
|
||||
@ -1993,7 +1968,7 @@ error_type TContabilizzazione::adjust_sconto_rows(TDocumento& doc)
|
||||
return no_error;
|
||||
}
|
||||
|
||||
static real inc_field(TRectype& rec, const char* field, real diff)
|
||||
static real inc_field(TRectype& rec, const char* field, const real& diff)
|
||||
{
|
||||
real val = rec.get_real(field);
|
||||
val += diff;
|
||||
@ -2092,12 +2067,12 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
|
||||
ie.put(RMI_IMPONIBILE, gd_imp.get());
|
||||
}
|
||||
}
|
||||
} // Visto che vengono restituiti nello stesso ordine in cui sono state chiamate le rispettive TGeneric_distrib::add()
|
||||
} // Visto che vengono restituiti nello stesso ordine in cui sono state chiamate le rispettive TGeneric_distrib::add()
|
||||
|
||||
if (_caus->iva() == iva_acquisti && items > 0)
|
||||
{
|
||||
const TString16 tdoc_cont(doc.tipo().totale_doc_cont());
|
||||
if (tdoc_cont.not_empty())
|
||||
const TString16 tdoc_cont = doc.tipo().totale_doc_cont();
|
||||
if (tdoc_cont.full())
|
||||
{
|
||||
real diffval = doc.get_real(tdoc_cont) - doc.totale_doc();
|
||||
TCurrency_documento dv(diffval, doc);
|
||||
@ -2117,7 +2092,7 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
|
||||
}
|
||||
else
|
||||
{
|
||||
real diffimp = iva.scorpora(difflit);
|
||||
const real diffimp = iva.scorpora(difflit);
|
||||
inc_field(rigaiva, RMI_IMPONIBILE, difflit);
|
||||
inc_field(rigaiva, RMI_IMPOSTA, diffimp);
|
||||
}
|
||||
@ -2182,7 +2157,7 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
|
||||
|
||||
imposta = impval.get_num(); // questa e' l'imposta ricalcolata
|
||||
}
|
||||
if (imponibile != ZERO && codiva.not_empty())
|
||||
if (imponibile != ZERO && codiva.full())
|
||||
{
|
||||
TRectype& rec_iva = _movimento->iva(nr);
|
||||
rec_iva.put(RMI_ANNOES,annoes);
|
||||
@ -2273,7 +2248,7 @@ bool TContabilizzazione::valid_row_type(const char* rt) const
|
||||
return !tri.empty();
|
||||
}
|
||||
|
||||
void TContabilizzazione::split_sp_amount(const real & amount, int decimals)
|
||||
void TContabilizzazione::split_sp_amount(const real & amount, int decimals) const
|
||||
{
|
||||
TGeneric_distrib d(amount, decimals);
|
||||
|
||||
@ -3118,11 +3093,26 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
|
||||
change_doc_status(doc);
|
||||
|
||||
const TRectype& mov = _movimento->curr();
|
||||
TString80 msg;
|
||||
msg.format("--- Movimento contabile $[b,w]%ld$[n,w]", mov.get_long(MOV_NUMREG));
|
||||
msg << " del " << mov.get(MOV_DATAREG);
|
||||
TString msg;
|
||||
msg.format(FR("--- Movimento contabile $[b,w]%ld$[n,w]"), mov.get_long(MOV_NUMREG));
|
||||
msg << TR(" del ") << mov.get(MOV_DATAREG);
|
||||
const long protiva = mov.get_long(MOV_PROTIVA);
|
||||
if (protiva > 0)
|
||||
msg << TR(" protocollo IVA ") << protiva;
|
||||
_viswin->add_line(msg);
|
||||
|
||||
if (_caus->iva() == iva_acquisti && _caus->causale_reg_iva().full() && doc.clifor().get_long(CLI_CODCFASS) > 0)
|
||||
{
|
||||
TMovimentoPN movreg;
|
||||
const error_type err = write_regolarizzazione(doc, movreg);
|
||||
if (err == no_error)
|
||||
{
|
||||
msg.format(FR("--- Movimento regolarizzazione IVA $[b,w]%ld$[n,w] protocollo IVA %ld"),
|
||||
movreg.curr().get_long(MOV_NUMREG), movreg.curr().get_long(MOV_PROTIVA));
|
||||
_viswin->add_line(msg);
|
||||
}
|
||||
}
|
||||
|
||||
call_exe(doc, movimento);
|
||||
}
|
||||
|
||||
@ -4084,11 +4074,118 @@ error_type TContabilizzazione::write_percip(TDocumento& doc, const TMovimentoPN&
|
||||
return _error;
|
||||
}
|
||||
|
||||
error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMovimentoPN& mov)
|
||||
{
|
||||
bool do_insert = true;
|
||||
long nr = doc.get_long(DOC_NUMREG)+1;
|
||||
if (nr > 1)
|
||||
{
|
||||
TLocalisamfile fmov(LF_MOV);
|
||||
fmov.put(MOV_NUMREG, nr);
|
||||
if (fmov.read() == NOERR) // Il movimento esiste!
|
||||
{
|
||||
const char* const key[4] = { DOC_PROVV, DOC_ANNO, DOC_CODNUM, DOC_NDOC };
|
||||
// Controlla che il movimento abbia ancora il riferimento esatto al documento
|
||||
TString8 dkey, dval;
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
dkey = "D"; dkey << key[k];
|
||||
dval = fmov.get(dkey);
|
||||
if (dval != doc.get(key[k]))
|
||||
{
|
||||
nr = 0; // La chiave non corrisponde più: forse l'hanno cancellato e reinserito
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
nr = 0; // Il movimento non esiste più: l'hanno cancellato!
|
||||
if (nr > 0)
|
||||
{
|
||||
TString msg;
|
||||
msg.format(FR("--- La regolarizzazione verrà ricontabilizzata nel movimento %ld"), nr);
|
||||
_viswin->add_line(msg);
|
||||
do_insert = false;
|
||||
}
|
||||
}
|
||||
|
||||
error_type error = no_error;
|
||||
if (do_insert)
|
||||
{
|
||||
error = get_next_reg_num(nr);
|
||||
if (error != no_error)
|
||||
return error;
|
||||
}
|
||||
|
||||
const TCli_for& clifor = doc.clifor();
|
||||
|
||||
const TString4 codcaus = _caus->causale_reg_iva();
|
||||
const TDate datareg = _movimento->curr().get(MOV_DATAREG);
|
||||
const TCausale caus(codcaus, datareg.year());
|
||||
|
||||
TRectype& head = mov.curr();
|
||||
head.put(MOV_NUMREG,nr);
|
||||
|
||||
TSaldo_agg saldo;
|
||||
if (!do_insert)
|
||||
{
|
||||
mov.read(_isequal, _lock);
|
||||
aggiorna_saldi(saldo, mov, false);
|
||||
}
|
||||
|
||||
head.put(MOV_DATAREG, datareg);
|
||||
head.put(MOV_DATACOMP, _movimento->curr().get(MOV_DATACOMP));
|
||||
head.put(MOV_ANNOES, _movimento->curr().get(MOV_ANNOES));
|
||||
head.put(MOV_ANNOIVA, _movimento->curr().get(MOV_ANNOIVA));
|
||||
head.put(MOV_REG, caus.reg().name());
|
||||
head.put(MOV_NUMDOC, doc.get(DOC_NDOC));
|
||||
head.put(MOV_DATADOC, doc.get(DOC_DATADOC));
|
||||
|
||||
head.put(MOV_CODCAUS, caus.codice());
|
||||
head.put(MOV_TIPODOC, caus.tipo_doc());
|
||||
head.put(MOV_PROTIVA, caus.reg().protocol());
|
||||
|
||||
TString descr;
|
||||
descr << TR("Regolarizzazione ") << doc.get(DOC_CODNUM) << '/' << doc.numero() << TR(" del ") << doc.get(DOC_DATADOC);
|
||||
head.put(MOV_DESCR,descr);
|
||||
|
||||
head.put(MOV_TIPO, "C");
|
||||
head.put(MOV_CODCF, doc.clifor().get_long(CLI_CODCFASS));
|
||||
head.put(MOV_TOTDOC, doc.totale_doc());
|
||||
|
||||
// Scrive sulla testata dell'anticipo il numero di documento originale
|
||||
head.put(MOV_DPROVV, doc.get(DOC_PROVV));
|
||||
head.put(MOV_DANNO, doc.get(DOC_ANNO));
|
||||
head.put(MOV_DCODNUM, doc.get(DOC_CODNUM));
|
||||
head.put(MOV_DNDOC, doc.get(DOC_NDOC));
|
||||
head.put(MOV_CONTSEP, doc.get(DOC_CONTSEP));
|
||||
|
||||
TRectype& rmi = mov.iva(0);
|
||||
rmi.put(RMI_IMPONIBILE, _movimento->iva(0).get(RMI_IMPONIBILE));
|
||||
rmi.put(RMI_IMPOSTA, _movimento->iva(0).get(RMI_IMPOSTA));
|
||||
rmi.put(RMI_CODIVA, _movimento->iva(0).get(RMI_CODIVA));
|
||||
TBill zio; caus.bill(2, zio);
|
||||
zio.put(rmi);
|
||||
|
||||
const int err = do_insert ? mov.write(true) : mov.rewrite(true);
|
||||
if (err == NOERR)
|
||||
{
|
||||
aggiorna_saldi(saldo, mov, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_viswin->add_line("--- Impossibile registrare il movimento di regolarizzazione");
|
||||
error = nr_reg_error;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void TContabilizzazione::aggiorna_saldi(TSaldo_agg& saldo, TMovimentoPN& mv, bool save)
|
||||
{
|
||||
const TRectype& mov = mv.curr();
|
||||
const TDate datareg = mov.get_date(MOV_DATAREG);
|
||||
const TString16 codcaus = mov.get(MOV_CODCAUS);
|
||||
const TString4 codcaus = mov.get(MOV_CODCAUS);
|
||||
|
||||
tiposal tsal = normale;
|
||||
if (codcaus != _caus->codice()) // Should never happen, but ...
|
||||
@ -4387,7 +4484,7 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
||||
if (interattivo)
|
||||
{
|
||||
_auto_data = true;
|
||||
_nump_iva = 1;
|
||||
// _nump_iva = 1; // Commentata il 07-06-2013: perchè dovrebbe essere diverso?
|
||||
}
|
||||
|
||||
esercizi().update();
|
||||
@ -4579,7 +4676,7 @@ bool TContabilizzazione::call_exe(const TDocumento& doc, const TMovimentoPN& mov
|
||||
const bool ok = app.run() == 0;
|
||||
|
||||
if (ininame.exist())
|
||||
::remove(ininame);
|
||||
ininame.fremove();
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ void TContabilizzazione_analitica::calcola_date_comp(const TDocumento& doc, TDat
|
||||
|
||||
void TContabilizzazione_analitica::split_sp_amount(TAnal_mov & mov, bool pareggio, const TImporto & totdoc,
|
||||
const TBit_array & spese, const real & amount, const real & no_ca_amount,
|
||||
int decimals)
|
||||
int decimals) const
|
||||
{
|
||||
char sezione = totdoc.sezione();
|
||||
TGeneric_distrib w(amount, decimals);
|
||||
|
Loading…
x
Reference in New Issue
Block a user