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 #7470

Closed
wants to merge 1 commit into from
Closed

Conversation

xpindia22
Copy link
Sponsor

@xpindia22 xpindia22 commented Jun 8, 2024

WHen prescribing a drug , in the inhouse drop down menu, with this code modification one can see the ndc_number(which can record peice of one tablet during adding of a drug this can be done.) along with ndc_number, you will see the no of tablets available in stock and the expiry date. This can be valuable to the pharmacist as he/she can decide which lot to finish first etc. without this info many a times when we select a drug to prescribe, and when we click on save, it says not enough in stock. this code can be incorporated in the openemr.
regards
Robert

Fixes #

Short description of what this resolves:

This adds a new feature to the drop down menu of drugs which are being prescribed. The user comes to know when the drug is going to expire. So if there are 2 lots of the same medication, the one dated to expire earlier can be finished first.

Secondly this shows no of tablets available in stock.
Right now without this modification, it allows u to select the drug , no of tablets etc but when u press ok, it gives an error that there are not enough medications in the stock.

thirdly
as advised by openemr ndc can be used to mention the price of medication, so same has been done.
these three modifications augment the functioning of the openemr.

Changes proposed in this pull request:

lines 61-75 of c_Prescription.class.php have been changed to

$res = sqlStatement("SELECT d.name, d.ndc_number, d.form, d.size, " .
"d.unit, d.route, d.substitute, t.drug_id, t.selector, t.dosage, " .
"t.period, t.quantity, t.refills, d.drug_code, i.on_hand " .
"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 " .
"ORDER BY t.selector");

        while ($row = sqlFetchArray($res)) {
            $tmp_output = $row['selector'];
            if ($row['ndc_number']) {

                $tmp_output .= ' - Price of One Tab: ' . $row['ndc_number'];
                $tmp_output .= ' - No left in stock: ' . $row['on_hand'];
               }

====================================

WHen prescribing a drug , in the inhouse drop down menu, with this code modification one can see the ndc_number(which can record peice of one tablet during adding of a drug this can be done.) along with ndc_number, you will see the no of tablets available in stock and the expiry date.
This can be valuable to the pharmacist as he/she can decide which lot to finish first etc. without this info many a times when we select a drug to prescribe, and when we click on save, it says not enough in stock.
this code can be incorporated in the openemr.
regards
Robert

$tmp_output .= ' - Price of One Tab: ' . $row['ndc_number'];
Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add price of one tablet.


$tmp_output .= ' - Price of One Tab: ' . $row['ndc_number'];
$tmp_output .= ' - No left in stock: ' . $row['on_hand'];
Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will display the no of tablets left in stock while prescribing.


$tmp_output .= ' - Price of One Tab: ' . $row['ndc_number'];
$tmp_output .= ' - No left in stock: ' . $row['on_hand'];
$tmp_output .= ' - Expiry Date: ' . $row['expiration'];
Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Displays the expiry date of the drug u are going to prescribe.

// }
$res = sqlStatement("SELECT d.name, d.ndc_number, d.form, d.size, " .
"d.unit, d.route, d.substitute, t.drug_id, t.selector, t.dosage, " .
"t.period, t.quantity, t.refills, d.drug_code, i.on_hand,i.expiration " .
Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated added join statement to include on_hand and expiration date.

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.

Removed blank spaces, and corrected indentation.
Pl see if it is ok.

@stephenwaite
Copy link
Sponsor Member

hi @xpindia22, check out these 2 errors
Screenshot from 2024-06-10 07-34-47

you can also get going with the easy dev setup which has some neat features with the openemr-cmd that can do this for you

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.

The blank space has been removed the the indentation error corrected to the best of my knowledge.
Pl see if its ok :)

@xpindia22 xpindia22 closed this by deleting the head repository Jun 15, 2024
@xpindia22
Copy link
Sponsor Author

hi @stephenwaite ,
I am not sure if the two errors have been fixed as per the requirements or not.
How would i come to know if the changes have been accepted for merging or not.
regard
Robert

@xpindia22
Copy link
Sponsor Author

hi @stephenwaite ,
I am not sure if the two errors have been fixed as per the requirements or not.
How would i come to know if the changes have been accepted for merging or not.
regard
Robert

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.

None yet

2 participants