From f85d0ea349dde6c07b509c5685f508e0d121c782 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Wed, 7 May 2025 01:30:13 +0200 Subject: [PATCH] Patch level : 12.00 Files correlati : Bug : Collegamento a fepa --- src/cg/cg0200.cpp | 7 +- src/cg/cglib.h | 2 +- src/cg01/cg0200.cpp | 79 +---- src/cg01/cg0201.cpp | 144 ++++---- src/cg01/cg0201.h | 23 +- src/cg01/cg0700.cpp | 2 +- src/cg01/cg2100.cpp | 2 +- src/cg01/cg2102.cpp | 2 +- src/cg01/cg6400.cpp | 2 +- src/cg01/cglib.h | 6 +- src/cg01/cglib03.cpp | 33 +- src/cg01/cglib04.cpp | 37 +- src/cg01/cglib08.cpp | 2 +- src/fp01/fp0200.cpp | 1 - src/fp01/fp0300.cpp | 4 +- src/fp01/fplib.h | 2 + src/fp01/fplib01.cpp | 1 - src/li/lilib01.h | 2 +- src/li01/letint.h | 25 ++ src/li01/lilib01.cpp | 707 +++++++++++++++++++++++++++++++++++++ src/li01/lilib01.h | 119 +++++++ src/ve01/ve0100.cpp | 6 - src/ve01/ve0100.h | 2 - src/ve01/ve0600.cpp | 2 +- src/ve01/ve1500.cpp | 2 +- src/ve01/ve2400.cpp | 7 - src/ve01/ve3800.cpp | 2 +- src/ve01/ve6500.cpp | 2 +- src/ve01/ve6600.cpp | 2 +- src/ve01/velib.h | 12 +- src/ve01/velib03.cpp | 791 +++++------------------------------------- src/ve01/velib04.cpp | 1 + src/ve01/velib04.h | 16 +- src/ve01/velib04b.cpp | 4 +- src/ve01/velib04f.cpp | 2 +- src/ve01/velib05.cpp | 2 +- src/ve01/velib06.cpp | 41 +-- src/ve01/velib06a.cpp | 6 +- src/ve01/velib07.cpp | 4 +- src/ve01/velib08.cpp | 14 +- src/ve01/veuml.h | 3 - 41 files changed, 1123 insertions(+), 1000 deletions(-) create mode 100644 src/li01/letint.h create mode 100644 src/li01/lilib01.cpp create mode 100644 src/li01/lilib01.h diff --git a/src/cg/cg0200.cpp b/src/cg/cg0200.cpp index 830d0c596..f0dc021f0 100755 --- a/src/cg/cg0200.cpp +++ b/src/cg/cg0200.cpp @@ -1419,7 +1419,8 @@ void TClifo_application::common_f(const TMask& m) } TToken_string data; - TString8 first, second; + TString8 first, second; + first.format("%c%06ld", m.get(F_TIPOCF)[0], m.get_long(F_CODCF)); TSheet_field& s = m.sfield(F_SHEET_CONT); FOR_EACH_SHEET_ROW(s, r, row) @@ -1433,10 +1434,10 @@ void TClifo_application::common_f(const TMask& m) data.cut(0); const char* d = NULL; while ((d = row->get())) - { + { if (*d > ' ') data.add(d); - } + } rec.put("DATA", data); } } diff --git a/src/cg/cglib.h b/src/cg/cglib.h index e5c999d5a..8e57f8d9c 100644 --- a/src/cg/cglib.h +++ b/src/cg/cglib.h @@ -1570,7 +1570,7 @@ public: virtual int readat(TRecnotype nrec, word lockop = _nolock); virtual int read(word op = _isequal, word lockop = _nolock); - virtual int TMovimento_contabile::remove(); + virtual int remove(); // Funzioni per costruttore di copia diff --git a/src/cg01/cg0200.cpp b/src/cg01/cg0200.cpp index 4c35e0b9e..24cc5440e 100644 --- a/src/cg01/cg0200.cpp +++ b/src/cg01/cg0200.cpp @@ -51,7 +51,6 @@ protected: //////////// static bool ban_notify(TSheet_field& ban, int r, KEY key); static bool indsp_notify(TSheet_field& indsp, int r, KEY key); - static bool spese_notify(TSheet_field& spese, int r, KEY key); static void indsp_sheet_rebuilder(); static bool effetti_notify(TSheet_field& s, int r, KEY key); @@ -70,7 +69,6 @@ protected: TSheet_field& indsp_sheet() const; TSheet_field& contatti_sheet() const; - TSheet_field& spese_sheet() const; TString_array& field_sheet(short id) const; void reset_sheet(); void indsp_pack(); @@ -952,9 +950,9 @@ int TClifo_application::read(TMask& m) if (_gesven) { indsp_sheet().reset(); - for (i = 1; i <= _rel->indirizzi().rows(); i++) + for (i = 1; i <= _rel->indirizzi(); i++) { - const TRectype& rec = _rel->indirizzi()[i]; + const TRectype& rec = (const TRectype&) _rel->indirizzo(i); const int r = indsp_sheet().set_row_cell(F_RAGSOCI, rec.get(IND_RAGSOC)); indsp_sheet().set_row_cell(F_INDIRI, rec.get(IND_INDIR), r); @@ -996,9 +994,9 @@ int TClifo_application::read(TMask& m) field_sheet(F_CODINDEFF).add(riga); } contatti_sheet().reset(); - for (int i = 1; i <= _rel->contatti().rows(); i++) + for (int i = 1; i <= _rel->contatti(); i++) { - const TRectype& contact = _rel->contatti()[i]; + const TRectype& contact = (const TRectype &) _rel->contatto(i); TAuto_token_string data = contact.get("DATA"); const int r = contatti_sheet().set_row_cell(F_CONTACT, data.get(0)); @@ -1006,16 +1004,6 @@ int TClifo_application::read(TMask& m) contatti_sheet().set_row_cell(F_TIPO1 + j, data.get(), r); contatti_sheet().check_row(r); } - spese_sheet().reset(); - for (int i = 1; i <= _rel->cfspra().rows(); i++) - { - const TRectype& contact = _rel->contatto(c); - const int r = spese_sheet().set_row_cell(F_CONTACT, contact.get(CFSPRA_TIPOSPRA)); - - spese_sheet().set_row_cell(F_CODSP, contact.get(CFSPRA_CODSPRA), r); - spese_sheet().set_row_cell(F_QTADEF, contact.get(CFSPRA_QTADEF), r); - spese_sheet().check_row(r); - } } TToken_string key; @@ -1155,20 +1143,6 @@ void TClifo_application::ini2mask(TConfig& ini, TMask& m, bool query) else break; } - spese_sheet().reset(); - for (i = 0; ; i++) - { - para.format("%d,%d", LF_CFSPRA, i + 1); - if (ini.set_paragraph(para)) - { - const int r = spese_sheet().set_row_cell(F_CONTACT, ini.get(CFSPRA_TIPOSPRA)); - - spese_sheet().set_row_cell(F_CODSP, ini.get(CFSPRA_CODSPRA), r); - spese_sheet().set_row_cell(F_QTADEF, ini.get(CFSPRA_QTADEF), r); - } - else - break; - } } TString p; @@ -1376,12 +1350,6 @@ TSheet_field& TClifo_application::contatti_sheet() const return o_sheet; } -TSheet_field& TClifo_application::spese_sheet() const -{ - TSheet_field& o_sheet = _msk->sfield(F_SHEET_SPESE); - return o_sheet; -} - void TClifo_application::reset_sheet() { TToken_string nulla = "|**"; @@ -1450,18 +1418,12 @@ void TClifo_application::common_f(const TMask& m) { const char tipocf = m.get(F_TIPOCF)[0]; const long codcf = m.get_long(F_CODCF); - TRectype recind(LF_INDSP); _rel->destroy_rows(); indsp_pack(); - if (_rel->indirizzi().key().empty()) - { - recind.put(IND_TIPOCF, tipocf); - recind.put(IND_CODCF, codcf); - _rel->indirizzi().set_key(&recind); - } FOR_EACH_SHEET_ROW_LOOP(indsp_sheet(), r) { + TRectype& recind = _rel->indirizzo(r); recind.zero(); recind.put(IND_TIPOCF,tipocf); recind.put(IND_CODCF,codcf); @@ -1482,23 +1444,16 @@ void TClifo_application::common_f(const TMask& m) recind.put(IND_PADESTIN, indsp_sheet().get_str_row_cell(r, F_PADESTINI)); recind.put(IND_CODDEST, indsp_sheet().get_str_row_cell(r, F_CODDEST)); recind.put(IND_PARIFAMM, indsp_sheet().get_str_row_cell(r, F_PARIFAMMI)); - _rel->indirizzi().add_row(recind); } - int err = _rel->indirizzi().write(true); - - if (err != NOERR) - { - error_box(FR("Errore %d nella scrittura indirizzi"), err); - return; - } TToken_string data; TString8 first, second; + first.format("%c%06ld", m.get(F_TIPOCF)[0], m.get_long(F_CODCF)); TSheet_field& s = m.sfield(F_SHEET_CONT); FOR_EACH_SHEET_ROW(s, r, row) { - TRectype& rec=_rel->contatto(r); + TRectype& rec = _rel->contatto(r); rec.put("COD", "BACON"); rec.put("FIRST", first); second.format("%06ld", row->get_long(0)); @@ -1643,22 +1598,6 @@ bool TClifo_application::indsp_notify(TSheet_field& indsp, int r, KEY key) return true; } -bool TClifo_application::spese_notify(TSheet_field& spese, int r, KEY key) -{ - switch (key) - { - case K_CTRL + K_INS: - // request to add the row #r - // Set tipo to S - spese.set_row_cell(F_TIPOSPRA, "S", r); - spese.check_row(r); - break; - default: - break; - } - return true; -} - bool TClifo_application::effetti_notify(TSheet_field& pnae, int r, KEY key) { if (key == K_INS) @@ -1731,10 +1670,6 @@ bool TClifo_application::user_create() // initvar e arrmask TSheet_field& ind = _msk->sfield(F_SHEET_G_VEN); ind.set_notify(indsp_notify); - - TSheet_field& spese = _msk->sfield(F_SHEET_SPESE); - - spese.set_notify(spese_notify); ind.sheet_mask().set_handler(F_COMI, comi_handler); ind.sheet_mask().set_handler(F_PADESTINI, coddest_handler); diff --git a/src/cg01/cg0201.cpp b/src/cg01/cg0201.cpp index 103157714..db7286948 100644 --- a/src/cg01/cg0201.cpp +++ b/src/cg01/cg0201.cpp @@ -25,7 +25,7 @@ TRectype& TClifoVI::indirizzo(int i) { TRectype *r=(TRectype*)_indirizzi.objptr(i); - if (r == NULL) + if (r == nullptr) { r = new TRectype(LF_INDSP); _indirizzi.add(r,i); @@ -45,86 +45,88 @@ TRectype& TClifoVI::contatto(int i) return *r; } - int TClifoVI::read_indirizzi() { - destroy_rows(); + destroy_rows(); - if (_gesven) - { - const TRectype& rind = curr(LF_INDSP); - - rind.put(IND_TIPOCF, tipocf); - rind.put(IND_CODCF, codcf); - _indirizzi.read(rind); - - // Read contatti - TLocalisamfile cont(LF_MULTIREL); - const char tipocf = curr().get_char(CLI_TIPOCF); - const long codcf = curr().get_long(CLI_CODCF); - TString8 first; first.format("%C%06ld", tipocf, codcf); - - cont.put("COD", "BACON"); - cont.put("FIRST", first); - for (int err = cont.read(_isgteq); - err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first; - err = cont.next()) - _contatti.add(cont.curr()); - } - - return 0; + if (_gesven) + { + const TRectype& rind = curr(LF_INDSP); + + for (bool ok = is_first_match(LF_INDSP); ok; ok = next_match(LF_INDSP)) + { + const int nriga = rind.get_int(IND_CODIND) - 1; + indirizzo(nriga) = rind; + } + _oldindirizzi = indirizzi(); + + // Read contatti + TLocalisamfile cont(LF_MULTIREL); + const char tipocf = curr().get_char(CLI_TIPOCF); + const long codcf = curr().get_long(CLI_CODCF); + TString8 first; first.format("%C%06ld", tipocf, codcf); + + cont.put("COD", "BACON"); + cont.put("FIRST", first); + for (int err = cont.read(_isgteq); + err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first; + err = cont.next()) + _contatti.add(cont.curr()); + } + + return 0; } int TClifoVI::write_contatti() { - TAssoc_array old_ones; - TLocalisamfile cont(LF_MULTIREL); - const char tipocf = curr().get_char(CLI_TIPOCF); - const long codcf = curr().get_long(CLI_CODCF); - TString8 first; first.format("%C%06ld", tipocf, codcf); - - cont.put("COD", "BACON"); - cont.put("FIRST", first); - for (int err = cont.read(_isgteq); - err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first; - err = cont.next()) - old_ones.add(cont.curr().get("SECOND")); + TAssoc_array old_ones; + TLocalisamfile cont(LF_MULTIREL); + const char tipocf = curr().get_char(CLI_TIPOCF); + const long codcf = curr().get_long(CLI_CODCF); + TString8 first; first.format("%C%06ld", tipocf, codcf); - FOR_EACH_ASSOC_OBJECT(old_ones, h, k, r) - { - bool trovato = false; - for (int i = _contatti.last(); i >= 0 && !trovato; i--) - { - const TRectype& c = (const TRectype&)_contatti[i]; - - trovato = c.get_long("SECOND") == atol(k); - } - if (!trovato) - { - cont.zero(); - cont.put("COD", "BACON"); - cont.put("FIRST", first); - cont.put("SECOND", k); - cont.remove(); - } - } + cont.put("COD", "BACON"); + cont.put("FIRST", first); + for (int err = cont.read(_isgteq); + err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first; + err = cont.next()) + old_ones.add(cont.curr().get("SECOND")); - FOR_EACH_ARRAY_ITEM(_contatti, i, obj) - { - TRectype& rec = *(TRectype*)obj; - - if (rec.get("DATA").full()) - { - TString8 second; - second.format("%06ld", rec.get_long("SECOND")); - rec.put("COD", "BACON"); - rec.put("FIRST", first); - rec.put("SECOND", second); - rec.write_rewrite(cont); - } - } + FOR_EACH_ASSOC_OBJECT(old_ones, h, k, r) + { + bool trovato = false; + for (int i = _contatti.last(); i >= 0 && !trovato; i--) + { + const TRectype& c = (const TRectype&)_contatti[i]; - return 0; + trovato = c.get_long("SECOND") == atol(k); + } + if (!trovato) + { + cont.zero(); + cont.put("COD", "BACON"); + cont.put("FIRST", first); + cont.put("SECOND", k); + cont.remove(); + } + } + + FOR_EACH_ARRAY_ITEM(_contatti, i, obj) + { + TRectype& rec = *(TRectype*)obj; + + if (rec.get("DATA").full()) + { + TString8 second; + second.format("%06ld", rec.get_long("SECOND")); + rec.put("COD", "BACON"); + rec.put("FIRST", first); + rec.put("SECOND", second); + rec.write_rewrite(cont); + } + } + + return 0; } int TClifoVI::read(TIsamop op, TReclock lockop) diff --git a/src/cg01/cg0201.h b/src/cg01/cg0201.h index 15b4d13c7..78852f284 100644 --- a/src/cg01/cg0201.h +++ b/src/cg01/cg0201.h @@ -9,9 +9,9 @@ class TClifoVI : public TRelation { // @DPRIV - TRecord_array _indirizzi; - TRecord_array _cfspra; - TTrimmed_record_array _contatti; + TArray _indirizzi; + int _oldindirizzi; + TArray _contatti; bool _gesven, _geslv; // @END @@ -34,14 +34,23 @@ public: virtual int rewrite(bool force=TRUE); virtual int remove(); - TRecord_array & indirizzi() { return _indirizzi; } - TRecord_array & cfspra() { return _cfspra; } - TRecord_array & contatti() { return _contatti; } - void destroy_rows(); + int write_rec(bool re, const TRectype& rec, TLocalisamfile& f); + int write_contatti(); + + + TRectype& indirizzo(int i); + int indirizzi() { return _indirizzi.items(); } + + void destroy_rows(); + TRectype& contatto(int i); + int contatti() const { return _contatti.items(); } + void gestione_vendite(bool gv) { _gesven = gv; } void gestione_lavanderie(bool glv) { _geslv = glv; } + int cancella(TLocalisamfile& f, int da, int a); + TClifoVI(); virtual ~TClifoVI() {} }; diff --git a/src/cg01/cg0700.cpp b/src/cg01/cg0700.cpp index 64da6c39b..621fc8fef 100644 --- a/src/cg01/cg0700.cpp +++ b/src/cg01/cg0700.cpp @@ -2,7 +2,7 @@ #include #include #include -#include "..\ve\velib.h" +#include "..\ve01\velib.h" #include "cg0.h" #include "cg0700a.h" diff --git a/src/cg01/cg2100.cpp b/src/cg01/cg2100.cpp index e06944043..a8023e5f5 100644 --- a/src/cg01/cg2100.cpp +++ b/src/cg01/cg2100.cpp @@ -21,7 +21,7 @@ // Campi su maschera #include "cg2100.h" #include "tsdb.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" enum { diff --git a/src/cg01/cg2102.cpp b/src/cg01/cg2102.cpp index 8ce2bfe8f..83f1dec92 100644 --- a/src/cg01/cg2102.cpp +++ b/src/cg01/cg2102.cpp @@ -23,7 +23,7 @@ #include #include #include -#include "../fp/fplib.h" +#include "../fp01/fplib.h" /////////////////////////////////////////////////////////// // Funzioni di decodifica/calcolo diff --git a/src/cg01/cg6400.cpp b/src/cg01/cg6400.cpp index b1f7c457f..6f868eb0c 100644 --- a/src/cg01/cg6400.cpp +++ b/src/cg01/cg6400.cpp @@ -261,7 +261,7 @@ bool TRic_archivi::leggi_marker_rep() FILE* inmark = fopen(_marker,"r"); if (inmark != NULL) { - const word letti = fread(buffer.get_buffer(),1,size,inmark); + const size_t letti = fread(buffer.get_buffer(),1,size,inmark); fclose(inmark); _progdisk = atoi(buffer.sub(34,36)); diff --git a/src/cg01/cglib.h b/src/cg01/cglib.h index 609a80606..e0ca3fb49 100644 --- a/src/cg01/cglib.h +++ b/src/cg01/cglib.h @@ -1624,9 +1624,9 @@ public: virtual int read(word op = _isequal, word lockop = _nolock) override; virtual int remove(TBaseisamfile& f) const override; - virtual int remove() const { TLocalisamfile f(num()); return remove(f); } - virtual int write() const { TLocalisamfile f(num()); return write_rewrite(f); } - virtual int rewrite() const { TLocalisamfile f(num()); return write_rewrite(f, true); } + virtual int remove() const { TBaseisamfile f(num()); return remove(f); } + virtual int write() const { TBaseisamfile f(num()); return write_rewrite(f); } + virtual int rewrite() const { TBaseisamfile f(num()); return write_rewrite(f, true); } // Funzioni per costruttore di copia diff --git a/src/cg01/cglib03.cpp b/src/cg01/cglib03.cpp index b8b994d6d..6b533664a 100644 --- a/src/cg01/cglib03.cpp +++ b/src/cg01/cglib03.cpp @@ -114,25 +114,22 @@ bool gestione_IVAxCassa(const TDate& data_mov, long firm) { const TDate data = data_mov.ok() ? data_mov : TDate(TODAY); const int anno = data.year(); - bool yes = dongle().active(ICAUT) && dongle().active(SCAUT); + bool yes = true; + if (firm <= 0) + firm = prefix().get_codditta(); + TString16 codtab; + + codtab.format("%05ld%04d", firm, anno); + + const TRectype& lia = cache().get("%LIA", codtab); + + yes = lia.get_bool("B5"); if (yes) { - if (firm <= 0) - firm = prefix().get_codditta(); - TString16 codtab; - - codtab.format("%05ld%04d", firm, anno); - - const TRectype& lia = cache().get("%LIA", codtab); - - yes = lia.get_bool("B5"); - if (yes) - { - TDate dal = lia.get("D0"); if (dal.year() != anno) dal = TDate( 1, 1, anno); - TDate al = lia.get("D1"); if (al.year() != anno) al = TDate(31,12, anno); - yes = data >= dal && data <= al; - } + TDate dal = lia.get("D0"); if (dal.year() != anno) dal = TDate( 1, 1, anno); + TDate al = lia.get("D1"); if (al.year() != anno) al = TDate(31,12, anno); + yes = data >= dal && data <= al; } return yes; } @@ -214,9 +211,7 @@ bool is_IVAxCassa(const TRectype& mov) if (!mov_has_imposte(mov)) return false; const TDate data_reg = mov.get(MOV_DATAREG); -// const TDate data_doc = mov.get(MOV_DATADOC); -// const TDate data_rif = data_doc.ok() && data_doc < data_reg ? data_doc : data_reg; -// if (!gestione_IVAxCassa(data_rif)) + if (!gestione_IVAxCassa(data_reg)) return false; diff --git a/src/cg01/cglib04.cpp b/src/cg01/cglib04.cpp index c4492cb3a..a55d6e0c0 100644 --- a/src/cg01/cglib04.cpp +++ b/src/cg01/cglib04.cpp @@ -252,28 +252,25 @@ TRic_recfield::TRic_recfield(TRectype& rec, const char* name, int from, int len) void TRic_recfield::set(int from, int to) { - const TTrec& rd = _rec->rec_des(); + int nf; + const RecDes& rd = _rec->rec_des(); - if (!rd.exist(_name)) - { - _p = NULL; - _len = 0; - _dec = 0; - _type = _nullfld; - yesnofatal_box(FR("File n. %d unknown field %s"), _rec->num(), _name); - } - else - { - CHECK(from >= 0, "Invalid Start"); - - const TFieldDes & f = rd.field(_name); - - _p = _rec->string() + f.offset() + from; - _dec = f.dec(); - _type =f.type(); - } + if ((nf = findfld(&rd, _name)) == -1) + { + _p = NULL; + _len = 0; + _dec = 0; + _type = _nullfld; + yesnofatal_box(FR("File n. %d unknown field %s"), _rec->num(), _name); + } + else + { + CHECK(from >= 0, "Invalid Start"); + _p = _rec->string() + rd.Fd[nf].RecOff + from; + _dec = rd.Fd[nf].Dec; + _type = rd.Fd[nf].TypeF; + } } - const char* TRic_recfield::operator =(const char* s) { __putfieldbuff( _len, _dec, _type, s, _p); diff --git a/src/cg01/cglib08.cpp b/src/cg01/cglib08.cpp index 5e3f8154c..2ac5a8c2e 100644 --- a/src/cg01/cglib08.cpp +++ b/src/cg01/cglib08.cpp @@ -6,7 +6,7 @@ #include #include "cglib.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" #include #include diff --git a/src/fp01/fp0200.cpp b/src/fp01/fp0200.cpp index 427ac0e83..52e9f3c0f 100644 --- a/src/fp01/fp0200.cpp +++ b/src/fp01/fp0200.cpp @@ -7,7 +7,6 @@ #include #include "../ve01/velib05.h" -#include "../fe/felib.h" #include "fp0.h" #include "fp0200a.h" diff --git a/src/fp01/fp0300.cpp b/src/fp01/fp0300.cpp index bda81a5e9..6dc945d60 100644 --- a/src/fp01/fp0300.cpp +++ b/src/fp01/fp0300.cpp @@ -8,7 +8,7 @@ #include "fplib.h" #include "../ve01/velib04.h" -#include "../fe/felib.h" + #include "fp0.h" #include "fp0300a.h" @@ -169,7 +169,7 @@ void TPA_mask::fill_docs() FOR_EACH_TOKEN(stati, r) tipi.add(tipo); - sdocs.read('D' ,dal.year(), codnum, tipi, stati, filter, dal, al); + sdocs.read('D', dal.year(), codnum, tipi, stati, filter, dal, al); const int items = sdocs.items(); diff --git a/src/fp01/fplib.h b/src/fp01/fplib.h index c15511e2e..8750235f3 100644 --- a/src/fp01/fplib.h +++ b/src/fp01/fplib.h @@ -95,6 +95,7 @@ void archive_xml_acq(const TFilename &xml_name, int anno); void retrieve_xml_acq(const TFilename &xml_name, int anno); void data_ricezione(const TFilename & full_xml_name, TDate & data); +#ifndef NOTAPF #define NOTAPF @@ -118,6 +119,7 @@ public: TFP_nota_piede_f(); ~TFP_nota_piede_f() = default; }; +#endif typedef enum { _int = 0, _cf, _ean8, _ean13, _39, _codabar, _upc } fp_tip_art; diff --git a/src/fp01/fplib01.cpp b/src/fp01/fplib01.cpp index fe5930c06..fe5a20822 100644 --- a/src/fp01/fplib01.cpp +++ b/src/fp01/fplib01.cpp @@ -12,7 +12,6 @@ #include #include "../cg/cfban.h" -#include "../fe/felib.h" #include "../li/letint.h" #include "../ve/velib04.h" #include diff --git a/src/li/lilib01.h b/src/li/lilib01.h index fdb12bbcf..f3556718a 100644 --- a/src/li/lilib01.h +++ b/src/li/lilib01.h @@ -14,7 +14,7 @@ #endif class TDocumento; -class TLista_documenti; +//class TLista_documenti; #ifndef __REPUTILS_H #include diff --git a/src/li01/letint.h b/src/li01/letint.h new file mode 100644 index 000000000..dffab2c90 --- /dev/null +++ b/src/li01/letint.h @@ -0,0 +1,25 @@ +#ifndef __LETINT_H +#define __LETINT_H + +#define LETINT_ANNO "ANNO" +#define LETINT_NUMPROT "NUMPROT" +#define LETINT_DATAREG "DATAREG" +#define LETINT_VSPROT "VSPROT" +#define LETINT_VSDATA "VSDATA" +#define LETINT_CODCLI "CODCLI" +#define LETINT_UFFIVA "UFFIVA" +#define LETINT_NOTE "NOTE" +#define LETINT_TIPOOP "TIPOOP" +#define LETINT_IMPORTO "IMPORTO" +#define LETINT_UTILIZZATO "UTILIZZATO" +#define LETINT_DAL "DAL" +#define LETINT_AL "AL" +#define LETINT_STAMPATO "STAMPATO" +#define LETINT_INVIATO "INVIATO" +#define LETINT_PROTINTF "PROTINTF" +#define LETINT_PROTINTS "PROTINTS" +#define LETINT_PROTDATA "PROTDATA" +#define LETINT_CHIUSA "CHIUSA" +#define LETINT_CODTPE "CODTPE" + +#endif diff --git a/src/li01/lilib01.cpp b/src/li01/lilib01.cpp new file mode 100644 index 000000000..a8861adf1 --- /dev/null +++ b/src/li01/lilib01.cpp @@ -0,0 +1,707 @@ +#include "lilib01.h" +#include "letint.h" +#include +#include +#include +#include + +#ifndef __VELIB04_H +#include "../ve01/velib04.h" +#endif + +#define INIZIO_LETINT 2017 + +// ritorna il codice iva del plafond +const TString & iva_plafond() +{ + static TString codiva_plafond_def("*"); + static TString codiva_plafond_alt; + + if (codiva_plafond_def == "*") + { + codiva_plafond_def = ini_get_string(CONFIG_DITTA, "li", "CODIVA"); + codiva_plafond_alt = ini_get_string(CONFIG_DITTA, "li", "CODIVALT"); + } + if (codiva_plafond_def.full()) + return codiva_plafond_def; + if (codiva_plafond_alt.full()) + return codiva_plafond_alt; + return EMPTY_STRING; +} + +// Controllo se il codice iva è uguale a quello impostato per il calcolo del plafond +bool check_iva_plafond(const TString& cod) +{ + return cod == iva_plafond(); +} + +const TString & make_key(const int anno, const int numplaf) +{ + TString & key = get_tmp_string(20); + + key.format("%04d|%06d", anno, numplaf); + return key; +} + +static TToken_string __tipidoc; +static TToken_string __statidoc; +static bool __enable_fatture = false; + +void get_tipi_stati() +{ + if (__tipidoc.blank()) + { + __enable_fatture = ini_get_bool(CONFIG_DITTA, "li", "ENABLEFATT"); + + TToken_string tipidoc = (TToken_string &)ini_get_string(CONFIG_DITTA, "li", "TIPIDOC"); + + for (const char * tipo = tipidoc.get(0); tipo && *tipo; tipo = tipidoc.get()) + { + TToken_string statidoc(ini_get_string(CONFIG_DITTA, "li", tipo), ','); + const int stato_ini = statidoc.get_int(0); + const int stato_fin = statidoc.get_int(); + + for (int i = stato_ini; i <= stato_fin; i++) + { + __tipidoc.add(tipo); + __statidoc.add(i); + } + } + } +} + +TToken_string & tipi() +{ + if (__tipidoc.blank()) + get_tipi_stati(); + return __tipidoc; +} + +TToken_string & stati() +{ + if (__statidoc.blank()) + get_tipi_stati(); + return __statidoc; +} + +#define LINT_MSG 0 +#define LINT_ERROR 1 +#define LINT_CONDITIONAL_ERROR 2 +#define LINT_FATAL 3 + +static TToken_string __lint_msg("", '\n'); +static bool __lint_batch = false; + +void lint_batch(const bool on) { __lint_batch = on; } + +bool lint_add_msg(const char * msg, const int msg_type = LINT_MSG, const char * question = "") +{ + TString m(msg); + bool ok = msg_type == LINT_MSG; + + if (msg_type > LINT_MSG) + m.insert(TR("Errore : ")); + if (msg_type == LINT_FATAL) + fatal_box(m); + if (__lint_batch) + __lint_msg.add(m); + else + { + switch (msg_type) + + { + case LINT_MSG : + message_box(m); + break; + case LINT_ERROR: + error_box(m); + break; + case LINT_CONDITIONAL_ERROR: + m << ' ' << question << " ?"; + yesnocancel_box (m); + break; + default: + break; + } + } + return ok; +} + +void lint_reset_msg() { __lint_msg.cut(0); } +const TToken_string & lint_get_msg() { return __lint_msg; } + +void TLi_manager::set_anno(const int anno) +{ + if (_anno != anno) + { + _anno = anno; + read(); + } +} + +void genera_li_storico(bool update_doc, const int anno, const long from_cli, const long to_cli, const char tipocf) +{ + // Apro la tabella dei plafonds con chiave 2 (CODCLI+ANNO+NUMPROT) e per ogni cliente calcolo i plafond dal 2017 + const TDate dal(1, 1, anno); + TRelation rletint(LF_LETINT); + TRectype * from_let = nullptr; + TRectype * to_let = nullptr; + + if (from_cli > 0L) + { + from_let = new TRectype(rletint.file().curr()); + from_let->put(LETINT_CODCLI, from_cli); + } + if (to_cli > 0L) + { + to_let = new TRectype(rletint.file().curr()); + to_let->put(LETINT_CODCLI, to_cli); + } + TString filter = LETINT_DAL ; filter << ">=" << dal.date2ansi(); + TCursor letint(&rletint, filter , 2, from_let, to_let); + const int items = letint.items(); + TAssoc_array cli; + bool ok = true; + TString msg(TR("Ricostruzione plafond dal ")); + + msg << dal.string(); + + TProgress_monitor status(items, msg); + TString16 curr_codcli; + + lint_reset_msg(); + lint_batch(); + for (letint = 0; ok && letint.pos() < items; ++letint) + { + if (ok = status.add_status()) + { + const TString16 codcli = letint.curr().get(LETINT_CODCLI); + TBit_array * years = nullptr; + + if (codcli != curr_codcli) + { + curr_codcli = codcli; + cli.add(curr_codcli, years = new TBit_array); + + } + if (years != nullptr) + years->set(letint.curr().get_int(LETINT_ANNO) - INIZIO_LETINT); + } + } + + TString_array keys; + + cli.get_keys(keys); + keys.sort(); + + const int cli_items = keys.items(); + + for (int i = 0; i < cli_items; i++) + { + const TString & codcli = keys[i]; + const TBit_array & years = (const TBit_array &)cli[codcli]; + + if (years.some_one()) + { + const int last = years.last_one(); + + for (int y = years.first_one(); y <= last; y++) + { + const int anno = INIZIO_LETINT + y; + TLi_manager li('C', atol(codcli), anno); + + li.rebuild_plafond(update_doc, anno); + } + } + } + const TString messages = lint_get_msg(); + + if (messages.full()) + message_box(messages); + lint_batch(false); +} + +void TLi_manager::read(const TRectype & filter) +{ + TCursor c(new TRelation(LF_LETINT), "", 2, &filter, &filter); + const int items = c.items(); + + _plafonds.destroy(); + for (c = 0L; c.pos() < items; ++c) + _plafonds.add(c.curr()); + _valid_plafond = items > 0; +} + +int TLi_manager::flush() +{ + int err = NOERR; + + if (_dirty) + { + TLocalisamfile letint(LF_LETINT); + const int rows = _plafonds.items(); + + for (int r = 0; err == NOERR && r < rows; r++) + { + TRectype & row = (TRectype &)_plafonds[r]; + + err = row.rewrite(letint); + } + _dirty = err != NOERR; // almeno se c'è un errore non lo segna come scritto + } + return err; +} + +TRectype & TLi_manager::get_lint(const int numprot) +{ + const int rows = _plafonds.items(); + static TRectype nullrec(LF_LETINT); // orrible static record for errors + + for (int r = 0; r < rows; r++) + { + TRectype & rec = (TRectype &) _plafonds[r]; + if (numprot == rec.get_int(LETINT_NUMPROT)) + return rec; + } + nullrec.put(LETINT_CODCLI, _codcli); + nullrec.put(LETINT_ANNO, _anno); + nullrec.put(LETINT_NUMPROT, numprot); + return nullrec; +} + +void TLi_manager::add2lint(TRectype & reclint, const real & utilizzo, const bool add) +{ + TLocalisamfile letint(LF_LETINT); + const real valore = add ? utilizzo : -utilizzo; + + reclint.add(LETINT_UTILIZZATO, valore); + + const bool soluzione_unica = reclint.get_bool(LETINT_TIPOOP) == SOLUZIONE_UNICA; + const real utilizzato = reclint.get_real(LETINT_UTILIZZATO); + const real importo = reclint.get_real(LETINT_IMPORTO); + const bool chiusa = (soluzione_unica && (utilizzato) != ZERO) || (utilizzato >= importo); + + reclint.put(LETINT_CHIUSA, chiusa); + _dirty = true; +} + +bool TLi_manager::utilizza_plafond(const TDocumento & d, TToken_string & plafs, const real importo) +{ + bool ok = true; + + TDate dal(1, 1, _anno); + real imp_plafond = importo; + const TDate datadoc = d.get_date(DOC_DATADOC); + const int day = datadoc - dal; + TToken_string & letints = _days[day]; + const int letitems = letints.items(); + + if (d.is_nota_credito()) + { + if (d.get(DOC_PLAFOND).empty()) + { + TString8 codnumdocrif = d.get(DOC_CODNUMRIF); + int annodocrif = d.get_int(DOC_ANNORIF); + const long numdocrif = d.get_long(DOC_NUMDOCRIF); + + if (codnumdocrif.blank()) + codnumdocrif = d.get(DOC_CODNUM); + if (annodocrif == 0) + annodocrif = d.get_int(DOC_ANNO); + + TDocumento docrif('D', annodocrif, codnumdocrif, numdocrif); + + if (!docrif.empty()) + { + plafs = docrif.get(DOC_PLAFOND); + + const int items = plafs.items(); + + for (int k = 0; k < items; k++) + { + TToken_string plaf = plafs.get(k); + + plaf.add(ZERO, _plimporto); + plafs.add(plaf, k); + } + } + } + } + + const int plafsitems = plafs.items(); + + if (plafsitems < letitems) + { + TToken_string new_plafs("", ','); + + for (int j = 0; j < letitems; j++) + { + TRectype & rec = (TRectype &)_plafonds[letints.get_int(j)]; + bool chiusa = rec.get_bool(LETINT_CHIUSA); + const int numprot = rec.get_int(LETINT_NUMPROT); + const int tipo = rec.get_int(LETINT_TIPOOP); + TToken_string new_plaf; + + new_plaf.add(_anno, _planno); + new_plaf.add(numprot, _plnumprot); + real utilizzo; + for (int k = 0; utilizzo == ZERO && k < plafsitems; k++) + { + TToken_string plaf(plafs.get(k)); + + if (plaf.get_int(_plnumprot) == numprot) + utilizzo = plaf.get_real(_plimporto); + } + new_plaf.add(utilizzo, _plimporto); + new_plafs.add(new_plaf); + } + plafs = new_plafs; + } + + const bool storna = imp_plafond < ZERO; + bool tipo_per_periodo = true; + + for (int k = storna ? letitems - 1 : 0; imp_plafond != ZERO && (storna ? k >= 0: k < letitems); storna ? k-- : k++) + { + TRectype & rec = (TRectype &) _plafonds[letints.get_int(k)]; + bool chiusa = rec.get_bool(LETINT_CHIUSA); + + if (!chiusa || storna) + { + real utilizzo = imp_plafond; + const real let_importo = rec.get_real(LETINT_IMPORTO); + const real totale_utilizzato = rec.get_real(LETINT_UTILIZZATO); + TToken_string plaf = plafs.get(k); + const real disponibile = let_importo - totale_utilizzato; + const real totale = totale_utilizzato + utilizzo; + const real utilizzo_plaf = plaf.get_real(_plimporto); + + tipo_per_periodo &= rec.get_int(LETINT_TIPOOP) == A_TEMPO; + if (d.is_nota_credito()) + { + if (utilizzo > ZERO) + { + if (utilizzo + utilizzo_plaf > ZERO) + utilizzo = -utilizzo_plaf; + } + if (totale < ZERO) + utilizzo -= totale; + } + else + { + if (totale > let_importo) + utilizzo = disponibile; + if (totale < ZERO) + utilizzo += totale; + } + imp_plafond -= utilizzo; + plaf.add(utilizzo + utilizzo_plaf, _plimporto); + plafs.add(plaf, k); + add2lint(rec, utilizzo); + } + } + if (!tipo_per_periodo && imp_plafond > ZERO) + { + TString msg(TR("Attenzione il plafond del cliente ")); + + msg << _codcli << ' ' << TR("il plafond per l'anno ") << _anno << ' ' << + TR("è stato superato di € ") << imp_plafond; + lint_add_msg(msg, LINT_ERROR); + ok = false; + } + return ok; +} + +int TLi_manager::get_plafond_row(const TDocumento & d, TString & protinf, TString & protins, TDate & dataprot, real & utilizzo, TString & field, TString & descr, bool & to_print, bool & add_date, int num) const +{ + TToken_string plafs(d.get(DOC_PLAFOND), ','); + const int plafsitems = plafs.items(); + + protinf.cut(0); + protins.cut(0); + dataprot = botime; + field.cut(0); + descr.cut(0); + to_print = false; + add_date = true; + if (num >= 0 && num < plafsitems) + { + TToken_string plaf = plafs.get(num); + TToken_string key = plaf.get(_planno); + + utilizzo = plaf.get_real(_plimporto); + key.add(plaf.get(_plnumprot)); + + const TRectype & reclint = cache().get(LF_LETINT, key); + + if (reclint.full()) + { + const TString & type = reclint.get(LETINT_CODTPE); + const TRectype & rectype = cache().get("%TPE", type); + + protinf = reclint.get(LETINT_PROTINTF); + protins = reclint.get(LETINT_PROTINTS); + dataprot = reclint.get_date(LETINT_VSDATA); + if (type.full() && rectype.full()) + { + field = rectype.get("S4"); + descr = rectype.get("S1"); + to_print = !rectype.get_bool("B0"); + add_date = !rectype.get_bool("B1"); + } + else + { + field = "Dich.Inten"; + descr = "N.di protocollo di invio"; + to_print = true; + add_date = true; + } + } + return ++num; + } + else + return -1; +} + +void TLi_manager::clear_letint() +{ + const int rows = _plafonds.items(); + + for (int r = 0; r < rows; r++) + { + TRectype & row = (TRectype &) _plafonds[r]; + + row.zero(LETINT_UTILIZZATO); + row.zero(LETINT_CHIUSA); + } + _dirty = true; + flush(); +} + +void TLi_manager::rebuild_plafond(bool update_docs, const int anno) +{ + TLista_documenti din; + TDate dal; dal.set_start_year(anno); + TDate al; al.set_end_year(anno); + + set_anno(anno); + clear_letint(); + din.read('D', 'C', _codcli, anno, tipi(), stati(), dal, al); + + const int items = din.items(); + + if (_valid_plafond) + { + TProgress_monitor status(items, "Aggiornamento plafond : Ricostuzione"); + + for (int i = 0; status.add_status() && i < items; i++) + { + TToken_string plafs("", ','); + + if (update_docs) + { + din[i].zero(DOC_PLAFOND); + din[i].rewrite(); + } + else + utilizza_plafond(din[i], plafs, din[i].importo_plafond()); + } + if (!update_docs) + flush(); + } + else + { + bool has_plafond = false; + + for (int i = 0; !has_plafond && i < items; i++) + has_plafond = din[i].importo_plafond() != ZERO; + + if (has_plafond) + { + TString msg(TR("Attenzione il cliente ")); + + msg << _codcli << TR(" per l'anno") << dal.year() << TR("ha documenti con esenzione plafond ma non ha plafond registrati"); + lint_add_msg(msg); + } + } +} + +void TLi_manager::read(const char t, const long c, int anno) +{ + TRectype reclint(LF_LETINT); + + flush(); + _plafond = ZERO; + _dirty = false; + _days.destroy(); + if (anno != 0) + _anno = anno; + TDate inizio_anno; inizio_anno.set_start_year(_anno); + TDate fine_anno; fine_anno.set_end_year(_anno); + const int last_day = fine_anno - inizio_anno; + + for (int d = 0; d <= last_day; d++) + _days.add(new TToken_string); + if (t != ' ') + _tipocf = t; + if (c != 0) + _codcli = c; + if (_anno == 0) + _anno = TDate(TODAY).year(); + reclint.put(LETINT_CODCLI, _codcli); + reclint.put(LETINT_ANNO, _anno); + read(reclint); + + const int rows = _plafonds.items(); + + for (int r = 0; r < rows; r++) + { + const TRectype & row = (const TRectype &)_plafonds[r]; + const real importo = row.get_real(LETINT_IMPORTO); + const real utilizzato = row.get_real(LETINT_UTILIZZATO); + + _plafond += importo; + _utilizzato += utilizzato; + + TDate inizio = row.get_date(LETINT_DAL); + TDate fine = row.get_date(LETINT_AL); + + if (!inizio.ok()) + inizio = inizio_anno; + if (!fine.ok()) + fine = fine_anno; + + const int from_day = inizio < inizio_anno ? 0 : inizio - inizio_anno; + const int to_day = fine - inizio_anno; + + for (int d = from_day; d <= to_day; d++) + { + TToken_string & list = _days[d]; + + list.add(r); + } + } +} + +bool TLi_manager::doc_ok(const TDocumento & doc) const +{ + const TString8 tipodoc = doc.tipo().codice(); + const TString4 stato = doc.get(DOC_STATO); + TToken_string & t = tipi(); + + if (__enable_fatture) + { + if (doc.tipo().is_fattura()) + return doc.tipo().stato_bloccato() <= ' ' || stato[0] < doc.tipo().stato_bloccato(); + else + return (t.find(tipodoc) >= 0) && (doc.tipo().stato_bloccato() <= ' ' || stato[0] < doc.tipo().stato_bloccato()); + } + else + return (t.find(tipodoc) >= 0) && (stati().find(stato) >= 0); +} + +bool TLi_manager::plafond_write(TDocumento& d) +{ + bool ok = true; + real importo_plafond = d.importo_plafond(); + + if (doc_ok(d) && has_valid_plafond()) // Se il cliente non mi interessa + { + if (importo_plafond != ZERO) + { + TToken_string plafs("", ','); + + // Il controllo è andato bene, adesso mi segno i plafond che ho utilizzato nel memo del documento + ok = utilizza_plafond(d, plafs, importo_plafond); + const int items = plafs.items(); + + for (int i = items -1; i >= 0; i--) + { + TToken_string plaf(plafs.get(i)); + + if (plaf.get_real(_plimporto) == ZERO) + plafs.destroy(i); + } + d.put(DOC_PLAFOND, plafs); + flush(); + } + } + return ok; +} + +bool TLi_manager::plafond_rewrite(TDocumento& d) +{ + bool ok = true; + TToken_string plafs(d.get(DOC_PLAFOND), ','); + const TString8 tipodoc = d.tipo().codice(); + const TString4 stato = d.get(DOC_STATO); + + if (doc_ok(d) && has_valid_plafond()) + { + const real diff = d.importo_plafond(true); + + // Calcolo le differenze tra il plafond attuale da verificare e quello precedente + if (diff != ZERO) + { + ok = utilizza_plafond(d, plafs, diff); + + const int items = plafs.items(); + + for (int i = items - 1; i >= 0; i--) + { + TToken_string plaf(plafs.get(i)); + + if (plaf.get_real(_plimporto) == ZERO) + plafs.destroy(i); + } + d.put(DOC_PLAFOND, plafs); + flush(); + } + } + return ok; +} + +bool TLi_manager::write_rewrite(TDocumento& d, bool rewrite) +{ + bool ok = true; + + // Aggiunte per il controllo plafond + if (main_app().has_module(LIAUT, CHK_DONGLE) && _valid_plafond) + { + if (rewrite) + ok = plafond_rewrite(d); + else + ok = plafond_write(d); + } + else + d.zero(DOC_PLAFOND); + return ok; +} + +bool TLi_manager::remove(TDocumento& d) +{ + bool ok = true; + TToken_string plafs(d.get(DOC_PLAFOND), ','); + + if (main_app().has_module(LIAUT, CHK_DONGLE) && has_valid_plafond() && plafs.full()) + { + ok = utilizza_plafond(d, plafs, -d.importo_plafond()); + flush(); + } + return ok; +} + +TLi_manager::TLi_manager(const char t, const long c, const int anno) + : _tipocf(t), _codcli(c), _anno(anno), _plafond(), + _utilizzato(), _valid_plafond(false), + _dirty(false), _plafonds() +{ + if (_anno == 0) + _anno = today.year(); + read(); +} + +TLi_manager::~TLi_manager() +{ + flush(); +} \ No newline at end of file diff --git a/src/li01/lilib01.h b/src/li01/lilib01.h new file mode 100644 index 000000000..c72673dd4 --- /dev/null +++ b/src/li01/lilib01.h @@ -0,0 +1,119 @@ +#ifndef __LILIB01_H +#define __LILIB01_H + +#ifndef __DATE_H +#include +#endif + +#ifndef __RELATION_H +#include +#endif + +#ifndef __RECARRAY_H +#include +#endif + +class TDocumento; + +#ifndef __REPUTILS_H +#include +#endif + +#define SOLUZIONE_UNICA 1 +#define FINO_A_PLAFOND 2 +#define A_TEMPO 3 + +enum plafStruct { _planno, _plnumprot, _plimporto}; + +// Ritorna il codice iva del plafond +const TString & iva_plafond(); +// Controllo se il codice iva è uguale a quello impostato per il calcolo del plafond +bool check_iva_plafond(const TString& cod); +// controlla la visualizzazione immediata dei messaggi +void lint_batch(const bool on = true); +// azzera i messaggi +void lint_reset_msg(); +// restituisce i messaggi +const TToken_string & lint_get_msg(); +// Ricostruisce il plafond dall'anno +void genera_li_storico(bool update_doc, const int anno, const long from_cli = 0L, const long to_cli = 0L, const char tipocf = 'C'); +// Ritorna la lista dei tipi +TToken_string & tipi(); +// Ritorna la lista degli stati +TToken_string & stati(); + +class TLi_manager : public TObject +{ + bool _valid_plafond; + char _tipocf; + long _codcli; + int _anno; + bool _dirty; + + real _plafond; + real _utilizzato; + TString_array _days; + TArray _plafonds; + +protected: + + void clear_letint(); + void read(const TRectype & filter); + int flush(); + + +public: + // Getters + char tipo() const { return _tipocf; } + long codice() const { return _codcli; } + int anno() const { return _anno; } + bool doc_ok(const TDocumento & doc) const; + + // Ritorno il plafond + const real get_plafond() { return _plafond; } + // Ritorno l'utilizzo + const real get_utilizzo() { return _utilizzato; } + // Ritorno il plafond + const real get_residuo() { return _plafond - _utilizzato; } + // Ritorno se il plafond è valido + bool has_valid_plafond() const { return _valid_plafond; } +// ritorna lettera d'intento modificata + const bool dirty() const { return _dirty; } + // imposta lettera d'intento modificata + void set_dirty(bool on = true) { _dirty = on; } + // imposta l'anno + void set_anno(const int anno); + // Ritorna la lettera d'intento + TRectype & get_lint(const int numprot); + // Ritorna la lettera d'intento + const TArray & get_plafond_array() const { return _plafonds; } + // Utilizza il plafond + bool utilizza_plafond(const TDocumento & d, TToken_string & plafs, const real importo); + // Ritorna il tipo di plafond dell'iesimo plafond del documento + int get_plafond_row(const TDocumento & d, TString & protinf, TString & protins, TDate & dataprot, real & utilizzo, TString & field, TString & descr, bool & toprint, bool & add_date, int num = 0) const; + + // Functions +// Aggiunge a una lettera d'intento + void sub2lint(TRectype & reclint, const real & utilizzo) { add2lint(reclint, utilizzo, false); } + // Aggiungono a una lettera d'intento + void add2lint(TRectype & reclint, const real & utilizzo, const bool add = true); + + // Funzione che aggiorna il residuo plafond dichiarazione dalla data alla data + void TLi_manager::rebuild_plafond(bool update_docs = true, const int anno = 0); + // Funzione che effettivamente effettua il calcolo dalla data della dichiarazione alla data passata + const real elab_util(TDate ad = 0L); + bool plafond_write(TDocumento& d); + bool plafond_rewrite(TDocumento& d); + bool rewrite(TDocumento& d) { return write_rewrite(d, true); } + bool write(TDocumento& d) { return write_rewrite(d, false); } + bool write_rewrite(TDocumento& d, bool rewrite = false); + bool remove(TDocumento& d); + + void read(const char t = ' ', const long c = 0L, int anno = 0); + +// Costructors/Destructors + TLi_manager(const long c, const int anno = 0) : TLi_manager('C', c, anno) {} + TLi_manager(const char t = 'C' , const long c = 0L, const int anno = 0); + virtual ~TLi_manager(); +}; +#endif \ No newline at end of file diff --git a/src/ve01/ve0100.cpp b/src/ve01/ve0100.cpp index 0c7eff7b4..287781b35 100644 --- a/src/ve01/ve0100.cpp +++ b/src/ve01/ve0100.cpp @@ -26,12 +26,6 @@ #include "../cg/cfban.h" -void TMotore_application::build_file_list(TBit_array & files) -{ - TRelation_application::build_file_list(files); - files.set(LF_RIGHEDOC); -} - TCursor* TMotore_application::get_filtered_cursor() const { const TEdit_field& f = _msk->efield(F_NDOC); diff --git a/src/ve01/ve0100.h b/src/ve01/ve0100.h index d57c5da08..16c03329c 100644 --- a/src/ve01/ve0100.h +++ b/src/ve01/ve0100.h @@ -37,8 +37,6 @@ class TMotore_application : public TRelation_application int _ncopie; protected: - - virtual void build_file_list(TBit_array & files); // Array di maschere documento TAssoc_array _doc_masks; // Ridefinizione dei metodi virtuali diff --git a/src/ve01/ve0600.cpp b/src/ve01/ve0600.cpp index 4b1d3762f..08217791f 100644 --- a/src/ve01/ve0600.cpp +++ b/src/ve01/ve0600.cpp @@ -7,7 +7,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" /////////////////////////////////////////////////////////// // Applicazione per gestione maschere di modulo diff --git a/src/ve01/ve1500.cpp b/src/ve01/ve1500.cpp index a79bd2d8a..492fe07e5 100644 --- a/src/ve01/ve1500.cpp +++ b/src/ve01/ve1500.cpp @@ -7,7 +7,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "velib.h" #include "ve1.h" diff --git a/src/ve01/ve2400.cpp b/src/ve01/ve2400.cpp index 4ebce528d..3140b660c 100644 --- a/src/ve01/ve2400.cpp +++ b/src/ve01/ve2400.cpp @@ -1978,13 +1978,6 @@ void TMask_anamag::ricalcola_giacenze() // METODI DELL'APPLICAZIONE //------------------------------------------------------------------------------------------------- -void TAnagrafica_magazzino::build_file_list(TBit_array & files) -{ - TRelation_application::build_file_list(files); - files.set(LF_UMART); - files.set(LF_CODCORR); - files.set(LF_DESLIN); -} void TAnagrafica_magazzino::on_firm_change() { if (_msk) diff --git a/src/ve01/ve3800.cpp b/src/ve01/ve3800.cpp index 44a0a387e..3aa74f986 100644 --- a/src/ve01/ve3800.cpp +++ b/src/ve01/ve3800.cpp @@ -9,7 +9,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "velib07.h" /////////////////////////////////////////////////////////// diff --git a/src/ve01/ve6500.cpp b/src/ve01/ve6500.cpp index c4c7014e3..faf2f55d4 100644 --- a/src/ve01/ve6500.cpp +++ b/src/ve01/ve6500.cpp @@ -6,7 +6,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "../mg/mglib.h" #include "ve6.h" diff --git a/src/ve01/ve6600.cpp b/src/ve01/ve6600.cpp index 55d90d68a..7c73f0ac3 100644 --- a/src/ve01/ve6600.cpp +++ b/src/ve01/ve6600.cpp @@ -3,7 +3,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "../mg/anamag.h" #include diff --git a/src/ve01/velib.h b/src/ve01/velib.h index 2b411693c..842f9a468 100644 --- a/src/ve01/velib.h +++ b/src/ve01/velib.h @@ -58,7 +58,7 @@ class TSelect_color_mask; #endif #ifndef __LILIB01_H -#include "../li/lilib01.h" +#include "../li01/lilib01.h" #endif #define RIGA_MERCE 'M' @@ -169,8 +169,8 @@ public: const TString& codice_tipo_ritenuta() const { return get("S13").left(4); } const TString& tipo_riga() const { return get("S8"); } char genere() const; - const TString& conto_analitico_vendite() const { return ((cod() == "ATR") || (cod() == "RSS")) ? EMPTY_STRING : get("S1").sleft(20); } - const TString& conto_analitico_acquisti() const { return ((cod() == "ATR") || (cod() == "RSS")) ? get("S1").sleft(20) : get("S2"); } + const TString& conto_analitico_vendite() const { return ((cod() == "ATR") || (cod() == "RSS")) ? EMPTY_STRING : get_tmp_string() = get("S1").sleft(20); } + const TString& conto_analitico_acquisti() const { return get_tmp_string() = ((cod() == "ATR") || (cod() == "RSS")) ? get("S1").sleft(20) : get("S2"); } bool has_conto_vendite() const { return get_int("I2"); } bool has_conto_acquisti() const { return get_int("I5"); } const TString& cdc() const { return get("S1").mid(20, 20); } @@ -743,7 +743,7 @@ public: bool raggruppabile(const TRiga_documento& r, TToken_string& campi) const; TRiga_documento& operator +=(const TRiga_documento& r); - virtual void reset_fields(TAuto_variable_rectype& rec, bool all = true) { rec.remove_field(nullptr, all); } + virtual void reset_fields(TAuto_variable_rectype& rec, bool all = true) { rec.remove_field(); } void set_fields(TAuto_variable_rectype& rec); real prezzo(bool scontato, bool lordo, int ndec = AUTO_DECIMALS) const ; @@ -1130,7 +1130,7 @@ public: TPagamento& pagamento(); - void update_spese_aut(TSheet_field * sh = nullptr, bool force = false); + void update_spese_aut(TString_array & spese, bool preserve_old = false, TSheet_field * sh = NULL, bool force = false); void update_conai_qta(); void update_conai(); @@ -1362,8 +1362,6 @@ public: static bool sort_row_handler( TMask_field& f, KEY key ); static bool genera_xml_handler(TMask_field& f, KEY key); static bool importa_xml_handler(TMask_field& f, KEY key); - static bool incolla_handler(TMask_field& f, KEY k); - static bool copia_handler(TMask_field& f, KEY k); static bool savedef_handler(TMask_field& f, KEY k); static bool swap_handler(TMask_field& f, KEY k); static bool ss_notify(TSheet_field& ss, int r, KEY key); diff --git a/src/ve01/velib03.cpp b/src/ve01/velib03.cpp index d3294fd15..2e9123251 100644 --- a/src/ve01/velib03.cpp +++ b/src/ve01/velib03.cpp @@ -5,13 +5,15 @@ #include #include +#include "velib.h" #include "../ca/calib01.h" -#include "../cg/cfban.h" +#include "../cg01/cglib.h" +#include "../cg01/cfban.h" #include #include "../db/dblib.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" #include "../pr/prlib.h" -#include "../li/letint.h" +#include "../li01/letint.h" #include "../sv/svlib01.h" #include @@ -1740,7 +1742,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const rdoc->put(f, rdoc->retrieve_original_row_field(rif_fld)); } if (rdoc->is_descrizione()) - myself.reset_fields(*rdoc, false); + myself.reset_fields(*rdoc); } err = TMultiple_rectype::write_rewrite(f, re); @@ -3011,7 +3013,7 @@ void TDocumento::put_str(const char* fieldname, const char* val) if (TRectype::get(DOC_TIPODOC) != v) { TAuto_variable_rectype::put_str(fieldname, v); - reset_fields(*this, false); + reset_fields(*this); set_fields(*this); } else @@ -3333,13 +3335,13 @@ void TDocumento::update_raee() void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field* sh, bool force) { - const bool updated = get_bool(DOC_SPESEUPD); + const bool updated = get_bool(DOC_SPESEUPD); - if (!force && updated) - return; + if (!force && updated) + return; + + const bool interactive = sh != NULL; - const bool interactive = sh != nullptr; - if (force || tipo().spese_aut()) { const int nrows = physical_rows(); @@ -3352,6 +3354,8 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, if (r.tipo().tipo() == RIGA_SPESEDOC && r.is_generata() && tipo_spese) { + if (preserve_old) + return; destroy_row(i, true); if (interactive) sh->destroy(i - 1); @@ -3359,111 +3363,109 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, } TString4 cod_iva_cli; - const int nspese = spese_aut.items(); + const int nspese = spese_aut.items(); - if (nspese > 0) + if (nspese > 0) { - TSpesa_prest sp; + TSpesa_prest sp; cod_iva_cli = codesiva(); - for (i = 0; i < nspese; i++) - { - const TString& s = spese_aut.row(i); - - if (sp.read(s) != NOERR) - warning_box("Codice spesa '%s' assente", (const char*)s); - else + for (i = 0; i < nspese; i++) { - const TString4 tipo(sp.tipo_riga()); - TRiga_documento& riga = new_row(tipo); - - riga.put(RDOC_CODART, s); - riga.generata(); - riga.put(RDOC_DESCR, sp.descrizione()); - if (cod_iva_cli.blank()) - riga.put(RDOC_CODIVA, sp.cod_iva()); + const TString& s = spese_aut.row(i); + + if (sp.read(s) != NOERR) + warning_box("Codice spesa '%s' assente", (const char*)s); else - riga.put(RDOC_CODIVA, cod_iva_cli); - - switch (sp.tipo()) { - case 'Q': - { - real qta; + const TString4 tipo(sp.tipo_riga()); + TRiga_documento& riga = new_row(tipo); - if (qtadef == ZERO) + riga.put(RDOC_CODART, s); + riga.generata(); + riga.put(RDOC_DESCR, sp.descrizione()); + if (cod_iva_cli.blank()) + riga.put(RDOC_CODIVA, sp.cod_iva()); + else + riga.put(RDOC_CODIVA, cod_iva_cli); + switch (sp.tipo()) { - qta = sp.qta(); + case 'Q': + { + real qta = sp.qta(); if (qta == ZERO) qta = UNO; + riga.put("QTA", qta); } - else - qta = qtadef; - riga.put(RDOC_QTA, qta); - } - // Continua perche' e' quantita' e valore - case 'V': - { - const real cambio = get_real(DOC_CAMBIO); - const TString4 valuta = get(DOC_CODVAL); - real prezzo = sp.prezzo(); - - sppr_calc(sp, valuta, cambio, prezzo); - if (this->calcolo_lordo()) + // Continua perche' e' quantita' e valore + case 'V': { - prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS); - riga.put(RDOC_PREZZOL, prezzo); - } - riga.put(RDOC_PREZZO, prezzo); - riga.put(RDOC_UMQTA, sp.um()); - } - break; - case 'P': - default: - riga.put(RDOC_QTA, sp.perc()); - break; - } - riga.put(RDOC_CODCOSTO, sp.cdc()); - riga.put(RDOC_CODCMS, sp.cms()); - riga.put(RDOC_FASCMS, sp.fase()); - riga.cms2tipodet(); + const real cambio = get_real(DOC_CAMBIO); + const TString4 valuta = get(DOC_CODVAL); + real prezzo = sp.prezzo(); - if (interactive) - { - const int nrow = sh->insert(-1, FALSE); - riga.autoload(*sh); - sh->check_row(nrow, 0x2); + sppr_calc(sp, valuta, cambio, prezzo); + if (this->tipo().calcolo_lordo()) + { + prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS); + riga.put(RDOC_PREZZOL, prezzo); + } + riga.put(RDOC_PREZZO, prezzo); + riga.put(RDOC_UMQTA, sp.um()); + } + break; + case 'P': + default: + riga.put(RDOC_QTA, sp.perc()); + break; + } + if (cod_iva_cli.empty()) + riga.put(RDOC_CODIVA, sp.cod_iva()); + else + riga.put(RDOC_CODIVA, cod_iva_cli); + + riga.put(RDOC_CODCOSTO, sp.cdc()); + riga.put(RDOC_CODCMS, sp.cms()); + riga.put(RDOC_FASCMS, sp.fase()); + riga.cms2tipodet(); + + if (interactive) + { + const int nrow = sh->insert(-1, FALSE); + riga.autoload(*sh); + sh->check_row(nrow); + } } } } } - put(DOC_SPESEUPD, true); + put(DOC_SPESEUPD, true); } void TDocumento::update_conai_qta() { _conaiqta.destroy(); FOR_EACH_SELF_PHYSICAL_RDOC(i, r) - if (r->is_merce() || r->is_omaggio()) - { - TString current_cat; + if (r->is_merce() || r->is_omaggio()) + { + TString current_cat; - for (int i = 1; i <= FR_CMAX; i++) - { - TString8 cat = r->get(conai_sottocat_name(i)); + for (int i = 1; i <= FR_CMAX; i++) + { + TString8 cat = r->get(conai_sottocat_name(i)); - if (cat.full()) - { - const real rowqty = r->calc_conai_qta(i); + if (cat.full()) + { + const real rowqty = r->calc_conai_qta(i); - real * q = (real *) _conaiqta.objptr(cat); - - if (q == NULL) - _conaiqta.add(cat, q = new real); - *q += rowqty; - } - } - } + real * q = (real *)_conaiqta.objptr(cat); + + if (q == NULL) + _conaiqta.add(cat, q = new real); + *q += rowqty; + } + } + } } const char* get_cf_esenz(const TString& tipo_conai) @@ -4365,616 +4367,3 @@ HIDDEN const char * __rdoc_fields[] = { RDOC_STATORIGA, RDOC_TIPORIGA, RDOC_GENE RDOC_AIDRIGA, RDOC_CODCMS, RDOC_FASCMS, RDOC_CODCOSTO, RDOC_CODAGG1, RDOC_CODAGG2, RDOC_PRIORITY, RDOC_TIPODET, RDOC_TIPOCOLL, RDOC_IDRIGACOLL, RDOC_REVCHARGE, nullptr }; -HIDDEN const char * __rdoctempl_fields[] = { RDOCTEMPL_STATORIGA, RDOCTEMPL_TIPORIGA, RDOCTEMPL_GENERATA, RDOCTEMPL_GENTIPO, - RDOCTEMPL_CODMAG, RDOCTEMPL_CODART, RDOCTEMPL_CODARTMAG, RDOCTEMPL_CHECKED, RDOCTEMPL_LIVELLO, - RDOCTEMPL_DESCR, RDOCTEMPL_DESCLUNGA, RDOCTEMPL_DESCEST, RDOCTEMPL_PREZZO, RDOCTEMPL_PREZZOL, - RDOCTEMPL_RIDPREZZO, RDOCTEMPL_UMQTA, RDOCTEMPL_QTA, RDOCTEMPL_QTAGG1, RDOCTEMPL_QTAGG2, - RDOCTEMPL_QTAGG3, RDOCTEMPL_QTAGG4, RDOCTEMPL_QTAGG5, RDOCTEMPL_QTAEVASA, RDOCTEMPL_RIGAEVASA, - RDOCTEMPL_TARA, RDOCTEMPL_PNETTO, RDOCTEMPL_NCOLLI, RDOCTEMPL_SCONTO, - RDOCTEMPL_PERCPROV, RDOCTEMPL_PERCPROV1, RDOCTEMPL_IMPFISSO, RDOCTEMPL_IMPFISUN, RDOCTEMPL_CODIVA, - RDOCTEMPL_ADDIVA, RDOCTEMPL_ASPBENI, RDOCTEMPL_RG1, RDOCTEMPL_CAUSMAG, RDOCTEMPL_MOVMAG, RDOCTEMPL_CODMAGC, - RDOCTEMPL_DATACONS, RDOCTEMPL_IMPIANTO, RDOCTEMPL_LINEA, RDOCTEMPL_IDRIGA, RDOCTEMPL_DACODNUM, RDOCTEMPL_DAANNO, - RDOCTEMPL_DAPROVV, RDOCTEMPL_DANDOC, RDOCTEMPL_DAIDRIGA, RDOCTEMPL_ACODNUM, RDOCTEMPL_AANNO, RDOCTEMPL_APROVV, RDOCTEMPL_ANDOC, - RDOCTEMPL_AIDRIGA, RDOCTEMPL_CODCMS, RDOCTEMPL_FASCMS, RDOCTEMPL_CODCOSTO, RDOCTEMPL_CODAGG1, RDOCTEMPL_CODAGG2, - RDOCTEMPL_PRIORITY, RDOCTEMPL_TIPODET, RDOCTEMPL_TIPOCOLL, RDOCTEMPL_IDRIGACOLL, RDOCTEMPL_REVCHARGE, - nullptr }; - -int TDocumento_template::read(char t, long c , const char * td) -{ - int err = NOERR; - - tipocf(t); - codcf(c); - tipodoc(td); - if (t <= ' ') - destroy_rows(); - else - { - TAuto_variable_rectype * key = new TAuto_variable_rectype(LF_RDOCTEMPLATE); - - key->put(RDOCTEMPL_TIPOCF, tipocf()); - key->put(RDOCTEMPL_CODCF, codcf()); - key->put(RDOCTEMPL_TIPODOC, tipodoc()); - err = TRecord_array::read(key); - if (err == NOERR) - pack(); - } - return err; -} - -void TDocumento_template::templ2doc(TDocumento & doc) const -{ - const int nrows = rows(); - - doc.destroy_rows(); - for (int i = 1; i <= nrows; i++) - { - TRiga_documento & rd = doc.new_row(); - const TRectype & rt = row(i); - - for (int f = 0; __rdoc_fields[f] != nullptr; f++) - { - CHECK(strcmp(__rdoc_fields[f], __rdoctempl_fields[f]) == 0, format(FR("Errore %s diverso da %s"), __rdoc_fields[f], __rdoctempl_fields[f])); - rd.put(__rdoc_fields[f], row(i).get(__rdoctempl_fields[f])); - } - } -} - -void TDocumento_template::doc2templ(const TDocumento & doc) -{ - destroy_rows(); - FOR_EACH_RDOC(doc, r, riga) - { - TRiga_documento & rd = (TRiga_documento &)*riga; - TRectype rt(key()); - - rt.put(RDOCTEMPL_NRIGA, r); - for (int f = 0; __rdoc_fields[f] != nullptr; f++) - { - CHECK(strcmp(__rdoc_fields[f], __rdoctempl_fields[f]) == 0, format(FR("Errore %s diverso da %s"), __rdoc_fields[f], __rdoctempl_fields[f])); - rt.put(__rdoctempl_fields[f], rd.get(__rdoc_fields[f])); - } - add_row(rt); - } -} - -TDocumento_template::TDocumento_template(char tipocf, long codcf, const char * tipodoc) : TRecord_array(LF_RDOCTEMPLATE, RDOCTEMPL_NRIGA) -{ - read(tipocf, codcf, tipodoc); -} - -bool TDocumento_EDI::send_header() -{ - const tip_doc t = (tip_doc)tipo().tipo(); - TAnagrafica ditta(LF_NDITTE, prefix().get_codditta()); - - _set.new_rec(BGM); - _set.set(BGM, BGM_ID_EDI_MITT1, ditta.partita_IVA()); - _set.set(BGM, BGM_ID_EDI_MITT2, "ZZ"); - - TString4 tpdestedi = clifor().vendite().get(CFV_TPDESTEDI); - - _set.set(BGM, BGM_ID_EDI_DEST1, tpdestedi.full() ? clifor().vendite().get(CFV_DESTEDI) : clifor().get(CLI_PAIV)); - if (tpdestedi.blank()) - tpdestedi = "ZZ"; - _set.set(BGM, BGM_ID_EDI_DEST2, tpdestedi); - - const TString & tiposdi = tipo_doc_sdi(); - - if (tiposdi == "TD20" || tiposdi == "TD21" || tiposdi == "TD22" || - tiposdi == "TD28" || tiposdi == "TD29") - _set.set(BGM, BGM_TIPODOC, "AUTINV"); - else - if (tiposdi == "TD01" || tiposdi == "TD23" || - tiposdi == "TD24" || tiposdi == "TD25" || - tiposdi == "TD26" || tiposdi == "TD27") - _set.set(BGM, BGM_TIPODOC, "INVOIC"); - else - if (tiposdi == "TD02") - _set.set(BGM, BGM_TIPODOC, "INVPRE"); - else - if (tiposdi == "TD04") - _set.set(BGM, BGM_TIPODOC, "NOTACC"); - else - if (tiposdi == "TD05") - _set.set(BGM, BGM_TIPODOC, "NOTADD"); - else - if (tiposdi == "TD06") - _set.set(BGM, BGM_TIPODOC, "NCS"); - _set.set(BGM, BGM_NUMDOC, get(DOC_NDOC)); - _set.set(BGM, BGM_DATADOC, get_date(DOC_DATADOC)); - - const TString & codcont = get(DOC_CODCONT); - - if (codcont.full()) - { - TToken_string key("C"); - - key.add(""); - key.add(get(DOC_TIPOCF)); - key.add(get(DOC_CODCF)); - key.add(codcont); - const TRectype & contrec = cache().get(LF_CONDV, key); - - _set.new_rec(RFC); - _set.set(RFC, RFC_NUMCO, codcont); - - _set.set(RFC, RFC_DATAINCO, contrec.get_date(CONDV_VALIN)); - _set.set(RFC, RFC_DATAFICO, contrec.get_date(CONDV_VALFIN)); - } - _set.new_rec(NAS); - _set.set(NAS, NAS_CODFORN, ditta.partita_IVA()); - _set.set(NAS, NAS_QCODFORN, "VA"); - _set.set(NAS, NAS_RAGSOCF, ditta.ragione_sociale()); - _set.set(NAS, NAS_INDIRF, ditta.indirizzo_residenza()); - _set.set(NAS, NAS_CITTAF, ditta.comune_residenza()); - _set.set(NAS, NAS_PROVF, ditta.provincia_residenza()); - _set.set(NAS, NAS_CAPF, ditta.CAP_residenza()); - - const TString & stato_estero = ditta.stato_estero_ISO(); - - if (stato_estero.full()) - { - _set.set(NAS, NAS_NAZIOF, stato_estero); - _set.set(NAS, NAS_PIVAINT, ditta.codice_fiscale()); - } - _set.set(NAS, NAS_PIVANAZF, ditta.partita_IVA()); - _set.set(NAS, NAS_TRIBUNALE, ditta.tribunale()); - _set.set(NAS, NAS_CCIAA, ditta.cciaa()); - _set.set(NAS, NAS_CAPSOC, ditta.capitale().string(0, 2)); - _set.set(NAS, NAS_CODFISC, ditta.codice_fiscale()); - - _set.new_rec(NAI); - _set.set(NAI, NAI_CODFATT, clifor().anagr().partita_IVA()); - _set.set(NAI, NAI_QCODFATT, "VA"); - _set.set(NAI, NAI_RAGSOCI, clifor().get(CLI_RAGSOC)); - _set.set(NAI, NAI_INDIRI, clifor().anagr().indirizzo_residenza()); - _set.set(NAI, NAI_CITTAI, clifor().anagr().comune_residenza()); - _set.set(NAI, NAI_PROVI, clifor().anagr().provincia_residenza()); - _set.set(NAI, NAI_CAPI, clifor().anagr().CAP_residenza()); - _set.set(NAI, NAI_NAZIOI, clifor().anagr().stato_estero_ISO()); - _set.set(NAI, NAI_PIVANAZI, clifor().anagr().partita_IVA()); - _set.set(NAI, NAI_CODFISCA, clifor().anagr().codice_fiscale()); - - const TString & nota = get(DOC_NOTE).sleft(350); - - if (in_valuta() || nota.full()) - { - _set.new_rec(FTX); - if (in_valuta()) - _set.set(FTX, FTX_DIVISA, get(DOC_CODVAL)); - _set.set(FTX, FTX_NOTE, nota); - } - TPagamento & pag = pagamento(); - const int rate = pag.n_rate(); - const TString tipo = rate == 1 ? "10E" : "21"; - TString rifpag = pag.inizio_scadenza() == 'F' ? "1" : "66"; - TString relterm = pag.a_fine_mese() ? "6" : "1"; - TString untemp = pag.mese_commerciale() ? "M" : "D"; - TString codban = get(DOC_CODABIA); - - codban << get(DOC_CODCABA); - for (int r = 0; r < rate; r++) - { - _set.new_rec(PAT); - _set.set(PAT, PAT_TIPOCOND, tipo); - _set.set(PAT, PAT_DATASCAD, pag.data_rata(r)); - _set.set(PAT, PAT_RIFTERMP, rifpag); - _set.set(PAT, PAT_RELTERMP, relterm); - _set.set(PAT, PAT_UNTEMP, untemp); - _set.set(PAT, PAT_NUNTEMP, (long) r); - _set.set(PAT, PAT_IMPORTO, pag.importo_rata(r, in_valuta())); - _set.set(PAT, PAT_DIVISA, get(DOC_CODVAL)); - _set.set(PAT, PAT_PERC, pag.perc_rata(r)); - _set.set(PAT, PAT_DESCRIZ, cache().get("%PAG", get(DOC_CODPAG), "S0")); - _set.set(PAT, PAT_BANCACOD, get(DOC_IBAN)); - _set.set(PAT, PAT_BANCADESC, cache().get("%BAN", codban, "S0")); - - const TTipo_pag t = pag.tipo_rata(r); - - TString mezzo = "10"; - - if (t == _bonfico) - mezzo = "30"; - else - if (t == _tratta || t == _tratta_acc|| t == _paghero) - mezzo = "70"; - else - if (t == _ric_ban) - mezzo = "74"; - else - if (t == _cessione || t == _let_cred) - mezzo = "97"; - else - if (t == _rid) - mezzo = "15E"; - _set.set(PAT, PAT_CODPAG, t == _rim_dir ? "1" : "35"); - _set.set(PAT, PAT_MEZZOPAG, mezzo); - } - return true; -} - -bool TDocumento_EDI::send_rows() -{ - const tip_doc t = (tip_doc) tipo().tipo(); - - _totrighe = ZERO; - long prog = 1; - - FOR_EACH_SELF_RDOC(r, prow) - { - TRiga_documento &row = *prow; - - if (!row.is_descrizione() || _send_desc) - { - real qta = row.quantita(); - const real prezzo = row.prezzo(false, false, 3); - const real importo = row.is_sconto() ? ZERO : row.importo(false, false, 3); - long nrcuint = 0L; - - _totrighe += importo; - if (qta == ZERO) - qta = UNO; - _set.new_rec(DET); - _set.set(DET, DET_NUMRIGA, (long) prog++); - _set.set(DET, DET_TIPCODCU, "EN"); - - const TString & codartmag = row.get(RDOC_CODARTMAG); - - if (codartmag.full()) - { - const TArticolo & art = cached_article(codartmag); - TString ean = art.type2codcorr("1"); - const TString & upc = art.type2codcorr("U"); - - if (ean.blank()) - ean = art.type2codcorr("8"); - if (ean.full()) - { - _set.set(DET, DET_CODEANCU, ean); - _set.set(DET, DET_TIPCODCU, "EN"); - _set.set(DET, DET_CODEANTU, ean); - } - else - if (upc.full()) - { - _set.set(DET, DET_CODEANCU, upc); - _set.set(DET, DET_TIPCODCU, "UP"); - _set.set(DET, DET_CODEANTU, upc); - } - nrcuint = art.get_int(ANAMAG_PPCONF); - if (nrcuint == 0L) - nrcuint = art.get_int(ANAMAG_PPCOLLO); - if (nrcuint > 0L) - { - _set.set(DET, DET_NRCUINTU, nrcuint); - _set.set(DET, DET_UDMNRCUINTU, "PCE"); - } - - TString codart = art.type2codcorr("N"); row.get(RDOC_CODART); - - if (codart.blank()) - TString codart = row.get(RDOC_CODART); - _set.set(DET, DET_CODDISTU, codart); - } - _set.set(DET, DET_CODFORTU, row.get(RDOC_CODART)); - _set.set(DET, DET_TIPQUANT, qta > ZERO ? "L01" : "L02"); - _set.set(DET, DET_QTACONS, qta); - - const TString um = cache().get("%UMS", row.get(RDOC_UMQTA), "S8"); - - _set.set(DET, DET_UDMQCONS, um); // sistemare - _set.set(DET, DET_QTAFATT, qta); - _set.set(DET, DET_UDMQFATT, um); // sistemare - - if (prezzo != ZERO) - { - _set.set(DET, DET_PRZUNI, prezzo); - _set.set(DET, DET_TIPOPRZ, "AAA"); - _set.set(DET, DET_UDMPRZUN, um); - _set.set(DET, DET_PRZUN2, prezzo); - _set.set(DET, DET_TIPOPRZ2, "AAA"); - _set.set(DET, DET_UDMPRZUN2, um); - } - if (importo != ZERO) - _set.set(DET, DET_IMPORTO, importo); - _set.set(DET, DET_DIVRIGA, get(DOC_CODVAL)); - if (in_valuta()) - { - TCurrency importo_valfirm(importo); - - importo_valfirm.change_to_firm_val(); - _set.set(DET, DET_IMPORTO2, importo_valfirm.get_num()); - _set.set(DET, DET_DIVRIGA2, TCurrency::get_firm_val()); - } - _set.new_rec(DES); - _set.set(DES, DES_DESCR, row.descrizione()); - _set.new_rec(TAX); - _set.set(TAX, TAX_TIPOTASS, "VAT"); - const TCodiceIVA & i = row.iva(); - - _set.set(TAX, TAX_DESCRIZ, i.descrizione()); - if (i.IVA11_vendite() == "20" || i.IVA11_vendite() == "21") - _set.set(TAX, TAX_CATIMP, "G"); - else - if (i.iva_esente() || i.iva_non_imponibile() || i.iva_non_soggetta()) - _set.set(TAX, TAX_CATIMP, "E"); - else - if (is_split_payment()) - _set.set(TAX, TAX_CATIMP, "SPL"); - else - if (get_bool(DOC_IVAXCASSA)) - _set.set(TAX, TAX_CATIMP, "D"); - else - _set.set(TAX, TAX_CATIMP, "S"); - _set.set(TAX, TAX_ALIQIVA, i.aliquota()); - _set.set(TAX, TAX_IMPORTO, row.imposta(false)); - - const TString sconto(row.get(RDOC_SCONTO)); - - if (sconto.full() || row.is_sconto()) - { - const real perc = row.is_sconto() ? ZERO : CENTO - sconto2perc(sconto) * CENTO; - const real sconto = row.is_sconto() ? abs(row.importo(false, false, 3)) : row.sconto(); - - _set.new_rec(ALD); - _set.set(ALD, ALD_INDSCADD, "A"); - _set.set(ALD, ALD_INDSEQ, 1); - _set.set(ALD, ALD_TIPOSCADD, "DI"); - _set.set(ALD, ALD_IMPORTO, sconto); - _set.set(ALD, ALD_PERC, perc); - } - - TString num_bolla; - TDate data_bolla; - TString num_ord; - TDate data_ord; - - for (const TRiga_documento * orig_rdoc = (const TRiga_documento *) row.find_original_rdoc(); orig_rdoc != nullptr;) - { - TDoc_key key(orig_rdoc->get_doc_key()); - TDocumento orig_doc(key); - - if (orig_doc.is_bolla() && num_bolla.blank()) - { - num_bolla = orig_doc.get(DOC_NDOC); - data_bolla = orig_doc.get_date(DOC_DATADOC); - } - if (orig_doc.is_ordine() && num_ord.blank()) - { - TString num_ord_cli = orig_doc.get(DOC_NUMDOCRIF); - - if (num_ord_cli.full()) - { - num_ord = num_ord_cli; - data_ord = orig_doc.get_date(DOC_DATADOCRIF); - } - else - { - num_ord = orig_doc.get(DOC_NDOC); - data_ord = orig_doc.get_date(DOC_DATADOC); - } - } - orig_rdoc = (const TRiga_documento *) orig_doc[orig_rdoc->get_int(RDOC_NRIGA)].find_original_rdoc(); - } - - const int codindsp = get_int(DOC_CODINDSP); - TString codice; - TString tipo; - TString ragsoc; - TString indir; - TString citta; - TString prov; - TString stato; - - if (codindsp != 0) - { - codice = clifor().indsp(codindsp).get(IND_CODDEST); - if (codice.full()) - { - const TRectype & dest = cache().get("DST", codice); - - tipo = dest.get("S10"); - if (tipo.blank()) - tipo = "91"; - ragsoc = dest.get("S0"); - if (ragsoc.blank()) - ragsoc = clifor().indsp(codindsp).get(IND_RAGSOC); - indir = dest.get("S1").sleft(35); - if (indir.blank()) - { - indir = clifor().indsp(codindsp).get(IND_INDIR); - indir << ' ' << clifor().indsp(codindsp).get(IND_CIV); - stato = clifor().indsp(codindsp).get(IND_STATO); - - TToken_string key; - - key.add(stato); - key.add(clifor().indsp(codindsp).get(IND_COM)); - const TRectype & comune = cache().get(LF_COMUNI, key); - - citta = comune.get(COM_DENCOM); - prov = comune.get(COM_PROVCOM); - } - else - { - TString civ = dest.get("S1").smid(35, 10); - - indir.trim(); - indir << ' ' << civ.ltrim(); - stato = dest.get("S8"); - - TToken_string key; - - key.add(stato); - key.add(dest.get("S9")); - - const TRectype & comune = cache().get(LF_COMUNI, key); - - citta = comune.get(COM_DENCOM); - prov = comune.get(COM_PROVCOM); - } - } - else - { - codice = clifor().anagr().partita_IVA(); - tipo = "VA"; - } - } - if (codice.full() || num_bolla.full()) - { - _set.new_rec(NAD); - if (codindsp == 0) - { - _set.set(NAD, NAD_CODCONS, clifor().anagr().partita_IVA()); - _set.set(NAD, NAD_QCODCONS, "VA"); - _set.set(NAD, NAD_RAGSOCD, clifor().anagr().ragione_sociale()); - _set.set(NAD, NAD_INDIRD, clifor().anagr().indirizzo_residenza()); - _set.set(NAD, NAD_CITTAD, clifor().anagr().comune_residenza()); - _set.set(NAD, NAD_PROVD, clifor().anagr().provincia_residenza()); - _set.set(NAD, NAD_NAZIOD, clifor().anagr().stato_residenza_ISO()); - } - else - { - if (codice.blank()) - { - ragsoc = clifor().indsp(codindsp).get(IND_RAGSOC); - indir = clifor().indsp(codindsp).get(IND_INDIR); - indir << ' ' << clifor().indsp(codindsp).get(IND_CIV); - stato = clifor().indsp(codindsp).get(IND_STATO); - - TToken_string key; - - key.add(stato); - key.add(clifor().indsp(codindsp).get(IND_COM)); - - const TRectype & comune = cache().get(LF_COMUNI, key); - - citta = comune.get(COM_DENCOM); - prov = comune.get(COM_PROVCOM); - } - _set.set(NAD, NAD_CODCONS, codice); - _set.set(NAD, NAD_QCODCONS, tipo); - _set.set(NAD, NAD_RAGSOCD, ragsoc); - _set.set(NAD, NAD_INDIRD, indir); - _set.set(NAD, NAD_CITTAD, citta); - _set.set(NAD, NAD_PROVD, prov); - _set.set(NAD, NAD_NAZIOD, stato); - } - - _set.set(NAD, NAD_NUMBOLLA, num_bolla); - _set.set(NAD, NAD_DATABOLL, data_bolla); - if (num_ord.full()) - { - _set.set(NAD, NAD_NUMORD, num_ord); - _set.set(NAD, NAD_DATAORD, data_ord); - } - } - } - } - return true; -} - -bool TDocumento_EDI::send_footer() -{ - const tip_doc t = (tip_doc) tipo().tipo(); - const TString & note = get(DOC_NOTE); - - if (note.full()) - { - _set.new_rec(FTT); - _set.set(FTT, FTT_TIPONOTA, "SIN"); - _set.set(FTT, FTT_NOTE, note); - } - - TAssoc_array& tabella = tabella_iva(); - const int items = riepilogo_iva_items(); - - for (int r = 0; r < items; r++) - { - TRiepilogo_iva * riep = (TRiepilogo_iva *) riepilogo_iva(r); - const TCodiceIVA & i = riep->cod_iva(); - - _set.new_rec(IVA); - _set.set(IVA, IVA_TIPOTASS, "VAT"); - _set.set(IVA, IVA_DESCRIZ, i.descrizione()); - if (i.IVA11_vendite() == "20" || i.IVA11_vendite() == "21") - _set.set(IVA, IVA_CATIMP, "G"); - else - if (i.iva_esente() || i.iva_non_imponibile() || i.iva_non_soggetta()) - _set.set(IVA, IVA_CATIMP, "E"); - else - if (is_split_payment()) - _set.set(IVA, IVA_CATIMP, "SPL"); - else - if (get_bool(DOC_IVAXCASSA)) - _set.set(IVA, IVA_CATIMP, "D"); - else - _set.set(IVA, IVA_CATIMP, "S"); - _set.set(IVA, IVA_ALIQIVA, i.aliquota()); - _set.set(IVA, IVA_SIMPONIB, riep->imponibile()); - _set.set(IVA, IVA_SIMPORTO, riep->iva()); - } - _set.new_rec(TMA); - _set.set(TMA, TMA_TOTDOC1, totale_doc()); - _set.set(TMA, TMA_IMPOSTA1, imposta()); - _set.set(TMA, TMA_IMPONIB1, imponibile()); - _set.set(TMA, TMA_TOTRIGHE1, _totrighe); - _set.set(TMA, TMA_TOTANT1, pagato()); - _set.set(TMA, TMA_TOTPAG1, netto_a_pagare()); - _set.set(TMA, TMA_DIVISA1, get_real(DOC_CODVAL)); - _set.set(TMA, TMA_TOTMERCE, get_real(DOC_TOTMER)); - _set.set(TMA, TMA_TOTRITACC, ritenute('F', false, 2)); - return true; -} - -bool TDocumento_EDI::send(const char * path) -{ - bool ok = send_header(); - if (ok) - ok = send_rows(); - if (ok) - ok = send_footer(); - - TFilename fname(path); - TString name; - - name << get(DOC_TIPOCF) << format("%06ld", get_long(DOC_CODCF)) << get(DOC_ANNO) << get(DOC_CODNUM) << format("%06ld", get_long(DOC_NDOC)); - fname.add(name); fname.ext("txt"); - return _set.save(fname); -} - - -bool TDocumento_EDI::receive_header() -{ - const tip_doc t = (tip_doc)tipo().tipo(); - - return true; -} - -bool TDocumento_EDI::receive_rows() -{ - const tip_doc t = (tip_doc)tipo().tipo(); - - return true; -} - -bool TDocumento_EDI::receive_footer() -{ - const tip_doc t = (tip_doc)tipo().tipo(); - - return true; -} - -bool TDocumento_EDI::receive(const char * file) -{ - bool ok = _set.load(file); - - if (ok) - ok = receive_header(); - if (ok) - ok = receive_rows(); - if (ok) - ok = receive_footer(); - return ok; -} \ No newline at end of file diff --git a/src/ve01/velib04.cpp b/src/ve01/velib04.cpp index 6470a339c..781cf9eb1 100644 --- a/src/ve01/velib04.cpp +++ b/src/ve01/velib04.cpp @@ -122,6 +122,7 @@ int TLista_documenti::find(const TDocumento & doc) const return find(provv, anno, codnum, ndoc); } + int TLista_documenti::read(char provv, char tipocf, long clifo, int anno, TToken_string& tipidoc, TToken_string& statidoc, const char * docfilter, const TDate& dd, const TDate& ad, const char* codnum, long dn, long an) diff --git a/src/ve01/velib04.h b/src/ve01/velib04.h index 49518c26c..cab2b7587 100644 --- a/src/ve01/velib04.h +++ b/src/ve01/velib04.h @@ -10,7 +10,7 @@ #endif #ifndef __CGLIB_H -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #endif class TLista_documenti : public TObject // velib04 @@ -25,11 +25,15 @@ public: int find(char provv, int anno, const char * codnum, long ndoc) const; int find(const TDocumento & doc) const; bool exist(char provv, int anno, const char * codnum, long ndoc) const { return find(provv, anno,codnum, ndoc) >= 0; } - int read(char provv, char tipo, long clifo, int anno, TToken_string& tipidoc, TToken_string& statidoc, const char * docfilter = "",const TDate& dd = nulldate, const TDate& ad = nulldate, - const char* codnum = "", long dn = 0L, long an = 0L); - int read(char provv, int anno, const char* codnum, TToken_string& tipidoc, TToken_string& statidoc, const char * docfilter = "", const TDate& dd = nulldate, const TDate& ad = nulldate, - long dn = 0L, long an = 0L) { return read(provv, ' ', 0L, anno, tipidoc, statidoc, docfilter, dd, ad, codnum, dn, an); } - int write(bool re = false) const; + int read(char provv, char tipo, long clifo, int anno, TToken_string& tipidoc, TToken_string& statidoc, const char * docfilter = "", const TDate& dd = nulldate, const TDate& ad = nulldate, + const char* codnum = "", long dn = 0L, long an = 0L); + int read(char provv, char tipo, long clifo, int anno, TToken_string& tipidoc, TToken_string& statidoc, const TDate& dd = nulldate, + const TDate& ad = nulldate, long dn = 0L, long an = 0L) { return read(provv, tipo, clifo, anno, tipidoc, statidoc,"", dd, ad, "", dn, an); } + int read(char provv, int anno, const char * codnum, TToken_string& tipidoc, TToken_string& statidoc, const char * docfilter = "", const TDate& dd = nulldate, const TDate& ad = nulldate, + long dn = 0L, long an = 0L) { return read(provv, ' ', 0L, anno, tipidoc, statidoc, docfilter, dd, ad, codnum, dn, an); } + int read(char provv, int anno, const char * codnum, TToken_string& tipidoc, TToken_string& statidoc, const TDate& dd = nulldate, const TDate& ad = nulldate, + long dn = 0L, long an = 0L) { return read(provv, ' ', 0L, anno, tipidoc, statidoc, "", dd, ad, codnum, dn, an); } + int write(bool re = false) const; int rewrite() const { return write(true); } int add(TDocumento* doc) { return _documenti.add(doc); } diff --git a/src/ve01/velib04b.cpp b/src/ve01/velib04b.cpp index f2511f912..22129644a 100644 --- a/src/ve01/velib04b.cpp +++ b/src/ve01/velib04b.cpp @@ -1,7 +1,7 @@ #include "velib04.h" #include "../ca/calib01.h" -#include "../cg/cglib.h" -#include "../cg/cgsaldac.h" +#include "../cg01/cglib.h" +#include "../cg01/cgsaldac.h" #include "../in/inlib01.h" #include diff --git a/src/ve01/velib04f.cpp b/src/ve01/velib04f.cpp index 8b35d9079..91be96f1d 100644 --- a/src/ve01/velib04f.cpp +++ b/src/ve01/velib04f.cpp @@ -6,7 +6,7 @@ #include "../ca/movana.h" #include "../ca/rmovana.h" #include "../ca/rrip.h" -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "../mg/anamag.h" /////////////////////////////////////////////////////////// diff --git a/src/ve01/velib05.cpp b/src/ve01/velib05.cpp index 4d23deb7f..70942de41 100644 --- a/src/ve01/velib05.cpp +++ b/src/ve01/velib05.cpp @@ -3,7 +3,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include diff --git a/src/ve01/velib06.cpp b/src/ve01/velib06.cpp index 418c2cdeb..d5bc73b58 100644 --- a/src/ve01/velib06.cpp +++ b/src/ve01/velib06.cpp @@ -14,7 +14,7 @@ #include #include "../db/dblib.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" #include "velib04.h" #include "vepriv.h" #include "verig.h" @@ -526,18 +526,6 @@ TDocumento_mask::TDocumento_mask(const char* td, short cust_height) } _sheet->set_height(cust_height); - add_button(DLG_COPIA, page, "~Copia", 1, -2, 10, 2, "", TOOL_COPYROW); - set_handler(DLG_COPIA, copia_handler); - add_button(DLG_COPIA_TUTTO, page, "~Tutto", 15, -2, 10, 2, "", TOOL_COPYALLROW); - set_handler(DLG_COPIA_TUTTO, copia_handler); - add_button(DLG_INCOLLA, _sheet->page(), "~Incolla", 29, -2, 10, 2, "", TOOL_PASTEROW); - set_handler(DLG_INCOLLA, incolla_handler); - add_button(DLG_TEMPLATE, page, "~Default", 43, -2, 10, 2, "", TOOL_TEMPLATE); - set_handler(DLG_TEMPLATE, savedef_handler); - add_button(DLG_UP_ROW, page, "~Su", 57, -2, 10, 2, "", TOOL_MOVEUP); - set_handler(DLG_UP_ROW, swap_handler); - add_button(DLG_DOWN_ROW, page, "~Giù", 71, -2, 10, 2, "", TOOL_MOVEDN); - set_handler(DLG_DOWN_ROW, swap_handler); } TDocumento_mask::~TDocumento_mask() @@ -5261,33 +5249,6 @@ bool TDocumento_mask::gestione_note_per_articolo() const return id2pos(F_NAR) > 0; } -void TDocumento_mask::update_cartacei() -{ - TGolem_field * g = (TGolem_field *)find_by_id(DLG_CARTACEI); - TString catdoc; - - if (g != nullptr) - { - TDocumento& curr_doc = doc(); - const TCausale * c = curr_doc.get_caus_cont(); - - if (c != nullptr) - { - if (c->iva() != nessuna_iva) - { - const TString& tipodoc = c->tipo_doc(); - TClasse_doc * cat = categorie_doc().find_causcont(c->codice()); // Cerco se ho un record che abbia specificata quella caus. contabile - - if (cat == nullptr) - cat = categorie_doc().find_tipodoc(tipodoc); - if (cat != nullptr) - catdoc = cat->catdoc(); - } - } - g->set_catdoc(catdoc); - } -} - /////////////////////////////////////////////////////////// // Gestione lettore codice a barre /////////////////////////////////////////////////////////// diff --git a/src/ve01/velib06a.cpp b/src/ve01/velib06a.cpp index 38bb06ad6..e5790ad8b 100644 --- a/src/ve01/velib06a.cpp +++ b/src/ve01/velib06a.cpp @@ -24,9 +24,9 @@ #include "velib07.h" #include "ve0100n.h" -#include "../cg/cglib.h" +#include "../cg01/cglib.h" #include "../db/dblib.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" #include "../mg/mglib.h" #include "../db/dblib.h" @@ -3065,7 +3065,6 @@ bool codcms_handler(TMask_field& f, KEY key) mask.mask2doc(); doc.zero(DOC_SPESEUPD); doc.update_spese_aut(spese, false, &mask.sfield(F_SHEET)); - mask.update_cartacei(); } } if ((main_app().has_module(CTAUT, CHK_DONGLE) || main_app().has_module(PAAUT, CHK_DONGLE)) && (key == K_TAB && f.focusdirty())) @@ -3760,7 +3759,6 @@ bool tipodocsdi_handler(TMask_field& f, KEY key) TDocumento_mask& mask = (TDocumento_mask &)f.mask(); mask.mask2doc(); - mask.update_cartacei(); } return true; } diff --git a/src/ve01/velib07.cpp b/src/ve01/velib07.cpp index f89dec5d9..c0a87340b 100644 --- a/src/ve01/velib07.cpp +++ b/src/ve01/velib07.cpp @@ -1,8 +1,8 @@ #include "velib05.h" #include "velib07.h" -#include "../cg/cgsaldac.h" -#include "../cg/cglib.h" +#include "../cg01/cgsaldac.h" +#include "../cg01/cglib.h" #include "../db/dblib.h" #include "../lv/lvlib.h" diff --git a/src/ve01/velib08.cpp b/src/ve01/velib08.cpp index 8cb223e20..281eaacfc 100644 --- a/src/ve01/velib08.cpp +++ b/src/ve01/velib08.cpp @@ -7,11 +7,11 @@ #include #include "velib.h" #include "ve0100m.h" -#include "../fp/fplib.h" +#include "../fp01/fplib.h" #include #include -#include "../cg/cfban.h" +#include "../cg01/cfban.h" #include #include #include @@ -1206,7 +1206,7 @@ const TString& TDocumento::descrizione(const TRiga_documento& rdoc) err << "Il documento " << rdoc.doc().anno() << " " << rdoc.doc().codice_numerazione().codice() << " " << rdoc.doc().numero() << " ha la riga numero " << rdoc.numero() << " pi lunga di quanto supportato dal formato dell'agenzia delle entrate, verr troncata a 1000 caratteri"; get_xml_log()->log(1, err); } - return tmp.sleft(1000); + return tmp.left(1000); } return rdoc.get(RDOC_DESCR); } @@ -1273,12 +1273,12 @@ HIDDEN void dump_flds(TAuto_variable_rectype & rec, int rifnumlinea, TString_arr TToken_string vals; real num = rifnumlinea; TString strnum = num.string(0, 2); - const TTrec& rd = prefix().get_recdes(rec.num()); + const RecDes& rd = prefix().get_recdes(rec.num()); - for (int i = 0; i < rd.nfields(); i++) + for (int i = 0; i < rd.NFields; i++) { - const TFieldDes & fld = rd.field(i); - const TString & fldname = fld.name(); + const RecFieldDes & fld = rd.Fd[i]; + const TString & fldname = fld.Name; if (!fld2skip(fldname)) { diff --git a/src/ve01/veuml.h b/src/ve01/veuml.h index 5ea2da84e..773df01c1 100644 --- a/src/ve01/veuml.h +++ b/src/ve01/veuml.h @@ -175,9 +175,6 @@ #define DLG_CONFERMA 420 -// pulsanti operazioni sulle righe - - #define F_GRUPPO 440 #define F_CONTO 441 #define F_SOTTOCONTO 442