I haven’t written any code yet because i don’t know where to start.
I have a RX Prescription form that Doctor’s fill out to create a “New Prescription”. I need to write a check to make sure what they fill out is actually possible. There are 4 variables they fill out: Quantity, MG per Dose, Dosages per Day, Prescribed Date.
For example, I need to make sure that if a Doctor fills out a RX for: 10 total pills, 1MG per dose & 3 Dosages per day, that it will return an error. It would error because after 3 days the Patient would only have 1 Pill left (3 per day * 3 days = 9 total dosages).
I need to make sure that the prescription makes sense, and that whatever they fill out is mathematically possible. My guess is to write a PHP Loop, but the math is sadly very fuzzy to me. Any help is greatly appreciated. This is the final functionality for my project before it goes “Live”.
Are you basically saying you want to find out if the total number of pills is wholly divisible by the number of days? Do you know the number of days the prescription is for? If so:
Perhaps I am misunderstanding what you are asking.