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
11 require_once("../globals.php");
13 $zip = new ZipArchive
;
14 $zip->open($GLOBALS['temporary_files_dir'].'/FormularyFiles.zip');
15 $zip->extractTo($GLOBALS['temporary_files_dir']);
18 $file = "./Weno Exchange LLC/BSureFormulary.txt";
19 $lines = count(file($file));
20 echo text($lines). "<br>";
24 $fileName = new SplFileObject($file);
26 echo text($fileName)."<br>"; //return the first line from file
28 $in = explode("|", $fileName);
30 echo text($in[2])."<br>";
31 echo text($in[5])."<br>";
32 echo text($in[8])."<br>";
38 $find = sqlQuery("SELECT ndc FROM erx_drug_paid WHERE ndc = ?", array($ndc));
40 * Insert drug if not found in the table
42 if (!empty($find['ndc'])) {
43 sqlStatementNoLog("INSERT INTO `erx_drug_paid` SET `drug_label_name` = ?, `NDC` = ?, `price_per_unit` = ? ", array($drugName,$ndc,$price));
44 echo xlt("Inserted")."<br> ";
47 * If the drug is found update the price.
49 sqlStatementNoLog("UPDATE erx_drug_paid SET price_per_unit = ? WHERE ndc = ?", array($price, $ndc));
50 echo xlt("Updated!")."<br>";
53 } while ($i < $lines);