3 * weno rx ajax sample code
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
12 require_once('../globals.php');
13 use OpenEMR\Core\Header
;
19 <title
><?php
print xlt("Weno Sample Code") ?
></title
>
20 <?php Header
::setupHeader(['jquery-ui', 'jquery-ui-sunny']); ?
>
26 <h3
><?php
print xlt("Convert a JavaScript object into a JSON string, and send it to the server.") ?
></h3
>
30 <input type
='submit' id
='confirm_btn' value
='<?php print xla("Confirm") ?>' >
33 <input type
='submit' id
='order' value
='<?php print xla("Transmit Order") ?>' >
35 <div id
="success"></div
>
39 $
(document
).ready(function(){
42 $
("#transmit").hide();
43 $
("#confirm_btn").click(function(){
45 //build a process that will create the code below for transmit.
46 //each drug transmitted has to be separate
48 $
("#transmit").show();
52 $
('#order').click(function(){
53 $
('#success').html("<i class="fa fa
-refresh fa
-spin fa
-3x fa
-fw
"></i>");
54 var patient
= { "patient": {
57 "street" : "123 Franklin Blvd",
58 "city" : "Chesapeake",
64 var provider
= {"provider": {
67 "provnpi" : 1033137377,
68 "facilityphone" : 7573331212,
69 "facilityfax" : 7574441212,
70 "facilityname" : "East Cardiology",
71 "facilitystreet" : "127 Albert Dr.",
72 "facilitycity" : "Chesapeake",
73 "facilitystate" : "VA",
74 "facilityzip" : 23320,
75 "qualifier" : "D91539:C29729",
76 "wenoAccountId" : "111",
77 "wenoAccountPass" : "A80B97AB1A80B92084CB86DE61A1F82A6979990B",
78 "wenoClinicId" : "D91539:C29729"
80 var pharmacy
= {"pharmacy": {
81 "storename":"Test Direct Pharmacy",
84 "pharmacyPhone":2109128143,
85 "pharmacyFax":5128525926
88 var script
= {"script": {
89 "drugName" : "tylonal ES TABS",
90 "drug_NDC" : 405012301,
91 "dateAdded" : "2017-02-02",
94 "dateModified" : "2017-02-15",
95 "note" : "add not to pharmacy",
100 var sendPatient
= JSON
.stringify(patient
);
101 var sendProvider
= JSON
.stringify(provider
);
102 var sendPharmacy
= JSON
.stringify(pharmacy
);
103 var sendScript
= JSON
.stringify(script
);
104 var send
= '['+sendPatient+
','+sendProvider+
','+sendPharmacy+
','+sendScript+
']';
109 url
: 'https://apa.openmedpractice.com/apa/interface/weno/receivingrx.php?',
110 data
: {"scripts": send
},
112 success
: function(response
){
113 console
.log(response
);
115 $
('#success').html('<p>'+response+
'</p>');
117 error
: function(xhr
, status
, error
){
121 console
.warn(xhr
.responseText
);