Skip to content

Commit

Permalink
fix: support multiple modifiers in fee sheet (openemr#7166)
Browse files Browse the repository at this point in the history
* fix: support multiple modifiers in fee sheet

* add function for modifier work

* disable text template for fee sheet

* validate modifiers

* nice catch by Brady, bring new coding tab to custom json menu

* use recursive last char function
stephenwaite authored Jan 27, 2024
1 parent f7c5705 commit d893b1f
Showing 5 changed files with 58 additions and 13 deletions.
48 changes: 45 additions & 3 deletions interface/forms/fee_sheet/new.php
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@ function echoServiceLines()
if ($codetype != 'COPAY' && (!empty($code_types[$codetype]['mod']) || $modifier)) {
echo " <td class='billcell'><input type='text' class='form-control form-control-sm' name='bill[" . attr($lino) . "][mod]' " .
"title='" . xla("Multiple modifiers can be separated by colons or spaces, maximum of 4 (M1:M2:M3:M4)") . "' " .
"value='" . attr($modifier) . "' size='" . attr($code_types[$codetype]['mod']) . " 'onkeyup='policykeyup(this)' /></td>\n";
"value='" . attr($modifier) . "' size='" . attr($code_types[$codetype]['mod']) . "' onkeyup='policykeyup(this)' onblur='formatModifier(this)' /></td>\n";
} else {
echo " <td class='billcell'>&nbsp;</td>\n";
}
@@ -670,7 +670,12 @@ function echoProductLines()

$arrcode = explode('|', $codestring);
if (strpos($arrcode[1], ':') !== false) {
list($code, $modifier) = explode(":", $arrcode[1]);
$tmp = explode(':', $arrcode[1]);
$code = $tmp[0] ?? '';
$modifier = $tmp[1] ?? '';
$modifier .= ($tmp[2] ?? '') ? ":" . $tmp[2] : '';
$modifier .= ($tmp[3] ?? '') ? ":" . $tmp[3] : '';
$modifier .= ($tmp[4] ?? '') ? ":" . $tmp[4] : '';
} else {
$code = $arrcode[1];
$modifier = '';
@@ -906,6 +911,38 @@ function defaultPriceLevelChanged(sel) {
}
}

function formatModifier(e) {
let mods = e.value;
mods = mods.substring(0, 11).trim();
let modArray = mods.includes(':') ? mods.split(":") : mods.split(" ");
let cntr = 0;
modArray.forEach( function(m) {
let l = m.length;
if (l) {
cntr++;
if (l !== 2) {
alert("Removing invalid modifier " + m);
modArray.pop();
}
} else {
modArray.pop();
}
});

let modString = modArray.join(":");
e.value = checkLastChar(modString);
}

function checkLastChar(s) {
let last_char = s.slice(-1);
if (last_char === ':') {
s = s.substring(0, s.length - 1);
return checkLastChar(s);
} else {
return s;
}
}

</script>
<style>
@media only screen and (max-width: 1024px) {
@@ -1566,7 +1603,12 @@ function defaultPriceLevelChanged(sel) {
);
} else {
if (strpos($newcode, ':') !== false) {
list($code, $modifier) = explode(":", $newcode);
$tmp = explode(':', $arrcode[1]);
$code = $tmp[0] ?? '';
$modifier = $tmp[1] ?? '';
$modifier .= ($tmp[2] ?? '') ? ":" . $tmp[2] : '';
$modifier .= ($tmp[3] ?? '') ? ":" . $tmp[3] : '';
$modifier .= ($tmp[4] ?? '') ? ":" . $tmp[4] : '';
} else {
$code = $newcode;
$modifier = '';
8 changes: 4 additions & 4 deletions interface/main/tabs/menu/menus/standard.json
Original file line number Diff line number Diff line change
@@ -904,8 +904,8 @@
"children": [
{
"label": "Codes",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/patient_file/encounter/superbill_custom_full.php",
"children": [],
"requirement": 0,
@@ -916,8 +916,8 @@
},
{
"label": "Native Data Loads",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/super/load_codes.php",
"children": [],
"requirement": 0,
2 changes: 1 addition & 1 deletion interface/patient_file/encounter/load_form.php
Original file line number Diff line number Diff line change
@@ -41,6 +41,6 @@
include_once("$incdir/forms/" . $_GET["formname"] . "/new.php");
}

if (!empty($GLOBALS['text_templates_enabled'])) { ?>
if (!empty($GLOBALS['text_templates_enabled']) && !($_GET['formname'] == 'fee_sheet')) { ?>
<script src="<?php echo $GLOBALS['web_root'] ?>/library/js/CustomTemplateLoader.js"></script>
<?php } ?>
5 changes: 4 additions & 1 deletion interface/super/edit_list.php
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ function listChecksum($list_id)
"fs_category, fs_option, fs_codes" .
"))) AS checksum FROM fee_sheet_options"
);
} else if ($list_id == 'code_types') {
} elseif ($list_id == 'code_types') {
$row = sqlQuery(
"SELECT BIT_XOR(CRC32(CONCAT_WS(',', " .
"ct_key, ct_id, ct_seq, ct_mod, ct_just, ct_mask, ct_fee, ct_rel, ct_nofs, ct_diag" .
@@ -352,6 +352,9 @@ function getCodeDescriptions($codes)
if (!empty($tmp[0] ?? null)) {
$code = $tmp[0] ?? '';
$modifier = $tmp[1] ?? '';
$modifier .= ($tmp[2] ?? '') ? ":" . $tmp[2] : '';
$modifier .= ($tmp[3] ?? '') ? ":" . $tmp[3] : '';
$modifier .= ($tmp[4] ?? '') ? ":" . $tmp[4] : '';
}
} else {
$code = $arrcode[1];
8 changes: 4 additions & 4 deletions sites/default/documents/custom_menus/Custom.json
Original file line number Diff line number Diff line change
@@ -904,8 +904,8 @@
"children": [
{
"label": "Codes",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/patient_file/encounter/superbill_custom_full.php",
"children": [],
"requirement": 0,
@@ -916,8 +916,8 @@
},
{
"label": "Native Data Loads",
"menu_id": "adm0",
"target": "adm",
"menu_id": "cod0",
"target": "cod",
"url": "/interface/super/load_codes.php",
"children": [],
"requirement": 0,

0 comments on commit d893b1f

Please sign in to comment.