Hi, I am building a form that I would like to pull billing data into from the patients record. I can’t figure out where this data is stored in the system. I have made a video of what data I am looking to retrieve. http://www.youtube.com/watch?v=CRZk6fapGk0
I had looked at that table but was looking at it wrong. I found all the data that I was looking parse from the table. The thing I am trying to figure out now is how to pull only data for the current encounter.
else if ($data_type == 35) {
$query = “SELECT code, code_text FROM billing WHERE " .
“pid = ? AND code_type = ‘ICD9’ AND billed = 0”;
//“ORDER BY begdate”;
//mod added to create short cut back to add alergy
echo '<br> <a href=”/interface/patient_file/encounter/load_form.php?formname=fee_sheet"target=“RTop”>Add ICD9 codes</a>  ’;
// debugging
$lres = sqlStatement($query, array($GLOBALS));
$count = 0;
while ($lrow = sqlFetchArray($lres)) {
if ($count++) echo “<br />”;
echo htmlspecialchars( $lrow, ENT_NOQUOTES);
if ($lrow) echo ’ (’ . htmlspecialchars( $lrow, ENT_NOQUOTES) . ‘)’;
}
}
This code works but unless billing is done before this patient is seen again then all of the ICD9 codes that are not billed since the patient was last seen will populate the form. I am not sure if I want that to happen. So, I was thinking about adding a variable $encounter but not sure where to add it in the options.inc.php file to produce the results I am looking to obtain.
Because the current encounter changes everything the patient is seen what holds the encounter number so that I can grab it to use in the SQL statement?
I have one other hurdle to cross with these data types. They are read only. I did not catch the meaning until I went to save the data and it did not save it to the database to be printed in the report. Where would I go to add the data_type to have the data retrieved added to the database.