diff --git a/ve/velib03.cpp b/ve/velib03.cpp index 3d86bc673..d08569722 100755 --- a/ve/velib03.cpp +++ b/ve/velib03.cpp @@ -145,6 +145,8 @@ public: CHECKS(magc && strlen(magc) <= 5, "Invalid CODMAG ", magc); _codmagc.add(magc); } + void reset_magc(int r) { _codmagc.add("", r - 1); } + void destroy_magc(int r) { _codmagc.destroy(r - 1); } }; const char* TMov_mag_doc::codmag_rauto(int r) const @@ -702,7 +704,8 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src) // Memorizza tutti i campi chiave const char provv = dst.get_char(RDOC_PROVV); const int anno = dst.get_int(RDOC_ANNO); - const TString4 codnum = dst.get(RDOC_CODNUM); + const TString4 codnum = dst.get(RDOC_CODNUM); + const long numdoc = dst.get_long(RDOC_NDOC); const int nriga = is_riga ? dst.get_int(RDOC_NRIGA) : 0; const long idriga = is_riga ? dst.get_long(RDOC_IDRIGA) : 0; @@ -1270,9 +1273,15 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const const TString & causcons = caulav.get("S2"); if (causcons.full()) + { mov[LF_RMOVMAG][j - 1].put(RMOVMAG_CODCAUS, causcons); + mov.reset_magc(j - 1); + } else + { mov.destroy_row(--j, true); + mov.destroy_magc(j); + } } const real qtarit = r.get(RDOC_QTAGG1); @@ -1282,6 +1291,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const { TRectype & rm = mov.insert_row(j++); + mov.add_magc(""); rm.put(RMOVMAG_IMPIANTO, r.get(RDOC_IMPIANTO)); rm.put(RMOVMAG_LINEA, r.get(RDOC_LINEA)); rm.put(RMOVMAG_CODMAG, r.get(RDOC_CODMAGC));