Re: [gnome-db] Re: Report API



Loren Bandiera wrote:

Dru wrote:

I havn't looked at xsl-fo before or know whats its capiable of or how it
works in detail.

XSL Formatting Objects (XSL-FO) are the second half of the Extensible
Stylesheet Language (XSL).  XSL-FO is an XML application that describes
how pages will look when presented to a reader.

More information:

http://www.w3.org/TR/xsl/slice6.html#fo-section
http://www.ibiblio.org/xml/books/bible2/chapters/ch18.html


ohhh.  its kinda completely different to the layout design of papyrus
at moment.   I'll put at end of email the current format for xml
to kinda show whats its like. though from this xml you could convert
to any other xml with converters.


Should papyrus be continued to be run as a seperate process or should
api be changed
and implimented into gnome-db library?  What does the xsl style sheet do
for
the reports?  Does when you dymically build the xsl resolve the database
queries?

For what I was planning, first you build your GdaReportDocument and then
create the GdaReportResults which is what builds the queries and creates
the XML (If I understand the current API correctly).
I see there are two ways to create a report, one is using a predefined layout
with xml and multiple queries, another is using a single query and
wanting the results of such displayed as a query.

The XML would be read and the XSL stylesheet would be dynamically created
and used to transform the report into XSL-FO.
Could be another output engine from papyrus xml, the xsl-fo generator.
But papyrus includes orginal formating in the xml document.  Similar
to how you would in html.

Once you have the formatting objects set you can transform that into
XHTML, PDF, RTF, etc.  You need a FO processor for this step, which is why
I was looking at xmlroff (http://xmlroff.sourceforge.net/).

Do you need to construct reports in memory? (at moment input is only a
file but parser could
be modified to take xml doc instead in memory instead).

I don't think it has to be done all in memory but I think it might be good
to have a choice.  Let the programmer choose what approach works best for
them.




<report>
<title><label>Invoice Statement</label></title>
<requires>arg_invoiceid</requires>
<table>
       <row>
               <cell width="20%">
               </cell>
               <cell width="60%">
<label align="center" paragraph="true">
<image>treshnaheader</image>
Accounts to
x1 t2dd 3 st
Bl a43a Ca
8001 #1
http://www.treshna.com
</label>
               </cell>
               <cell width="20%">
                       <image align="right">logo</image>
               </cell>
       </row>
</table>
<database name="treshna" type="postgres">dbname=accounts host=tyrael</database> <datasource name="invoice" database="treshna">select * from invoice where invoicenumber=<data>arg_invoiceid</data></datasource> <datasource name="company" database="treshna">select * from company where id=<data source="invoice">company</data></datasource>
<table width="100%">
       <row>
               <cell>
               <label align="left" paragraph="true" width="50%">Tax Invoice
<data source="company">name</data>
<data source="company">address</data>
<data source="company">phone</data>
               </label>
               </cell>
<cell><label align="right" paragraph="true" width="50%">GST number: 23 768 161
Invoice number: <data source="invoice">invoicenumber</data>
Invoice date: <data source="invoice">gendate</data>
               </label>
               </cell>
       </row>
</table>
<spacer style="vertical">1cm</spacer>
<datasource name="charges" database="treshna">select * from timesheet, company where invoice=<data>arg_invoiceid</data> and timesheet.company=company.id and timesheet.gendate>'2002-10-31'order by gendate</datasource> <datasource name="sales" database="treshna">select * from sale where invoice=<data>arg_invoiceid</data> order by gendate</datasource>

<line style="single" width="100%"></line>
<table width="100%" expand="2">
       <header>
               <row>
               <cell><label bold="true">date</label></cell>
               <cell><label bold="true">work/part details</label></cell>
               <cell><label bold="true">hours</label></cell>
               <cell><label bold="true">amount</label></cell>
               </row>
       </header>
       <dataloop source="charges">
       <row>
               <cell><label><data>gendate</data></label></cell>
<cell><label paragraph="true" width="65%"><data>description</data></label></cell>
               <cell><label><data>hours</data></label></cell>
<cell><label align="right">$<equation format=".2"><data>hourlyrate</data> * <data>hours</data></equation></label></cell>
       </row>
       </dataloop>
       <dataloop source="sales">
       <row>
               <cell><label><data>gendate</data></label></cell>
<cell><label paragraph="true" width="65%"><data>description</data></label></cell>
               <cell><label>-</label></cell>
<cell><label align="right">$<equation format=".2"><data>amount</data></equation></label></cell>
       </row>
       </dataloop>
       <footer>
               <row>
               <cell span="3"><label bold="true">Balance</label></cell>
<cell><label bold="true">$<equation format="'3.2"><equation type="sum" source="charges"><data>hours</data> * <data> hourlyrate</data></equation> + <equation type="sum" source="sales"><data>amount</data></equation></equation></label></cell>

               </row>
       </footer>
</table>
<line style="double" width="100%"></line>
<spacer style="vertical">1cm</spacer>
<table align="right">
      <row>
           <cell><label>Total excluding GST</label></cell>
<cell><label>$<equation format="'3.2"><equation type="sum" source="charges"><data>hours</data> * <data>hourlyrate</data></equation> + <equation type="sum" source="sales"><data>amount</data></equation></equation></label></cell>
      </row><row>
           <cell><label>GST</label></cell>
<cell><label>$<equation format="'3.2"><equation source="charges" type="sum"><data>hours</data> * <data>hourlyrate</data> * 0.125</equation> + <equation type="sum" source="sales"><data>amount</data> * 0.125</equation></equation></label></cell>
      </row><row>
           <cell><label bold="true">Total including GST</label></cell>
<cell><label bold="true">$<equation format="'3.2"><equation type="sum" source="charges">(<data>hours</data> * <data>hourlyrate</data>) * 1.125</equation> + <equation type="sum" source="sales"><data>amount</data> * 1.125</equation></equation></label></cell>
      </row>
</table>
</report>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]