How to add Ordring and Sorting function in patient list report

brainknight wrote on Sunday, January 11, 2015:

Hello Developers ,

May be this is not the suitable forum for this topics and please if any recommendations it will be much appreciated.

Please I need your help.

I need to add ordering and sorting function to the [patient list] report records to be like the [Appointment Report].

I need the fields and columns (Last Visit, Patient Name, File Number) to be as hyperlinks, when I press these field the sorting changed as the field.

-When I press the patient name the records to be sorted alphabetically.
-When I press the file number the records to be sorted from the 1st one increasingly.
-When I press the last visit the records to be sorted increasingly.

I tried in patient_list.php file but its not working.

Thank you in advance.

Regards.
B. K.

cmswest wrote on Monday, January 12, 2015:

Hi brainknight, I’ll look into it.

brainknight wrote on Monday, January 12, 2015:

Many Thanks Stephin,

mdsupport wrote on Tuesday, January 13, 2015:

May not be so much useful in case of patient list but for smaller lists you can use this Firefox addon without need to touch the code for occasional table manipulation requirements.

cmswest wrote on Tuesday, January 13, 2015:

You’re welcome. Please make a backup of your current file, openemr/interface/reports/patient_list.php and then replace the live file with the attached.

A concession had to be made for this javascript approach. There is no total number of patients at the bottom of the list now.

Edit: it’s only working accurately for names at this moment.

cmswest wrote on Tuesday, January 13, 2015:

Somewhat related is the * Fix This * that displays next to the Provider drop down. Here’s a fix for the next patch.

brainknight wrote on Wednesday, January 14, 2015:

Hi Stephen.

Thank you very much, I appreciate this good work for you.

B. K.

kodusote wrote on Wednesday, January 14, 2015:

Hi Stephen,

I have combined the changes in the two files (attached) and it works as expected. However, sorting with the Last Visit column gives the best result when the date display format is set in globals as YYYYMMDD as I think it sorts the column as text not as date. I believe most people can work with this is it is not possible to make it sort this column as date format.

Thanks.

brainknight wrote on Wednesday, January 14, 2015:

Hi Kayode.

Many Thanks for your help, I appreciated for you.

B. K.

brainknight wrote on Thursday, January 15, 2015:

Dears Stephen and Kayode.

Thank you very much for your support, its working fine now as expected.

Thank you again and I appreciated for you.

Regards
B. K.

bradymiller wrote on Sunday, January 25, 2015:

Hi Stephen,

Thanks for pointing this out.
Committed a fix that preserved the generate_form_field() function call:

-brady
OpenEMR