类似于 PHP 的水晶报表?

发布于 2024-07-17 05:22:08 字数 263 浏览 14 评论 0 原文

我正在寻找可以在 PHP 中运行并且类似于水晶报表的东西。 我基本上需要一个布局设置,这意味着我只需插入数据即可输出发票,然后将其发送到打印机。

到目前为止我发现的最接近的是 PDFB,但这有点痛苦,因为它需要精确定位。

我想要有一些东西可以基于模板(最好是基于 XML)生成发票,然后将其输出到易于我们打印的表单(PostScript 会很好!)

它也需要支持条形码(尽管这些可以生成为 GD 图像)

另一个要求是这必须是 FLOSS

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

小巷里的女流氓 2024-07-24 05:22:08

通过 Apache FOP -bridge.sourceforge.net/pjb/" rel="noreferrer">PHP-JavaBridge。

方法如下: http://wiki.apache.org/xmlgraphics-fop/HowTo/PHPJavaBridge

PostScript 就太好了!

许多 PostScript 打印机也能识别 PDF。

Use XML + XSL:FO with Apache FOP via PHP-JavaBridge.

Here is how: http://wiki.apache.org/xmlgraphics-fop/HowTo/PHPJavaBridge

PostScript would be nice!

Many PostScript printers understand PDF too.

随遇而安 2024-07-24 05:22:08

我在 PHP 中使用了 Spreadsheet_Excel_Writer,它已经足够好了。 不是所见即所得,但它确实生成 XSL 文件,我对此很满意。 然后,您可以使用 OpenOffice 宏将文档转换为 PDF。 它可以从命令行运行,因此,它也可以从 PHP 脚本运行。

或者这是一个更好的方法。

使用 OpenOffice 转换 Smarty 模板。 Smarty 是一个很酷的 PHP 模板引擎,我推荐它用于此目的。 然后使用 PHP 和 Smarty 生成纯 HTML。 最后,只需使用上述方法将生成的 HTML 转换为 PDF 即可。

报告发生了革命性的变化(tm)。

编辑2009年6月6日
改装了? 啊没关系。

不管怎样,这个方法可以在不运行 X11 的无头服务器上运行。 我从提到的链接中获取了脚本(除了我把它在预先存在的集合“Standard”而不是“DannysLibrary”中),然后我使用 PuTTY 从 Windows 计算机运行此命令,并且 X 在远程计算机上关闭,并且未设置 DISPLAY 变量,并且......好吧,在无论如何,OOo 无法找到 X11 进行连接。

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

这很有效,而且我相信这对于任何需要从其他格式转换为 PDF 的人来说都非常有用,包括从 HTML 生成可打印的报告。 通过编辑宏,您甚至可以让 OOo 直接从 stdin 或临时服务 URL 读取,并输出到预定义文件中。 一旦您掌握了基本代码,链接上的脚本就非常简单扩大。

摘要:

  • 生成 XLS 或 HTML 格式的报告
  • 并进行转换,
  • 即使它是 OOo,它也适用于无头机器

编辑 2009 年 6 月 9 日
我尝试以这种方式实现在线转换器。 您应该使 PHP 在创建宏的同一用户下运行。 该用户显然不可能是 www-data。 我尝试使用 suphp,但由于某种原因它没有正确更改用户(posix_getuid() 不断返回 33,即 www-data)。 修复此问题后我将对其进行编辑。

编辑2009年6月26日
我猜我花了一段时间才回来报告。 是的,这适用于 suphp。 然而,我无法现场展示它,因为我唯一的服务器运行一个相对重要的网络应用程序,该应用程序没有专业的安全审核。 这意味着我们保护后端所依赖的一件事是前端运行的用户是非常非常非特权的用户(例如 www-data)。 不要问:-)

希望这对某人有帮助:是的,使用 OO.o 转换为 PDF 是非常现实的。 OO.o 中甚至有一些远程调用支持,但我并没有只是为了写这篇文章而研究它。

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.

独自唱情﹋歌 2024-07-24 05:22:08

我在php中使用了eclpse:“BIRT项目”

http://www.eclipse.org/birt /phoenix/

您在 Eclipse 中设计报告。
然后将其上传到你的服务器(它必须运行tomcat)我知道。
然后你可以从你的 php 应用程序调用该报告
您可以通过查询字符串将参数发送到报告:

/myreport.birt?param=var¶m2=var2

到目前为止,我们有一个像这样工作了 4 年的应用程序。
大约有 100 份报告,效果非常好。

当然它是开源的。

祝你好运

I have used the eclpse in php: "BIRT Project"

http://www.eclipse.org/birt/phoenix/

You design your report in Eclipse.
Then upload it to your server (it must be running tomcat) I know.
Then you can call that report from your php application
you can send the parameters to the report through the query string:

/myreport.birt?param=var¶m2=var2

We have a 4 year application working like this so far.
Around a 100 reports and it works really well.

