Please don't use bitcoind accounts for that purpose. They weren't meant for this, and you will start to get bugs. I'm not sure what exactly happens when you try to send whole balance of one account to somewhere else. Either it will fail with an error message, or it will take the fee from the amount as I said (unlikely, I think), or - which is a disaster in your case, it will take the fee from another unspent output without you knowing it until it hits you.
What bugs?
It takes the fee from the account but when you send the whole account balance it gets negative due to the fee and send the fee from the main(my own) account (which was my issue).
But suppose i make my own account system as you suggested, i will have the same issue. I still have to know the fee before sending any funds or it will be taken from me.
- user has funds to send X
- X + FEE is larger than user funds
- user sends X
- the system will send X + FEE anyway cause my wallet has enough funds
I need to take X + FEE from the user, and avoid sending it if the total is larger than his funds.