Skip to Content
Menu
This question has been flagged
2 Replies
4319 Views

Guys, how to create HTML report from scratch.

Whatever I do it gives me only error messages.

Tried to use forms from other modules .... same result. Is there any manual how to achieve it ?

Avatar
Discard

Are you asking how to create Qweb reports or how to parse HTML fields into a report or? Gives us some more details.

Author Best Answer

I would like to change xml/xsl report a'm currently using to the HTML which is much simplier and easier to modify.

Currently using slightly changed report based on product_report.

It would be ok if I can add table header or for example summary at the end.

That's all i actually need. But completely don't understand xml/xsl ... so ....

how can I add table header into the existing form ?

<pre>

<lots>

<lot-line type="fields" name="id">

<title type="field" name="name"/>

<quantity type="field" name="qty_available"/>

<location type="field" name="location_id"/>

<available type="field" name="virtual_available"/>

</lot-line>

</lots>

</pre>

<pre>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:variable name="initial_bottom_pos">20.5</xsl:variable>

<xsl:variable name="initial_left_pos">2.5</xsl:variable>

<xsl:variable name="height_increment">0.5</xsl:variable>

<xsl:variable name="width_increment">1</xsl:variable>

<xsl:variable name="frame_height">8cm</xsl:variable>

<xsl:variable name="frame_width">18cm</xsl:variable>

<xsl:variable name="number_columns">1</xsl:variable>

<xsl:variable name="max_frames">20</xsl:variable>

<xsl:template match="/">

<xsl:apply-templates select="lots"/>

</xsl:template>

<xsl:template match="lots">

<document>

<template leftMargin="2.0cm" rightMargin="1.5cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Address list" author="">

<pageTemplate id="all">

<pageGraphics/>

<xsl:apply-templates select="lot-line" mode="frames"/>

</pageTemplate>

</template>

<stylesheet>

<paraStyle name="nospace" fontName="Verdana" fontSize="8" spaceBefore="0" spaceAfter="0"/>

<blockTableStyle id="mytable1">

<blockBackground colorName="lightgrey" start="0,0" stop="0,0"/>

<blockBackground colorName="lightgrey" start="1,0" stop="-1,0"/>

<blockBackground colorName="lightgrey" start="2,0" stop="-1,0"/>

</blockTableStyle>

<blockTableStyle id="mytable">

<blockBackground colorName="white" start="0,0" stop="0,0"/>

<blockBackground colorName="lightgrey" start="1,0" stop="2,0"/>

<blockBackground colorName="lightblue" start="2,0" stop="3,0"/>

<blockBackground colorName="lightgreen" start="3,0" stop="4,0"/>

</blockTableStyle>

</stylesheet>

<story>

<xsl:apply-templates select="lot-line" mode="story"/>

</story>

</document>

</xsl:template>

<xsl:template match="lot-line" mode="frames">

<xsl:if test="position() &lt; $max_frames + 1">

<frame>

<xsl:attribute name="width">

<xsl:value-of select="$frame_width"/>

</xsl:attribute>

<xsl:attribute name="height">

<xsl:value-of select="$frame_height"/>

</xsl:attribute>

<xsl:attribute name="x1">

<xsl:value-of select="$initial_left_pos + ((position()-1) mod $number_columns) * $width_increment"/>

<xsl:text>cm</xsl:text>

</xsl:attribute>

<xsl:attribute name="y1">

<xsl:value-of select="$initial_bottom_pos - floor((position()-1) div $number_columns) * $height_increment"/>

<xsl:text>cm</xsl:text>

</xsl:attribute>

</frame>

</xsl:if>

</xsl:template>

<xsl:param name="pmaxChars" as="xs:integer" select="80"/>

<xsl:template match="lot-line" mode="story">

<blockTable style="mytable1" colWidths="12cm,1.5cm,1.5cm,1.5cm">

<tr>

<td>Title</td><td>Qty</td><td>Available</td><td>Location</td>

</tr>

</blockTable>

<nextFrame/>

</xsl:template>

<xsl:template match="lot-line" mode="story">

<blockTable style="mytable" colWidths="12cm,1.5cm,1.5cm,1.5cm">

<tr>

<td>

<para style="nospace"><xsl:value-of select="title" /></para>

</td>

<td>

<para style="nospace"><xsl:value-of select="location" /></para>

</td>

<td>

<para style="nospace"><xsl:value-of select="available" /></para>

</td>

<td>

<para style="nospace"><xsl:value-of select="quantity" /></para>

</td>

</tr>

<tr>

<td></td><td></td><td></td><td></td>

</tr>

</blockTable>

<nextFrame/>

</xsl:template>

</xsl:stylesheet>

</pre>

Avatar
Discard
Related Posts Replies Views Activity
1
Apr 20
2331
0
May 21
1087
1
May 20
5250
1
Oct 17
2196
0
Jul 16
2434