From 677c9aeebf99d36472b542255461f63a58e3e96e Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 31 Jan 2010 02:08:17 +0000 Subject: [PATCH] Patch level : 10.0 592 Files correlati : lv2.exe Ricompilazione Demo : [ ] Commento : CCorretto valore convenzionale per articolo git-svn-id: svn://10.65.10.50/trunk@20029 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- lv/lv1200.cpp | 6 +++--- lv/lv2500.cpp | 48 +++++++++++++++++++++++++++++++++--------------- lv/lv2900.cpp | 11 +++++------ 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/lv/lv1200.cpp b/lv/lv1200.cpp index 892a5258c..f14076fd6 100755 --- a/lv/lv1200.cpp +++ b/lv/lv1200.cpp @@ -94,7 +94,7 @@ bool TStampa_a_kg_rep::get_usr_val(const TString& name, TVariant& var) const } } } - else +/* else da decidere se gestire { //preparo una cache sulla tabella delle unità di misura const TRectype& unita = cache().get("%UMS", art.first_um()); @@ -111,8 +111,8 @@ bool TStampa_a_kg_rep::get_usr_val(const TString& name, TVariant& var) const const real qtaconv = qta * fatconv * peso; var = qtaconv; } - } - } + } + } */ } } return true; diff --git a/lv/lv2500.cpp b/lv/lv2500.cpp index 076336ea3..4dc7ba129 100755 --- a/lv/lv2500.cpp +++ b/lv/lv2500.cpp @@ -280,8 +280,10 @@ void TFatturazione_lavanderie::aggiorna_fattura(TDocumento & doc, int codcont) //e/o eliminare quelle inutili e/o aggiungere quelle per il ciclaggio su 2 linee void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_documenti& doc_in) { + bool use_indsp = ini_get_bool(CONFIG_DITTA, "mg", "MOV_INDSPED"); //scorro tutti i documenti di output generati precedentemente - for (int id = 0; id < doc_out.items(); id++) + + for (int id = 0; id < doc_out.items(); id++) { //instanzio il documento e recupero le variabili di interesse per recuperare //il contratto del cliente in questione @@ -473,20 +475,18 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do const TString4 artcli = rcont.get(LVRCONDV_VCARTCLI); real dot; const int annoes = _data_elab.year(); + //instanzio il TArticolo_lavanderia - TArticolo_lavanderie artlav(codart, 'C', clifo, indsped); - //cerco la giacenza per articolo dell'articolo esaminato - const int index = artlav.find_clifomag(annoes); + TArticolo_lavanderie& artlav = cached_article_laundry(codart, 'C', clifo, use_indsp ? indsped : 0); + //estraggo il record corrispondente su LF_CLIFOGIAC + const TRecmag_lavanderie& reclav = artlav.find_rec(annoes); //se lo trovo e se il tipo dotazione è iniziale 'I', allora leggo la dotazione iniziale //dalle giacenze articolo per cliente, altrimenti leggo la dotazione odierna - if (index >= 0) - { - if (tipodot == "I") - dot = artlav.clifomag(annoes)[index].get_real("DOTIN"); - else - dot = artlav.clifomag(annoes)[index].get_real("DOTOD"); - } + if (tipodot == "I") + dot = reclav.get_real("DOTIN"); + else + dot = reclav.get_real("DOTOD"); //leggo dalla riga contratto il tipo forfait const int tipoforf = rcont.get_int(LVRCONDV_TIPOFORF); @@ -675,6 +675,8 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do //instanzio i due real che andranno a contenere l'importo covenzionale totale e il consumo totale real impconvtot; real consumotot; + TAssoc_array arts; + //scorro tutte le righe documento dalla riga in esame fino alla fine for (int j = i; j < doc.physical_rows(); j++) @@ -685,9 +687,24 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do const TString80 codart = riga.get(RDOC_CODART); const TRectype & rcont = contr.row(codart); const char tipvalconvcli = rcont.get_char(LVRCONDV_VCARTCLI); - if (tipvalconvcli == 'C') + if (tipvalconvcli == 'C') { - impconvtot += dot * rcont.get_real(LVRCONDV_VALCONV) * rcont.get_real(LVRCONDV_FORFPERCL) / CENTO; + if (arts.objptr(codart) == NULL) + { + const TString4 tipodot = rcont.get(LVRCONDV_NOLCIC); + TArticolo_lavanderie& artlav = cached_article_laundry(codart, 'C', clifo, use_indsp ? indsped : 0); + //estraggo il record corrispondente su LF_CLIFOGIAC + const TRecmag_lavanderie& reclav = artlav.find_rec(annoes); + //se lo trovo e se il tipo dotazione è iniziale 'I', allora leggo la dotazione iniziale + //dalle giacenze articolo per cliente, altrimenti leggo la dotazione odierna + if (tipodot == "I") + dot = reclav.get_real("DOTIN"); + else + dot = reclav.get_real("DOTOD"); + const real impconv = dot * rcont.get_real(LVRCONDV_VALCONV) * rcont.get_real(LVRCONDV_FORFPERCL) / CENTO; + impconvtot += impconv; + arts.add(codart, codart); + } consumotot += riga.get_real(RDOC_QTA) * riga.get_real(RDOC_PREZZO); } } @@ -719,7 +736,8 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do const TString80 codart = delrow.get(RDOC_CODART); const TRectype& rcont = contr.row(codart); const char tipvalconvcli = rcont.get_char(LVRCONDV_VCARTCLI); - if (tipvalconvcli == 'C') + char lavtype = delrow.get_char("LVTYPE"); + if (tipvalconvcli == 'C' && (lavtype == '\0' || lavtype == 'C')) doc.destroy_row(k, true); } } @@ -731,7 +749,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do 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")); + rout.put(RDOC_QTA, reclav.get_real("DOTIN")); const TString80 codartorig=rout.get(RDOC_CODART); for (int h = doc.physical_rows(); h > i; h--) diff --git a/lv/lv2900.cpp b/lv/lv2900.cpp index b59bb2f9f..3ed4c6d80 100755 --- a/lv/lv2900.cpp +++ b/lv/lv2900.cpp @@ -423,8 +423,7 @@ bool TConta_pulito_msk::elabora_file(const TFilename& file, TLog_report& logrep) TDate data(atoi(riga.mid(78, 2)), atoi(riga.mid(80, 2)), atoi(riga.mid(82, 4))); - int codcf = atoi(riga.mid(86, 6)); - + long codcf = atol(riga.mid(86, 6)); const bool ann = riga.mid(100, 1)[0] == 'S' ? true : false; TRiga_pacco* rp = new TRiga_pacco(); @@ -433,7 +432,7 @@ bool TConta_pulito_msk::elabora_file(const TFilename& file, TLog_report& logrep) rp->set_quantita(qta); rp->set_data(data); - if(codcf > 0) + if (codcf > 0L) { rp->set_cliente(codcf); //eventualmente vuoto TDate databo(atoi(riga.mid(92, 2)), atoi(riga.mid(94, 2)), atoi(riga.mid(96, 4))); @@ -726,7 +725,7 @@ void TConta_pulito_msk::prepara_movimenti(const TFilename& file, TAssoc_array& m long codcf = _codcf; //se non ho lanciato il programma da linea di comando, leggo i paramtri dalla maschera - if (_auto != 'A') + if (_auto != "A") { dadata = get_date(F_DADATA); adata = get_date(F_ADATA); @@ -794,7 +793,7 @@ bool TConta_pulito_msk::genera_movmag(TAssoc_array& movimenti) //cerco l'ultimo numero di chiave in movmag TISAM_recordset mov("USE MOVMAG"); long nummov = 0; - if(!mov.move_first()) + if(mov.move_last()) nummov += mov.get(MOVMAG_NUMREG).as_int(); TLocalisamfile movi(LF_MOVMAG); @@ -805,7 +804,7 @@ bool TConta_pulito_msk::genera_movmag(TAssoc_array& movimenti) long codcf = _codcf; //se non ho lanciato il programma da linea di comando, leggo i paramtri dalla maschera - if (_auto != 'A') + if (_auto != "A") { dadata = get_date(F_DADATA); adata = get_date(F_ADATA);