Patch level : 12.0 1108

Files correlati     : lv2.exe
Commento :

Corretta la fatturazione di lavanderie nel caso di esenzione art. 8
This commit is contained in:
Alessandro Bonazzi 2022-02-05 11:25:25 +01:00
parent 73bf1a78b9
commit c83a27cb22

View File

@ -660,15 +660,11 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
un altra cache su ANAMAG e imposto il codiva uguale al codice iva dell articolo in questione */
key = doc.get(DOC_TIPOCF);
key.add(clifo);
const TRectype& cfven = cache().get(LF_CFVEN,key);
TString8 codiva = cfven.get(CFV_ASSFIS);
TString8 codiva = cache().get(LF_CFVEN, key, CFV_ASSFIS);
if (codiva.blank())
{
const TRectype& anamag = cache().get(LF_ANAMAG,codartcfg);
codiva = anamag.get(ANAMAG_CODIVA);
}
codiva = cache().get(LF_ANAMAG, codartcfg, ANAMAG_CODIVA);
riga.put(RDOC_QTA,UNO);
riga.put(RDOC_UMQTA,umcodart);
riga.put(RDOC_PREZZO,totmerc);
@ -706,14 +702,11 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
un altra cache su ANAMAG e imposto il codiva uguale al codice iva dell articolo in questione */
key = doc.get(DOC_TIPOCF);
key.add(clifo);
const TRectype& cfven = cache().get(LF_CFVEN,key);
TString8 codiva = cfven.get(CFV_ASSFIS);
TString8 codiva = cache().get(LF_CFVEN, key, CFV_ASSFIS);
if (codiva.blank())
{
const TRectype& anamag = cache().get(LF_ANAMAG,codartcfg);
codiva = anamag.get(ANAMAG_CODIVA);
}
codiva = cache().get(LF_ANAMAG, codartcfg, ANAMAG_CODIVA);
const int rigamerce = doc.physical_rows() > 0 && doc[1].is_descrizione()?2:1;
TRiga_documento& fixrow=doc.insert_row(rigamerce, "01"); // creo una nuova riga in cima al documento e imposto i valori appena estratti
@ -1570,8 +1563,16 @@ TRiga_documento& TFatturazione_lavanderie::find_or_create_row(TDocumento& doc_ou
set_perc_provv(row);
set_perc_provv(row, false);
const TRectype& anamag = cache().get(LF_ANAMAG, rin.get(RDOC_CODART));
row.put(RDOC_CODIVA, anamag.get(ANAMAG_CODIVA));
TToken_string key;
key.add('C');
key.add(doc_out.clifor().codice());
TString8 codiva = cache().get(LF_CFVEN, key, CFV_ASSFIS);
if (codiva.blank())
codiva = cache().get(LF_ANAMAG, rin.get(RDOC_CODART), ANAMAG_CODIVA);
row.put(RDOC_CODIVA, codiva);
row.zero(RDOC_CODAGG1);
row.zero(RDOC_QTA);
@ -2167,7 +2168,6 @@ void TFatturazione_lav_app::main_loop()
const bool use_indsp = ini_get_bool(CONFIG_DITTA, "mg", "MOV_INDSPED");
const bool prezzo_da_contratto = ini_get_int(CONFIG_DITTA, "lv", "Tipopr") == 0;
const bool aggcli = ini_get_bool(CONFIG_DITTA, "lv", "AggHead");
// const bool agghead = prezzo_da_contratto || aggcli;
const TString4 num_buoni = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
const TString4 tipo_buoni = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
@ -2432,9 +2432,9 @@ void TFatturazione_lav_app::main_loop()
if (cab.full() && cab != "00000")
{
doc_updated |= (doc.get(DOC_CODABIA) != abi) || (doc.get(DOC_CODCABA) != cab);
doc.put(DOC_CODABIA, abi);
doc.put(DOC_CODCABA, cab);
doc.put(DOC_IBAN, iban);
doc.update(DOC_CODABIA, abi);
doc.update(DOC_CODCABA, cab);
doc.update(DOC_IBAN, iban);
}
key.cut(0);
key.add(cli.get(CLI_TIPOCF));
@ -2456,35 +2456,17 @@ void TFatturazione_lav_app::main_loop()
cab = cfbanpr.get(CFBAN_CAB);
progbnp = cfbanpr.get_int(CFBAN_PROGPR);
}
if (cab.full() && cab != "00000")
{
doc_updated |= (doc.get(DOC_CODABIP) != abi) || (doc.get(DOC_CODCABP) != cab);
doc.put(DOC_CODABIP, abi);
doc.put(DOC_CODCABP, cab);
doc.put(DOC_PROGBNP, progbnp);
}
const TString8 codpag = cli.get(CLI_CODPAG);
if (codpag.full())
{
doc_updated |= (doc.get(DOC_CODPAG) != codpag);
doc.put(DOC_CODPAG, codpag);
}
const TString8 spinc = cli.vendite().get(CFV_PERCSPINC);
if (spinc.full())
{
doc_updated |= (doc.get(DOC_PERCSPINC) != spinc);
doc.put(DOC_PERCSPINC, spinc);
}
const bool addbolli = cli.vendite().get_bool(CFV_ADDBOLLI);
doc_updated |= (doc.get_bool(DOC_ADDBOLLI) != addbolli);
doc.put(DOC_ADDBOLLI, addbolli);
const TString agente1 = cli.vendite().get(CFV_CODAG1);
if (agente1.full())
{
doc_updated |= (doc.get(DOC_CODAGVIS) != agente1);
doc.put(DOC_CODAGVIS, agente1);
}
if (cab.full() && cab != "00000")
{
doc_updated |= (doc.get(DOC_CODABIP) != abi) || (doc.get(DOC_CODCABP) != cab);
doc.update(DOC_CODABIP, abi);
doc.update(DOC_CODCABP, cab);
doc.update(DOC_PROGBNP, progbnp);
}
doc_updated |= doc.update_if_full(DOC_CODPAG, cli.get(CLI_CODPAG));
doc_updated |= doc.update_if_full(DOC_PERCSPINC, cli.vendite().get(CFV_PERCSPINC));
doc_updated |= doc.update_if_full(DOC_ADDBOLLI, cli.vendite().get_bool(CFV_ADDBOLLI));
doc_updated |= doc.update_if_full(DOC_CODAGVIS, cli.vendite().get(CFV_CODAG1));
if (doc_updated)
{
TString msg(" Cli.");