Patch level : 12.0 1002
Files correlati : vetbspp.msk ve0.exe ve1.exe ve5,exe ve6,exe vetabcom.txt vetbtib.msk Commento : 1) Spostati i campi per il calcolo ritenute sulle spese su di una riga. 2) Autoevasione degli ordini. 3) Tolte le spesse di incasso dalla formula IMPCAS. Interno 1) Verificare se soggetto a ritenuta e soggetto al calcolo ritenuta sono la stessa cosa. 2) Nella tabella dei tipi documento c'e un flag di autoevasione e il codice di una elaborazione di evasione ordini. 3) Da correggere presso i clienti che eventualmente la usino. 4) Verificare anche il raggruppamento righe in fatturazione bolle
This commit is contained in:
parent
2a31cbd8cf
commit
5dc73ee370
@ -6,18 +6,15 @@
|
|||||||
|
|
||||||
void TFatturazione_bolle::init()
|
void TFatturazione_bolle::init()
|
||||||
{
|
{
|
||||||
// Attenzione: uso il TConfig perchè con varibili del tipo AGGFLD(FATPROV) la ini_get_string() NON funziona bene
|
const TString& cod = get("CODTAB");
|
||||||
TConfig ini(CONFIG_DITTA, "ve");
|
|
||||||
|
|
||||||
const char* cod = get("CODTAB");
|
|
||||||
TString80 name;
|
TString80 name;
|
||||||
|
|
||||||
name.format("AGGFLD(%s)", cod);
|
name.format("AGGFLD(%s)", (const char *)cod);
|
||||||
_lista_campi = ini.get(name);
|
_lista_campi = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||||
|
|
||||||
name.format("ROWSORT(%s)", cod);
|
name.format("ROWSORT(%s)", (const char *)cod);
|
||||||
_rowsort = ini.get(name);
|
_rowsort = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||||
_impminfat = real(ini.get("IMPMINFAT"));
|
_impminfat = ini_get_real(CONFIG_DITTA, "ve", "IMPMINFAT");
|
||||||
}
|
}
|
||||||
|
|
||||||
TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
||||||
@ -147,10 +144,8 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
|
|||||||
{
|
{
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc_out, nr, rout) // ... cerca una riga compatibile
|
FOR_EACH_PHYSICAL_RDOC(doc_out, nr, rout) // ... cerca una riga compatibile
|
||||||
{
|
{
|
||||||
if (rout->sola_descrizione()) // Ignora le righe descrittive
|
if (!rout->sola_descrizione() && // Ignora le righe descrittive
|
||||||
continue;
|
rin.raggruppabile(*rout, campi_riga)) // Se esiste una riga compatibile ...
|
||||||
|
|
||||||
if (rin.raggruppabile(*rout, campi_riga)) // Se esiste una riga compatibile ...
|
|
||||||
{
|
{
|
||||||
add_rows(*rout, rin);
|
add_rows(*rout, rin);
|
||||||
r.set_final_rdoc_key(*rout);
|
r.set_final_rdoc_key(*rout);
|
||||||
@ -203,10 +198,12 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
|||||||
|
|
||||||
if (usa_dcons)
|
if (usa_dcons)
|
||||||
{
|
{
|
||||||
bool da_elaborare = FALSE;
|
bool da_elaborare = false;
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc_in, r, rin)
|
FOR_EACH_PHYSICAL_RDOC(doc_in, r, rin)
|
||||||
{
|
{
|
||||||
TDate data_cons = rin->get_date(RDOC_DATACONS);
|
TDate data_cons = rin->get_date(RDOC_DATACONS);
|
||||||
|
|
||||||
if (!data_cons.ok())
|
if (!data_cons.ok())
|
||||||
data_cons = dcons;
|
data_cons = dcons;
|
||||||
da_elaborare = ddoc >= data_cons && !rin->get_bool(RDOC_RIGAEVASA);
|
da_elaborare = ddoc >= data_cons && !rin->get_bool(RDOC_RIGAEVASA);
|
||||||
@ -443,25 +440,23 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
if (!rdoc->is_descrizione() && rdoc->get(RDOC_CODIVA).blank())
|
if (!rdoc->is_descrizione() && rdoc->get(RDOC_CODIVA).blank())
|
||||||
{
|
{
|
||||||
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 TString& 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 TString& 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);
|
||||||
}
|
}
|
||||||
|
@ -2842,8 +2842,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
if (anticipo.abs() < td.abs())
|
if (anticipo.abs() < td.abs())
|
||||||
{
|
{
|
||||||
const real imposte_effettive = is_split_payment(head) ? ZERO : totimposte.get_num();
|
const real imposte_effettive = is_split_payment(head) ? ZERO : totimposte.get_num();
|
||||||
|
|
||||||
TGeneric_distrib d(anticipo.get_num(), ndec);
|
TGeneric_distrib d(anticipo.get_num(), ndec);
|
||||||
|
|
||||||
d.add(totimponibili.get_num());
|
d.add(totimponibili.get_num());
|
||||||
d.add(imposte_effettive);
|
d.add(imposte_effettive);
|
||||||
d.add(totspese.get_num());
|
d.add(totspese.get_num());
|
||||||
@ -2861,6 +2861,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
TCurrency_documento val3(pagtotspese); val3.change_to_firm_val();
|
TCurrency_documento val3(pagtotspese); val3.change_to_firm_val();
|
||||||
TCurrency val1(totdoc);
|
TCurrency val1(totdoc);
|
||||||
TCurrency_documento ant(anticipo.get_num(), doc);
|
TCurrency_documento ant(anticipo.get_num(), doc);
|
||||||
|
|
||||||
ant.change_to_firm_val();
|
ant.change_to_firm_val();
|
||||||
val1 -= ant + val2 + val3;
|
val1 -= ant + val2 + val3;
|
||||||
if (test_swap())
|
if (test_swap())
|
||||||
@ -3031,6 +3032,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
real importo_rata_val = in_valuta ? pag.importo_rata(r-1, true) : importo_rata_lit;
|
real importo_rata_val = in_valuta ? pag.importo_rata(r-1, true) : importo_rata_lit;
|
||||||
real delta_lit = importo_rata_lit - imprata;
|
real delta_lit = importo_rata_lit - imprata;
|
||||||
real delta_val = in_valuta ? importo_rata_val - imprataval : ZERO;
|
real delta_val = in_valuta ? importo_rata_val - imprataval : ZERO;
|
||||||
|
|
||||||
// Controlla se l'importo della nota di credito supera quello della fattura
|
// Controlla se l'importo della nota di credito supera quello della fattura
|
||||||
if (delta_lit > ZERO || delta_val > ZERO)
|
if (delta_lit > ZERO || delta_val > ZERO)
|
||||||
{
|
{
|
||||||
@ -3589,10 +3591,12 @@ error_type TContabilizzazione::write_pagamento_anticipo(TDocumento& doc)
|
|||||||
const TString8 numpart = mov.get(MOV_NUMDOC); // Nessun controllo se prot.iva o numdoc xche' tanto proviene dal mov precedentemente scritto
|
const TString8 numpart = mov.get(MOV_NUMDOC); // Nessun controllo se prot.iva o numdoc xche' tanto proviene dal mov precedentemente scritto
|
||||||
|
|
||||||
TPartita* partita = new TPartita(_co_cliente,anno,numpart);
|
TPartita* partita = new TPartita(_co_cliente,anno,numpart);
|
||||||
|
|
||||||
partita->allinea();
|
partita->allinea();
|
||||||
|
|
||||||
// reperire il numero della riga partita (nrigp) appena aggiunta
|
// reperire il numero della riga partita (nrigp) appena aggiunta
|
||||||
int nriga = (int) TPartita::UNASSIGNED;
|
int nriga = (int) TPartita::UNASSIGNED;
|
||||||
|
|
||||||
// Cerca la riga di partita con riferimento alla fattura che si sta pagando
|
// Cerca la riga di partita con riferimento alla fattura che si sta pagando
|
||||||
for (int r = partita->last(); r > 0; r = partita->pred(r))
|
for (int r = partita->last(); r > 0; r = partita->pred(r))
|
||||||
{
|
{
|
||||||
@ -3648,6 +3652,7 @@ error_type TContabilizzazione::write_pagamento_anticipo(TDocumento& doc)
|
|||||||
const TString4 val(doc.get(DOC_CODVAL));
|
const TString4 val(doc.get(DOC_CODVAL));
|
||||||
const TDate datacam(doc.get_date(DOC_DATACAMBIO));
|
const TDate datacam(doc.get_date(DOC_DATACAMBIO));
|
||||||
const bool valuta = val.not_empty();
|
const bool valuta = val.not_empty();
|
||||||
|
|
||||||
riga_part.put(PART_IMPORTO,imp.get_num());
|
riga_part.put(PART_IMPORTO,imp.get_num());
|
||||||
riga_part.put(PART_IMPORTOVAL,impval.get_num());
|
riga_part.put(PART_IMPORTOVAL,impval.get_num());
|
||||||
riga_part.put(PART_IMPTOTDOC,imp.get_num());
|
riga_part.put(PART_IMPTOTDOC,imp.get_num());
|
||||||
@ -3837,8 +3842,8 @@ error_type TContabilizzazione::write_anticipo(TDocumento& doc, const TMovimentoP
|
|||||||
error_type TContabilizzazione::write_intra(TDocumento& doc)
|
error_type TContabilizzazione::write_intra(TDocumento& doc)
|
||||||
{
|
{
|
||||||
const TRectype& rm = _movimento->curr();
|
const TRectype& rm = _movimento->curr();
|
||||||
|
|
||||||
const TDate data_reg = rm.get(MOV_DATAREG);
|
const TDate data_reg = rm.get(MOV_DATAREG);
|
||||||
|
|
||||||
/* Ora so fare le rettifiche! 29-09-2015
|
/* Ora so fare le rettifiche! 29-09-2015
|
||||||
// Controllo la liceita' della scrittura del movimento intra
|
// Controllo la liceita' della scrittura del movimento intra
|
||||||
const TDate data_intra = rm.get(MOV_DATACOMPI);
|
const TDate data_intra = rm.get(MOV_DATACOMPI);
|
||||||
@ -3899,25 +3904,26 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
TGeneric_distrib d(spese, doc.decimals());
|
TGeneric_distrib d(spese, doc.decimals());
|
||||||
TGeneric_distrib dlit(speselit, TCurrency::get_firm_dec());
|
TGeneric_distrib dlit(speselit, TCurrency::get_firm_dec());
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc, i, prdoc0) if (prdoc0->is_articolo())
|
FOR_EACH_PHYSICAL_RDOC(doc, i, rr)
|
||||||
|
if (rr->is_articolo())
|
||||||
{
|
{
|
||||||
const TRiga_documento& rr = doc[i];
|
|
||||||
TCurrency_documento imp_val(rr.TVariable_rectype::exist("VALINTRA") ? rr.get_real("VALINTRA") : rr.importo(true, false), doc);
|
TCurrency_documento imp_val(rr->TVariable_rectype::exist("VALINTRA") ? rr->get_real("VALINTRA") : rr->importo(true, false), doc);
|
||||||
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
||||||
|
|
||||||
d.add(imp_val.get_num());
|
d.add(imp_val.get_num());
|
||||||
dlit.add(imp.get_num());
|
dlit.add(imp.get_num());
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc, i, prdoc) if (prdoc->is_articolo())
|
FOR_EACH_PHYSICAL_RDOC(doc, i1, rr1)
|
||||||
|
if (rr1->is_articolo())
|
||||||
{
|
{
|
||||||
const TRiga_documento& rr = doc[i];
|
const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr1->get(RDOC_CODARTMAG));
|
||||||
const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr.get(RDOC_CODARTMAG));
|
|
||||||
const TString16 nomenclatura = rec_anamag.get(ANAMAG_CLASSDOG);
|
const TString16 nomenclatura = rec_anamag.get(ANAMAG_CLASSDOG);
|
||||||
|
|
||||||
const TRectype& rec_noc = cchh.get("%NOC", nomenclatura);
|
const TRectype& rec_noc = cchh.get("%NOC", nomenclatura);
|
||||||
const char noc_s4 = rec_noc.get_char("S4"); // Obbligatorietà unità di misura supplementare
|
const char noc_s4 = rec_noc.get_char("S4"); // Obbligatorietà unità di misura supplementare
|
||||||
bool ums_obbl = noc_s4 > ' ';
|
bool ums_obbl = noc_s4 > ' ';
|
||||||
|
|
||||||
if (ums_obbl && noc_s4 != 'E')
|
if (ums_obbl && noc_s4 != 'E')
|
||||||
ums_obbl = is_cessione ? noc_s4=='C' : noc_s4=='A';
|
ums_obbl = is_cessione ? noc_s4=='C' : noc_s4=='A';
|
||||||
|
|
||||||
@ -3926,12 +3932,14 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
const real unsuppun = rec_anamag.get_real(ANAMAG_UNSUPPUN); // Massa UMS
|
const real unsuppun = rec_anamag.get_real(ANAMAG_UNSUPPUN); // Massa UMS
|
||||||
const TString16 paeseorig = is_cessione ? EMPTY_STRING : rec_anamag.get(ANAMAG_PAESE); // Campo solo per Acquisti
|
const TString16 paeseorig = is_cessione ? EMPTY_STRING : rec_anamag.get(ANAMAG_PAESE); // Campo solo per Acquisti
|
||||||
TString4 provincia;
|
TString4 provincia;
|
||||||
|
|
||||||
if (is_cessione)
|
if (is_cessione)
|
||||||
provincia = rec_anamag.get(ANAMAG_PROV);
|
provincia = rec_anamag.get(ANAMAG_PROV);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const TString8 codmag = rr.get(RDOC_CODMAG);
|
const TString8 codmag = rr1->get(RDOC_CODMAG);
|
||||||
TString4 com = cchh.get("MAG", codmag, "S5"); // Comune del magazzino
|
TString4 com = cchh.get("MAG", codmag, "S5"); // Comune del magazzino
|
||||||
|
|
||||||
if (com.empty())
|
if (com.empty())
|
||||||
{
|
{
|
||||||
const long codditta = prefix().get_codditta();
|
const long codditta = prefix().get_codditta();
|
||||||
@ -3963,8 +3971,10 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
key.add(nomenclatura);
|
key.add(nomenclatura);
|
||||||
key.add(paeseorig);
|
key.add(paeseorig);
|
||||||
key.add(provincia);
|
key.add(provincia);
|
||||||
|
|
||||||
TRectype* rc = (TRectype*)righe.objptr(key); // Riga intra
|
TRectype* rc = (TRectype*)righe.objptr(key); // Riga intra
|
||||||
if (rc == NULL)
|
|
||||||
|
if (rc == nullptr)
|
||||||
{
|
{
|
||||||
rc = new TRectype(LF_RINTRA);
|
rc = new TRectype(LF_RINTRA);
|
||||||
rc->put("NUMREG", numreg);
|
rc->put("NUMREG", numreg);
|
||||||
@ -3980,8 +3990,8 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
rc->put("PROV", provincia);
|
rc->put("PROV", provincia);
|
||||||
righe.add(key, rc);
|
righe.add(key, rc);
|
||||||
}
|
}
|
||||||
const real qta = rr.get_real(RDOC_QTA);
|
const real qta = rr1->get_real(RDOC_QTA);
|
||||||
TCurrency_documento imp_val(rr.TVariable_rectype::exist("VALINTRA") ? rr.get_real("VALINTRA") : rr.importo(true, false), doc);
|
TCurrency_documento imp_val(rr1->TVariable_rectype::exist("VALINTRA") ? rr1->get_real("VALINTRA") : rr1->importo(true, false), doc);
|
||||||
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
||||||
|
|
||||||
imp_val += d.get();
|
imp_val += d.get();
|
||||||
@ -4007,26 +4017,27 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
|
|
||||||
real peso = qta * massanun; // peso netto
|
real peso = qta * massanun; // peso netto
|
||||||
if (peso.is_zero())
|
if (peso.is_zero())
|
||||||
peso = rr.get_real(RDOC_PNETTO);
|
peso = rr1->get_real(RDOC_PNETTO);
|
||||||
massakg += peso;
|
massakg += peso;
|
||||||
|
|
||||||
if (ums_obbl || ums.full() || !unsuppun.is_zero())
|
if (ums_obbl || ums.full() || !unsuppun.is_zero())
|
||||||
{
|
{
|
||||||
real qta_ums;
|
real qta_ums;
|
||||||
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("MASSAUMS") è sempre TRUE!
|
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("MASSAUMS") è sempre TRUE!
|
||||||
if (rr.TVariable_rectype::exist("MASSAUMS"))
|
if (rr1->TVariable_rectype::exist("MASSAUMS"))
|
||||||
qta_ums = rr.get_real("MASSAUMS");
|
qta_ums = rr1->get_real("MASSAUMS");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cerco di convertire l'unità di misura su rdoc nella unità di misura supplementare
|
// Cerco di convertire l'unità di misura su rdoc nella unità di misura supplementare
|
||||||
const TString4 um = rr.get(RDOC_UMQTA);
|
const TString4 um = rr1->get(RDOC_UMQTA);
|
||||||
|
|
||||||
if (ums.full() && um.full())
|
if (ums.full() && um.full())
|
||||||
{
|
{
|
||||||
if (ums == um) // Se coincidono, ho già finito ...
|
if (ums == um) // Se coincidono, ho già finito ...
|
||||||
qta_ums = qta;
|
qta_ums = qta;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TArticolo& art = rr.articolo();
|
TArticolo& art = rr1->articolo();
|
||||||
qta_ums = art.convert_to_um(qta, ums, um); // ... altrimenti converto
|
qta_ums = art.convert_to_um(qta, ums, um); // ... altrimenti converto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4039,9 +4050,9 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
|
|
||||||
real vs; // Valore statistico
|
real vs; // Valore statistico
|
||||||
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("VALSTAT") è sempre TRUE!
|
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("VALSTAT") è sempre TRUE!
|
||||||
if (rr.TVariable_rectype::exist("VALSTAT"))
|
if (rr1->TVariable_rectype::exist("VALSTAT"))
|
||||||
{
|
{
|
||||||
TCurrency_documento vstat(rr.get_real("VALSTAT"), doc);
|
TCurrency_documento vstat(rr1->get_real("VALSTAT"), doc);
|
||||||
vstat.change_to_firm_val();
|
vstat.change_to_firm_val();
|
||||||
vs = vstat.get_num();
|
vs = vstat.get_num();
|
||||||
}
|
}
|
||||||
|
@ -862,19 +862,17 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
|
|
||||||
if (nettifica())
|
if (nettifica())
|
||||||
{
|
{
|
||||||
FOR_EACH_PHYSICAL_RDOC_BACK(indoc, i, rdoc)
|
FOR_EACH_PHYSICAL_RDOC_BACK(indoc, i, inrec)
|
||||||
{
|
if (inrec->is_evasa())
|
||||||
TRiga_documento& inrec = *rdoc;
|
|
||||||
if (inrec.is_evasa())
|
|
||||||
indoc.destroy_row(i, true);
|
indoc.destroy_row(i, true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const real evaso = inrec.qtaevasa();
|
const real evaso = inrec->qtaevasa();
|
||||||
const char* fq = inrec.field_qta();
|
const char* fq = inrec->field_qta();
|
||||||
const char* fqe = inrec.field_qtaevasa();
|
const char* fqe = inrec->field_qtaevasa();
|
||||||
inrec.add(fq, -evaso); // nuovo modo di incrementare
|
|
||||||
inrec.zero(fqe);
|
inrec->add(fq, -evaso); // nuovo modo di incrementare
|
||||||
}
|
inrec->zero(fqe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (indoc.is_evaso())
|
if (indoc.is_evaso())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user