Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/openemr/openemr into weno…
Browse files Browse the repository at this point in the history
…_last

* 'master' of https://github.com/openemr/openemr:
  Hide dashboard card 2 (openemr#7423)
  fix: ccda zip import and php warnings and deprecations (openemr#7416)
  Fee sheet and Codes revenue code (openemr#7415)
  Refactor UB04 837i X12 feature to make work again. (openemr#7412)
  feat: support loop 2420E (openemr#7405)
  Fix: Revert "Fix: OpenEMR logs sensitive information such as payment details (openemr#7341)" (openemr#7396)
  Weno better error handling from fetches (openemr#7408)
  • Loading branch information
sjpadgett committed May 7, 2024
2 parents fb8ed1a + 6e94bfb commit 631b69f
Show file tree
Hide file tree
Showing 31 changed files with 931 additions and 775 deletions.
2 changes: 2 additions & 0 deletions Documentation/help_files/medical_dashboard_help.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@

<p><?php echo xlt("These items can be edited if the user has sufficient privilege");?>.</p>

<p><?php echo xlt("Some of these data sections can be turned off if not being utilized by the clinic. Go to Admin, Config, Appearance to hide the cards to streamline the dashboard"); ?></p>

<p><?php echo xlt("Billing - provides a summary of the balances - Patient Balance Due, Insurance Balance Due, Total Balance Due and lists the name of the Primary Insurance along with its effective date");?>.</p>

<p><?php echo xlt("Demographics - patient demographics and insurance information");?>.</p>
Expand Down
49 changes: 26 additions & 23 deletions interface/billing/ub04_dispose.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
* @package OpenEMR
* @link http:https://www.open-emr.org
* @author Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2017 Jerry Padgett <[email protected]>
* @copyright Copyright (c) 2017-2024 Jerry Padgett <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

require_once("../globals.php");

use OpenEMR\Billing\BillingUtilities;
use OpenEMR\Billing\Claim;
use OpenEMR\Billing\X125010837I;
use OpenEMR\Pdf\PdfCreator;

function ub04_dispose()
Expand All @@ -41,8 +40,8 @@ function ub04_dispose()
saveTemplate($encounter, $pid, $ub04id, $dispose);
exit("done");
} elseif ($dispose == "reset_claim") {
$pid = isset($_POST['pid']) ? $_POST['pid'] : $_GET['pid'];
$encounter = isset($_POST['encounter']) ? $_POST['encounter'] : $_GET['encounter'];
$pid = $_POST['pid'] ?? $_GET['pid'];
$encounter = $_POST['encounter'] ?? $_GET['encounter'];
// clear claim first otherwise get ub04 returns cuurent version.
//
$flg = exist_ub04_claim($pid, $encounter, true);
Expand Down Expand Up @@ -72,7 +71,7 @@ function get_payer_defaults($payerid)
function savePayerTemplate($payerid, $ubo4id)
{
$ub04id = json_encode($ub04id);
sqlStatement("update insurance_companies set claim_template= ? where id = ?", array(
sqlStatement("update insurance_companies set claim_template = ? where id = ?", array(
$ubo4id,
$payerid
));
Expand Down Expand Up @@ -120,8 +119,8 @@ function buildTemplate(string $pid = null, string $encounter = null, $htmlin, st

function ub04Dispose($dispose = 'download', $htmlin = "", $filename = "ub04.pdf", $form_action = "")
{
$top = isset($_POST["left_ubmargin"]) ? $_POST["left_ubmargin"] : $GLOBALS['left_ubmargin_default'];
$side = isset($_POST["top_ubmargin"]) ? $_POST["top_ubmargin"] : $GLOBALS['top_ubmargin_default'];
$top = $_POST["left_ubmargin"] ?? $GLOBALS['left_ubmargin_default'];
$side = $_POST["top_ubmargin"] ?? $GLOBALS['top_ubmargin_default'];
$form_filename = $GLOBALS['OE_SITE_DIR'] . "/documents/edi/$filename";
// convert points to inches-some tricky calculus here! 72 pts/inch
$top = round($top / 72.00, 2) . "in";
Expand All @@ -146,7 +145,9 @@ function ub04Dispose($dispose = 'download', $htmlin = "", $filename = "ub04.pdf"
'no-images' => $isnotform,
'grayscale' => true,
'page-size' => 'Letter',
'orientation' => 'Portrait'
'orientation' => 'Portrait',
'load-media-error-handling' => 'ignore',
'load-error-handling' => 'ignore'
);

$PdfCreator = new PdfCreator();
Expand Down Expand Up @@ -183,7 +184,7 @@ function exist_ub04_claim($pid, $encounter, $flag = false)
$encounter
));
if ($row) {
if (! empty($row['submitted_claim'])) {
if (!empty($row['submitted_claim'])) {
if ($flag === false) {
return $row['submitted_claim'];
} else {
Expand Down Expand Up @@ -247,8 +248,8 @@ function get_ub04_array($pid, $encounter, &$log = "")
$clm_amount_adjusted = 0;
$clm_amount_paid = $ub04_proc_index ? 0 : $claim->patientPaidAmount();
for ($tlh = 0; $tlh < $proccount; ++$tlh) {
$tmp = $claim->procs[$tlh][code_text];
if ($claim->procs[$tlh][code_type] == 'HCPCS') {
$tmp = $claim->procs[$tlh]['code_text'];
if ($claim->procs[$tlh]['code_type'] == 'HCPCS') {
$tmpcode = '3';
} else {
$tmpcode = '1';
Expand All @@ -265,7 +266,9 @@ function get_ub04_array($pid, $encounter, &$log = "")
}
}
foreach ($revcode as $key => $row) {
$revcod[$key] = $row['revenue_code'];
if (!empty($row)) {
$revcod[$key] = $row['revenue_code'];
}
}
array_multisort($revcod, SORT_ASC, $revcode2);
// Procedure loop starts here.
Expand Down Expand Up @@ -294,10 +297,10 @@ function get_ub04_array($pid, $encounter, &$log = "")
$mcnt = $ub04_proc_index;

// @todo need if inpatient or out patient for box 74 - 74e
$tmp = $claim->cleanDate($revcode2[$mcnt][date]);
$tmp = $claim->cleanDate($revcode2[$mcnt]['date']);
$sdate = substr($tmp, 4, 2) . substr($tmp, 6, 2) . substr($tmp, 2, 2);
if ($pcnt < 6) {
$ub04id[$dos++] = $revcode2[$mcnt][code]; /* 74. PRINCIPAL PROCEDURE CODE */
$ub04id[$dos++] = $revcode2[$mcnt]['code']; /* 74. PRINCIPAL PROCEDURE CODE */
$ub04id[$dos++] = $sdate; /* 74. PRINCIPAL PROCEDURE DATE */
if ($dos == 388) {
$dos = 393;
Expand All @@ -307,12 +310,12 @@ function get_ub04_array($pid, $encounter, &$log = "")
// @todo Deal with code modifiers $revcode2[$mcnt][modifier]
$tmp = $claim->serviceDate();
$sdate = substr($tmp, 4, 2) . substr($tmp, 6, 2) . substr($tmp, 2, 2);
$ub04id[$os] = $claim->procs[$mcnt][revenue_code]; // 42. REVENUE CODE, Line 1-23 */
$ub04id[++$os] = strtoupper($revcode2[$mcnt][code_text]); /* 43. REVENUE DESCRIPTION, Line 1-23 */
$ub04id[++$os] = trim($revcode2[$mcnt][code] . ' ' . $revcode2[$mcnt][modifier]); /* 44. HCPCS/ACCOMMODATION RATES/HIPPS RATE CODES, Line 1-23 */
$ub04id[$os] = $claim->procs[$mcnt]['revenue_code']; // 42. REVENUE CODE, Line 1-23 */
$ub04id[++$os] = strtoupper($revcode2[$mcnt]['code_text']); /* 43. REVENUE DESCRIPTION, Line 1-23 */
$ub04id[++$os] = trim($revcode2[$mcnt]['code'] . ' ' . $revcode2[$mcnt]['modifier']); /* 44. HCPCS/ACCOMMODATION RATES/HIPPS RATE CODES, Line 1-23 */
$ub04id[++$os] = $sdate; /* 45. SERVICE DATE, Line 1-23 */
$ub04id[++$os] = $revcode2[$mcnt][units]; /* 46. SERVICE UNITS, Line 1-23 */
$ub04id[++$os] = str_replace('.', ' ', sprintf('%8.2f', $revcode2[$mcnt][fee])); /* 47. TOTAL CHARGES, Line 1-23 */
$ub04id[++$os] = $revcode2[$mcnt]['units']; /* 46. SERVICE UNITS, Line 1-23 */
$ub04id[++$os] = str_replace('.', ' ', sprintf('%8.2f', $revcode2[$mcnt]['fee'])); /* 47. TOTAL CHARGES, Line 1-23 */
$ub04id[++$os] = ''; /* 48. NON-COVERED CHARGES, Line 1-23 */
$os += 2;
}
Expand Down Expand Up @@ -347,10 +350,10 @@ function get_ub04_array($pid, $encounter, &$log = "")
}
}
// @todo Not sure
$ub04id[367] = $diagnosis[0] ? substr($diagnosis[0], 0, 7) : ''; /* 69. ADMITTING DIAGNOSIS CODE */
$ub04id[368] = $diagnosis[1] ? substr($diagnosis[1], 0, 7) : ''; /* 70a. PATIENT'S REASON FOR VISIT */
$ub04id[369] = $diagnosis[2] ? substr($diagnosis[2], 0, 7) : ''; /* 70b. PATIENT'S REASON FOR VISIT */
$ub04id[370] = $diagnosis[3] ? substr($diagnosis[3], 0, 7) : ''; /* 70c. PATIENT'S REASON FOR VISIT */
$ub04id[367] = $diagnosis[0] ?? '' ? substr($diagnosis[0], 0, 7) : ''; /* 69. ADMITTING DIAGNOSIS CODE */
$ub04id[368] = $diagnosis[1] ?? '' ? substr($diagnosis[1], 0, 7) : ''; /* 70a. PATIENT'S REASON FOR VISIT */
$ub04id[369] = $diagnosis[2] ?? '' ? substr($diagnosis[2], 0, 7) : ''; /* 70b. PATIENT'S REASON FOR VISIT */
$ub04id[370] = $diagnosis[3] ?? '' ? substr($diagnosis[3], 0, 7) : ''; /* 70c. PATIENT'S REASON FOR VISIT */

$payer_os = 0;
if (empty($claim->payerName(0))) {
Expand Down
Loading

0 comments on commit 631b69f

Please sign in to comment.