Patch level : 10.970

Files correlati     :  lv2.exe
Ricompilazione Demo : [ ]
Commento            :

Modifiche fatturazione


git-svn-id: svn://10.65.10.50/branches/R_10_00@21913 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2011-04-06 15:30:05 +00:00
parent 377c121076
commit a78da73521

@ -136,6 +136,7 @@ protected:
real get_percprovv(const TRiga_documento & row, char tipoprovv, const TString & codpr, bool first, const TRectype & age) const;
public:
bool is_document_compatible(const TRectype & doc) const;
int write_fatt_ragg();
void set_perc_provv(TRiga_documento & row, bool prima = true);
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
@ -153,6 +154,28 @@ TFatturazione_lavanderie::TFatturazione_lavanderie(const char* cod, bool prova)
{
}
bool TFatturazione_lavanderie::is_document_compatible(const TRectype & doc) const
{
bool ok = false;
const TString4 codnum(doc.get(DOC_CODNUM));
const TString4 tipodoc(doc.get(DOC_TIPODOC));
const char stato(doc.get_char(DOC_STATO));
const TString& codnumel = codice_numerazione_iniziale();
if (codnumel.blank() || codnum == codnumel)
{
for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)
{
const TString & tipel = tipo_iniziale(i);
if (tipel.blank())
break;
if (tipodoc == tipel)
ok = true;
}
}
return ok;
}
//DOC_RAGGRUPPABILI: metodo che restituisce true se i documenti sono raggruppabili sulla base dei campi
//contenuti nella stringa campi
bool TFatturazione_lavanderie::doc_raggruppabili(const TDocumento& doc_in, const TDocumento& doc_out, TToken_string& campi) const
@ -2131,6 +2154,8 @@ void TFatturazione_lav_app::main_loop()
TProgind pi(recset.items(), "Fatturazione", true, true);
long last_clifo = 0;
int numdocgen = 0;
int numdocscart = 0;
bool space = true;
real totimp;
real imposta;
real totdoc;
@ -2173,13 +2198,25 @@ void TFatturazione_lav_app::main_loop()
tmp << lastcli;
cliela.add(tmp, tmp);
}
else
if (!_solototali)
{
TString str;
TToken_string key;
key.add('C');
key.add(lastcli);
str << "Cli." << lastcli << ' ' << cache().get(LF_CLIFO, key, CLI_RICALT) << " non ha generato la fattura pur avendo bolle";
_log->log(0, str);
numdocscart++;
}
docsout.destroy(-1);
if (!_solototali)
docsin.rewrite();
docsin.destroy(-1);
}
lastcli = clifo;
space = true;
}
//preparo la chiave e recupero da CFVEN i dati di quel cliente
@ -2197,7 +2234,7 @@ void TFatturazione_lav_app::main_loop()
//se il codice di zona è pieno, allora:
if (mskzona.full())
{
//leggo il codice di zona standard di quel cliente e lo confronto con quello della mascera (V o F)
//leggo il codice di zona standard di quel cliente e lo confronto con quello della maschera (V o F)
const TString& codzona = clienti.get(CFV_CODZONA);
cliok = (codzona == mskzona);
}
@ -2205,16 +2242,19 @@ void TFatturazione_lav_app::main_loop()
//se il codice categoria economica è pieno e ho passato il test sul codice di zona, allora:
if (cliok && mskcat.full())
{
//leggo il codice categoria economica standard di quel cliente e lo confronto con quello della mascera (V o F)
//leggo il codice categoria economica standard di quel cliente e lo confronto con quello della maschera (V o F)
const TString& codcat = clienti.get(CFV_CODCATC);
cliok = (codcat == mskcat);
}
}
else
if (!_solototali && docrec.get(DOC_STATO) < stato_min)
if (!_solototali && elab.is_document_compatible(docrec) && docrec.get(DOC_STATO) < stato_min)
{
TString msg("Bolla n.ro ");
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << "Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " in stato " << docrec.get(DOC_STATO);
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);
_log->log(0, msg);
}
@ -2319,8 +2359,12 @@ void TFatturazione_lav_app::main_loop()
}
if (doc_updated)
{
TString msg("Bolla n.ro ");
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " aggiornata la testata ";
if (space)
_log->log(0, "");
space = false;
TString msg(" Cli.");
msg << clifo << " " << clirec.get(CLI_RICALT) << "Bolla " << docrec.get(DOC_CODNUM) << ' ' << docrec.get(DOC_TIPODOC) << ' ' << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " aggiornata la testata ";
_log->log(0, msg);
}
}
@ -2335,27 +2379,43 @@ void TFatturazione_lav_app::main_loop()
//estraggo il record corrispondente su LF_CLIFOGIAC
const TRecmag_lavanderie& rec = art.find_rec(annoes);
if (space)
_log->log(0, "");
space = false;
TString str;
str << "Bolla " << docrec.get(DOC_CODNUM) << '|' << docrec.get(DOC_TIPODOC) << " n.ro " << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC)
<< " Cliente " << clifo << ' ' << clirec.get(CLI_RAGSOC) << " articolo " << codart << " - ";
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 << " - ";
if (rec.get_real("DOTOD") < ZERO)
{
TString msg;
msg << str << " Dotazione odierna negativa";
msg << str << " Dot.odier.negativa";
_log->log(0, msg);
}
if (rec.get_real("DOTIN") < ZERO)
{
TString msg;
msg << str << " Dotazione iniziale negativa";
msg << str << " Dot.iniz.negativa";
_log->log(0, msg);
}
if (prezzo_da_contratto && rcont.get_real(LVRCONDV_PREZZO) == ZERO)
if (prezzo_da_contratto)
{
TString msg;
msg << str << " Prezzo da contratto zero";
_log->log(0, msg);
if (rcont.get_real(LVRCONDV_PREZZO) == ZERO)
{
TString msg;
msg << str << " Prezzo zero";
_log->log(0, msg);
}
}
else
{
if ((*doc)[r].get_real(RDOC_PREZZO) == ZERO)
{
TString msg;
msg << str << " Prezzo zero";
_log->log(0, msg);
}
}
}
}
@ -2373,6 +2433,7 @@ void TFatturazione_lav_app::main_loop()
elab.elabora(docsin, docsout, datafat);
const int items = docsout.items();
if (docsout.items() == 0)
if (items > 0)
{
if (!_solototali)
@ -2391,6 +2452,22 @@ void TFatturazione_lav_app::main_loop()
spese += doc.spese();
}
}
else
if (!_solototali)
{
if (space)
_log->log(0, "");
space = false;
TString str;
TToken_string key;
key.add('C');
key.add(lastcli);
str << "Cli." << lastcli << ' ' << cache().get(LF_CLIFO, key, CLI_RICALT) << " non ha generato la fattura pur avendo bolle";
_log->log(0, str);
numdocscart++;
}
docsout.destroy(-1);
if (!_solototali)
docsin.rewrite();
@ -2420,6 +2497,10 @@ void TFatturazione_lav_app::main_loop()
str.format(" %5d", numdocgen);
str << totimp.stringa(17) << imposta.stringa(15) << totdoc.stringa(15) << spese.stringa(13);
_log->log(0, str);
str = "Numero fatture scartate";
_log->log(0, str);
str.format(" %5d", numdocscart);
_log->log(0, str);
_log->print_or_preview();
delete _log;
}