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
13 require_once('../globals.php');
15 use OpenEMR\Core\Header
;
21 <title
><?php
print xlt("Weno Sample Code") ?
></title
>
22 <?php Header
::setupHeader(['jquery-ui', 'jquery-ui-sunny']); ?
>
28 <h3
><?php
print xlt("Convert a JavaScript object into a JSON string, and send it to the server.") ?
></h3
>
32 <input type
='submit' id
='confirm_btn' value
='<?php print xla("Confirm") ?>' >
35 <input type
='submit' id
='order' value
='<?php print xla("Transmit Order") ?>' >
37 <div id
="success"></div
>
41 $
(document
).ready(function(){
44 $
("#transmit").hide();
45 $
("#confirm_btn").click(function(){
47 //build a process that will create the code below for transmit.
48 //each drug transmitted has to be separate
50 $
("#transmit").show();
54 $
('#order').click(function(){
55 $
('#success').html("<i class="fa fa
-refresh fa
-spin fa
-3x fa
-fw
"></i>");
56 var patient
= { "patient": {
59 "street" : "123 Franklin Blvd",
60 "city" : "Chesapeake",
66 var provider
= {"provider": {
69 "provnpi" : 1033137377,
70 "facilityphone" : 7573331212,
71 "facilityfax" : 7574441212,
72 "facilityname" : "East Cardiology",
73 "facilitystreet" : "127 Albert Dr.",
74 "facilitycity" : "Chesapeake",
75 "facilitystate" : "VA",
76 "facilityzip" : 23320,
77 "qualifier" : "D91539:C29729",
78 "wenoAccountId" : "111",
79 "wenoAccountPass" : "A80B97AB1A80B92084CB86DE61A1F82A6979990B",
80 "wenoClinicId" : "D91539:C29729"
82 var pharmacy
= {"pharmacy": {
83 "storename":"Test Direct Pharmacy",
86 "pharmacyPhone":2109128143,
87 "pharmacyFax":5128525926
90 var script
= {"script": {
91 "drugName" : "tylonal ES TABS",
92 "drug_NDC" : 405012301,
93 "dateAdded" : "2017-02-02",
96 "dateModified" : "2017-02-15",
97 "note" : "add not to pharmacy",
102 var sendPatient
= JSON
.stringify(patient
);
103 var sendProvider
= JSON
.stringify(provider
);
104 var sendPharmacy
= JSON
.stringify(pharmacy
);
105 var sendScript
= JSON
.stringify(script
);
106 var send
= '['+sendPatient+
','+sendProvider+
','+sendPharmacy+
','+sendScript+
']';
111 url
: 'https://apa.openmedpractice.com/apa/interface/weno/receivingrx.php?',
112 data
: {"scripts": send
},
114 success
: function(response
){
115 console
.log(response
);
117 $
('#success').html('<p>'+response+
'</p>');
119 error
: function(xhr
, status
, error
){
123 console
.warn(xhr
.responseText
);