Add Function for Fee Sheet not working 4.1

hpcalaf wrote on Tuesday, November 08, 2011:

When you try to add a new CPT code to a Fee Sheet group the Code List window pops up, allows you to search and find codes, but once the code is selected, all selections disappear and you set with an empty Code List window.  All that you can do is close the window.  Tested in both Chrome and Firefox Ubuntu Browsers to Ubuntu server implemenation.

Also reported here https://sourceforge.net/projects/openemr/forums/forum/202504/topic/4733781?message=10697774

To work around, what is the format of the fs_codes field in the ‘fee_sheet_options’ table.  There is only a single entry for each group, so its hard to tell how a multiple list of multiple fees would be formatted: CPT4|99201|

bradymiller wrote on Saturday, November 12, 2011:

Hi,

Confirmed this bug. Would be good to place this on the Bug tracker.

Also, looks like the formatting is:
CPT4|99201~CPT4|99554  etc…

-brady

hpcalaf wrote on Saturday, November 19, 2011:

Per your suggestion Brady, I added this to Bug tracker…I hope its ok for me to do that.

Thanks for the tip about “~” as work around.

Henry

bradymiller wrote on Sunday, November 20, 2011:

Hi Henry,

Definitely ok; that’s what the tracker is for :slight_smile:
I’m guessing this should be a simple fix in the interface/super/edit_layout.php script. Any takers?

-brady

hpcalaf wrote on Sunday, November 20, 2011:

I looked at this a little.  I doubt I’m qualified to implement a fix, but I have noticed that the called interface/patient_file/encounter/find_code_popup.php calls a javascript process called “opener.set_related”.  I don’t see where this property is pulled into the routine.

Also notice that when you hover over the links on the popup that the links to pull in the codes seem to all be incomplete.  Mine all look like this… “http://<sitename>/interface/patient_file/encounter/find_code_popup.php?codetype=”

Given hints about where to look further on this, I’m happy to do that.

Henry

yehster wrote on Thursday, December 29, 2011:

Henry,
“opener” refers to the window which opened find_code_popup.php.  In this case it superbill_custom_full.php opens find_code_popup, and scf is the file which defines the set_related javascript function.
Here’s some more info on “openemr” for reference.
http://www.w3schools.com/jsref/prop_win_opener.asp
-Kevin Yeh
kevin.y@integralemr.com

samsalas wrote on Sunday, January 08, 2012:

I have looked into this problem and found that after a search is performed the site ID is missing from session data.  Not sure if a popup needs a “restoreSession()” like other sessions.

aaversa wrote on Monday, January 09, 2012:

Hi everyone,

We were experiencing the same problem adding codes (CPT and ICD) to the Fee Sheet list.

The function set_related() is defined twice inside interface/super/edit_list.php (lines 489 and 551). It appears as though one callback is intended when editing the Immunizations list, and the other when editing the Fee Sheet.

I am new to the OpenEMR code base, so I simply combined the two functions and used an if statement to determine which path to follow. I’m sure there is a much cleaner way to correct the issue, and will be happy to submit a proper patch once I become more familiar with the code. In the meantime, I have included the combined set_related() function I’m using. This has been tested both from Fee Sheet & Immunization list edit.

Thanks,
Aric Aversa

function set_related(codetype, code, selector, codedesc) {
 if (typeof(current_sel_name) == 'undefined')
 {
 // Coming from Fee Sheet edit
  var f = document.forms[0];
  var celem = f['opt[' + current_lino + '][codes]'];
  var delem = f['opt[' + current_lino + '][descs]'];
  var i = 0;
  while ((i = codedesc.indexOf('~')) >= 0) {
   codedesc = codedesc.substring(0, i) + ' ' + codedesc.substring(i+1);
  }
  if (code) {
   if (celem.value) {
    celem.value += '~';
    delem.value += '~';
   }
   celem.value += codetype + '|' + code + '|' + selector;
   if (codetype == 'PROD') delem.value += code + ':' + selector + ' ' + codedesc;
   else delem.value += codetype + ':' + code + ' ' + codedesc;
  } else {
   celem.value = '';
   delem.value = '';
  }
  displayCodes(current_lino);
 }
 else
 {
  // Coming from Immunizations edit
     var f = document.forms[0][current_sel_name];
     var s = f.value;
     if (code) {
         s = code;
     }
     else {
         s = '0';
     }
     f.value = s;
 }
}

bradymiller wrote on Tuesday, January 10, 2012:

Hi,

Nice. Tested it and works well. I committed this to the sourceforge codebase. Here’s the commit:
http://github.com/openemr/openemr/commit/5db171813e7deeecd1aa904aa14a96a531053d8f
(will also include this in the next 4.1 patch)
For future, recommend setting up a git/github repo for submitting code; instructions to do this can be found here:
http://www.open-emr.org/wiki/index.php/Git_for_dummies

Thanks for the contribution; this bug was a high priority fix and glad to see it squashed.

-brady