Skip to content

Commit

Permalink
Merge pull request openemr#7547 from stephenwaite/rel-702-iss7501-take-3
Browse files Browse the repository at this point in the history
fix: set default if only 1 effective insurance (openemr#7546)
  • Loading branch information
stephenwaite authored Jul 2, 2024
2 parents 1fc056a + ce4eac3 commit 8cdc22d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion interface/billing/billing_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -1117,12 +1117,16 @@ function criteriaSelectHasValue(select) {

$last_level_closed = sqlQuery("SELECT `last_level_closed` FROM `form_encounter` WHERE `encounter` = ?", array($iter['enc_encounter']))['last_level_closed'];
$effective_insurances = getEffectiveInsurances($iter['pid'], $iter['enc_date']);
$insuranceCount = count($effective_insurances ?? []);

foreach ($effective_insurances as $key => $row) {
$insuranceName = sqlQuery("SELECT `name` FROM `insurance_companies` WHERE `id` = ?", array($row['provider']))['name'];
$x12Partner = sqlQuery("SELECT `x12_default_partner_id` FROM `insurance_companies` WHERE `id` = ?", array($row['provider']))['x12_default_partner_id'];
$lhtml .= "<option value=\"" . attr(substr($row['type'], 0, 1) . $row['provider']) . "\"";
if ($key == $last_level_closed) {
if (
$key == $last_level_closed
|| $insuranceCount = 1
) {
$lhtml .= " selected";
$default_x12_partner = $x12Partner;
}
Expand Down

0 comments on commit 8cdc22d

Please sign in to comment.