6 * @link http://www.open-emr.org
7 * @author Sherwin Gaddis <sherwingaddis@gmail.com>
8 * @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once('../globals.php');
14 require_once("$srcdir/patient.inc");
15 use OpenEMR\Core\Header
;
16 use OpenEMR\Rx\Weno\TransmitData
;
18 $date = date("Y-m-d");
19 $pid = $GLOBALS['pid'];
20 $uid = $_SESSION['authUserID']; //username of the person for this session
22 $tData = new TransmitData();
24 $send = $tData->getDrugList($pid, $date);
25 $provider = $tData->getProviderFacility($uid);
26 $patientPharmacy = $tData->patientPharmacyInfo($pid);
27 $mailOrder = $tData->mailOrderPharmacy();
34 <?php Header
::setupHeader(['jquery-ui', 'jquery-ui-sunny']); ?
>
49 <body
class="body_top">
51 <h2
><?php
print xlt("Prescription Transmit Review"); ?
></h2
>
52 <div
class="table-responsive text-center" style
="margin-left:10%;width:75%;">
53 <table
class="table table-condensed table-striped">
55 <th
class='text-center'><?php
print xlt("Drug"); ?
></th
>
56 <th
class='text-center'><?php
print xlt("Quantity"); ?
></th
>
59 //List drugs to be sent
61 $drug = array(); //list of records that need to updated with pharmacy information
62 while ($list = sqlFetchArray($send)) {
63 print "<tr class='text-center'><td>". text($list['drug']) . " </td><td> " . text($list['quantity']) . "</td></tr>";
64 $drug[] = $list['id'];
71 <?php
if (empty($drug)) {
72 echo "<br> <p class='text-danger'><strong> ".xlt("No prescriptions selected"). "</strong></p>";
77 <h3
><?php
echo xlt("Select Pharmacy"); ?
></h3
>
78 <?php
echo xlt("Patient Default"); ?
> <br
>
79 <input type
= 'radio' name
= "pharmacy" id
= 'patientPharmacy' value
="<?php print attr($patientPharmacy['pharmacy_id']) ?>" checked
="checked">
81 if (!$patientPharmacy['name']) {
82 print "<b>".xlt("Please set pharmacy in patient\'s chart!")."</b><br> <br>";
84 print text($patientPharmacy['name']);
88 <?php
print xlt("Mail Order") ?
> <br
>
89 <input type
= 'radio' name
= 'pharmacy' id
= 'mailOrder' value
= "<?php print attr($mailOrder['id']) ?>"><?php
print "CCS Medical 14255 49th Street, North, Clearwater, FL 33762 <br>" ?
>
91 <div id
="confirm" show
>
93 <input type
='submit' id
='confirm_btn' value
='<?php print xla("Approve Order"); ?>' >
96 <div id
="transmit" hidden
>
98 <input type
='submit' id
='order' value
='<?php print xla("Transmit Order"); ?>' >
100 <div id
="success"></div
>
103 <script type
="text/javascript">
106 $
(document
).ready(function(){
109 var toTran
= <?php
echo json_encode($drug); ?
>; //pass php array to jquery script
112 //Updates the order with the pharmacy information
113 $
("#confirm_btn").click(function(){
115 var pharm_Id
= $
("input[name='pharmacy']:checked").val();
117 if($
('#patientPharmacy').is(':checked')) {
122 if($
('#mailOrder').is(':checked')) {
127 //Shows the transmit button after selecting approved
128 $
("#transmit").toggle();
129 //Hide the approve button after selection
130 $
("#confirm").toggle();
132 //this is to set the pharmacy for the presciption(s)
133 $
.ajax({ url
: 'markTx.php?arr='+pharm_Id+
','+toTran
});
135 //Makes the returned ajax call a global variable
136 function getReturnJson(x
){
137 //to process multiple prescriptions.
138 jsonArray
.push(returnedJson
= x
);
142 //loop through the prescription to create json code on fly
143 $
.each(toTran
, function( index
, value
) {
144 //this is to create the json script to be transmitted
146 //feeds the json generator
147 url
: 'jsonScript.php?getJson='+pharm_Id+
','+value
,
149 success
: function(response
){
150 console
.log(response
);
151 getReturnJson(response
);
153 error
: function(xhr
, status
, error
){
157 console
.warn(xhr
.responseText
);
161 }); //end of confirm button
164 $
('#order').click(function() {
165 $
('#success').html("<i class='fa fa-refresh fa-spin fa-3x fa-fw'></i>");
168 // Lets not talk to user here because most likely won't make to user anyway.
169 // So we'll batch the ajax calls with an apply and promise so everyone is happy.
170 // This isn't foolproof so look here if not batching large json requests.
171 $
.each(jsonArray
, function(index
, value
) {
176 url
: 'https://apa.openmedpractice.com/apa/interface/weno/receivingrx.php?',
177 data
: {"scripts": value
},
179 success
: function (response
) {
180 responses
.push(response
);
182 error
: function (xhr
, status
, error
) {
186 console
.warn(xhr
.responseText
);
188 }) //end of ajax push
190 }); // end of each loop
192 $
("#transmit").toggle(); // turn off xmit button for spinner
194 // here we apply actual weno server requests and I've been promised
195 // a done event to present results to user in one shot.
196 $
.when
.apply(null, request
).done(function() {
197 // all done with our requests, lets announce what weno says.
198 var announce
= '<?php echo xlt("Send Complete - Prescription(s) Return Status");?>';
199 $
('#success').html('<p><h4 class="bg-info">' + announce +
'</h4></p>');
200 $
.each(responses
, function (index
, response
) {
201 console
.log('result: ' + response
);
202 $
('#success').append('<p>' + response +
'</p>');
206 }); // That's it for click event.
208 }); //end of doc ready
216 <p
><?php
print xlt("Open Med Practice and its suppliers use their commercially reasonable efforts to provide the most current and complete data available to them concerning prescription histories, drug interactions and formularies, patient allergies and other factors, but by your use of this service you acknowledge that (1) the completeness and accuracy of such data depends upon the completeness and accuracy with which it is entered into connected electronic databases by physicians, physician’s offices, pharmaceutical benefits managers, electronic medical records firms, and other network participants, (2) such data is subject to error or omission in input, storage or retrieval, transmission and display, technical disruption, power or service outages, or other interruptions in electronic communication, any or all of which may be beyond the control of Open Med Practice and its suppliers, and (3) some information may be unavailable due to regulatory, contractual, privacy or other legal restrictions. You are responsible to use your clinical judgment at all times in rendering medical service and advice."); ?
></p
>