-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update C_Prescription.class.php to display no of tablets left in stock, with expiry date, in the drop down menu when prescribing a drug to a patient. #7487
Conversation
Added option to display no of tablets left in stock, with expiry date, in the drop down menu when prescribing a drug to a patient. This can be very helpful to the pharmacist /doctor to decide from which stock to give the drug. In addition as suggested in the openemr documentation ndc_number field can be used to display the price of one tablet etc so while adding a drug to the inventory, the price of one tablet can be calculated and added in ndc_number. Regards Dr Robert James
indentation errors corrected. blank line removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation errors corrected and blank line removed.
"t.period, t.quantity, t.refills, d.drug_code, i.on_hand,i.expiration " . | ||
"FROM drug_templates AS t " . | ||
"JOIN drugs AS d ON d.drug_id = t.drug_id " . | ||
"JOIN drug_inventory AS i ON d.drug_id = i.drug_id " . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With inhouse_pharmacy will every drug record have a drug_inventory record? I haven't used the inhouse_pharmacy module much so you'll need to confirm if this is true or not. If drug records can exist without a drug_inventory record should make the drug_inventory a LEFT JOIN as you will break existing data records for other users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The medications whose template has been created only those show up in drop down menu. If we have added the drug details but not created any template for it then those drugs dont show up in the drop down by default.
( i feel this is a small bug because the medicine should anyway appear in the drop down , if it has been added to the inventory, irrespective of a template/s having been created or not for it.
This is applicable to only the drugs in the pharmacy drug_record. So i do not think there will be any issue.
Only the drugs listed in drug inventory show up in the drop down.
controllers/C_Prescription.class.php
Outdated
|
||
while ($row = sqlFetchArray($res)) { | ||
$tmp_output = $row['selector']; | ||
if ($row['ndc_number']) { | ||
$tmp_output .= ' [' . $row['ndc_number'] . ']'; | ||
$tmp_output .= ' - Price of One Tab: ' . $row['ndc_number']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to include include translation using the xl function, ie this should be:
$tmp_output .= ' - ' . xl('No left in stock:') . ' . $row['on_hand'];
The value is sanitized/escaped in the html function so you don't need xlt here, just need the xl.
//xl function added for translation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xl function added for translation.
$tmp_output .= ' - ' . xl('Price of One Tab:') . ' ' . $row['ndc_number'];
$tmp_output .= ' - ' . xl('No left in stock:') . ' ' . $row['on_hand'];
$tmp_output .= ' - ' . xl('Expiry Date:') . ' ' . $row['expiration'];
controllers/C_Prescription.class.php
Outdated
|
||
while ($row = sqlFetchArray($res)) { | ||
$tmp_output = $row['selector']; | ||
if ($row['ndc_number']) { | ||
$tmp_output .= ' [' . $row['ndc_number'] . ']'; | ||
$tmp_output .= ' - Price of One Tab: ' . $row['ndc_number']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @xpindia22 , doesn't seem right that $row['ndc_number']
holds the price of the drug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stephenwaite ,
ok then in that case we can leave ndc_number for what it is supposed to display and not enter the price of one tablet during entering a drug into pharmacy record.
I will remove this "- Price of One Tab:" if you say so.
left ndc_number to display the default ndc number. It will not display price of one tablet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left ndc_number as it was intended to display ndc number. It will not diaplay the price of one tablet which was to be put manually while entering the drug into the inventory.
The empty line removed from line 76. Regards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 76 - empty line error- empty space removed.
Added option to display no of tablets left in stock, with expiry date, in the drop down menu when prescribing a drug to a patient. This can be very helpful to the pharmacist /doctor to decide from which stock to give the drug. In addition as suggested in the openemr documentation ndc_number field can be used to display the price of one tablet etc so while adding a drug to the inventory, the price of one tablet can be calculated and added in ndc_number. Regards
Dr Robert James
Fixes #7486
Short description of what this resolves:
Added option to display no of tablets left in stock, with expiry date, in the drop down menu when prescribing a drug to a patient. This can be very helpful to the pharmacist /doctor to decide from which stock to give the drug. In addition as suggested in the openemr documentation ndc_number field can be used to display the price of one tablet etc so while adding a drug to the inventory, the price of one tablet can be calculated and added in ndc_number.
Changes proposed in this pull request:
Added option to display no of tablets left in stock, with expiry date, in the drop down menu when prescribing a drug to a patient. This can be very helpful to the pharmacist /doctor to decide from which stock to give the drug. In addition as suggested in the openemr documentation ndc_number field can be used to display the price of one tablet etc so while adding a drug to the inventory, the price of one tablet can be calculated and added in ndc_number.