diff --git a/mg/mglib.h b/mg/mglib.h index 3f7f866bc..2654113a0 100755 --- a/mg/mglib.h +++ b/mg/mglib.h @@ -353,7 +353,7 @@ protected: public: // IO ad alto livello const char *get_next_key() ; - virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock); + virtual void synchronize_bodies(); virtual int remove(TBaseisamfile& f) const ; void add_automatiche(); virtual int write(TBaseisamfile& f) const ; @@ -368,7 +368,7 @@ public: }; -bool rebuild_balances(TString16 annoes, bool reset_giac=FALSE); +bool rebuild_balances(const TString16 annoes, bool reset_giac=FALSE); #define FORM_MAXGIACLEV 4 // numero di livelli giacenza nel form #define FORM_MAXARTLEV 8 // numero di livelli codice nel form diff --git a/mg/mglib02.cpp b/mg/mglib02.cpp index 69fe03c4d..e0f7080b2 100755 --- a/mg/mglib02.cpp +++ b/mg/mglib02.cpp @@ -959,22 +959,23 @@ void TMov_mag::set_body_key(TRectype & rowrec) rowrec.put("NUMREG",get("NUMREG")); } -int TMov_mag::read(TBaseisamfile& f, word op , word lockop) -{ - int res=TMultiple_rectype::read(f,op,lockop); +void TMov_mag::synchronize_bodies() +{ + TMultiple_rectype::synchronize_bodies(); // reset delle strutture per il controlli delle variazioni dei saldi - _annoes=get("ANNOES"); - lines_to_add.destroy(); - lines_to_subtract.destroy(); - - const int nrows = rows(); - - for (int i = 1; i<= nrows; i++) - line_deleted(line2key(i), line2data(i)); - return res; + if (autoload_enabled()) + { + _annoes=get("ANNOES"); + lines_to_add.destroy(); + lines_to_subtract.destroy(); + const int nrows = rows(); + for (int i = 1; i<= nrows; i++) + line_deleted(line2key(i), line2data(i)); + } } + int TMov_mag::remove(TBaseisamfile& f) const { int res; @@ -1334,7 +1335,7 @@ int TMov_mag::codice_esercizio(TDate &d) } //********************** -bool rebuild_balances(TString16 annoes, bool reset_giac) +bool rebuild_balances(const TString16 annoes, bool reset_giac) { TArray used_files; used_files.add(new TLocalisamfile(LF_RMOVMAG),LF_RMOVMAG); @@ -1360,7 +1361,7 @@ bool rebuild_balances(TString16 annoes, bool reset_giac) while (!mag.eof() && currcode==mag.get("CODART")) { mag.put("GIAC",0); - mag.put("RIM",0); + mag.put("RIM",0);mag.put("VALRIM",0); mag.put("ACQ",0);mag.put("VALACQ",0); mag.put("ENT",0);mag.put("VALENT",0); mag.put("VEN",0);mag.put("VALVEN",0);