If you run the program under simulation, crank-up the generic value read by READADC for your key detector, you can clearly see the program overwriting the Eeprom. That may not be a real world test but shows the program is flawed and has the potential for corruption.
Your code is extremely hard to understand or follow. It's not clear what variables are being used for, what they hold or what their values mean. There are also too many cases of 'magic numbers' which are meaningless to anyone other than yourself; "if b18=88 then" etc.
One place where you can massively improve things is with respect to the 'readkey' and 'idkey' routines and the carrying around of some arbitrary word value. Make the two routines into one, use a 'gotKey' or similar byte variable for the result, return zero if no key pressed, an ASCII character of what that key means when pressed. Your ...
temw1=0
do until temw1>0 and temw1<510 'check for "#" pressed
gosub readkey
gosub idkey
pause 20
loop
can then become a much simpler and more understandable ...
Do
Gosub GetKey
Loop Until gotKey = "#"
Programming is a science in getting the right algorithms, interaction and timings but also an art. Aesthetics play an important part and you should aim to make code accessible to others. The pinnacle is writing code which others can follow and understand easily even when its intricacies may be well beyond their understanding. Do it right, and even someone unfamiliar with what the program is doing can find inconsistencies and flaws in reasoning behind the code which is a great aid to debugging and getting help.