From bd69651da67694dbb78399ae196c6cee82ff3a0f Mon Sep 17 00:00:00 2001 From: luca83 Date: Thu, 20 Aug 2009 09:14:10 +0000 Subject: [PATCH] Patch level : 10.0 patch 417 Files correlati : lv2 Ricompilazione Demo : [ ] Commento : Corretta la domanda "Vuoi sovrascivere, sommare o ignorare", adesso viene proposta per ogni cliente che incontro (mail Paolo 12/08) git-svn-id: svn://10.65.10.50/trunk@19210 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- lv/lv2600.cpp | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/lv/lv2600.cpp b/lv/lv2600.cpp index 92a4db4d9..09e4129ae 100755 --- a/lv/lv2600.cpp +++ b/lv/lv2600.cpp @@ -156,7 +156,7 @@ TAcquisizione_cache::TAcquisizione_cache() : TCache(17) { _codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)"); _tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_RIT(0)"); - _stato = ini_get_string(CONFIG_DITTA, "lv", "STATO_RIT(0)"); + _stato = cache().get("%TIP", _tipodoc, "S2").left(1); _ndoc = 0; } @@ -176,7 +176,7 @@ protected: virtual bool create(); virtual bool destroy(); - void elabora_file(const TString& file, bool new_file, TLog_report &rep); + void elabora_file(const TString& file, TLog_report &rep); public: @@ -204,12 +204,14 @@ bool TAcquisizione_lavanderie_app::destroy() } //ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file, creando i documenti -void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_file, TLog_report &rep) +void TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report &rep) { TAcquisizione_cache ca; bool sovrascrivi = true; + bool nuovo_cliente = true; TAssoc_array deleted_docs; + TAssoc_array clienti; //scandisco il file TScanner s(file); while (s.ok()) @@ -219,7 +221,7 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi continue; TDate datadoc; - long codcf = 0; + long codcf = 0; TString8 codcf_str; TString80 codart; long qta; long rotti; @@ -236,11 +238,18 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi const int y = atoi(riga.mid(4,4)); if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000) { + codcf_str = riga.mid(8,6); datadoc = TDate(d, m, y); - codcf = atol(riga.mid(8,6)); + codcf = atol(codcf_str); codart = riga.mid(14,8); qta = atol(riga.mid(22,6)); rotti = atol(riga.mid(28,6)); + + if(!clienti.is_key(codcf_str)) + { + clienti.add(codcf_str,codcf_str); + nuovo_cliente = true; + } } else continue; @@ -253,9 +262,10 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi const int d = atoi(riga.mid(6,2)); if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000) { + codcf_str = riga.mid(28,20); datadoc = TDate(d, m, y); codart = riga.mid(8,20); - codcf = atol(riga.mid(28,20)); + codcf = atol(codcf_str); qta = atoi(riga.mid(48,11)); ndoc = atoi(riga.mid(59,11)); @@ -265,8 +275,15 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi case 2: tipo_conteggio = "Manuale"; break; case 3: tipo_conteggio = "Scarto"; break; default: break; + } + operatore = riga.mid(81,40); + + if(!clienti.is_key(codcf_str)) + { + clienti.add(codcf_str,codcf_str); + nuovo_cliente = true; + } } - operatore = riga.mid(81,40); } else continue; } @@ -276,18 +293,19 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi TDocumento& doc = ca.doc(datadoc,codcf); //se sto elaborando un nuovo file, ma i documenti che sto importando esistono gią, chiedi cosa devo fare - if (doc.rows() > 0 && new_file) + if (doc.rows() > 0 && nuovo_cliente) { KEY k = yesnocancel_box(TR("ATTENZIONE: il documento che si sta importando esiste gią! Si desidera continuare?\n" - "Premendo SI il documento verrą sovracsritto;\n" + "Premendo SI il documento verrą sovrascritto;\n" "Premendo NO le quantitą verranno sommate a quelle esistenti\n" - "Premendo ANNULLA il file verrą ignorato")); + "Premendo ANNULLA il documento non verrą modificato")); switch (k) { case K_YES: sovrascrivi = true; break; case K_NO: sovrascrivi = false; break; default: return; } + nuovo_cliente = false; } else { @@ -331,8 +349,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi { const TRectype& anamag = cache().get(LF_ANAMAG, codart); - // - TRiga_documento& rdoc = doc.new_row("22"); rdoc.put(RDOC_CODART, codart); rdoc.put(RDOC_DESCR, anamag.get(ANAMAG_DESCR)); @@ -342,7 +358,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi rdoc.put(RDOC_QTAGG1, qta); rdoc.put(RDOC_QTA, rotti); } - new_file = false; } //rinomino il file in uso @@ -354,7 +369,6 @@ void TAcquisizione_lavanderie_app::elabora_file(const TString& file, bool new_fi s.close(); fcopy(fnameini, fnamefin); fnameini.fremove(); - if (ca.empty()) { @@ -401,10 +415,10 @@ bool TAcquisizione_lavanderie_app::transfer() list_files(file, lista_file); FOR_EACH_ARRAY_ROW(lista_file, r2, row2) - elabora_file(*row2, true, logrep); + elabora_file(*row2, logrep); } else - elabora_file(file, true, logrep); + elabora_file(file, logrep); } }