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:
parent
801514f96b
commit
2c6da54e05
117
lv/lv2500.cpp
117
lv/lv2500.cpp
@ -270,34 +270,25 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
|
|||||||
switch (tipocanfix)
|
switch (tipocanfix)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
|
||||||
for (int k = rigamerce+1; k <= rows; k++)
|
for (int k = rigamerce+1; k <= rows; k++)
|
||||||
{
|
|
||||||
doc.destroy_row(k);
|
doc.destroy_row(k);
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
|
||||||
for (int k = rigamerce+1; k <= rows; k++)
|
for (int k = rigamerce+1; k <= rows; k++)
|
||||||
{
|
{
|
||||||
TRiga_documento& rout = doc[k];
|
TRiga_documento& rout = doc[k];
|
||||||
rout.zero(RDOC_PREZZO);
|
rout.zero(RDOC_PREZZO);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
|
||||||
for (int k = rigamerce+1; k <= rows; k++)
|
for (int k = rigamerce+1; k <= rows; k++)
|
||||||
{
|
{
|
||||||
TRiga_documento& rout = doc[k];
|
TRiga_documento& rout = doc[k];
|
||||||
rout.zero(RDOC_PREZZO);
|
rout.zero(RDOC_PREZZO);
|
||||||
rout.zero(RDOC_QTA);
|
rout.zero(RDOC_QTA);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -336,8 +327,8 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
|
|||||||
|
|
||||||
switch (tipoforf)
|
switch (tipoforf)
|
||||||
{
|
{
|
||||||
case 0: //forfait = NESSUNO
|
case 0: break;//forfait = NESSUNO
|
||||||
break;
|
|
||||||
case 1: //forfait = A VALORE FISSO
|
case 1: //forfait = A VALORE FISSO
|
||||||
{
|
{
|
||||||
rout.put(RDOC_QTA, UNO); //qta fissa a UNO
|
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)
|
switch (contrper)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: descr << " per il giorno"; break;
|
||||||
descr << " per il giorno";
|
case 1: descr << " per la settimana"; break;
|
||||||
break;
|
case 2: descr << " per la quindicina"; break;
|
||||||
case 1:
|
case 3: descr << " per il mese"; break;
|
||||||
descr << " per la settimana";
|
default: break;
|
||||||
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_DESCR,descr);
|
||||||
|
|
||||||
nolorow.put(RDOC_QTA, dot);
|
nolorow.put(RDOC_QTA, dot);
|
||||||
nolorow.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZNOL));
|
nolorow.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZNOL));
|
||||||
|
rout.put(RDOC_QTA, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: //forfait = CICLAGGIO
|
case 3: //forfait = CICLAGGIO
|
||||||
@ -392,8 +375,7 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
|
|||||||
{
|
{
|
||||||
//leggo il flag del tipo ciclaggio
|
//leggo il flag del tipo ciclaggio
|
||||||
const bool cicl2rig = contr.get_bool(LVCONDV_CICLAGGIO);
|
const bool cicl2rig = contr.get_bool(LVCONDV_CICLAGGIO);
|
||||||
//calcolo il valore cicl secondo la formula
|
//calcolo il valore cicl secondo la formula CICL = MINIMO CICLAGGIO * DOT
|
||||||
//CICL = MINIMO CICLAGGIO * DOT
|
|
||||||
const real cicl = rcont.get_real(LVRCONDV_MINCIC) * 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
|
//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
|
//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;
|
break;
|
||||||
case 5: //forfait = FISSO SU DOTAZIONE INIZIALE
|
case 5: //forfait = FISSO SU DOTAZIONE INIZIALE
|
||||||
{
|
{
|
||||||
|
|
||||||
rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART));
|
rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART));
|
||||||
rout.put(RDOC_QTA, artlav.clifomag(annoes)[index].get_real("DOTIN"));
|
rout.put(RDOC_QTA, artlav.clifomag(annoes)[index].get_real("DOTIN"));
|
||||||
const TString80 codartorig=rout.get(RDOC_CODART);
|
const TString80 codartorig=rout.get(RDOC_CODART);
|
||||||
@ -531,13 +512,19 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: break;
|
||||||
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
|
//ADD_ROWS: per adesso un segnaposto
|
||||||
void TFatturazione_lavanderie::add_rows(TRiga_documento & rout, TRiga_documento & rin)
|
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 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
||||||
TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_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
|
//preparo la query sui contratti
|
||||||
TString str;
|
TString str;
|
||||||
@ -806,15 +793,10 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
|
|||||||
TLista_documenti doc_in;
|
TLista_documenti doc_in;
|
||||||
TLista_documenti doc_out;
|
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())
|
for(bool ok = contr.move_first(); ok; ok = contr.move_next())
|
||||||
{
|
{
|
||||||
//scarto i contratti scaduti
|
//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())
|
if (_msk->get_date(F_DADATA) <= contr.get(LVCONDV_DATAIN).as_date() || _msk->get_date(F_ADATA) >= contr.get(LVCONDV_DATASC).as_date())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -823,18 +805,70 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//sacrto tutti quelli a cui ho già fatturato
|
//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;
|
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.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"))
|
if (ini_get_bool(CONFIG_DITTA, "lv", "RifTest"))
|
||||||
elab.put("B15", true); //forzo la descrizione abbreviata
|
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.write();
|
||||||
|
}
|
||||||
|
|
||||||
doc_out.destroy(-1);
|
doc_out.destroy(-1);
|
||||||
|
|
||||||
doc_in.destroy(-1);
|
doc_in.destroy(-1);
|
||||||
@ -933,6 +967,7 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
docsin.destroy(-1);
|
docsin.destroy(-1);
|
||||||
}
|
}
|
||||||
lastcli = clifo;
|
lastcli = clifo;
|
||||||
|
|
||||||
TString tmp;
|
TString tmp;
|
||||||
tmp << lastcli;
|
tmp << lastcli;
|
||||||
cliela.add(tmp, tmp);
|
cliela.add(tmp, tmp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user