Patch level : 10.0 patch 421

Files correlati     : lv2
Ricompilazione Demo : [ ]
Commento            :
Corretta la generazione delle fatrture di solo nolo


git-svn-id: svn://10.65.10.50/trunk@19643 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca83 2009-11-17 17:40:01 +00:00
parent 801514f96b
commit 2c6da54e05

View File

@ -134,7 +134,7 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
bool rifbol = contr.get_bool(LVCONDV_RIFBOL);
bool riftest = ini_get_bool(CONFIG_DITTA, "lv", "RifTest");
if (doc.physical_rows()>0 && doc[1].is_descrizione())
if (doc.physical_rows() > 0 && doc[1].is_descrizione())
{
if (elcons)
{
@ -174,9 +174,9 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
if (ragart)
{
real totmerc;
const int rows=doc.physical_rows();
const int rows = doc.physical_rows();
for (int i=1; i<=rows; i++) //calcolo totale merce
for (int i=1; i <= rows; i++) //calcolo totale merce
{
const TRiga_documento& riga = doc[i];
if (riga.is_merce())
@ -270,34 +270,25 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
switch (tipocanfix)
{
case 0:
{
for (int k = rigamerce+1; k <= rows; k++)
{
doc.destroy_row(k);
}
}
break;
case 1:
{
for (int k = rigamerce+1; k <= rows; k++)
{
TRiga_documento& rout = doc[k];
rout.zero(RDOC_PREZZO);
}
}
break;
case 2:
{
for (int k = rigamerce+1; k <= rows; k++)
{
TRiga_documento& rout = doc[k];
rout.zero(RDOC_PREZZO);
rout.zero(RDOC_QTA);
}
}
break;
default:
break;
default: break;
}
break;
}
@ -325,10 +316,10 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
//dalle giacenze articolo per cliente, altrimenti leggo la dotazione odierna
if (index >=0)
{
if (tipodot=="I")
dot=artlav.clifomag(annoes)[index].get_real("DOTIN");
if (tipodot == "I")
dot = artlav.clifomag(annoes)[index].get_real("DOTIN");
else
dot=artlav.clifomag(annoes)[index].get_real("DOTOD");
dot = artlav.clifomag(annoes)[index].get_real("DOTOD");
}
//leggo dalla riga contratto il tipo forfait
@ -336,8 +327,8 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
switch (tipoforf)
{
case 0: //forfait = NESSUNO
break;
case 0: break;//forfait = NESSUNO
case 1: //forfait = A VALORE FISSO
{
rout.put(RDOC_QTA, UNO); //qta fissa a UNO
@ -358,25 +349,17 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
switch (contrper)
{
case 0:
descr << " per il giorno";
break;
case 1:
descr << " per la settimana";
break;
case 2:
descr << " per la quindicina";
break;
case 3:
descr << " per il mese";
break;
default:
break;
case 0: descr << " per il giorno"; break;
case 1: descr << " per la settimana"; break;
case 2: descr << " per la quindicina"; break;
case 3: descr << " per il mese"; break;
default: break;
}
nolorow.put(RDOC_DESCR,descr);
nolorow.put(RDOC_QTA, dot);
nolorow.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZNOL));
rout.put(RDOC_QTA, 0);
}
break;
case 3: //forfait = CICLAGGIO
@ -392,8 +375,7 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
{
//leggo il flag del tipo ciclaggio
const bool cicl2rig = contr.get_bool(LVCONDV_CICLAGGIO);
//calcolo il valore cicl secondo la formula
//CICL = MINIMO CICLAGGIO * DOT
//calcolo il valore cicl secondo la formula CICL = MINIMO CICLAGGIO * DOT
const real cicl = rcont.get_real(LVRCONDV_MINCIC) * dot;
//se il ciclaggio è su due linee, allora aggiungo una riga merce, per pareggiare il minimo ciclaggio
//che ha come quantità la differenza tra la quantità di minimo cilcaggio
@ -517,7 +499,6 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
break;
case 5: //forfait = FISSO SU DOTAZIONE INIZIALE
{
rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART));
rout.put(RDOC_QTA, artlav.clifomag(annoes)[index].get_real("DOTIN"));
const TString80 codartorig=rout.get(RDOC_CODART);
@ -527,17 +508,23 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
TRiga_documento& delrow = doc[h];
const TString80 codart=delrow.get(RDOC_CODART);
if ( codartorig == codart)
doc.destroy_row(h,true);
doc.destroy_row(h, true);
}
}
break;
default:
break;
default: break;
}
}
}
for(int h = doc.physical_rows(); h > 0; h--)
{
TRiga_documento& rdoc = doc[h];
if (rdoc.get(RDOC_DESCR).empty())
doc.destroy_row(h, true);
}
}
}
//ADD_ROWS: per adesso un segnaposto
void TFatturazione_lavanderie::add_rows(TRiga_documento & rout, TRiga_documento & rin)
@ -789,7 +776,7 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
{
TString4 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
char stato = cache().get("%TIP", tipodoc, "S2").left(1)[0];
char stato = cache().get("%TIP", tipodoc, "S2").mid(1,1)[0];
//preparo la query sui contratti
TString str;
@ -806,15 +793,10 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
TLista_documenti doc_in;
TLista_documenti doc_out;
TDocumento doc('D', _msk->get_date(F_DATAFAT).year(), codnum, 0);
doc.put(DOC_TIPODOC, tipodoc);
doc.put(DOC_STATO, stato);
doc.put(DOC_TIPOCF, 'C');
for(bool ok = contr.move_first(); ok; ok = contr.move_next())
{
//scarto i contratti scaduti
if (contr.get(LVCONDV_DATASC).as_date().ok())
if (_msk->get_date(F_DADATA) <= contr.get(LVCONDV_DATAIN).as_date() || _msk->get_date(F_ADATA) >= contr.get(LVCONDV_DATASC).as_date())
continue;
@ -823,18 +805,70 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
continue;
//sacrto tutti quelli a cui ho già fatturato
if(!cliela.is_key(contr.get(LVCONDV_CODCF).as_string()))
if(cliela.is_key(contr.get(LVCONDV_CODCF).as_string()))
continue;
TDocumento *pdoc= new TDocumento('D', _msk->get_date(F_DATAFAT).year(), codnum, 0);
doc_in.add(pdoc);
TDocumento& doc = *pdoc;
doc.put(DOC_TIPODOC, tipodoc);
doc.put(DOC_STATO, stato);
doc.put(DOC_TIPOCF, 'C');
doc.put(DOC_CODCF, contr.get(LVCONDV_CODCF).as_int());
doc_in.add(doc);
TLaundry_contract contratto(contr.cursor()->curr());
const long codcf = contratto.get_long(LVCONDV_CODCF);
const int codcont = contratto.get_int(LVCONDV_CODCONT);
TString str;
str << "USE LVRCONDV\n"
<< "FROM CODCF=" << codcf << " CODCONT=" << codcont << "\n"
<< "TO CODCF=" << codcf << " CODCONT=" << codcont;
TISAM_recordset rcont(str);
for(bool ok = rcont.move_first(); ok; ok = rcont.move_next())
{
TRectype& riga = rcont.cursor()->curr();
if (riga.get_int(LVRCONDV_TIPOFORF) == 2)
{
TRiga_documento& rdoc = doc.new_row("21");
rdoc.put(RDOC_CODART, riga.get(LVRCONDV_CODART));
rdoc.put(RDOC_CODARTMAG, riga.get(LVRCONDV_CODART));
rdoc.put(RDOC_QTA, 1);
rdoc.put(RDOC_QTAGG1, 1);
rdoc.put(RDOC_PREZZO, riga.get_real(LVRCONDV_PREZNOL));
rdoc.put(RDOC_CHECKED, true);
rdoc.put(RDOC_UMQTA, riga.get(LVRCONDV_UM));
TToken_string key;
key.add('C');
key.add(codcf);
TString8 codiva = cache().get(LF_CFVEN, key, CFV_ASSFIS);
if (codiva.blank())
codiva = cache().get(LF_ANAMAG, riga.get(LVRCONDV_CODART), ANAMAG_CODIVA);
rdoc.put(RDOC_CODIVA, codiva);
rdoc.put(RDOC_CODAGG1, riga.get(LVRCONDV_CAUSLAV));
}
}
if (ini_get_bool(CONFIG_DITTA, "lv", "RifTest"))
elab.put("B15", true); //forzo la descrizione abbreviata
elab.elabora(doc_in, doc_out, _msk->get_date(F_DATAFAT));
if (doc.rows() > 0)
{
elab.elabora(doc_in, doc_out, _msk->get_date(F_DATAFAT));
doc_out.write();
}
doc_out.destroy(-1);
doc_in.destroy(-1);
@ -933,6 +967,7 @@ void TFatturazione_lav_app::main_loop()
docsin.destroy(-1);
}
lastcli = clifo;
TString tmp;
tmp << lastcli;
cliela.add(tmp, tmp);