anchor.diff:  
   			//states_products_total
   
  -			sqlpre = "SELECT * FROM states_products_total WHERE state = '" + state + "'";
  +			sqlpre = "SELECT * FROM states_products_total WHERE state = '" + state + "'" + "AND pid = " + pid;
   			rs = stmt.executeQuery(sqlpre);
   
   			if (rs.isBeforeFirst())
  
positive.code: 
  		//states_total
  
  		 sqlpre = "SELECT * FROM states_total WHERE state = " + state;
  		 rs = stmt.executeQuery(sqlpre);
  
  		 if (rs.isBeforeFirst())
  		 	sql = "UPDATE states_total SET total = total + " + grandtotal + " WHERE  state = " + state;
  		 else
  		 	sql = "INSERT INTO states_total VALUES (" + state + ", " + grandtotal + ")";
  
  			stmt.executeUpdate(sql);
  		
  
negative.code: 
  			 //states_categories_total
  
  			sqlpre = "SELECT * FROM states_categories_total WHERE state = '" + state + "'" + "AND cid = " + cid;
  			rs = stmt.executeQuery(sqlpre);
  
  			if (rs.isBeforeFirst())
  