diff --git a/src/cg/cgpim.cpp b/src/cg/cgpim.cpp index 1e18c4deb..2f8644700 100755 --- a/src/cg/cgpim.cpp +++ b/src/cg/cgpim.cpp @@ -5,10 +5,8 @@ // funzione per classificare i PIM e sommare tutto cio' che contengono #include "cgpim.h" -bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost) +bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost, int & last_tiporec) { - int last_checked = 0; - // parse CODTAB of pim record const TString80 ctab = pimr.get("CODTAB"); @@ -27,7 +25,7 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t imp = ZERO; iva = ZERO; bool found = false; - for (int i = 0; i <= stop_tiporec; i++) + for (int i = last_tiporec + 1; i <= stop_tiporec; i++) { tiporec tocheck = (tiporec)i; @@ -239,6 +237,7 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t if (found) { t = tocheck; + last_tiporec = i; break; } } diff --git a/src/cg/cgpim.h b/src/cg/cgpim.h index cb789001e..e4bb7144a 100755 --- a/src/cg/cgpim.h +++ b/src/cg/cgpim.h @@ -79,6 +79,6 @@ enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali // CONTENTA? ciao, f. :) // ----------------------------------------------------------- -bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts); +bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts, int & last_tiporec); #endif