Using TMR0 to time an event
It's hard to follow what you think your code is supposed to do since it's pretty much devoid of comments.  Besides, your code isn't working, so it's irrelevant anyway.  Let's step back and think about how to best attack this problem.

You apparently want to track how much accumulated time some digital signal spends in either state.  If this is happening in human time, as implied by "opening" and "closing" of some device, then checking periodically is fine.  Every 10 ms should be fine, probably even every 100 ms.  Note that the actual sampling period doesn't matter as long as its regular and fast enough since you ultimately only care about the ratio of open to closed time.  The samples per unit time cancel out.

Timer 2 with its built-in period register is good for setting up a periodic interrupt.  In this interrupt, all you do is increment one of two counters depending on whether the device is open or closed.  These probably need to be wide counters, like 32 bits each.

When you are asked for the fraction of lid open time, the foreground code grabs a snapshot of the two counters and does the divide.

When you grab the snapshots, you have to make sure you are getting a consistent value since a interrupt could come along and change things between reading the individual bytes of the value.  There are two usual ways to get around this: disable interrupts for the few cycles it takes to copy each value, or after reading the value, check it again, and retry if it changed.