Patch level : 12.0 1244

Files correlati     : ve0.exe cg5.exe Mcg5500c.msk

Commento:
Aggiunto un controllo oopzionale sulla contbilizzazione fatture che derivano da una fattura da emettere o ricevere se la fattura appartiene alo strsso esercizio della da emettere o ricevere viene contabilizzata normlmente e non storna la fattura da emettere o ricevere.
This commit is contained in:
Alessandro Bonazzi 2023-02-16 21:51:40 +01:00
parent 46bc8b628c
commit ebd79dffd1
4 changed files with 55 additions and 43 deletions

View File

@ -423,7 +423,8 @@ public:
const bool num_provv() const { return get_bool("B0"); }
const bool auto_num() const { return get_bool("B1"); }
const bool dont_test_datadoc() const { return get_bool("B2"); }
const bool fattura_emettere_ricevere() const { return get_bool("B3"); }
const bool fattura_emettere_ricevere() const { return get_bool("B3"); }
const bool fattura_emettere_ricevere_check_ese() const { return get_bool("B11"); }
const bool save_and_new() const { return get_bool("B4"); }
const bool test_eser() const { return !get_bool("B5"); }
const bool auto_archive() const { return get_bool("B6"); }
@ -966,7 +967,7 @@ public:
static void set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc);
static void copy_data(TRectype& dst, const TRectype& src);
static void copy_data(TRiga_documento& dst, const TRiga_documento& src);
void copy_contents(const TDocumento& src, bool copy_header = true);
void copy_contents(const TDocumento& src, bool link_row = true, bool copy_header = true);
void set_fields(TAuto_variable_rectype & rec);
void update_esenzione();

View File

@ -642,52 +642,54 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
real impon;
const bool sconto_lordo = t.tipo() != RIGA_SCONTI && _contsclor && _sco_perc_bill.ok();
const int firmdec = TCurrency::get_firm_dec();
const TRectype * rdoc = r.find_original_rdoc();
if (rdoc != NULL && rdoc->get(RDOC_PROVV).not_empty())
const TRectype * orig_doc = r.find_original_doc();
const TRectype * rdoc = r.find_original_rdoc();
if (rdoc != nullptr && orig_doc != nullptr && orig_doc->get(RDOC_PROVV).not_empty())
{
TString80 key = rdoc->get(RDOC_CODNUM);
const TCodice_numerazione& num = cached_numerazione(key);
if (num.fattura_emettere_ricevere())
{
key.format("%3d%3d%6ld", c.gruppo(), c.conto(), c.sottoconto());
const TRectype* rs = &cache().get("&MRE", key);
if (rs->empty())
{
key.cut(6);
rs = &cache().get("&MRE", key);
if (rs->empty())
{
key.cut(3);
rs = &cache().get("&MRE", key);
}
}
if (rs->empty())
{
key = rdoc->get(RDOC_PROVV);
key << '|' << rdoc->get(RDOC_ANNO);
key << '|' << rdoc->get(RDOC_CODNUM);
key << '|' << rdoc->get(RDOC_NDOC);
if (num.fattura_emettere_ricevere())
{
const int act_es = esercizi().date2esc(r.doc().get_date(DOC_DATADOC));
const int orig_es = esercizi().date2esc(orig_doc->get_date(DOC_DATADOC));
const TRectype & doc = cache().get(LF_DOC, key);
const TTipo_documento& td = cached_tipodoc(doc.get(DOC_TIPODOC));
const TString& codcau = td.causale();
const TCausale caus(codcau);
if (!num.fattura_emettere_ricevere_check_ese() || act_es != orig_es)
{
key.format("%3d%3d%6ld", c.gruppo(), c.conto(), c.sottoconto());
const TRectype* rs = &cache().get("&MRE", key);
if (rs->empty())
{
key.cut(6);
rs = &cache().get("&MRE", key);
if (rs->empty())
{
key.cut(3);
rs = &cache().get("&MRE", key);
}
}
if (rs->empty())
{
const TTipo_documento& td = cached_tipodoc(orig_doc->get(DOC_TIPODOC));
const TString& codcau = td.causale();
const TCausale caus(codcau);
caus.bill(1, c);
}
else
{
const int gr = rs->get_int("I0");
const int co = rs->get_int("I1");
const long so = rs->get_int("I2");
const char tipo = rs->get_char("S6");
caus.bill(1, c);
}
else
{
const int gr = rs->get_int("I0");
const int co = rs->get_int("I1");
const long so = rs->get_int("I2");
const char tipo = rs->get_char("S6");
c.set(gr, co, so, tipo);
}
if (c.tipo() > ' ')
c.set(c.gruppo(), c.conto(), r.doc().get_long(DOC_CODCF), c.tipo());
c.set(gr, co, so, tipo);
}
if (c.tipo() > ' ')
c.set(c.gruppo(), c.conto(), r.doc().get_long(DOC_CODCF), c.tipo());
}
}
}
if (!sconto_lordo) // Al netto dello sconto

View File

@ -84,4 +84,5 @@
#define F_ARCHIVE 275
#define F_SPMSP 276
#define F_REVLEN 277
#define F_NOPA 278
#define F_NOPA 278
#define F_EMRICKYR 279

View File

@ -125,9 +125,17 @@ END
BOOLEAN F_EMRI
BEGIN
PROMPT 2 14 "Fatture da emettere/ricevere"
MESSAGE FALSE CLEAR,F_EMRICKYR
MESSAGE TRUE ENABLE,F_EMRICKYR
FIELD B3
END
BOOLEAN F_EMRICKYR
BEGIN
PROMPT 40 14 "Controllo esercizio"
FIELD B11
END
BOOLEAN F_SAVEANDNEW
BEGIN
PROMPT 2 15 "Rimanere in inserimento dopo la registrazione"