From 50fb6aef883a9036b4d3eea114560f0762c6a136 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 9 Nov 2011 08:21:19 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : Corrette segnalazioni su prezzi nulli git-svn-id: svn://10.65.10.50/branches/R_10_00@22480 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- lv/lv2500.cpp | 77 +++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/lv/lv2500.cpp b/lv/lv2500.cpp index 7de50e89f..4da688cc3 100755 --- a/lv/lv2500.cpp +++ b/lv/lv2500.cpp @@ -2138,8 +2138,8 @@ void TFatturazione_lav_app::main_loop() //preparo la query TString query; - TString16 fromcod = _msk->get(F_DACODCF); - TString16 tocod = _msk->get(F_ACODCF); + const TString& fromcod = _msk->get(F_DACODCF); + const TString& tocod = _msk->get(F_ACODCF); //&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\") query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")&&" @@ -2156,7 +2156,7 @@ void TFatturazione_lav_app::main_loop() TISAM_recordset recset(query); recset.set_var("#DAL", dal); recset.set_var("#AL", al); - TProgind pi(recset.items(), "Fatturazione", true, true); + TProgind pi(recset.items(), TR("Fatturazione"), true, true); long last_clifo = 0; int numdocgen = 0; int numdocscart = 0; @@ -2165,6 +2165,7 @@ void TFatturazione_lav_app::main_loop() real imposta; real totdoc; real spese; + TToken_string key; //TAssoc_array dei clienti per cui ho generato dei documenti TAssoc_array cliela; @@ -2175,8 +2176,9 @@ void TFatturazione_lav_app::main_loop() const long clifo = recset.get(DOC_CODCF).as_int(); if (clifo != last_clifo) { - TString80 str; - str << TR("Elaborazione Cliente ") << clifo; + key.format("C|%ld", clifo); + TString str; + str << TR("Cliente") << ' ' << clifo << ' ' << cache().get(LF_CLIFO, key, CLI_RAGSOC); pi.set_text(str); last_clifo=clifo; } @@ -2199,18 +2201,15 @@ void TFatturazione_lav_app::main_loop() if (!_solototali) docsout.write(); numdocgen += items; - TString tmp; + TString8 tmp; tmp << lastcli; cliela.add(tmp, tmp); } else if (!_solototali && docsout.items() == 0) //il messaggio deve comparire solo se non ho generato fatture { - TToken_string key; - key.add('C'); - key.add(lastcli); - + key.format("C|%ld", lastcli); TString str; - str << "Cli." << lastcli << ' ' << cache().get(LF_CLIFO, key, CLI_RICALT) << " non ha generato la fattura pur avendo bolle"; + str << "Cli. " << lastcli << ' ' << cache().get(LF_CLIFO, key, CLI_RICALT) << " non ha generato la fattura pur avendo bolle"; _log->log(0, str); numdocscart++; } @@ -2239,11 +2238,9 @@ void TFatturazione_lav_app::main_loop() } //preparo la chiave e recupero da CFVEN i dati di quel cliente - TToken_string key; - key.add('C'); - key.add(clifo); + key.format("C|%ld", clifo); const TRectype& clienti = cache().get(LF_CFVEN,key); - const TRectype & docrec = recset.cursor()->curr(); + const TRectype& docrec = recset.cursor()->curr(); const TRectype& clirec = cache().get(LF_CLIFO,key); //se il documento che sto analizzando è corretto, allora: @@ -2272,8 +2269,8 @@ void TFatturazione_lav_app::main_loop() if (space) //_log->log(0, ""); space = false; - TString msg("Cliente "); - msg << clifo << " " << clirec.get(CLI_RICALT) << "Bolla n.ro " << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " in stato " << docrec.get(DOC_STATO); + TString msg; + msg << "Cli. " << clifo << ' ' << clirec.get(CLI_RICALT) << " Bolla n. " << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " in stato " << docrec.get(DOC_STATO); _log->log(0, msg); } @@ -2361,13 +2358,13 @@ void TFatturazione_lav_app::main_loop() doc->put(DOC_CODCABP, cab); doc->put(DOC_PROGBNP, progbnp); } - const TString codpag = clirec.get(CLI_CODPAG); + const TString8 codpag = clirec.get(CLI_CODPAG); if (codpag.full()) { doc_updated |= (doc->get(DOC_CODPAG) != codpag); doc->put(DOC_CODPAG, codpag); } - const TString spinc = clienti.get(CFV_PERCSPINC); + const TString8 spinc = clienti.get(CFV_PERCSPINC); if (spinc.full()) { doc_updated |= (doc->get(DOC_PERCSPINC) != spinc); @@ -2395,7 +2392,8 @@ void TFatturazione_lav_app::main_loop() } for (int r = 1; !_solototali && r <= doc->physical_rows(); r++) { - const TString & codart = (*doc)[r].get(RDOC_CODARTMAG); + const TRiga_documento& rdoc = (*doc)[r]; + const TString80 codart = rdoc.get(RDOC_CODARTMAG); if (codart.full()) { @@ -2410,7 +2408,7 @@ void TFatturazione_lav_app::main_loop() TString str; str << "Cli." << clifo << ' ' << clirec.get(CLI_RICALT) << " Bolla " << docrec.get(DOC_CODNUM) << ' ' << docrec.get(DOC_TIPODOC) - << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " art." << codart << " - "; + << ' ' << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " art." << codart << " - "; if (rec.get_real("DOTOD") < ZERO) { @@ -2424,30 +2422,31 @@ void TFatturazione_lav_app::main_loop() msg << str << " Dot.iniz.negativa"; _log->log(0, msg); } + + bool prezzo_nullo = false; if (prezzo_da_contratto) { // Segnalo prezzo nullo solo se il contratto non è ad importo fisso (07/11/2011) - if (rcont.get_real(LVRCONDV_PREZZO).is_zero() && contr.get_real(LVCONDV_IMPFIX).is_zero()) - { - TString msg; - msg << str << " Prezzo zero sul contratto"; - _log->log(0, msg); - } + prezzo_nullo = rcont.get_real(LVRCONDV_PREZZO).is_zero() && contr.get_real(LVCONDV_IMPFIX).is_zero(); } else { - const TRiga_documento& rdoc = (*doc)[r]; - if (rdoc.get_real(RDOC_PREZZO).is_zero()) // Prezzo nullo sulla bolla - { - const TString8 causale = rdoc.get(RDOC_CODAGG1); - const TCausale_lavanderie& cau = cached_causale_lavanderie(causale); - if (!cau.ignora_prezzo_zero()) // Segnalo anomalia solo se la causale lo prevede (07/11/2011) - { - TString msg; - msg << str << " Prezzo zero sulla bolla"; - _log->log(0, msg); - } - } + prezzo_nullo = rdoc.get_real(RDOC_PREZZO).is_zero(); // Prezzo sulla bolla + } + if (prezzo_nullo) + { + const TString8 causale = rdoc.get(RDOC_CODAGG1); + const TCausale_lavanderie& cau = cached_causale_lavanderie(causale); + if (!cau.ignora_prezzo_zero()) // Segnalo anomalia solo se la causale lo prevede (07/11/2011) + { + TString msg; + msg << str << " Prezzo zero "; + if (prezzo_da_contratto) + msg << "sul contratto"; + else + msg << "sulla bolla"; + _log->log(0, msg); + } } } }