[IMP/ADD]: Header in hr_holidays xsl report with saterate template for xsl landscape rport.

bzr revid: rch_open_erp-20100914124100-0ifc15gr11yswtmv
This commit is contained in:
rch (Open ERP) 2010-09-14 18:11:00 +05:30
parent 433ce6f932
commit d6486e17d2
4 changed files with 94 additions and 24 deletions

View File

@ -3,19 +3,14 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="hr_custom_default.xsl"/>
<xsl:import href="hr_custom_rml.xsl"/>
<xsl:template match="/">
<xsl:call-template name="rml" />
</xsl:template>
<xsl:template name="rml">
<document filename="example.pdf">
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="first">
<frame id="col1" x1="0.8cm" y1="2.0cm" width="28.0cm" height="17cm"/>
</pageTemplate>
</template>
<stylesheet>
<xsl:template name="stylesheet">
<paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="left" />
<paraStyle name="normal-title" fontName="Helvetica" fontSize="10" alignment="center"/>
<paraStyle name="digits" fontName="Helvetica" fontSize="6" alignment="left"/>
@ -131,13 +126,6 @@
<lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
</stylesheet>
<story>
<xsl:call-template name="story"/>
</story>
</document>
</xsl:template>
<xsl:template name="story">
@ -151,24 +139,20 @@
<xsl:for-each select="report/res">
<td>
<para>
<xsl:attribute name="style">company</xsl:attribute>
Company Name: <xsl:value-of select="attribute::name" />
</para>
</td>
<td>
<para>
<xsl:attribute name="style">print-date</xsl:attribute>
Printing time: <xsl:value-of select="attribute::today" />
</para>
</td>
</xsl:for-each>
</tr>
</blockTable>
<spacer length="0.8cm" />
<spacer length="1.0cm" />
<para style="title" t="1">Off-Days' Summary</para>
<spacer length="0.5cm" />
<para style="normal-title" t="1">Analyze from <u><xsl:value-of select="report/from" /></u> to <u> <xsl:value-of select="report/to" /> </u> of the <u><xsl:value-of select="report/type" /></u> holidays. </para>
<spacer length="0.8cm" />
<spacer length="1.0cm" />
<xsl:variable name="cols_legend">
<xsl:text>0.7cm,5.0cm</xsl:text>
</xsl:variable>

View File

@ -27,7 +27,7 @@ from report.interface import report_rml
from report.interface import toxml
import pooler
import time
def lengthmonth(year, month):
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
@ -234,14 +234,23 @@ class report_custom(report_rml):
dept_done=1
emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
row_id = row_id +1
header_xml = '''
<header>
<date>%s</date>
<company>%s</company>
</header>
''' % (time.strftime('%m/%d/%Y %H:%M'),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
# Computing the xml
xml='''<?xml version="1.0" encoding="UTF-8" ?>
<report>
%s
%s
%s
%s
</report>
''' % (months_xml,date_xml, emp_xml)
''' % (header_xml,months_xml,date_xml, emp_xml)
return xml

View File

@ -0,0 +1,40 @@
<?xml version = '1.0' encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template name="first_page_graphics_corporation">
<!--logo-->
<fill color="black"/>
<stroke color="black"/>
<setFont name="DejaVu Sans" size="8"/>
<drawString x="1.3cm" y="19.5cm"><xsl:value-of select="//report/header/date"/></drawString>
<setFont name="DejaVu Sans Bold" size="10"/>
<drawString x="13.8cm" y="19.5cm"><xsl:value-of select="//report/header/company"/></drawString>
<setFont name="DejaVu Sans" size="8"/>
<drawRightString x="28.4cm" y="19.5cm"><pageNumber/> / </drawRightString>
<stroke color="#000000"/>
<lines>1.3cm 19.3cm 28.5cm 19.3cm</lines>
</xsl:template>
<xsl:template name="other_pages_graphics_corporation">
<!--logo-->
<fill color="black"/>
<stroke color="black"/>
<setFont name="DejaVu Sans" size="8"/>
<drawString x="1.3cm" y="19.5cm"><xsl:value-of select="//report/header/date"/></drawString>
<setFont name="DejaVu Sans Bold" size="10"/>
<drawString x="27.8cm" y="19.5cm"><xsl:value-of select="//report/header/company"/></drawString>
<setFont name="DejaVu Sans" size="8"/>
<drawRightString x="28.4cm" y="19.5cm"><pageNumber/> / </drawRightString>
<stroke color="#000000"/>
<lines>1.3cm 19.3cm 28.5cm 19.3cm</lines>
</xsl:template>
<xsl:template name="first_page_frames">
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
</xsl:template>
<xsl:template name="other_pages_frames">
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,37 @@
<?xml version = '1.0' encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template name="first_page_graphics_report"/>
<xsl:template name="other_pages_graphics_report"/>
<xsl:template name="rml">
<document filename="example.pdf">
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
<pageTemplate id="first_page">
<pageGraphics>
<xsl:call-template name="first_page_graphics_corporation"/>
</pageGraphics>
<xsl:call-template name="first_page_frames"/>
</pageTemplate>
<pageTemplate id="other_pages">
<pageGraphics>
<xsl:call-template name="other_pages_graphics_corporation"/>
</pageGraphics>
<xsl:call-template name="other_pages_frames"/>
</pageTemplate>
</template>
<stylesheet>
<xsl:call-template name="stylesheet"/>
</stylesheet>
<story>
<xsl:call-template name="story"/>
</story>
</document>
</xsl:template>
</xsl:stylesheet>