acknowledgments update
[openemr.git] / interface / billing / get_claim_file.php
blob53a62c257efc24a4161031b1c84192c99803f16f
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 require_once(dirname(__FILE__) . "/../globals.php");
8 require_once(dirname(__FILE__) . "/../../includes/config.php");
10 $fconfig = $GLOBALS['oer_config']['freeb'];
11 $content_type = "text/plain";
12 $claim_file_dir = $GLOBALS['OE_SITE_DIR'] . "/edi/";
14 $fname = $_GET['key'];
15 $fname = preg_replace("[/]","",$fname);
16 $fname = preg_replace("[\.\.]","",$fname);
17 $fname = preg_replace("[\\\\]","",$fname);
19 if (strtolower(substr($fname,(strlen($fname)-4))) == ".pdf") {
20 $content_type = "application/pdf";
21 if (!strpos($fname,'-batch')) $claim_file_dir = $fconfig['claim_file_dir'];
24 $fname = $claim_file_dir . $fname;
26 if (!file_exists($fname)) {
27 echo xl("The claim file: ") . $_GET['key'] . xl(" could not be accessed.");
29 elseif ($_GET['action'] == "print") {
31 <html>
32 <head>
33 <?php if (function_exists(html_header_show)) html_header_show(); ?>
34 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
35 </head>
36 <body class="body_top">
37 <br><p><h3><?php xl('Printing results:','e')?></h3><a href="billing_report.php"><?php xl('back','e')?></a><ul>
38 <?php
39 $estring = $fconfig['print_command'] . " -P " . $fconfig['printer_name'] . " " . $fconfig['printer_extras'] . " " . $fname;
40 $rstring = exec(escapeshellcmd($estring));
41 echo xl("Document") . $fname . xl("sent to printer.");
43 </ul>
44 </body>
45 </html>
46 <?php
48 else {
49 $fp = fopen($fname, 'r');
51 header("Pragma: public");
52 header("Expires: 0");
53 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
54 header("Content-Type: $content_type");
55 header("Content-Length: " . filesize($fname));
56 header("Content-Disposition: attachment; filename=" . basename($fname));
58 // dump the picture and stop the script
59 fpassthru($fp);
61 exit;