Provider NPI Sort Ascending Order

papin0 wrote on Thursday, August 21, 2014:

I have been trying to get the Provider NPI list to show up in alphabetical order by the First Name.

we found this code on the forum but it does not show the file that needs to be change.
We are using OpenEMR 4.1.2 (7)

Here is the code:

// provider list, including address book entries with an NPI number
else if ($data_type == 11) {
$ures = sqlStatement("SELECT id, fname, lname, specialty FROM users " .
"WHERE active = 1 AND ( info IS NULL OR info NOT LIKE ‘%Inactive%’ ) " .
“AND ( authorized = 1 OR ( username = ‘’ AND npi != ‘’ ) ) " .
“ORDER BY lname ASC”);
echo “”;
echo “” . htmlspecialchars( xl(‘Unassigned’), ENT_NOQUOTES) . “”;
while ($urow = sqlFetchArray($ures)) {
$uname = htmlspecialchars( $urow . ’ ’ . $urow, ENT_NOQUOTES);
$optionId = htmlspecialchars( $urow, ENT_QUOTES);
echo “<option value=’$optionId’”;
if ($urow == $currvalue) echo " selected”;
echo “>$uname”;
}
echo “”;

TIA

teryhill wrote on Thursday, August 21, 2014:

\library\options.inc.php line 218
Terry

papin0 wrote on Thursday, August 21, 2014:

sure i paste all the code is the code correct?

TIA

teryhill wrote on Thursday, August 21, 2014:

just change this “ORDER BY lname, fname”); to this “ORDER BY lname ASC”);

papin0 wrote on Friday, August 22, 2014:

Thank you so much

papin0 wrote on Friday, August 22, 2014:

can i use this to
when filtering by the provider (provider npi) name or last name shows no results unless i filter by the userid which is a pain to go look the userid since we create a lot of users almost everyday.
which file i need to modify to accomplish the provider (provider npi) filtering by fname or lname.

TIA