diff --git a/lv/lv2500.cpp b/lv/lv2500.cpp index adabcd500..97f5afe7d 100755 --- a/lv/lv2500.cpp +++ b/lv/lv2500.cpp @@ -137,7 +137,7 @@ protected: public: bool is_document_compatible(const TRectype & doc) const; - int write_fatt_ragg(); + int write_fatt_ragg(const bool solotot); void set_perc_provv(TRiga_documento & row, bool prima = true); virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out, const TDate& data_elab, bool interattivo = false); @@ -270,7 +270,7 @@ void TFatturazione_lavanderie::pre_process_input(TLista_documenti& doc_in) } } -void TFatturazione_lavanderie::aggiorna_fattura(TDocumento & doc, int codcont) +void TFatturazione_lavanderie::aggiorna_fattura(TDocumento& doc, int codcont) { const int nrows = doc.physical_rows(); const long codcf = doc.get_long(DOC_CODCF); @@ -325,7 +325,7 @@ void TFatturazione_lavanderie::aggiorna_fattura(TDocumento & doc, int codcont) } } -void TFatturazione_lavanderie::add_doc_to_list(const TString & key, const TDocumento & doc) +void TFatturazione_lavanderie::add_doc_to_list(const TString& key, const TDocumento& doc) { TDocumento * doc_cli = (TDocumento *) _doc_grouped.objptr(key); @@ -491,7 +491,7 @@ void TFatturazione_lavanderie::set_perc_provv(TRiga_documento & row, bool prima) } } -int TFatturazione_lavanderie::write_fatt_ragg() +int TFatturazione_lavanderie::write_fatt_ragg(const bool solotot) { int items = _doc_grouped.items(); TString_array kl; @@ -502,7 +502,7 @@ int TFatturazione_lavanderie::write_fatt_ragg() { TDocumento * d = (TDocumento *)_doc_grouped.objptr(*key); - if (d != NULL) + if (d != NULL && !solotot) d->write(); } _doc_grouped.destroy(); @@ -1860,9 +1860,9 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion TRectype& riga = rcont.cursor()->curr(); const int tipoforf = riga.get_int(LVRCONDV_TIPOFORF); - if (tipoforf > 0 && - ((tipoforf == 2) || - (tipoforf != 2 && fattnocons))) + //il nolo deve esserci sempre, il ciclaggio solo se fattnocons -> per me l'if diventa: + //if (tipoforf > 0 && (tipoforf != 2 && fattnocons)) + if (tipoforf > 0 && ((tipoforf == 2) || (tipoforf != 2 && fattnocons))) { TRiga_documento& rdoc = doc.new_row("21"); @@ -2142,8 +2142,8 @@ void TFatturazione_lav_app::main_loop() query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")&&" << "STR(BETWEEN(CODCF,\"" << fromcod << "\",\"" << tocod << "\"))\n" << "BY TIPOCF CODCF DATADOC\n" - << "FROM DATADOC=" << dal << " PROVV=D ANNO=" << year << "\n" - << "TO DATADOC=" << al << " PROVV=D ANNO=" << year << "\n"; + << "FROM DATADOC=#DAL PROVV=D ANNO=" << year << "\n" + << "TO DATADOC=#AL PROVV=D ANNO=" << year << "\n"; // query << "USE DOC KEY 2 SELECT BETWEEN(DATADOC,#DADATA,#ADATA)&&STATO==\"2\")&&(TIPODOC==\"B01\")\n" // << "FROM " << "TIPOCF=C PROVV=D ANNO=#ANNO DATADOC=#DADATA \n" // << "TO " << "TIPOCF=C PROVV=D ANNO=#ANNO DATADOC=#ADATA \n"; @@ -2151,6 +2151,8 @@ void TFatturazione_lav_app::main_loop() //instanzio il recordset011 TISAM_recordset recset(query); + recset.set_var("#DAL", dal); + recset.set_var("#AL", al); TProgind pi(recset.items(), "Fatturazione", true, true); long last_clifo = 0; int numdocgen = 0; @@ -2433,7 +2435,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) @@ -2475,7 +2477,7 @@ void TFatturazione_lav_app::main_loop() } genera_bolle_nolo(cliela, elab, numdocgen, totimp, imposta, totdoc, spese); - numdocgen += elab.write_fatt_ragg(); + numdocgen += elab.write_fatt_ragg(_solototali); TString str; const TString16 parolapl = _solototali ? "generate " : "elaborate ";