Of course it is open source.

Good luck

愛放△進行李 2024-07-24 05:22:08

如果您有服务器访问权限,您可能还想通过 XSL 格式化对象 ="http://xmlgraphics.apache.org/fop/" rel="noreferrer">Apache FOP。
XSL-FO 基于 XML,支持多种输出格式,包括 PostScript 和 PDF

If you have server access you might also like to go for XSL Formatting Objects through Apache FOP.
XSL-FO is XML based and supports alot of output formats including PostScript and PDF

蓝色星空 2024-07-24 05:22:08

Reportico

在我看来,Reportico 是最好的、详细的、功能丰富的 PHP 报表设计器之一。

Reportico

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

逆蝶 2024-07-24 05:22:08

如果您设法在 php 环境中调用 Java 应用程序(通常应该是可能的) JasperReports 也许您正在寻找的东西:

If you manage to call a Java application in your php-environment (which in general should be possible) JasperReports maybe the thing you are looking for:

深巷少女 2024-07-24 05:22:08

嗯..我在当前的项目中遇到了同样的问题,我最终使用了水晶报表并使用用 C# 编写的 ASP.NET Web 服务调用该报表。
Web 服务并不复杂,您仍然可以使用水晶报表的所有功能。
我认为你不会找到任何完全基于 php 的报表引擎可以与水晶报表相媲美...我还没有找到一个...

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...

君勿笑 2024-07-24 05:22:08

大约一年前我遇到了同样的问题。 在搜索了现有的解决方案后,我没有找到,所以我使用 Zend Framework 的 PDF 生成库编写了一个精简的水晶报告。 我必须大力调整他们的库以支持分组对象、重复部分和模板。 它确实有效,但确实很笨重,如果我必须再做一次,我会找到一种将 php 桥接到水晶报告的方法,要么通过 Gushiken 所说的 Web 服务,要么通过调用命令行应用程序。 CPAN 有一个 CR 的 Perl 接口: Win32::OLE::CrystalRuntime::Application

如果过去一年发布了 PHP 解决方案,我怀疑它是否足够成熟,无法与 CR 相比。不要浪费时间胡思乱想——选择有效的方法。 时间是昂贵的。 软件不是。

I ran into the same problem about a year ago. After searching all over for an existing solution I didn't find one, so I wrote a slimmed-down crystal reports using Zend Framework's PDF generation library. I had to heavily adapt their library to support grouped objects, repeating sections and templates. It worked, but it was really clunky, and if I had to do it again, I would find a way to bridge php to crystal reports, either through a web service like Gushiken said, or by calling a command-line app. CPAN has a Perl interface to C.R.: Win32::OLE::CrystalRuntime::Application .

If a PHP solution has been released in the past year, I doubt it is mature enough to compare to C.R. Don't waste your time pulling your hair out -- go with what works. Time is expensive. Software ain't.

乞讨 2024-07-24 05:22:08

满足这种需求的正确工具是 XSL-FO,因为它非常适合可打印媒体。
XSL-FO 与 XSLT 一样也是 W3C 推荐标准。
我制作了一个使用 XSL-FO 作为报告中间语言的 php 工具,该 XLS-FO 是将报告 XSLT 模板与 XML 数据合并(处理)的结果。

您可以使用 MS Word 自动创建模板,并按照用户手册中所示导出。 然后,您可以向报告引擎提供模板,并在运行时提供数据 XML。

同样在运行时,生成的 XSL-FO 报告将呈现为:

a) 相同的 XSL-FO(如果您想调试或只想要 XSL-FO)

b) 完美的 PDF(ApacheFOP 呈现 XSL-FO)

c ) 经过 XSLFO2HTML 转换的 HTML。

这是一个 symfony 1.4 插件的项目:
https://github.com/juanmf/sfPlugins/tree/master/reportPlugin

我打算将它与 sf 脱钩。 不要犹豫,询问任何事情。 这是操作方法:
https://github.com/juanmf/ sfPlugins/blob/master/reportPlugin/doc/HowToReport.pdf?raw=true

这篇文章也可能会给您一些帮助:
https://stackoverflow.com/questions/5519024/report-engine-solution- for-lamp-application/13042656

问候!

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!

腹黑女流氓 2024-07-24 05:22:08

尝试 Tufat

我只是碰巧看到..也许它会对你有所帮助。
不过,有一个免费版本可供您测试。

你一定会喜欢它..请分享你的副本。

Try Tufat

I just happen to see that ..may be it will help you.
However there is a free version is available for you to test.

You will like it .. Please share your copy.

枕头说它不想醒 2024-07-24 05:22:08

我使用过phpreports,我必须承认它对于基于网络的报告来说还不错,因为它支持标题,页脚、组、小计等

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.

开始看清了 2024-07-24 05:22:08

看看 siwapp.org,它是基于 Symphony Framework 的开源发票应用程序,处于早期测试阶段但很有前途。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文