diff --git a/lv/lv2500.cpp b/lv/lv2500.cpp index d87825664..8eef185a9 100755 --- a/lv/lv2500.cpp +++ b/lv/lv2500.cpp @@ -693,15 +693,15 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do 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); + TArticolo_lavanderie& art = 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); + const TRecmag_lavanderie& rec = art.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"); + dot = rec.get_real("DOTIN"); else - dot = reclav.get_real("DOTOD"); + dot = rec.get_real("DOTOD"); const real impconv = dot * rcont.get_real(LVRCONDV_VALCONV) * rcont.get_real(LVRCONDV_FORFPERCL) / CENTO; impconvtot += impconv; arts.add(codart, codart); @@ -729,6 +729,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do } else { + rout.put(RDOC_DESCR, "Valore convenzionale"); rout.put(RDOC_QTA, UNO); rout.put(RDOC_PREZZO, impconvtot); for (int k = doc.physical_rows(); k > i; k--) diff --git a/lv/lvlib.cpp b/lv/lvlib.cpp index 10b83e3dd..b5c744fde 100755 --- a/lv/lvlib.cpp +++ b/lv/lvlib.cpp @@ -562,6 +562,33 @@ const TString & TArticolo_lavanderie::get_str(const char* fieldname) const return EMPTY_STRING; } +void TArticolo_lavanderie::set_tipocf(char tipocf) +{ + if (_tipocf != tipocf) + { + _tipocf = tipocf; + remove_body(LF_CLIFOGIAC); + } +} + +void TArticolo_lavanderie::set_codcf(long codcf) +{ + if (_codcf != codcf) + { + _codcf = codcf; + remove_body(LF_CLIFOGIAC); + } +} + +void TArticolo_lavanderie::set_indsped(int indsped) +{ + if (_indsped != indsped) + { + _indsped = indsped; + remove_body(LF_CLIFOGIAC); + } +} + void TArticolo_lavanderie::set_body_key(TRectype & rowrec) { const int logicnum = rowrec.num(); @@ -716,6 +743,7 @@ TArticolo_lavanderie & cached_article_laundry(const char * codart, const char ti { HIDDEN TCache_articoli_lavanderie __cache_articoli_lavanderie; + TArticolo_lavanderie & art = __cache_articoli_lavanderie.lav(codart); art.set_tipocf(tipocf); diff --git a/lv/lvlib.h b/lv/lvlib.h index f6f0e251f..914a6c760 100755 --- a/lv/lvlib.h +++ b/lv/lvlib.h @@ -129,9 +129,9 @@ public: TRecord_array & clifomag(int annoes) const; TRecord_array & clifomag(const char * annoes) const { return clifomag(atoi(annoes));} - void set_tipocf(char tipocf) { _tipocf = tipocf;} - void set_codcf(long codcf) { _codcf = codcf;} - void set_indsped(int indsped) { _indsped = indsped;} + void set_tipocf(char tipocf); + void set_codcf(long codcf); + void set_indsped(int indsped); const TRecmag_lavanderie & find_rec(int annoes) const; const TRecmag_lavanderie & find_rec(const char * annoes) const { return find_rec(atoi(annoes)); } diff --git a/ve/velib03.cpp b/ve/velib03.cpp index efc90005b..37bc14905 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -1265,15 +1265,14 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const const TRectype & caulav = cache().get("&LVCAU", codcauslav); if (!caulav.empty()) { - if (!qta.is_zero()) + if (!qta.is_zero() && (j > 1)) { const TString & causcons = caulav.get("S2"); - CHECK(j > 1, "Wrong row number"); - if (causcons.full()) - mov[LF_RMOVMAG][j - 1].put(RMOVMAG_CODCAUS, causcons); - else - mov.destroy_row(--j, true); + if (causcons.full()) + mov[LF_RMOVMAG][j - 1].put(RMOVMAG_CODCAUS, causcons); + else + mov.destroy_row(--j, true); } const real qtarit = r.get(RDOC_QTAGG1);