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,28 +440,26 @@ 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
|
|
||||||
if ((rdoc->is_spese() || rdoc->is_prestazione()))
|
|
||||||
{
|
|
||||||
const TSpesa_prest& s = rdoc->spesa();
|
|
||||||
const TString& codiva = s.cod_iva();
|
|
||||||
if (codiva.full())
|
|
||||||
rdoc->put(RDOC_CODIVA, codiva);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if ((rdoc->is_spese() || rdoc->is_prestazione()))
|
||||||
|
{
|
||||||
|
const TSpesa_prest& s = rdoc->spesa();
|
||||||
|
const TString& codiva = s.cod_iva();
|
||||||
|
|
||||||
|
if (codiva.full())
|
||||||
|
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,175 +3904,181 @@ 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(imp_val); imp.change_to_firm_val();
|
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();
|
||||||
|
|
||||||
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, rr.get(RDOC_CODARTMAG));
|
const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr1->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 char noc_s4 = rec_noc.get_char("S4"); // Obbligatorietà unità di misura supplementare
|
||||||
|
bool ums_obbl = noc_s4 > ' ';
|
||||||
|
|
||||||
const TRectype& rec_noc = cchh.get("%NOC", nomenclatura);
|
if (ums_obbl && noc_s4 != 'E')
|
||||||
const char noc_s4 = rec_noc.get_char("S4"); // Obbligatorietà unità di misura supplementare
|
ums_obbl = is_cessione ? noc_s4=='C' : noc_s4=='A';
|
||||||
bool ums_obbl = noc_s4 > ' ';
|
|
||||||
if (ums_obbl && noc_s4 != 'E')
|
|
||||||
ums_obbl = is_cessione ? noc_s4=='C' : noc_s4=='A';
|
|
||||||
|
|
||||||
const TString4 ums = rec_noc.get("S5");
|
const TString4 ums = rec_noc.get("S5");
|
||||||
const real massanun = rec_anamag.get_real(ANAMAG_MASSANUN); // Massa KG
|
const real massanun = rec_anamag.get_real(ANAMAG_MASSANUN); // Massa KG
|
||||||
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)
|
|
||||||
provincia = rec_anamag.get(ANAMAG_PROV);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const TString8 codmag = rr.get(RDOC_CODMAG);
|
|
||||||
TString4 com = cchh.get("MAG", codmag, "S5"); // Comune del magazzino
|
|
||||||
if (com.empty())
|
|
||||||
{
|
|
||||||
const long codditta = prefix().get_codditta();
|
|
||||||
TString8 codulc; codulc.format("%ld|1", codditta);
|
|
||||||
const TRectype& unloc = cchh.get(LF_UNLOC, codulc);
|
|
||||||
com = unloc.get(ULC_COMULC);
|
|
||||||
}
|
|
||||||
key.format(" |%s", (const char*)com);
|
|
||||||
provincia = cchh.get(LF_COMUNI, key, COM_PROVCOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nomenclatura.blank() || (ums_obbl && unsuppun.is_zero() && ums.blank()) || massanun.is_zero() || provincia.blank())
|
if (is_cessione)
|
||||||
{
|
provincia = rec_anamag.get(ANAMAG_PROV);
|
||||||
TString msg;
|
|
||||||
msg << "--- L'articolo " << rec_anamag.get(ANAMAG_CODART) << " non riporta tutti i dati necessari per il movimento intracomunitario.";
|
|
||||||
_viswin->add_line(msg);
|
|
||||||
msg = " Si consiglia di verificare i seguenti valori sull'anagrafica:";
|
|
||||||
_viswin->add_line(msg);
|
|
||||||
msg = " ";
|
|
||||||
if (nomenclatura.blank()) msg << "nomenclatura combinata; ";
|
|
||||||
if (ums_obbl && unsuppun.is_zero()) msg << "unità di misura supplementare; ";
|
|
||||||
if (massanun.is_zero()) msg << "massa netta unitaria; ";
|
|
||||||
if (provincia.blank()) msg << (is_cessione ? "provincia d'origine; " : "provincia di destinazione; ");
|
|
||||||
msg.rtrim(2); msg << '.'; // Sostituisce l'ultimo punto e virgola con un punto
|
|
||||||
_viswin->add_line(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
key.cut(0);
|
|
||||||
key.add(nomenclatura);
|
|
||||||
key.add(paeseorig);
|
|
||||||
key.add(provincia);
|
|
||||||
TRectype* rc = (TRectype*)righe.objptr(key); // Riga intra
|
|
||||||
if (rc == NULL)
|
|
||||||
{
|
|
||||||
rc = new TRectype(LF_RINTRA);
|
|
||||||
rc->put("NUMREG", numreg);
|
|
||||||
rc->put("NUMRIG", numrig++);
|
|
||||||
rc->put("NATURA", natura);
|
|
||||||
rc->put("CONSEGNA", consegna);
|
|
||||||
rc->put("TRASPORTO", trasporto);
|
|
||||||
|
|
||||||
rc->put("NOMENCL", nomenclatura);
|
|
||||||
rc->put("UMS", ums);
|
|
||||||
rc->put("PAESE", paese);
|
|
||||||
rc->put("PAESEORIG", paeseorig);
|
|
||||||
rc->put("PROV", provincia);
|
|
||||||
righe.add(key, rc);
|
|
||||||
}
|
|
||||||
const real qta = rr.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(imp_val); imp.change_to_firm_val();
|
|
||||||
|
|
||||||
imp_val += d.get();
|
|
||||||
imp += dlit.get();
|
|
||||||
imp_val.change_value(codvali, cambioi);
|
|
||||||
|
|
||||||
real ammeuro = rc->get_real("AMMLIRE");
|
|
||||||
real ammvaluta = rc->get_real("AMMVALUTA");
|
|
||||||
real massakg = rc->get_real("MASSAKG");
|
|
||||||
real massaums = rc->get_real("MASSAUMS");
|
|
||||||
real valstat = rc->get_real("VALSTAT");
|
|
||||||
|
|
||||||
if (nota_credito)
|
|
||||||
{
|
|
||||||
ammeuro -= imp.get_num();
|
|
||||||
ammvaluta -= is_val ? imp_val.get_num() : ZERO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ammeuro += imp.get_num();
|
|
||||||
ammvaluta += is_val ? imp_val.get_num() : ZERO;
|
|
||||||
}
|
|
||||||
|
|
||||||
real peso = qta * massanun; // peso netto
|
|
||||||
if (peso.is_zero())
|
|
||||||
peso = rr.get_real(RDOC_PNETTO);
|
|
||||||
massakg += peso;
|
|
||||||
|
|
||||||
if (ums_obbl || ums.full() || !unsuppun.is_zero())
|
|
||||||
{
|
|
||||||
real qta_ums;
|
|
||||||
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("MASSAUMS") è sempre TRUE!
|
|
||||||
if (rr.TVariable_rectype::exist("MASSAUMS"))
|
|
||||||
qta_ums = rr.get_real("MASSAUMS");
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cerco di convertire l'unità di misura su rdoc nella unità di misura supplementare
|
const TString8 codmag = rr1->get(RDOC_CODMAG);
|
||||||
const TString4 um = rr.get(RDOC_UMQTA);
|
TString4 com = cchh.get("MAG", codmag, "S5"); // Comune del magazzino
|
||||||
if (ums.full() && um.full())
|
|
||||||
|
if (com.empty())
|
||||||
{
|
{
|
||||||
if (ums == um) // Se coincidono, ho già finito ...
|
const long codditta = prefix().get_codditta();
|
||||||
qta_ums = qta;
|
TString8 codulc; codulc.format("%ld|1", codditta);
|
||||||
else
|
const TRectype& unloc = cchh.get(LF_UNLOC, codulc);
|
||||||
|
com = unloc.get(ULC_COMULC);
|
||||||
|
}
|
||||||
|
key.format(" |%s", (const char*)com);
|
||||||
|
provincia = cchh.get(LF_COMUNI, key, COM_PROVCOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nomenclatura.blank() || (ums_obbl && unsuppun.is_zero() && ums.blank()) || massanun.is_zero() || provincia.blank())
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg << "--- L'articolo " << rec_anamag.get(ANAMAG_CODART) << " non riporta tutti i dati necessari per il movimento intracomunitario.";
|
||||||
|
_viswin->add_line(msg);
|
||||||
|
msg = " Si consiglia di verificare i seguenti valori sull'anagrafica:";
|
||||||
|
_viswin->add_line(msg);
|
||||||
|
msg = " ";
|
||||||
|
if (nomenclatura.blank()) msg << "nomenclatura combinata; ";
|
||||||
|
if (ums_obbl && unsuppun.is_zero()) msg << "unità di misura supplementare; ";
|
||||||
|
if (massanun.is_zero()) msg << "massa netta unitaria; ";
|
||||||
|
if (provincia.blank()) msg << (is_cessione ? "provincia d'origine; " : "provincia di destinazione; ");
|
||||||
|
msg.rtrim(2); msg << '.'; // Sostituisce l'ultimo punto e virgola con un punto
|
||||||
|
_viswin->add_line(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
key.cut(0);
|
||||||
|
key.add(nomenclatura);
|
||||||
|
key.add(paeseorig);
|
||||||
|
key.add(provincia);
|
||||||
|
|
||||||
|
TRectype* rc = (TRectype*)righe.objptr(key); // Riga intra
|
||||||
|
|
||||||
|
if (rc == nullptr)
|
||||||
|
{
|
||||||
|
rc = new TRectype(LF_RINTRA);
|
||||||
|
rc->put("NUMREG", numreg);
|
||||||
|
rc->put("NUMRIG", numrig++);
|
||||||
|
rc->put("NATURA", natura);
|
||||||
|
rc->put("CONSEGNA", consegna);
|
||||||
|
rc->put("TRASPORTO", trasporto);
|
||||||
|
|
||||||
|
rc->put("NOMENCL", nomenclatura);
|
||||||
|
rc->put("UMS", ums);
|
||||||
|
rc->put("PAESE", paese);
|
||||||
|
rc->put("PAESEORIG", paeseorig);
|
||||||
|
rc->put("PROV", provincia);
|
||||||
|
righe.add(key, rc);
|
||||||
|
}
|
||||||
|
const real qta = rr1->get_real(RDOC_QTA);
|
||||||
|
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();
|
||||||
|
|
||||||
|
imp_val += d.get();
|
||||||
|
imp += dlit.get();
|
||||||
|
imp_val.change_value(codvali, cambioi);
|
||||||
|
|
||||||
|
real ammeuro = rc->get_real("AMMLIRE");
|
||||||
|
real ammvaluta = rc->get_real("AMMVALUTA");
|
||||||
|
real massakg = rc->get_real("MASSAKG");
|
||||||
|
real massaums = rc->get_real("MASSAUMS");
|
||||||
|
real valstat = rc->get_real("VALSTAT");
|
||||||
|
|
||||||
|
if (nota_credito)
|
||||||
|
{
|
||||||
|
ammeuro -= imp.get_num();
|
||||||
|
ammvaluta -= is_val ? imp_val.get_num() : ZERO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ammeuro += imp.get_num();
|
||||||
|
ammvaluta += is_val ? imp_val.get_num() : ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
real peso = qta * massanun; // peso netto
|
||||||
|
if (peso.is_zero())
|
||||||
|
peso = rr1->get_real(RDOC_PNETTO);
|
||||||
|
massakg += peso;
|
||||||
|
|
||||||
|
if (ums_obbl || ums.full() || !unsuppun.is_zero())
|
||||||
|
{
|
||||||
|
real qta_ums;
|
||||||
|
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("MASSAUMS") è sempre TRUE!
|
||||||
|
if (rr1->TVariable_rectype::exist("MASSAUMS"))
|
||||||
|
qta_ums = rr1->get_real("MASSAUMS");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Cerco di convertire l'unità di misura su rdoc nella unità di misura supplementare
|
||||||
|
const TString4 um = rr1->get(RDOC_UMQTA);
|
||||||
|
|
||||||
|
if (ums.full() && um.full())
|
||||||
{
|
{
|
||||||
TArticolo& art = rr.articolo();
|
if (ums == um) // Se coincidono, ho già finito ...
|
||||||
qta_ums = art.convert_to_um(qta, ums, um); // ... altrimenti converto
|
qta_ums = qta;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TArticolo& art = rr1->articolo();
|
||||||
|
qta_ums = art.convert_to_um(qta, ums, um); // ... altrimenti converto
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (qta_ums.is_zero()) // Se non sono riuscito in altro modo ...
|
||||||
|
qta_ums = qta * unsuppun; // ... calcolo peso/qta in unità di misura supplementare
|
||||||
|
|
||||||
|
massaums += qta_ums;
|
||||||
}
|
}
|
||||||
if (qta_ums.is_zero()) // Se non sono riuscito in altro modo ...
|
|
||||||
qta_ums = qta * unsuppun; // ... calcolo peso/qta in unità di misura supplementare
|
|
||||||
|
|
||||||
massaums += qta_ums;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vs = qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
|
||||||
|
if (vs.is_zero())
|
||||||
|
vs = imp.get_num();
|
||||||
|
}
|
||||||
|
if (nota_credito)
|
||||||
|
valstat -= vs;
|
||||||
|
else
|
||||||
|
valstat += vs;
|
||||||
|
|
||||||
|
rc->put("AMMLIRE", ammeuro);
|
||||||
|
rc->put("AMMVALUTA", ammvaluta);
|
||||||
|
rc->put("MASSAKG", massakg);
|
||||||
|
rc->put("MASSAUMS", massaums);
|
||||||
|
rc->put("VALSTAT", valstat);
|
||||||
|
|
||||||
|
// Il totale delle righe in Euro!
|
||||||
|
if (nota_credito)
|
||||||
|
totale_righe -= imp.get_num();
|
||||||
|
else
|
||||||
|
totale_righe += imp.get_num();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
vs = qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
|
|
||||||
if (vs.is_zero())
|
|
||||||
vs = imp.get_num();
|
|
||||||
}
|
|
||||||
if (nota_credito)
|
|
||||||
valstat -= vs;
|
|
||||||
else
|
|
||||||
valstat += vs;
|
|
||||||
|
|
||||||
rc->put("AMMLIRE", ammeuro);
|
|
||||||
rc->put("AMMVALUTA", ammvaluta);
|
|
||||||
rc->put("MASSAKG", massakg);
|
|
||||||
rc->put("MASSAUMS", massaums);
|
|
||||||
rc->put("VALSTAT", valstat);
|
|
||||||
|
|
||||||
// Il totale delle righe in Euro!
|
|
||||||
if (nota_credito)
|
|
||||||
totale_righe -= imp.get_num();
|
|
||||||
else
|
|
||||||
totale_righe += imp.get_num();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (_error == no_error)
|
if (_error == no_error)
|
||||||
|
@ -862,20 +862,18 @@ 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())
|
||||||
indoc.stato(stato_finale_doc_iniziale()[0]);
|
indoc.stato(stato_finale_doc_iniziale()[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user