Conheça o Adianti Framework para PHP:

  • Desenvolvimento com componentes;
  • Formulários e datagrids.
  • Versão Web e Desktop (Gtk);
  • Multiplataforma;
  • Desenhe as interfaces;
  • IDE própria (Adianti Studio).
Ver detalhes...

Developing reports with Agata Report

Para prosseguir com o download do artigo, é necessário realizar login utilizando o Facebook ou Google. Este procedimento é totalmente seguro e nossa aplicação é certificada por ambos os serviços. Após a autenticação, você será direcionado de volta à nossa página para continuar o download.

Login com Facebook Login com Google


Pablo Dall'Oglio Some day, God has created the programmer and the end user. Since the programmer has developed a system to deliver to the end user, the end user started to have new demands, has been dreaming about new features, and day after day, his requirements about the system has changed. It's not true for 100% of the cases, but the end user mind map usually differs from the programmer way to conceive the system. The end user has always specific needs and one kind of need is about reports. But for this special need there are many solutions called report generators. A well trained person with technical skills as the customer side may solve almost all of the reporting needs from the end users without the intervention of the software's vendor. When I started developing Agata Report at 2001, there were few open source reporting tools. I was part of a team developing many systems in PHP for academic porpouses (academic management and library administration) and reports kept being a pain. So I decide in my spare time to develop my own tool to learn more about PHP-GTK (there had been just released at that time) offering a easy way to the people generate their reports. The first version worked just with Postgres, but now it connects to more than 10 databases (with its own database layer ) and its interface is translated to more than 7 languages (with the community help). Today Agata Report is used by many companies and government departments. Agata Report supports PostgreSQL, Mysql, Oracle, Sybase, SqlServer, Firebird, Frontbase, Informix, Sqlite, and Dbase and runs under Linux and Windows. Agata allows the Database administrator to define Database Dictionaries. A database dictionary contains the nicknames for tables and fields, all relations between the tables and allows the user to create database schemas. Besides the report, the user may generate the complete ER diagram from database in DIA format. Agata drives the end user through the task of building a SQL instruction without knowing SQL. Its very easy to select fields and ordering. Agata also suggest the linked tables for the end user through the use of its database dictionary. Agata also allows to do joins just clicking on some fields. The constraints are also defined in a easy way when the user may use "in" and "not in" operators over another pre-defined queries. An important resource is the possibility of to copy a complete SQL statement to the Agata main screen, it's special usefull when you have a set of legacy queries and want to run them under Agata Report. Agata also allows the user to create PHP functions and apply these functions over a column of the report. This way, there's no limit about what can be done :-) Inside this function, the user can even to connect another server, and retrieve remote informations. But this resource is usually used to format the information applying masks, and so on. There are couple of functions that come with default agata installation, specially those about strings manipullation, numbers, time and mathematics. Agata can generate reports in many formats (TXT, HTML, PDF, XML, CSV and OpenOffice), with groups, subtotals and grand totals. The end user may define many formulas (min, max, sum, avg) per level. Besides to define headers and footers for the report pages. The PDF files are generated through the FPDF1 library, and the OpenOffice documents are generates through the PhpDocWriter2 library. All other file formats are generated through an internal engine. The user may also generete graphs, mailing lettters (with details) and mailing labels. Through its interface, the user is free to define rectangles, ellipses, insert images, print barcodes, change the font style and so on. This features works through an own markup language but in the near future its going to become a wysiwyg interface. Through its WebInterface (called AgataWEB) the end user may access Agata to generate the reports designed with its client (PHP-GTK) interface. The WebInterface its an easy way to deliver the reports to the end user without worrying about client installation. The WebInterface allows the end user to fill run-time parameters, choose optional ordering and adictional filters, besides choose the file format and layout. AgataWeb needs PHP running over Apache or IIS servers and may be access over any known web browser (mozilla firefox, internet explorer, opera). But if you are a developer and would like to integrate the reporting tool with your PHP Web Application, you should consider to know AgataAPI. AgataAPI exposes the core of AgataReport through a set of methods that can be called to generate the report through an easy way. The AgataAPI runs the report, generate the files in the file format you want and make this available to your system. See the example below: setLanguage('en'); $api->setReportPath('/agata/reports/samples/customers.agt'); $api->setProject('Samples'); $api->setFormat('pdf'); $api->setOutputPath('/tmp/test.pdf'); $api->setLayout('default-PDF'); #How to set parameters, if they exist #$api->setParameter('$personCode', 4); #$api->setParameter('$personName', "'mary'"); $ok = $api->generateReport(); if (!$ok) { echo $api->getError(); } else { // opens file dialog $api->fileDialog(); } ?> But if your application is written in another language, you may also use AgataCLI. Through the AgataCLI, you can run your reports through the command line or a system call. There are importante features coming on. Things like conditional formating, Crosstab Reports and OpenOffice Parser, that will allow you to desing the report using OpenOffice and run this report using Agata Report engine. Things to make easier the life for users and developers. Pablo Dall'Oglio has been working with programming since 1995, when he started programming in clipper language, developing a couple of systems for school and medium business. Since 2000, he works only with PHP. He's author of well known open source projects like GNUTeca (, Agata Report ( and Tulip Editor ( PHP-GTK Enthusiast since its first release at 2001, became close friend of Andrei Zmievski, its creator. Member of PHP-GTK documentation and translation teams. Pablo is author of the first book about PHP-GTK in the world ( He has many articles published by national and international magazines about PHP, GTK, WebServices and PostgreSQL. He's specialist in Database Modelling, Software engeneering, object orientation, PostgreSQL, PHP and PHP-GTK. He can be reached through the email or