added VIS statement date to immunizations
[openemr.git] / interface / billing / get_claim_file.php
blobfd061d59547a124fdb4bee463428054428412b0d
1 <?php
2 require_once(dirname(__FILE__) . "/../globals.php");
3 require_once(dirname(__FILE__) . "/../../includes/config.php");
5 $fconfig = $GLOBALS['oer_config']['freeb'];
6 $content_type = "text/plain";
7 $claim_file_dir = "$webserver_root/edi/";
9 $fname = $_GET['key'];
10 $fname = preg_replace("[/]","",$fname);
11 $fname = preg_replace("[\.\.]","",$fname);
12 $fname = preg_replace("[\\\\]","",$fname);
14 if (strtolower(substr($fname,(strlen($fname)-4))) == ".pdf") {
15 $content_type = "application/pdf";
16 if (!strpos($fname,'-batch')) $claim_file_dir = $fconfig['claim_file_dir'];
19 $fname = $claim_file_dir . $fname;
21 if (!file_exists($fname)) {
22 echo xl("The claim file: ") . $_GET['key'] . xl(" could not be accessed.");
24 elseif ($_GET['action'] == "print") {
26 <html>
27 <head>
28 <?php if (function_exists(html_header_show)) html_header_show(); ?>
29 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
30 </head>
31 <body class="body_top">
32 <br><p><h3><?php xl('Printing results:','e')?></h3><a href="billing_report.php"><?php xl('back','e')?></a><ul>
33 <?php
34 $estring = $fconfig['print_command'] . " -P " . $fconfig['printer_name'] . " " . $fconfig['printer_extras'] . " " . $fname;
35 $rstring = exec(escapeshellcmd($estring));
36 echo xl("Document") . $fname . xl("sent to printer.");
38 </ul>
39 </body>
40 </html>
41 <?php
43 else {
44 $fp = fopen($fname, 'r');
46 header("Pragma: public");
47 header("Expires: 0");
48 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
49 header("Content-Type: $content_type");
50 header("Content-Length: " . filesize($fname));
51 header("Content-Disposition: attachment; filename=" . basename($fname));
53 // dump the picture and stop the script
54 fpassthru($fp);
56 exit;