2 // Copyright (C) 2010 MMF Systems, Inc>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
10 // START - INCLUDE STATEMENTS
11 include_once(dirname(__file__
)."/../globals.php");
12 include_once("$srcdir/forms.inc");
13 include_once("$srcdir/billing.inc");
14 include_once("$srcdir/patient.inc");
15 include_once("$srcdir/report.inc");
16 include_once("$srcdir/calendar.inc");
17 include_once("$srcdir/edi.inc");
19 // END - INCLUDE STATEMENTS
22 // File location (URL or server path)
24 $target = $GLOBALS['edi_271_file_path'];
26 if (isset($_FILES) && !empty($_FILES)) {
27 $target = $target .time().basename($_FILES['uploaded']['name']);
31 if ($_FILES['uploaded']['size'] > 350000) {
32 $message .= htmlspecialchars(xl('Your file is too large'), ENT_NOQUOTES
)."<br>";
35 if ($_FILES['uploaded']['type']!="text/plain") {
36 $message .= htmlspecialchars(xl('You may only upload .txt files'), ENT_NOQUOTES
)."<br>";
39 if (!isset($message)) {
40 if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
41 $message = htmlspecialchars(xl('The following EDI file has been uploaded').': "'. basename($_FILES['uploaded']['name']).'"', ENT_NOQUOTES
);
43 // Stores the content of the file
44 $Response271= file($FilePath);
46 // Counts the number of lines
47 $LineCount = count($Lines);
49 //This will be a two dimensional array
50 //that holds the content nicely organized
52 $DataSegment271 = array();
53 $Segments271 = array();
55 // We will use this as an index
60 // Loop through each line
61 foreach ($Response271 as $Value) {
62 // In the array store this line
63 // with values delimited by ^ (tilt)
64 // as separate array values
66 $DataSegment271[$i] = explode("^", $Value);
69 if (count($DataSegment271[$i])<6) {
72 if (file_exists($target)) {
76 foreach ($DataSegment271[$i] as $datastrings) {
77 $Segments271[$j] = explode("~", $datastrings);
79 $segment = $Segments271[$j][0];
82 // Switch Case for Segment
88 foreach ($Segments271[$j] as $segmentVal) {
90 $x12PartnerId = $segmentVal;
98 foreach ($Segments271[$j] as $segmentVal) {
99 if ($segmentVal == "EJ") {
100 $patientId = $Segments271[$j][2];
106 foreach ($Segments271[$j] as $segmentVal) {
111 foreach ($Segments271[$j] as $segmentVal) {
112 if ($segment != $segmentVal) {
113 eligibility_response_save($segmentVal, $x12PartnerId);
115 eligibility_verification_save($segmentVal, $x12PartnerId, $patientId);
123 // Increase the line index
128 //Increase the line index
133 $message .= htmlspecialchars(xl('Sorry, there was a problem uploading your file'), ENT_NOQUOTES
). "<br><br>";
140 <?php
html_header_show();?
>
141 <title
><?php
echo htmlspecialchars(xl('EDI-271 Response File Upload'), ENT_NOQUOTES
); ?
></title
>
142 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
143 <style type
="text/css">
145 /* specifically include & exclude from printing */
151 #report_parameters_daterange {
155 #report_results table {
160 /* specifically exclude some from the screen */
162 #report_parameters_daterange {
170 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
171 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
172 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
174 <script type
="text/javascript">
175 function edivalidation(){
177 var mypcc
= "<?php echo htmlspecialchars(xl('Required Field Missing: Please choose the EDI-271 file to upload'), ENT_QUOTES);?>";
179 if(document
.getElementById('uploaded').value
== ""){
185 $
("#theform").submit();
192 <body
class="body_top">
194 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
195 <?php
if (isset($message) && !empty($message)) {
197 <div style
="margin-left:25%;width:50%;color:RED;text-align:center;font-family:arial;font-size:15px;background:#ECECEC;border:1px solid;" ><?php
echo $message; ?
></div
>
202 if (isset($messageEDI)) {
204 <div style
="margin-left:25%;width:50%;color:RED;text-align:center;font-family:arial;font-size:15px;background:#ECECEC;border:1px solid;" >
205 <?php
echo htmlspecialchars(xl('Please choose the proper formatted EDI-271 file'), ENT_NOQUOTES
); ?
>
214 <span
class='title'><?php
echo htmlspecialchars(xl('EDI-271 File Upload'), ENT_NOQUOTES
); ?
></span
>
216 <form enctype
="multipart/form-data" name
="theform" id
="theform" action
="edi_271.php" method
="POST" onsubmit
="return top.restoreSession()">
218 <div id
="report_parameters">
222 <div style
='float:left'>
225 <td style
='width:125px;' class='label_custom'> <?php
echo htmlspecialchars(xl('Select EDI-271 file'), ENT_NOQUOTES
); ?
>: </td
>
226 <td
> <input name
="uploaded" id
="uploaded" type
="file" size
=37 /></td
>
231 <td align
='left' valign
='middle' height
="100%">
232 <table style
='border-left:1px solid; width:100%; height:100%' >
235 <div style
='margin-left:15px'>
236 <a href
='#' class='css_button' onclick
='return edivalidation(); '><span
><?php
echo htmlspecialchars(xl('Upload'), ENT_NOQUOTES
); ?
></span
>
248 <input type
="hidden" name
="form_orderby" value
="<?php echo htmlspecialchars($form_orderby, ENT_QUOTES); ?>" />
249 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>