How do I create new reports

profjake wrote on Tuesday, September 18, 2007:

Im new to OpenEMR.
What is the appropriate way to add new reports?
Do I take one of the other php report programs like the appointments report and use it as a template to edit and create a new one?
Then do I manually edit the link and name of that report into the ./templates/reports/general_reports.html file??
I mean, isnt there a better way to create a custom report and then store that report name and php link in a table that gets querried when you click on the "REPORTS" button on the nav pane?

sunsetsystems wrote on Thursday, September 20, 2007:

Yes, that’s the basic drill for making a new report.  A better way would be most welcomed!

Rod
www.sunsetsystems.com

profjake wrote on Thursday, September 20, 2007:

Well what I did was I changed the Appointment report in these ways

1. I added a reason column
2. I added a Copay column which is the copay amt of the primary insurance (if found)
3. I added a Notes/Comment field which is the Comments you type in on setting up an appointment.
4. I got rid of the Provider column. Most of the time, you are printing/using this report to give to the doc so he can pull charts or know his day. Rarely do you need a report of all appointments for all providers on a given day and if you did, why would you care what the provider’s name was (my opinion).

I am also going to add end time AND, Im gonna convert the time into AM/PM time. Has anyone done this yet? This should be a function in common api Id think. Do you think I should make that a config flag? Or is it already a config flag I can query? If not, I recommend one… a Euro time versus USA time flag.

Also, the report is using the cascading style sheet entries for detail and dehead from common_api. But I think the appointments report needs different settings, because for example, I want to left justify certain columns, right justify others, top justify them too, and make certain columns smaller so it forces a word wrap, particularly for the comments field because it gets too long. BTW did you know you can embed html code in many fields like in the comment field? I tried it with simple stuff like <br> and <p> This is BAD BAD BAD… I could probably enter php commands this way to do things like ERASE FILES OR DATA if I wanted to… Shouldn’t we be filtering out all HTML code from ALL of these fields???

Also, this is a viewable report, but how would I go about making a printable report? OR better yet, a  PDF?
I mean, there are no examples or templates of a "printable" report or an example of how to make a PDF.
That is REALLY what i need.

Ideally, Id like to add 3 buttons to the bottom of all viewable reports, PRINT, Generate PDF, Export to CSV

Now as for a better way to submit reports. The REPORTS screen should be pulling from a database of reports that has the name of the report php code in it to be executed. That wouldnt be too hard, would it? So it would make it easier to add reports because all youd have to do is write the report code, THEN add its name and php code file name to the database rather than have to edit the actual "reports" screen code.

markleeds wrote on Sunday, September 30, 2007:

I have an improvement over the current system of adding reports which I just commited to cvs.  Just replace /openemr/templates/reports/general_reports.html.

If you do nothing, the reports page will appear unchanged.

If you create the directory /openemr/interface/reports/myreports, and you put reports in it (they must be .php files), the links will appear at the top of the reports page.

If you then create subdirectories under myreports and put reports in these subdirectories, popup menus will appear on the reports page with the subdirectory name as the menu name and the php file contents as the report names (with the .php extension hidden).

Try it out and let me know what you think.  I am making up lots of reports now and I had the same problem so I did this to save some time.

aperezcrespo wrote on Tuesday, December 09, 2008:

Hi
   Is there some sort of How To for this?  I would like to try and start making some reports but I really need some sort of guide.

Thanks

I want to add a column in the appointments report because we are in the process of converting everything electronic and getting away from paper charts. We have created a category on the demographics page with a yesno box indicate whether or not the chart has been scanned into the EMR. That being said, is there a way to include that in the appointments report that we generate for the next day to let the front office staff know that patient no longer has a paper chart?

hi @D_Amy_Martin, sure, just need a couple entries in interface/reports/appointments_report.php

I’m in the process of adding the lines; just wanted to see if anyone else wrote it first, so I can inspect/tweak it for our clinic. :wink:

ok, ideally we would update the script to look at the demographics layout and look for a field that says include in reports