Skip to content

Commit

Permalink
Merge pull request openemr#2225 from sjpadgett/v5_0_1_7
Browse files Browse the repository at this point in the history
reference PR openemr#1612 statement reflects service and billing locations
  • Loading branch information
sjpadgett committed Feb 15, 2019
2 parents 74e765c + 1118523 commit d0cdc01
Show file tree
Hide file tree
Showing 4 changed files with 276 additions and 243 deletions.
8 changes: 6 additions & 2 deletions interface/billing/sl_eob_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/


// Updated by Growlingflea Software. now generates correct service and billing facility on statement.
// any questions contact Daniel Pflieger at [email protected]

require_once("../globals.php");
require_once("$srcdir/patient.inc");
require_once("$srcdir/invoice_summary.inc.php");
Expand Down Expand Up @@ -363,7 +366,7 @@ function upload_file_to_client_pdf($file_to_send, $aPatFirstName = '', $aPatID =

$res = sqlStatement("SELECT " .
"f.id, f.date, f.pid, f.encounter, f.stmt_count, f.last_stmt_date, f.last_level_closed, f.last_level_billed, f.billing_note as enc_billing_note, " .
"p.fname, p.mname, p.lname, p.street, p.city, p.state, p.postal_code, p.billing_note as pat_billing_note " .
"p.fname, p.mname, p.lname, p.street, p.city, p.state, p.postal_code, p.billing_note as pat_billing_note, f.provider_id " .
"FROM form_encounter AS f, patient_data AS p " .
"WHERE $where " .
"p.pid = f.pid " .
Expand Down Expand Up @@ -443,7 +446,7 @@ function upload_file_to_client_pdf($file_to_send, $aPatFirstName = '', $aPatID =
if (!empty($stmt)) {
++$stmt_count;
}

$stmt['fid'] = $row['id'];
$stmt['cid'] = $row['pid'];
$stmt['pid'] = $row['pid'];
$stmt['dun_count'] = $row['stmt_count'];
Expand All @@ -453,6 +456,7 @@ function upload_file_to_client_pdf($file_to_send, $aPatFirstName = '', $aPatID =
$stmt['level_closed'] = $row['last_level_closed'];
$stmt['patient'] = $row['fname'] . ' ' . $row['lname'];
$stmt['encounter'] = $row['encounter'];
$stmt['provider_id'] = $row['provider_id'];
#If you use the field in demographics layout called
#guardiansname this will allow you to send statements to the parent
#of a child or a guardian etc
Expand Down
7 changes: 7 additions & 0 deletions library/globals.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,13 @@ function gblTimeZones()
xl('This feature will allow the default POS facility code to be overriden from the encounter.')
),

'statement_logo' => array(
xl('Statement Logo GIF Filename'),
'text', // data type
'practice_logo.gif', // data type
xl('Place your logo in sites/default/images and type the filename including gif extension here.')
),

'use_custom_statement' => array(
xl('Use Custom Statement'),
'bool', // data type
Expand Down
13 changes: 12 additions & 1 deletion library/invoice_summary.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ function ar_get_invoice_summary($patient_id, $encounter_id, $with_detail = false
$codes[$code]['dtl'][$tmpkey] = $tmp;
}
}

// Get insurance data for stuff
$ins_data = array();
$res = sqlStatement("SELECT insurance_data.type as type, insurance_companies.name as name " .
"FROM insurance_data " .
"INNER JOIN insurance_companies ON insurance_data.provider = insurance_companies.id " .
"WHERE insurance_data.pid = ?", array($patient_id));
while ($row = sqlFetchArray($res)) {
$ins_data[$row['type']] = $row['name'];
}
// Get payments and adjustments. (includes copays)
$res = sqlStatement("SELECT " .
"a.code_type, a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, a.reason_code, " .
Expand Down Expand Up @@ -159,6 +167,9 @@ function ar_get_invoice_summary($patient_id, $encounter_id, $with_detail = false
$tmp['chg'] = 0 - $row['adj_amount'];
// $tmp['rsn'] = (empty($row['memo']) || empty($row['session_id'])) ? 'Unknown adjustment' : $row['memo'];
$tmp['rsn'] = empty($row['memo']) ? 'Unknown adjustment' : $row['memo'];
$tmp['rsn'] = str_replace("Ins1", $ins_data['primary'], $tmp['rsn']);
$tmp['rsn'] = str_replace("Ins2", $ins_data['secondary'], $tmp['rsn']);
$tmp['rsn'] = str_replace("Ins3", $ins_data['tertiary'], $tmp['rsn']);
$tmpkey = $paydate . $keysuff1++;
} else {
$tmpkey = $paydate . $keysuff2++;
Expand Down
Loading

0 comments on commit d0cdc01

Please sign in to comment.