Sorry for the long delay, but actually I have never received notification about this post being growing.
Basically about those variables, wan-rebootblock it’s used to avoid that on the “reset-day”, where you will reset the counters to 0 (because your monthly plan has reset), this reset will happen on every cycle for that day.
So let’s say you reset at midnight on 01 of each month, only the first time wan-rebootblock is 0; then once the limits are reset, such variable gets to 1 and does not allow the code to enter into that reset anymore for that day. From day 02 the reset function is not triggered anymore because of the different day.
wan-offset it’s used when the router is not rebooted between the month change. So, let’s say your router’s uptime is high and the interface has counted progressively by increasing its value all time, when the day 01 reaches, the script will store the previous counted value into offset, so that from now on the new data (which is reset to 0) is considering the previous ending value to be matched with the continuously increasing value assigned to your interface traffic. So this allows the counter from making a delta between the interface traffic accumulated and the current consumed value.
wan-refdata is when your router was reboot. In that case you loose the traffic counter for the interface, therefore you are not in the normal condition where you will use the offset. In this case you are recovering where you were with this reference data and then adds-up the traffic accumulated (after reboot) again in your interface counter.
Hope this makes sense too you.