Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

xpindia22
Copy link
Sponsor

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.

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.
Copy link
Sponsor Author

@xpindia22 xpindia22 left a 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 " .
Copy link
Sponsor Member

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.

Copy link
Sponsor Author

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.


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'];
Copy link
Sponsor Member

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.

@adunsulag adunsulag changed the title Update C_Prescription.class.php 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. Jun 19, 2024
//xl function added for translation.
Copy link
Sponsor Author

@xpindia22 xpindia22 left a 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'];


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'];
Copy link
Sponsor Member

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.

https://en.wikipedia.org/wiki/National_drug_code

Copy link
Sponsor Author

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.
Copy link
Sponsor Author

@xpindia22 xpindia22 left a 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
Copy link
Sponsor Author

@xpindia22 xpindia22 left a 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.

@xpindia22 xpindia22 closed this by deleting the head repository Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Added option to display no of tablets left in stock, with expiry date, in the drop down menu
3 participants