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
This commit is contained in:
guy 2011-11-09 08:21:19 +00:00
parent 70cd5fce96
commit 50fb6aef88

View File

@ -2138,8 +2138,8 @@ void TFatturazione_lav_app::main_loop()
//preparo la query //preparo la query
TString query; TString query;
TString16 fromcod = _msk->get(F_DACODCF); const TString& fromcod = _msk->get(F_DACODCF);
TString16 tocod = _msk->get(F_ACODCF); const TString& tocod = _msk->get(F_ACODCF);
//&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\") //&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\")
query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")&&" query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")&&"
@ -2156,7 +2156,7 @@ void TFatturazione_lav_app::main_loop()
TISAM_recordset recset(query); TISAM_recordset recset(query);
recset.set_var("#DAL", dal); recset.set_var("#DAL", dal);
recset.set_var("#AL", al); recset.set_var("#AL", al);
TProgind pi(recset.items(), "Fatturazione", true, true); TProgind pi(recset.items(), TR("Fatturazione"), true, true);
long last_clifo = 0; long last_clifo = 0;
int numdocgen = 0; int numdocgen = 0;
int numdocscart = 0; int numdocscart = 0;
@ -2165,6 +2165,7 @@ void TFatturazione_lav_app::main_loop()
real imposta; real imposta;
real totdoc; real totdoc;
real spese; real spese;
TToken_string key;
//TAssoc_array dei clienti per cui ho generato dei documenti //TAssoc_array dei clienti per cui ho generato dei documenti
TAssoc_array cliela; TAssoc_array cliela;
@ -2175,8 +2176,9 @@ void TFatturazione_lav_app::main_loop()
const long clifo = recset.get(DOC_CODCF).as_int(); const long clifo = recset.get(DOC_CODCF).as_int();
if (clifo != last_clifo) if (clifo != last_clifo)
{ {
TString80 str; key.format("C|%ld", clifo);
str << TR("Elaborazione Cliente ") << clifo; TString str;
str << TR("Cliente") << ' ' << clifo << ' ' << cache().get(LF_CLIFO, key, CLI_RAGSOC);
pi.set_text(str); pi.set_text(str);
last_clifo=clifo; last_clifo=clifo;
} }
@ -2199,18 +2201,15 @@ void TFatturazione_lav_app::main_loop()
if (!_solototali) if (!_solototali)
docsout.write(); docsout.write();
numdocgen += items; numdocgen += items;
TString tmp; TString8 tmp;
tmp << lastcli; tmp << lastcli;
cliela.add(tmp, tmp); cliela.add(tmp, tmp);
} }
else if (!_solototali && docsout.items() == 0) //il messaggio deve comparire solo se non ho generato fatture else if (!_solototali && docsout.items() == 0) //il messaggio deve comparire solo se non ho generato fatture
{ {
TToken_string key; key.format("C|%ld", lastcli);
key.add('C');
key.add(lastcli);
TString str; 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); _log->log(0, str);
numdocscart++; numdocscart++;
} }
@ -2239,11 +2238,9 @@ void TFatturazione_lav_app::main_loop()
} }
//preparo la chiave e recupero da CFVEN i dati di quel cliente //preparo la chiave e recupero da CFVEN i dati di quel cliente
TToken_string key; key.format("C|%ld", clifo);
key.add('C');
key.add(clifo);
const TRectype& clienti = cache().get(LF_CFVEN,key); 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); const TRectype& clirec = cache().get(LF_CLIFO,key);
//se il documento che sto analizzando è corretto, allora: //se il documento che sto analizzando è corretto, allora:
@ -2272,8 +2269,8 @@ void TFatturazione_lav_app::main_loop()
if (space) if (space)
//_log->log(0, ""); //_log->log(0, "");
space = false; space = false;
TString msg("Cliente "); TString msg;
msg << clifo << " " << clirec.get(CLI_RICALT) << "Bolla n.ro " << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " in stato " << docrec.get(DOC_STATO); 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); _log->log(0, msg);
} }
@ -2361,13 +2358,13 @@ void TFatturazione_lav_app::main_loop()
doc->put(DOC_CODCABP, cab); doc->put(DOC_CODCABP, cab);
doc->put(DOC_PROGBNP, progbnp); doc->put(DOC_PROGBNP, progbnp);
} }
const TString codpag = clirec.get(CLI_CODPAG); const TString8 codpag = clirec.get(CLI_CODPAG);
if (codpag.full()) if (codpag.full())
{ {
doc_updated |= (doc->get(DOC_CODPAG) != codpag); doc_updated |= (doc->get(DOC_CODPAG) != codpag);
doc->put(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()) if (spinc.full())
{ {
doc_updated |= (doc->get(DOC_PERCSPINC) != spinc); 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++) 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()) if (codart.full())
{ {
@ -2410,7 +2408,7 @@ void TFatturazione_lav_app::main_loop()
TString str; TString str;
str << "Cli." << clifo << ' ' << clirec.get(CLI_RICALT) << " Bolla " << docrec.get(DOC_CODNUM) << ' ' << docrec.get(DOC_TIPODOC) 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) if (rec.get_real("DOTOD") < ZERO)
{ {
@ -2424,33 +2422,34 @@ void TFatturazione_lav_app::main_loop()
msg << str << " Dot.iniz.negativa"; msg << str << " Dot.iniz.negativa";
_log->log(0, msg); _log->log(0, msg);
} }
bool prezzo_nullo = false;
if (prezzo_da_contratto) if (prezzo_da_contratto)
{ {
// Segnalo prezzo nullo solo se il contratto non è ad importo fisso (07/11/2011) // 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()) prezzo_nullo = 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);
}
} }
else else
{ {
const TRiga_documento& rdoc = (*doc)[r]; prezzo_nullo = rdoc.get_real(RDOC_PREZZO).is_zero(); // Prezzo sulla bolla
if (rdoc.get_real(RDOC_PREZZO).is_zero()) // Prezzo nullo sulla bolla }
if (prezzo_nullo)
{ {
const TString8 causale = rdoc.get(RDOC_CODAGG1); const TString8 causale = rdoc.get(RDOC_CODAGG1);
const TCausale_lavanderie& cau = cached_causale_lavanderie(causale); const TCausale_lavanderie& cau = cached_causale_lavanderie(causale);
if (!cau.ignora_prezzo_zero()) // Segnalo anomalia solo se la causale lo prevede (07/11/2011) if (!cau.ignora_prezzo_zero()) // Segnalo anomalia solo se la causale lo prevede (07/11/2011)
{ {
TString msg; TString msg;
msg << str << " Prezzo zero sulla bolla"; msg << str << " Prezzo zero ";
if (prezzo_da_contratto)
msg << "sul contratto";
else
msg << "sulla bolla";
_log->log(0, msg); _log->log(0, msg);
} }
} }
} }
} }
}
docsin.add(doc); docsin.add(doc);
} }