Fully responsive globals.php with vertical menu (#2460)
[openemr.git] / interface / weno / markTx.php
blobb51e7843373fe7156daf74c8481a7a93f0f296b8
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 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2016-2017 Sherwin Gaddis <sherwingaddis@gmail.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
17 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
18 csrfNotVerified();
21 $date = date("Y-m-d");
22 $script = filter_input(INPUT_GET, "rx");
23 $boxState = filter_input(INPUT_GET, "state");
25 $e_script = explode("-", $script);
27 if ($e_script[0] === "NewRx") {
28 //See if the value is set Note patched out sjp I see no reason to check, just set it.
29 //$check = "SELECT ntx FROM prescriptions WHERE id = ?";
30 //$getVal = sqlQuery($check, array($e_script[1]));
32 //Set for new rx to transmit or reset if not, depends if selected.
33 if ($boxState) {
34 $sql = "UPDATE prescriptions SET ntx = ?, txDate = ? WHERE id = ?";
35 sqlStatement($sql, array($boxState, $date, $e_script[1]));
36 } else {
37 $sql = "UPDATE prescriptions SET ntx = ? WHERE id = ?";
38 sqlStatement($sql, array($boxState, $e_script[1]));
41 //There is a flaw in the logic because if the doc goes back in to edit the script this date gets wiped out.
42 if ($e_script[0] === "RefillRx") { // Not sure I see reason this is needed Only worry if to xmit or not! - sjp
43 if ($boxState) {
44 $sql = "UPDATE prescriptions SET ntx = ?, txDate = ? WHERE id = ?";
45 sqlStatement($sql, array($boxState, $date, $e_script[1]));
46 } else {
47 $sql = "UPDATE prescriptions SET ntx = ? WHERE id = ?";
48 sqlStatement($sql, array($boxState, $e_script[1]));
52 if ($_GET['arr']) {
53 //First number is the pharmacy. The next number(s) are the records to be update with pharmacy info
55 $scriptUpdate = explode(",", $_GET['arr']);
57 $i = count($scriptUpdate) - 1; //Since first number is always the pharmacy -1
58 $ii = 1;
60 while ($i >= $ii) {
61 $query = "UPDATE prescriptions SET pharmacy_id = ? WHERE id = ?" ;
62 sqlStatement($query, array(trim($scriptUpdate[0]), $scriptUpdate[$ii]));
63 $ii++;
65 }//if statement