From ecca05524b9185fae6a0c530736fca3b4e210d12 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Wed, 21 Aug 2024 00:49:36 +0200 Subject: [PATCH] Patch level : 12.00 1328 Files correlati : ve1.exe ve1300.alx Commento: Aggiunto messaggio cli_ind alla stampa documenti --- src/ve/ve1100.cpp | 145 +++++++++++++++++++++++++---------- src/ve/ve1300.alx | 5 +- src/ve/ve1300.cpp | 187 ++++++++++++++++++++++++++++++--------------- src/ve/velib07.cpp | 2 +- 4 files changed, 237 insertions(+), 102 deletions(-) diff --git a/src/ve/ve1100.cpp b/src/ve/ve1100.cpp index fccdea1d5..f57e27f22 100755 --- a/src/ve/ve1100.cpp +++ b/src/ve/ve1100.cpp @@ -20,6 +20,7 @@ #include #include +#include #define LISTADOC "listadoc" #define FAKETOTFLD 9999 @@ -801,7 +802,7 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) } } // fine _DITTA - if (code== "_CLIENTE") + if ((code== "_CLIENTE") || (code == "_CLI_IND")) { // lettura dei dati del cliente // sintassi: _CLIENTE,{|} @@ -823,6 +824,9 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) TCli_for & cli_for = _doc->clifor(); TOccasionale & cli_occ = _doc->occas(); const bool occasionale = cli_for.is_occasionale(); + const TRectype & indsped = cli_for.indsped(_doc->get_int(DOC_CODINDSP)); + const bool is_sped = (code == "_CLI_IND") && indsped.full(); + TString in(s.get()); // prende la macro o il fieldref if (in[0] != '!') { @@ -839,67 +843,128 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s) in.ltrim(1); if (in=="INDNUM") { - valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF); - valore << " " ; - valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF)); + if (is_sped) + { + valore = indsped.get(IND_INDIR); // come usare indir2 IND_INDIR2 + valore << " " << indsped.get(IND_CIV); + } + else + { + valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF); + valore << " "; + valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF)); + } cf.set(valore); return true; } if (in.find("COM") == 0) { - const bool nascita = in[3] == 'N'; - const int p = in.find("->"); - if (p > 0) - in.ltrim(p + 2); - TLocalisamfile com(LF_COMUNI); - if (nascita) - { - com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC)); - com.put(COM_COM, occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC)); - } - else - { - com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATO): cli_for.get(CLI_STATOCF)); - com.put(COM_COM, occasionale ? cli_occ.get(OCC_COM): cli_for.get(CLI_COMCF)); - } - if (com.read() == NOERR) - cf.set(com.get(in)); + if (in.len() == 3) + { + if (is_sped) + valore = indsped.get(IND_COM); + else + valore = occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF); + cf.set(valore); + } + else + { + const bool nascita = in[3] == 'N'; + const int p = in.find("->"); + + if (p > 0) + in.ltrim(p + 2); + + TLocalisamfile com(LF_COMUNI); + + if (nascita) + { + com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC)); + com.put(COM_COM, occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC)); + } + else + { + if (is_sped) + { + com.put(COM_STATO, indsped.get(IND_STATO)); + com.put(COM_COM, indsped.get(IND_COM)); + } + else + { + com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATO) : cli_for.get(CLI_STATOCF)); + com.put(COM_COM, occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF)); + } + } + if (com.read() == NOERR) + cf.set(com.get(in)); + } return true; } + if (in.find("LOCALITACF") == 0) + { + if (is_sped) + valore = indsped.get(IND_LOCALITA); + else + valore = occasionale ? cli_occ.get(OCC_LOCALITA) : cli_for.get(CLI_LOCCF); + cf.set(valore); + return true; + } if (in.find("CAP") == 0) { - valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF); - cf.set(valore); + if (is_sped) + valore = indsped.get(IND_CAP); + else + valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF); + cf.set(valore); return true; } if (in.find("TEL") == 0) { - if (!occasionale) - { - if (in.len() == 3) - in << "1"; - const TString num(cli_for.get(in)); - in.insert("P"); - valore = cli_for.get(in); - valore << "/" << num; - } + if (is_sped) + { + valore = indsped.get(IND_PTEL); + valore << "/" << indsped.get(IND_TEL); + } + else + { + if (!occasionale) + { + if (in.len() == 3) + in << "1"; + const TString num(cli_for.get(in)); + in.insert("P"); + valore = cli_for.get(in); + valore << "/" << num; + } + } cf.set(valore); return true; } if (in=="FAX") { - if (!occasionale) - { - valore = cli_for.get("PFAX"); - valore << "/" << cli_for.get("FAX"); - } + if (is_sped) + { + valore = indsped.get(IND_PFAX); + valore << "/" << indsped.get(IND_FAX); + } + else + { + if (!occasionale) + { + valore = cli_for.get("PFAX"); + valore << "/" << cli_for.get("FAX"); + } + } cf.set(valore); return true; } if (in=="RAGSOC") { - valore = occasionale ? cli_occ.get(in) : cli_for.get(in); - valore.strip_double_spaces(); + if (is_sped) + valore = indsped.get(IND_RAGSOC); + else + valore = occasionale ? cli_occ.get(in) : cli_for.get(in); + valore.strip_double_spaces(); cf.set(valore); return true; } @@ -2144,4 +2209,4 @@ int ve1100(int argc, char* argv[]) const bool riep = argc >= 4 && argv[2][0] == 'L'; // Lista documenti a.run(argc, argv, riep ? TR("Lista documenti") : TR("Stampa documenti")); return 0; -} \ No newline at end of file +} diff --git a/src/ve/ve1300.alx b/src/ve/ve1300.alx index ce9a86a9f..e3cd5108a 100755 --- a/src/ve/ve1300.alx +++ b/src/ve/ve1300.alx @@ -21,6 +21,9 @@ DOC_CLIENTE \ user defined word in ve1.exe ; +: MESSAGE_CLI_IND ( s1 -- ) + DOC_CLI_IND \ user defined word in ve1.exe +; : MESSAGE_DITTA ( s1 -- ) GET_FIRM_DATA \ user defined word in report ; @@ -86,4 +89,4 @@ 7 SWAP UTILIZZO - ; \ No newline at end of file + ; diff --git a/src/ve/ve1300.cpp b/src/ve/ve1300.cpp index 39a2a35b0..e3a48af0e 100755 --- a/src/ve/ve1300.cpp +++ b/src/ve/ve1300.cpp @@ -32,11 +32,11 @@ class TDoc_recordset : public TISAM_recordset TRecnotype _mypos, _lastpos; protected: - virtual const TVariant& get_field(int logic, const char* field) const; + virtual const TVariant& get_field(int logic, const char* field) const; public: virtual TRecnotype items() const { return _lastpos; } - virtual TRecnotype current_row() const { return _mypos; } + virtual TRecnotype current_row() const { return _mypos; } virtual bool move_to(TRecnotype pos); TDocumentoEsteso& doc() { return *_doc; } @@ -470,13 +470,15 @@ TRiga_documento& TReport_doc::riga_doc(int n) return rs->riga_doc(n); } -bool TReport_doc::msg_cliente(TVariant_stack& stack) +bool TReport_doc::msg_cliente(TVariant_stack& stack, bool is_indsped) { TReport_field& cf = *curr_field(); - const TCli_for& cli_for = doc().clifor(); + TCli_for& cli_for = doc().clifor(); const TOccasionale& cli_occ = doc().occas(); const bool occasionale = cli_for.is_occasionale(); + const TRectype & indsped = cli_for.indsped(doc().get_int(DOC_CODINDSP)); + const bool is_sped = is_indsped && indsped.full(); TString in = stack.pop().as_string(); // prende la macro o il fieldref TString valore; @@ -496,67 +498,127 @@ bool TReport_doc::msg_cliente(TVariant_stack& stack) in.ltrim(1); if (in=="INDNUM") { - valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF); - valore << ' '; - valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF)); - cf.set(valore); + if (is_sped) + { + valore = indsped.get(IND_INDIR); // come usare indir2 IND_INDIR2 + valore << " " << indsped.get(IND_CIV); + } + else + { + valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF); + valore << ' '; + valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF)); + } + cf.set(valore); return true; } if (in.find("COM") == 0) { - const bool nascita = in[3] == 'N'; - const int p = in.find("->"); - if (p > 0) - in.ltrim(p + 2); - - TString8 key; - if (nascita) - { - key = occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC); - key << '|' << (occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC)); - } - else - { - key = occasionale ? cli_occ.get(OCC_STATO): cli_for.get(CLI_STATOCF); - key << '|' << (occasionale ? cli_occ.get(OCC_COM): cli_for.get(CLI_COMCF)); - } - valore = cache().get(LF_COMUNI, key, in); + if (in.len() == 3) + { + if (is_sped) + valore = indsped.get(IND_COM); + else + valore = occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF); + cf.set(valore); + } + else + { + const bool nascita = in[3] == 'N'; + const int p = in.find("->"); + + if (p > 0) + in.ltrim(p + 2); + + TString8 key; + + if (nascita) + { + key = occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC); + key << '|' << (occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC)); + } + else + { + if (is_sped) + { + key = indsped.get(IND_STATO); + key << '|' << indsped.get(IND_COM); + } + else + { + key = occasionale ? cli_occ.get(OCC_STATO) : cli_for.get(CLI_STATOCF); + key << '|' << (occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF)); + } + } + valore = cache().get(LF_COMUNI, key, in); + } cf.set(valore); return true; } + if (in.find("LOCALITACF") == 0) + { + if (is_sped) + valore = indsped.get(IND_LOCALITA); + else + valore = occasionale ? cli_occ.get(OCC_LOCALITA) : cli_for.get(CLI_LOCCF); + cf.set(valore); + return true; + } if (in.find("CAP") == 0) { - valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF); + if (is_sped) + valore = indsped.get(IND_CAP); + else + valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF); cf.set(valore); return true; } if (in.find("TEL") == 0) { - if (!occasionale) - { - if (in.len() == 3) - in << "1"; - const TString num(cli_for.get(in)); - in.insert("P"); - valore = cli_for.get(in); - valore << "/" << num; - } + if (is_sped) + { + valore = indsped.get(IND_PTEL); + valore << "/" << indsped.get(IND_TEL); + } + else + { + if (!occasionale) + { + if (in.len() == 3) + in << "1"; + const TString num(cli_for.get(in)); + in.insert("P"); + valore = cli_for.get(in); + valore << "/" << num; + } + } cf.set(valore); return true; } if (in=="FAX") { - if (!occasionale) - { - valore = cli_for.get("PFAX"); - valore << "/" << cli_for.get("FAX"); - } + if (is_sped) + { + valore = indsped.get(IND_PFAX); + valore << "/" << indsped.get(IND_FAX); + } + else + { + if (!occasionale) + { + valore = cli_for.get("PFAX"); + valore << "/" << cli_for.get("FAX"); + } + } cf.set(valore); return true; } if (in=="RAGSOC") { - valore = occasionale ? cli_occ.get(in) : cli_for.get(in); + if (is_sped) + valore = indsped.get(IND_RAGSOC); + else + valore = occasionale ? cli_occ.get(in) : cli_for.get(in); valore.strip_double_spaces(); cf.set(valore); return true; @@ -909,19 +971,23 @@ size_t TReport_doc::get_usr_words(TString_array& words) const const char* const name[] = { - "DOC_CLIENTE", - "DOC_PARENT_DOC", "DOC_PARENT_ROW", - "DOC_RIEPILOGO_IVA", - "DOC_SCADENZE", - "DOC_TOT_IMPONIBILI", - "DOC_LV_DOT", - "DOC_ADD_ROW", - NULL + "DOC_CLIENTE", // 0 + "DOC_PARENT_DOC", // 1 + "DOC_PARENT_ROW", // 2 + "DOC_RIEPILOGO_IVA", // 3 + "DOC_SCADENZE", // 4 + "DOC_TOT_IMPONIBILI", // 5 + "DOC_LV_DOT", // 6 + "DOC_ADD_ROW", // 7 + "DOC_CLI_IND", // 8 + nullptr }; ((TReport_doc*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile + size_t i; - for (i = 0; name[i] != NULL; i++) + + for (i = 0; name[i] != nullptr; i++) words.add(name[i]); return words.items(); @@ -943,6 +1009,7 @@ bool TReport_doc::execute_usr_word(unsigned int opcode, TVariant_stack& stack) case 5: msg_tot_imponibili(stack); break; case 6: msg_lv_dot(stack); break; case 7: msg_add_row(stack); break; + case 8: msg_cliente(stack, true); break; default: ok = false; break; } stack.reset(); // Svuota eventuali parametri variabili inutilizzati @@ -1292,7 +1359,7 @@ void TReport_doc_app::add_filter(TString& query, bool from) const bool TReport_doc_app::create() { if (!has_module(RSAUT)) - return error_box(FR("Modulo non autorizzato: %s"), dongle().module_code2desc(RSAUT)); + return error_box(FR("Modulo non autorizzato: %s"), (const char *) dongle().module_code2desc(RSAUT)); _msk = new TReport_doc_mask; return TSkeleton_application::create(); @@ -1638,17 +1705,17 @@ TReport_doc_app::TOutput_mode TReport_doc_app::key2mode(KEY k) const if (!has_module(RSAUT)) k = 'A'; - switch (k) - { + switch (k) + { case 'A': mode = out_preview; break; - case 'E': mode = out_mail; break; - case 'e': mode = out_signed_mail; break; - case 'P': mode = out_pdf; break; - case 'X': mode = out_disk; break; - case 'p': mode = out_signed_pdf; break; - case 'S': + case 'E': mode = out_mail; break; + case 'e': mode = out_signed_mail; break; + case 'P': mode = out_pdf; break; + case 'X': mode = out_disk; break; + case 'p': mode = out_signed_pdf; break; + case 'S': default : mode = out_print; break; - } + } return mode; } diff --git a/src/ve/velib07.cpp b/src/ve/velib07.cpp index 935d2fd99..49970d678 100755 --- a/src/ve/velib07.cpp +++ b/src/ve/velib07.cpp @@ -705,7 +705,7 @@ bool TDocument_report::msg_riepilogo_iva(TVariant_stack& stack) const TRectype& rec = ((TISAM_recordset*)recordset())->cursor()->relation()->file(idx).curr(); TDocumento & doc = (TDocumento &)((TDocument_recordset*)recordset())->doc(rec); - TAssoc_array & IVA = doc.tabella_iva(); // serve per aggiornare la tebella + TAssoc_array & i = doc.tabella_iva(); // serve per aggiornare la tebella TRiepilogo_iva * r = (TRiepilogo_iva *) doc.riepilogo_iva(index); TString value; if (r != NULL)