From f1cb1825613743afa7fd475251b8ff48b5d9038b Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Fri, 6 Oct 2023 00:02:59 +0200 Subject: [PATCH] Patch level : 12.00 1286 Files correlati : ve0.exe ve.exe ca3.exe sc0.exe Commento : Velocizzata la stampa mastrini di analitica Il rendiconto raddoppiava il pagato Lo stesso nel saldaconto extracontabile Aggiunto controllo numeri di documento doppi aalla contabilizzazione --- src/ve/velib04b.cpp | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/ve/velib04b.cpp b/src/ve/velib04b.cpp index f7330eb37..3624f7203 100755 --- a/src/ve/velib04b.cpp +++ b/src/ve/velib04b.cpp @@ -5113,7 +5113,48 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc write_all(doc, *_movimento); // Se la scrittura è andata ok... } } - + // Controllo documenti duplicati + + const int annodoc = _movimento->lfile().get_date(MOV_DATADOC).year(); + const TString4 tipo = _movimento->lfile().get(MOV_TIPO); + const TString8 cod_reg = _movimento->lfile().get(MOV_REG); + const long fornitore = _movimento->lfile().get_long(MOV_CODCF); + const TString numdoc = _movimento->lfile().get(MOV_NUMDOC); + + if (annodoc > 0 && fornitore > 0) + { + TString filter; + TRelation rel(LF_MOV); + TRectype& rec = rel.curr(); + TRectype recfrom(rec); + + filter << '(' << MOV_NUMDOC << "=\"" << numdoc << "\")&&(" << MOV_REG << "!=\"\")"; + filter << "&&(" << MOV_NUMREG << "!=\"" << _movimento->lfile().get_long(MOV_NUMREG) << "\")"; + recfrom.put(MOV_TIPO, tipo); + recfrom.put(MOV_CODCF, fornitore); + recfrom.put(MOV_DATAREG, TDate(1, 1, annodoc)); + + TRectype recto(recfrom); + + recto.put(MOV_DATAREG, TDate(31, 12, annodoc + 1)); + + TCursor cur(&rel, filter, 3, &recfrom, &recto); + const TRecnotype items = cur.items(); + + cur.freeze(); + for (cur = 0; cur.pos() < items; ++cur) + { + const int ad = rec.get_date(MOV_DATADOC).year(); + const TString8 cr = rec.get(MOV_REG); + + if (ad == annodoc && cod_reg == cr) + { + msg.format(FR("Il documento %d / %s è già stato inserito con la registrazione %ld"), + annodoc, (const char*)numdoc, rec.get_long(MOV_NUMREG)); + _viswin->add_line(msg); + } + } + } if (!good()) { display_error(doc);