There is an overarching problem with the way you are designing the script. It isnt mean to go down through the code and execute everything in order.
This is how you have it:
if (condition) do this
if (condition) do this
If both conditions result to true, then both actions are performed. IT should, instead, only evaluate one condition to true and perform one action per every time the script loops.
This of onLoop as what you want to do in one moment of time based on environmental values at that instance.
you should instead do:
if (condition) do this
else if (condition) do this
for example:
if (bank is not open) open bank
else if (bank is open) deposit logs
The first iteration of the loop. the bank is not open. So you open the bank. The next iteration, the bank is open. So you deposit the logs.
Inside of each if statement, you can put more if statements to check more conditions, but try to only ever execute one action every time the script loops.
After you get the hang of that, you can look into Events to contain certain actions, and execute 'mini onLoops' throughout the script.
Edit: after looking at it more, I see that you arent completely ignoring else statements, but the banking function shouldn't be doing everything at once