Weno eRx fixes (#1139)
[openemr.git] / interface / weno / markTx.php
blobdb10511d067d88d3fa2962ebac29ca7974a9682d
1 <?php
2 /**
3 * weno rx mark tx.
5 * @package OpenEMR
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 $date = date("Y-m-d");
14 $script = filter_input(INPUT_GET, "rx");
15 $boxState = filter_input(INPUT_GET, "state");
17 $e_script = explode("-", $script);
19 if ($e_script[0] === "NewRx") {
20 //See if the value is set Note patched out sjp I see no reason to check, just set it.
21 //$check = "SELECT ntx FROM prescriptions WHERE id = ?";
22 //$getVal = sqlQuery($check, array($e_script[1]));
24 //Set for new rx to transmit or reset if not, depends if selected.
25 if ($boxState) {
26 $sql = "UPDATE prescriptions SET ntx = ?, txDate = ? WHERE id = ?";
27 sqlStatement($sql, array($boxState, $date, $e_script[1]));
28 } else {
29 $sql = "UPDATE prescriptions SET ntx = ? WHERE id = ?";
30 sqlStatement($sql, array($boxState, $e_script[1]));
33 //There is a flaw in the logic because if the doc goes back in to edit the script this date gets wiped out.
34 if ($e_script[0] === "RefillRx") { // Not sure I see reason this is needed Only worry if to xmit or not! - sjp
35 if ($boxState) {
36 $sql = "UPDATE prescriptions SET ntx = ?, txDate = ? WHERE id = ?";
37 sqlStatement($sql, array($boxState, $date, $e_script[1]));
38 } else {
39 $sql = "UPDATE prescriptions SET ntx = ? WHERE id = ?";
40 sqlStatement($sql, array($boxState, $e_script[1]));
44 if ($_GET['arr']) {
45 //First number is the pharmacy. The next number(s) are the records to be update with pharmacy info
47 $scriptUpdate = explode(",", $_GET['arr']);
49 $i = count($scriptUpdate) - 1; //Since first number is always the pharmacy -1
50 $ii = 1;
52 while ($i >= $ii) {
53 $query = "UPDATE prescriptions SET pharmacy_id = ? WHERE id = ?" ;
54 sqlStatement($query, array(trim($scriptUpdate[0]), $scriptUpdate[$ii]));
55 $ii++;
57 }//if statement