From 3cdf8db1eb14d153d4a8d188c424c5f169cfa855 Mon Sep 17 00:00:00 2001 From: Simone Palacino Date: Tue, 10 Mar 2020 15:15:19 +0100 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : ps6362.exe ps6362100a.msk Commento : - Personalizzazione Major: - Aggiunto campo in esportazione "descampolibero6" - Aggiunto campo maschera per filtro cliente - default: flexform --- src/ps/flexform_xml.cpp | 26 +------------------------- src/ps/flexform_xml.h | 6 ++---- src/ps/ps6362100.cpp | 26 +++++++++++++++----------- src/ps/ps6362100a.h | 5 +++-- src/ps/ps6362100a.uml | 24 +++++++++++++++++++----- src/ps/xml_element.cpp | 23 +++++++++++++++++++++++ src/ps/xml_element.h | 2 ++ 7 files changed, 65 insertions(+), 47 deletions(-) diff --git a/src/ps/flexform_xml.cpp b/src/ps/flexform_xml.cpp index 8881ef9d3..8dd870cb6 100644 --- a/src/ps/flexform_xml.cpp +++ b/src/ps/flexform_xml.cpp @@ -1,6 +1,3 @@ -#include -#include - #include "flexform_xml.h" #include "config.h" #include "date.h" @@ -117,27 +114,6 @@ TOrdini_riga_xml::~TOrdini_riga_xml() // Flexform xml export /////////////////////////////////////////////////////////// -const char* TFlexform_xml::generate_GUID() -{ - static TString _guid; - if (_guid.empty()) - { - char cstr[39]; - size_t chars; - GUID uuid; - if (UuidCreate(&uuid) == RPC_S_OK) - { - LPOLESTR lpsz; - StringFromCLSID(uuid, &lpsz); - wcstombs_s(&chars, cstr, lpsz, wcslen(lpsz)); - _guid = cstr; - } - else - _guid = ""; - } - return _guid; -} - TFlexform_xml::TFlexform_xml(const char* xml_name) : _file_name(xml_name), _fout(nullptr) { // @@ -163,7 +139,7 @@ int TFlexform_xml_ddt::add_doc() return _docs_unico.size(); } -int TFlexform_xml_ddt::add_row(shared_ptr riga, int which_doc) +int TFlexform_xml_ddt::add_row(const shared_ptr& riga, const int which_doc) { int i = which_doc < 0 ? (int)_testate.size() - 1 : which_doc; if (!_testate.empty() && i < (int)_testate.size()) diff --git a/src/ps/flexform_xml.h b/src/ps/flexform_xml.h index 3bb2b10d2..7bd0a8939 100644 --- a/src/ps/flexform_xml.h +++ b/src/ps/flexform_xml.h @@ -147,7 +147,6 @@ protected: ofstream* _fout; TEsa_import_xml _esa_import; - static const char* generate_GUID(); void set_indentation(const bool use_tab, const short n_spaces) { _esa_import.set_indentation(use_tab, n_spaces); } virtual bool print() pure; @@ -174,11 +173,11 @@ public: * \returns indice documento in cui e' stata inserita la riga. * \returns -1 se non e' mai stato inserito alcun documento o l'indice (\a which_doc) non e' corretto. */ - int add_row(shared_ptr riga, int which_doc = -1); + int add_row(const shared_ptr& riga, int which_doc = -1); bool print() override; shared_ptr new_row() { _rows.insert(_rows.end(), make_shared()); return _rows.back(); } - /** Setto testata al documento n. \a which_riga, altrimenti se non specificato setta l'ultimo doc presente. + /** Setto testata al documento n. \a which_doc, altrimenti se non specificato setta l'ultimo doc presente. * \returns indice documento settato. * \returns -1 se non e' mai stato inserito alcun documento o l'indice (\a which_doc) non e' corretto. */ @@ -188,7 +187,6 @@ public: ~TFlexform_xml_ddt() = default; }; - /** * \brief Esportatore XML Ordini Flexform. */ diff --git a/src/ps/ps6362100.cpp b/src/ps/ps6362100.cpp index a9df0b3ac..7c62f4dc3 100644 --- a/src/ps/ps6362100.cpp +++ b/src/ps/ps6362100.cpp @@ -1,13 +1,13 @@ -#include +#include // KnownFolder di Windows #include "ps6362.h" #include "ps6362100a.h" #include "applicat.h" #include "automask.h" -#include "tabutil.h" // TTable -#include "sqlset.h" // TSQL_recordset -#include "progind.h" // TProgress_monitor +#include "tabutil.h" // TTable +#include "sqlset.h" // TSQL_recordset +#include "progind.h" // TProgress_monitor #include "flexform_xml.h" @@ -44,6 +44,7 @@ void TMajor_export_mask::save_all() const ini_set_string(CONFIG_DITTA, "ps6362", "fldyear", get(F_ANNO_ELAB)); ini_set_string(CONFIG_DITTA, "ps6362", "numddt", get(F_NUMDDT)); ini_set_string(CONFIG_DITTA, "ps6362", "numord", get(F_NUMORD)); + ini_set_string(CONFIG_DITTA, "ps6362", "codcf", get(F_CODCF)); ini_set_string(CONFIG_DITTA, "ps6362", "num_da", get(F_NUMDDT_DA)); ini_set_string(CONFIG_DITTA, "ps6362", "num_a", get(F_NUMDDT_A)); } @@ -67,6 +68,7 @@ void TMajor_export_mask::load_all() set(F_ANNO_ELAB, ini_get_string(CONFIG_DITTA, "ps6362", "fldyear", y)); set(F_NUMDDT, ini_get_string(CONFIG_DITTA, "ps6362", "numddt", "")); set(F_NUMORD, ini_get_string(CONFIG_DITTA, "ps6362", "numord", "")); + set(F_CODCF, ini_get_string(CONFIG_DITTA, "ps6362", "codcf", "12")); set(F_NUMDDT_DA, ini_get_string(CONFIG_DITTA, "ps6362", "num_da", "")); set(F_NUMDDT_A, ini_get_string(CONFIG_DITTA, "ps6362", "num_a", "")); if(get(F_NUMDDT).empty() || get(F_NUMORD).empty()) @@ -102,7 +104,7 @@ class TMajor_export_app : public TSkeleton_application bool create() override; static TFilename check_name_file(const TString& dir, bool sub_fld, int from, int to, bool ddt = true); - static const char* get_riferimento_flexform(const TSQL_recordset& righe_doc); + static TString get_riferimento_flexform(const TSQL_recordset& righe_doc); static bool export_ddt(TMask& msk); static bool export_ordini() { return false; } void main_loop() override; @@ -132,7 +134,7 @@ TFilename TMajor_export_app::check_name_file(const TString& dir, const bool sub_ xml << name << ".xml"; if (xml.exist()) { - const int key = yesnocancel_box("Esiste gia' un file per questa esportazione. Creare nuovo nome?\nCliccare 'No' se si vuole sostituire il file."); + const int key = yesnocancel_box("Esiste gia' un file per questa esportazione. Creare duplicato?\nCliccare 'No' se si vuole sostituire il file."); if (key == K_YES) { int i = 1; @@ -150,15 +152,15 @@ TFilename TMajor_export_app::check_name_file(const TString& dir, const bool sub_ return xml; } -const char* TMajor_export_app::get_riferimento_flexform(const TSQL_recordset& righe_doc) +TString TMajor_export_app::get_riferimento_flexform(const TSQL_recordset& righe_doc) { const TString& rg1 = righe_doc.get(3).as_string(); - const TToken_string t(rg1, '\n'); + const TToken_string t(rg1, char(0xB6)); // Simbolo paragrafo ¶ TString line; for(int i = 0; i < t.items(); ++i) { t.get(i, line); - if (line.starts_with("RIFERIMENTO_FLEX")) + if (line.starts_with("CODFLEX")) break; line.cut(0); } @@ -176,6 +178,7 @@ bool TMajor_export_app::export_ddt(TMask& msk) const TString& dir = msk.get(F_FLDDEST); const bool sub_fld = msk.get_bool(F_SUBFLD); const int year = msk.get_int(F_ANNO_ELAB); + const int codcli = msk.get_int(F_CODCF); const int from = msk.get_int(F_NUMDDT_DA); const int to = msk.get_int(F_NUMDDT_A); const TString& codnum = msk.get(F_NUMDDT); @@ -185,7 +188,8 @@ bool TMajor_export_app::export_ddt(TMask& msk) return false; TFlexform_xml_ddt xml_ddts(path_xml); TString query_doc; - query_doc << "SELECT DATADOC, NDOC FROM doc WHERE CODNUM = '" << codnum << "' AND ANNO = " << year << " AND PROVV = 'D' AND NDOC >= " << from << " AND NDOC <= " << to; + query_doc << "SELECT DATADOC, NDOC FROM doc WHERE CODNUM = '" << codnum << "' AND ANNO = " << year << + " AND PROVV = 'D' AND TIPOCF = 'C' AND CODCF = " << codcli << " AND NDOC >= " << from << " AND NDOC <= " << to; TSQL_recordset doc(query_doc); TProgress_monitor bar(doc.items(), "Esportazione ddt"); @@ -209,7 +213,7 @@ bool TMajor_export_app::export_ddt(TMask& msk) const TString& cod_art = righe_doc.get(0).as_string(); TString descr = righe_doc.get(1).as_string(); const TString& qta = righe_doc.get(2).as_string(); - TString desccampolibero6 = get_riferimento_flexform(righe_doc); // get(3) RG1 + const TString& desccampolibero6 = get_riferimento_flexform(righe_doc); // get(3) RG1 if (righe_doc.get(4).as_bool()) descr << righe_doc.get(5).as_string(); diff --git a/src/ps/ps6362100a.h b/src/ps/ps6362100a.h index 6b48b48b3..907975e45 100644 --- a/src/ps/ps6362100a.h +++ b/src/ps/ps6362100a.h @@ -4,5 +4,6 @@ #define F_NUMORD 104 #define F_NUMDDT 105 #define F_ANNO_ELAB 106 -#define F_NUMDDT_DA 107 -#define F_NUMDDT_A 108 \ No newline at end of file +#define F_CODCF 107 +#define F_NUMDDT_DA 108 +#define F_NUMDDT_A 109 \ No newline at end of file diff --git a/src/ps/ps6362100a.uml b/src/ps/ps6362100a.uml index 2b6da7312..6a2c35010 100644 --- a/src/ps/ps6362100a.uml +++ b/src/ps/ps6362100a.uml @@ -38,7 +38,7 @@ END RADIOBUTTON F_TIPODOC 64 BEGIN - PROMPT 6 5 "@bSelezionare tipo documento da esportare" + PROMPT 6 5 "@bSelezionare tipo documento da esportare/importare" ITEM "D|DDT" ITEM "O|Ordini" FLAG "ZD" @@ -75,16 +75,29 @@ END STRING F_ANNO_ELAB 4 BEGIN - PROMPT 37 8 "Anno elaborazione" + PROMPT 32 8 "Anno elaborazione" +END + +NUMBER F_CODCF 6 +BEGIN + PROMPT 32 9 "cod. cliente " + USE LF_CLIFO + INPUT TIPOCF "C" + INPUT CODCF F_CODCF + DISPLAY "Cod." CODCF + DISPLAY "Rag. Soc.@50" RAGSOC + OUTPUT F_CODCF CODCF + FLAGS "" END STRING F_NUMDDT_DA 7 BEGIN - PROMPT 37 9 "da num. doc. " - USE LF_DOC + PROMPT 32 10 "da num. doc. " + USE LF_DOC JOIN %TIP ALIAS 104 INTO CODTAB=TIPODOC JOIN LF_CLIFO INTO TIPOCF=TIPOCF CODCF=CODCF INPUT PROVV "D" + INPUT TIPOCF "C" SELECT INPUT ANNO F_ANNO_ELAB SELECT INPUT CODNUM F_NUMDDT SELECT INPUT NDOC F_NUMDDT_DA @@ -97,9 +110,10 @@ END STRING F_NUMDDT_A 7 BEGIN - PROMPT 37 10 "a " + PROMPT 57 10 "a " COPY USE F_NUMDDT_DA INPUT PROVV "D" + INPUT TIPOCF "C" SELECT INPUT ANNO F_ANNO_ELAB SELECT INPUT CODNUM F_NUMDDT SELECT INPUT NDOC F_NUMDDT_A diff --git a/src/ps/xml_element.cpp b/src/ps/xml_element.cpp index 29b021587..6ef92f829 100644 --- a/src/ps/xml_element.cpp +++ b/src/ps/xml_element.cpp @@ -1,3 +1,6 @@ +#include +#include + #include "xml_element.h" #define XML_ESCAPE_CHAR '&' @@ -84,6 +87,26 @@ void TXML_element::set_value(const TString& _Val) _value = _Val; } +const char* generate_GUID() +{ + static TString _guid; + if (_guid.empty()) + { + char cstr[39]; + size_t chars; + GUID uuid; + if (UuidCreate(&uuid) == RPC_S_OK) + { + LPOLESTR lpsz; + StringFromCLSID(uuid, &lpsz); + wcstombs_s(&chars, cstr, lpsz, wcslen(lpsz)); + _guid = cstr; + } + else + _guid = ""; + } + return _guid; +} /////////////////////////////////////////////////////////// diff --git a/src/ps/xml_element.h b/src/ps/xml_element.h index 2f003f00e..6035d6014 100644 --- a/src/ps/xml_element.h +++ b/src/ps/xml_element.h @@ -45,4 +45,6 @@ public: explicit TXML_element(const char* name, bool info_file) : TXML_element(name, "", info_file) { } }; +const char* generate_GUID(); + #endif // __XMLELEMENT_H__ \ No newline at end of file