I think it already works like that... at least it is supposed to.
I don't think so... For a start, I don't see where you exclude restoring items from max part for example.
Besides I don't see a single mention of joy in the code, while some items have a great impact on it, yet its mechanics are close to vitality.
Also there is a difference between using consumable stuff such as makeups for increasing charisma and restoring health.
There is no reason for us to not use temp consumables like makeups unless current charisma=max possible charisma already. More charisma always means more income in theory.
But if we have 99/100 health, it would be wise to ignore it. It's ok to have not 100% of health all the time, not to mention vitality or mp. In general we don't have to try to restore them completely, 85-90% should be enough.
If we have 80/100 health, it would be wise to use some food to restore it. If we have 70/100, it would be wise to use a small potion which restores 25 points or food. If we have 40/100 health, we use should try to use medium or two small ones before using better ones. If we have 1/1000, it would be wise to use ultimate healing potion.
I'm writing it because I'm not able to code it on my own, of course