Something like Crystal Reports for PHP?

2019-01-16 02:58发布

I'm looking for something that works in PHP and is similar to crystal reports. I basically need to have a layout setup that means I can output invoices just by inserting the data, and then send it to a printer.

The closest I've found so far is PDFB, but It's a bit of a pain as it needs to have precise positioning.

I'd like to have something that could generate an invoice based on a template (preferably XML based) and then output it to a form easy for us to print (PostScript would be nice!)

It needs to have support for barcodes too (though these can be generated as a GD image)

Another requirement is that this must be FLOSS

12条回答
\"骚年 ilove
2楼-- · 2019-01-16 03:17

hm.. i had the same problem at my current project and i ended up using crystal reports and calling the report with an asp.net web service written in c#. the web service is nothing to complex and you can still use all the features of crystal reports. i dont think that you will find any report engine that is completely based on php that can be compared to crystal reports... i havent been able to find one yet...

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-16 03:17

The right tool for this need is XSL-FO, as it's perfect for printable media. XSL-FO is also a W3C Recommendation, with XSLT. I've made a php tool that use XSL-FO as intermediate language for reporting, this XLS-FO is the result of merging (processing) the report XSLT template with your XML data.

You create the template automagically using MS Word, and exporting as shown in the user manual. Then you feed the reporting Engine with the template, and at run time with the data XML.

Also at runtime, the resulting XSL-FO report is rendered to:

a) the same XSL-FO (if you want to debug or just want a XSL-FO)

b) A perfect PDF, (ApacheFOP renders the XSL-FO)

c) HTML with a XSLFO2HTML transformation.

Here you have the project, its a symfony 1.4 plugin: https://github.com/juanmf/sfPlugins/tree/master/reportPlugin

I plan to decouple it from sf. Don't hesitate to ask anything. Here is the HowTo: https://github.com/juanmf/sfPlugins/blob/master/reportPlugin/doc/HowToReport.pdf?raw=true

This post might also give you some help: https://stackoverflow.com/questions/5519024/report-engine-solution-for-lamp-application/13042656

Regards!

查看更多
Emotional °昔
4楼-- · 2019-01-16 03:23

I've used Spreadsheet_Excel_Writer in PHP, and it's good enough. Not WYSIWYG, but it does generate XSL files, and I'm happy with it. Afterwards, you can use OpenOffice macro to convert the document to PDF. It works from command line, ergo, it works from PHP scripts too.

Or here's an even better way.

Use OpenOffice to convert a Smarty template. Smarty is a cool templating engine for PHP, I recommend it for this purpose. Then generate pure HTML using PHP with Smarty. Finally, just convert the generated HTML into PDF using aforementioned method.

Reporting Revolutionized (tm).

EDIT Jun6 2009 Modded down? Ah, nevermind.

Anyways, this method works on a headless server without running X11. I've taken the script from the mentioned link (except I put it in preexisting collection "Standard" instead of "DannysLibrary") and then I've ran this command from Windows machine using PuTTY, and X was shut down on remote machine, and DISPLAY variable was not set, and ... well, in any case, there's no way OOo could find X11 to connect to.

$ openoffice.org -invisible -headless "macro:///Standard.Conversion.ConvertWordToPDF(`pwd`/logaritamska.doc)"

This works and I'm sure this would work great for anyone who'd need conversion from another format into PDF, including production of printable reports from HTML. By editing the macro you could, perhaps, even get OOo to read directly from stdin or from your temporary service URL, and output into predefined file. The script on the link is quite simple once you have the elementary code to expand.

Summary:

  • generate reports as XLS or HTML
  • convert them
  • even though it's OOo, it works on headless machines

EDIT Jun 9 2009 I've tried to implement an online converter this way. You should make PHP run under the same user under which you created macros. This user apparently cannot be www-data. I've tried to use suphp, but for some reason it didn't change the user properly (posix_getuid() kept returning 33 which is www-data). I'll edit this once I fix this.

EDIT Jun 26 2009 Guess it took me a while to report back. Yes, this works with suphp. I'm however not in position to show it live, since the only server I have runs a relatively critical web app which didn't have professional security auditing. This means one of the things we depend on to protect the backend is that the user under which frontend runs is a very very unprivileged user (such as www-data). Don't ask :-)

Hope this helps someone: yes, converting into PDF with OO.o is quite realistic. There's even some remote calling support in OO.o but I didn't study that just for purposes of writing this.

查看更多
乱世女痞
5楼-- · 2019-01-16 03:23

Have a look at siwapp.org, it is opensource invoicing application based on Symphony Framework, it is in early beta but very promising.

查看更多
我只想做你的唯一
6楼-- · 2019-01-16 03:24

i have used phpreports, and i must admit it is not bad for web based reporting since it has support for headers, footers, groups, subtotals, etc.

查看更多
欢心
7楼-- · 2019-01-16 03:25

Reportico

In my opinion is one of the best, detailed and feature rich PHP Report Designer.

查看更多
登录 后发表回答