quick minor path updates (#1968)
[openemr.git] / interface / weno / formularyInsert.php
blob2fb522deb2d4cec59599e0ae761e403ab1be4fda
1 <?php
2 /**
3 * weno rx formulary update.
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");
14 echo xlt("Trying")."<BR>";
16 $zip = new ZipArchive;
17 $zip->open('FormularyFiles.zip');
18 $zip->extractTo($GLOBALS['temporary_files_dir']);
19 $zip->close();
21 $file = $GLOBALS['temporary_files_dir'] . "./Weno Exchange LLC/BSureFormulary.txt";
22 $lines = count(file($file));
23 echo text($lines). "<br>";
25 $i = 2;
26 // Settings to drastically speed up import with InnoDB
27 sqlStatementNoLog("SET autocommit=0");
28 sqlStatementNoLog("START TRANSACTION");
29 do {
30 $fileName = new SplFileObject($file);
31 $fileName->seek($i);
33 $in = explode("|", $fileName);
35 $ndc = $in[2];
36 $price = $in[5];
37 $drugName = $in[8];
39 sqlStatementNoLog("INSERT INTO `erx_drug_paid` SET `drug_label_name` = ?, `NDC` = ?, `price_per_unit` = ? ", array($drugName,$ndc,$price));
40 echo xlt("Inserted") . " " . text($drugName) . "<br> ";
42 $i++;
43 } while ($i < $lines);
45 // Settings to drastically speed up import with InnoDB
46 sqlStatementNoLog("COMMIT");
47 sqlStatementNoLog("SET autocommit=1");