From 8cfb1922eef7a06add95647ff09b72898c1ef3c8 Mon Sep 17 00:00:00 2001 From: Rod Roark Date: Mon, 9 Jul 2012 17:18:16 -0700 Subject: [PATCH] More improved flexibility of code types. --- interface/forms/fee_sheet/new.php | 4 ++-- interface/patient_file/report/custom_report.php | 13 +++++++++---- interface/reports/clinical_reports.php | 20 ++++++++++++++++++-- library/report.inc | 13 +++++++++---- library/sl_eob.inc.php | 6 +++--- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/interface/forms/fee_sheet/new.php b/interface/forms/fee_sheet/new.php index 3dd4039cc..dc6965617 100644 --- a/interface/forms/fee_sheet/new.php +++ b/interface/forms/fee_sheet/new.php @@ -168,7 +168,7 @@ function echoLine($lino, $codetype, $code, $modifier, $ndc_info='', echo " "; genProviderSelect('', '-- '.xl("Default").' --', $provider_id, true); echo "\n"; - if ($codetype == 'HCPCS' || $codetype == 'CPT4') { + if ($code_types[$codetype]['claim'] && !$code_types[$codetype]['diag']) { echo " " . htmlspecialchars($notecodes, ENT_NOQUOTES) . "\n"; } @@ -231,7 +231,7 @@ function echoLine($lino, $codetype, $code, $modifier, $ndc_info='', echo " "; genProviderSelect("bill[$lino][provid]", '-- '.xl("Default").' --', $provider_id); echo "\n"; - if ($codetype == 'HCPCS' || $codetype == 'CPT4') { + if ($code_types[$codetype]['claim'] && !$code_types[$codetype]['diag']) { echo " \n"; } diff --git a/interface/patient_file/report/custom_report.php b/interface/patient_file/report/custom_report.php index 239344b8d..f74dd32a0 100644 --- a/interface/patient_file/report/custom_report.php +++ b/interface/patient_file/report/custom_report.php @@ -475,10 +475,15 @@ foreach ($ar as $key => $val) { if ($res[1] == 'newpatient') { // display billing info - $bres = sqlStatement("SELECT date, code, code_text FROM billing WHERE " . - "pid = '$pid' AND encounter = '$form_encounter' AND activity = 1 AND " . - "( code_type = 'CPT4' OR code_type = 'OPCS' OR code_type = 'OSICS10' ) " . - "ORDER BY date"); + $bres = sqlStatement("SELECT b.date, b.code, b.code_text " . + "FROM billing AS b, code_types AS ct WHERE " . + "b.pid = ? AND " . + "b.encounter = ? AND " . + "b.activity = 1 AND " . + "b.code_type = ct.ct_key AND " . + "ct.ct_diag = 0 " . + "ORDER BY b.date", + array($pid, $form_encounter)); while ($brow=sqlFetchArray($bres)) { echo " ".xl('Procedure').": " . $brow['code'] . " " . $brow['code_text'] . "
\n"; diff --git a/interface/reports/clinical_reports.php b/interface/reports/clinical_reports.php index e4abcfe2e..f0744919f 100644 --- a/interface/reports/clinical_reports.php +++ b/interface/reports/clinical_reports.php @@ -25,6 +25,7 @@ $fake_register_globals=false; require_once("$srcdir/options.inc.php"); require_once("../drugs/drugs.inc.php"); require_once("$srcdir/formatting.inc.php"); + require_once("../../custom/code_types.inc.php"); function add_date($givendate,$day=0,$mth=0,$yr=0) { $cd = strtotime($givendate); @@ -48,6 +49,21 @@ $fake_register_globals=false; $form_diagnosis = trim($_POST["form_diagnosis"]); $form_lab_results = trim($_POST["form_lab_results"]); $form_service_codes = trim($_POST["form_service_codes"]); + +// Create comma-separated lists of active diagnosis and procedure code types. +$ct_diag_list = ''; +$ct_proc_list = ''; +foreach ($code_types as $ct_key => $ct_arr) { + if (!$ct_arr['active']) continue; + if ($ct_arr['diag']) { + if ($ct_diag_list) $ct_diag_list .= ','; + $ct_diag_list .= urlencode($ct_key); + } + else { + if ($ct_proc_list) $ct_proc_list .= ','; + $ct_proc_list .= urlencode($ct_key); + } +} ?> @@ -102,13 +118,13 @@ function set_related(codetype, code, selector, codedesc) { //This invokes the find-code popup. function sel_diagnosis(e) { current_sel_name = e.name; - dlgopen('../patient_file/encounter/find_code_popup.php?codetype=ICD9', '_blank', 500, 400); + dlgopen('../patient_file/encounter/find_code_popup.php?codetype=', '_blank', 500, 400); } //This invokes the find-code popup. function sel_procedure(e) { current_sel_name = e.name; - dlgopen('../patient_file/encounter/find_code_popup.php?codetype=CPT4', '_blank', 500, 400); + dlgopen('../patient_file/encounter/find_code_popup.php?codetype=', '_blank', 500, 400); } diff --git a/library/report.inc b/library/report.inc index e6e574d36..745e34e9d 100644 --- a/library/report.inc +++ b/library/report.inc @@ -301,10 +301,15 @@ function printPatientForms($pid, $cols) { if ($result{"form_name"} == "New Patient Encounter") { // display billing info echo "
"; - $bres = sqlStatement("SELECT date, code, code_text FROM billing WHERE " . - "pid = '$pid' AND encounter = '".$result['encounter']."' AND activity = 1 AND " . - "( code_type = 'CPT4' OR code_type = 'OPCS' OR code_type = 'OSICS10' ) " . - "ORDER BY date"); + $bres = sqlStatement("SELECT b.date, b.code, b.code_text " . + "FROM billing AS b, code_types AS ct WHERE " . + "b.pid = ? AND " . + "b.encounter = ? AND " . + "b.activity = 1 AND " . + "b.code_type = ct.ct_key AND " . + "ct.ct_diag = 0 " . + "ORDER BY b.date", + array($pid, $result['encounter'])); while ($brow=sqlFetchArray($bres)) { echo " ".xl('Procedure').": " . $brow['code'] . " " . $brow['code_text'] . "
\n"; diff --git a/library/sl_eob.inc.php b/library/sl_eob.inc.php index 2b9deb9d1..f47533f26 100644 --- a/library/sl_eob.inc.php +++ b/library/sl_eob.inc.php @@ -438,7 +438,7 @@ function arPostSession($payer_id,$check_number,$check_date,$pay_total,$post_to_d // Make this invoice re-billable, SQL-Ledger style. // function slSetupSecondary($invid, $debug) { - global $sl_err, $GLOBALS; + global $sl_err, $GLOBALS, $code_types; if ($GLOBALS['oer_config']['ws_accounting']['enabled'] === 2) die("Internal error calling slSetupSecondary()"); @@ -591,7 +591,7 @@ function arPostSession($payer_id,$check_number,$check_date,$pay_total,$post_to_d foreach ($code_types as $key => $value) { if (preg_match("/$key/", $row['serialnumber'])) { $code_type = $key; - if ($value['fee']) { + if (!$value['diag']) { $code_text = xl("Procedure") . " $code"; } else { $code_text = xl("Diagnosis") . " $code"; @@ -646,7 +646,7 @@ function arPostSession($payer_id,$check_number,$check_date,$pay_total,$post_to_d echo $query . "
\n"; } else { $proc_ins_id = idSqlStatement($query); - if ($code_type != "CPT4" && $code_type != "HCPCS") + if ($code_types[$code_type]['diag']) $proc_ins_id = 0; } } -- 2.11.4.GIT