MT#5879 separate row listing subs in template toolkit to have possibility generate multi-parted document
parent
21e2f2b38f
commit
ae5360882a
@ -0,0 +1,95 @@
|
||||
<html>
|
||||
<body width="215mm" height="297mm">
|
||||
|
||||
<style>
|
||||
<![CDATA[
|
||||
.address .company{
|
||||
font-weight: bold
|
||||
}
|
||||
g {
|
||||
/*
|
||||
fill:#000000;fill-opacity:1;fill-rule:nonzero;
|
||||
stroke:none;
|
||||
*/
|
||||
//font-family:HelveticaNeue;
|
||||
//font-family:Arial;
|
||||
font-family:HelveticaNeue-Light;
|
||||
font-variant:normal;
|
||||
//font-weight:300;
|
||||
font-size:2.6pt;
|
||||
writing-mode:lr;
|
||||
-inkscape-font-specification:HelveticaNeue-Light;
|
||||
}
|
||||
#titlepage{
|
||||
border: 1px solid black;
|
||||
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
|
||||
|
||||
<div>
|
||||
<title>MidPage</title>
|
||||
</div>
|
||||
<div>
|
||||
<title>LastPage</title>
|
||||
</div>
|
||||
<div y="0" x="0" width="215" height="297" id="titlepage">
|
||||
|
||||
<title>TitlePage</title>
|
||||
|
||||
<rect x="0" y="0" width="214.6" height="296.6" stroke-width="0.1" stroke="#FF0000" fill="#FFFFFF" id="totalborder"/>
|
||||
|
||||
<div y="40" x="10" width="50" height="30" id="titlepage_companyaddress_custom" transform="translate(10, 40)">
|
||||
<rect x="0" y="0" width="50" height="30" stroke-width="0.25" fill="#FFFFFF" id="titlepage_companyaddress_custom_border"/>
|
||||
<div x="5" y="7" id="titlepage_companyaddress_custom_1">address line 1</div>
|
||||
<div x="5" y="17" id="titlepage_companyaddress_custom_2">address line 2</div>
|
||||
<div x="5" y="27" id="titlepage_companyaddress_custom_3">address line 3</div>
|
||||
</div>
|
||||
<div y="135" x="10" width="195" height="150" id="titlepage_invoicedetails_head" transform="translate(10, 135)">
|
||||
<div id="calls_title" text-anchor="end">
|
||||
<span x="5" id="calls_zone" text-anchor="start">Zone</span>
|
||||
<span x="95" id="calls_number">Number</span>
|
||||
<span x="130" id="calls_duration">Duration</span>
|
||||
<span x="160" id="calls_freetime">Free time</span>
|
||||
<span x="190" id="calls_cost">Cost</span>
|
||||
</div>
|
||||
<!--{[% row_vertical_interval = 10 -%]}-->
|
||||
|
||||
<!--{[%MACRO datarow BLOCK -%]}-->
|
||||
<div y="10" text-anchor="end" id="calls[%loop.count-%]" class="datarow">
|
||||
<span x="5" id="calls_zone[%loop.count-%]" text-anchor="start"><!--{[% call.get_column('zone') %]}--><!--{[%#}-->Example zone<!--{%]}--></span>
|
||||
<span x="95" id="calls_number[%loop.count-%]"><!--{[% call.get_column('number') %]}--><!--{[%#}-->0<!--{%]}--></span>
|
||||
<span x="130" id="calls_duration[%loop.count-%]"><!--{[% call.get_column('duration')|format('%.3f') %]}--><!--{[%#}-->0.000<!--{%]}--></span>
|
||||
<span x="160" id="calls_freetime[%loop.count-%]"><!--{[% call.get_column('free_time')|format('%d') %]}--><!--{[%#}-->0.0<!--{%]}--></span>
|
||||
<span x="190" id="calls_cost[%loop.count-%]"><!--{[% ( call.get_column('cost') / 100 ) |format('%.2f') %]}--><!--{[%#}-->0.00<!--{%]}--></span>
|
||||
</div>
|
||||
<!--{[%END-%]}-->
|
||||
|
||||
<!--{[%MACRO totalrow BLOCK -%]}-->
|
||||
<div y="20" text-anchor="end" id="calls_total" class="datarow">
|
||||
<span x="5" id="calls_total_title" text-anchor="start">Total:</span>
|
||||
<span x="95" id="calls_total_number"><!--{[% total_number %]}--><!--{[%#}-->0<!--{%]}--></span>
|
||||
<span x="130" id="calls_total_duration"><!--{[% total_duration|format('%.3f') %]}--><!--{[%#}-->0.000<!--{%]}--></span>
|
||||
<span x="160" id="calls_total_freetime"><!--{[% total_free_time|format('%d') %]}--><!--{[%#}-->0.0<!--{%]}--></span>
|
||||
<span x="190" id="calls_total_cost"><!--{[% ( total_cost / 100 )|format('%.2f') %]}--><!--{[%#}-->0.00<!--{%]}--></span>
|
||||
</div>
|
||||
<!--{[%END-%]}-->
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="bgpage">
|
||||
<title>Background</title>
|
||||
<div y="270" x="5" width="205" height="18" transform="translate(5, 270)" class="address" font-size="2pt" id="bgpage_companyaddress_sipwise">
|
||||
<rect x="0" y="0" width="205" height="18" stroke-width="0.25" fill="#FFFFFF" id="titlepage_companyaddress_sipwise__border"/>
|
||||
<div x="2" y="5" id="bgpage_companyaddress_sipwise__company" class="company">{<!--{[%}-->provider.company<!--{%]}-->}</div>
|
||||
<div x="2" y="10" id="bgpage_companyaddress_sipwise__address">{<!--{[%}-->provider.street<!--{%]}-->}, Postcode {<!--{[%}-->provider.postcode<!--{%]}-->} {<!--{[%}-->provider.city<!--{%]}-->} {<!--{[%}-->provider.country<!--{%]}-->}</div>
|
||||
<div x="2" y="15" id="bgpage_companyaddress_sipwise__contact">{<!--{[%}-->provider.firstname<!--{%]}-->} {<!--{[%}-->provider.lastname<!--{%]}-->}. Phone: {<!--{[%}-->provider.phone<!--{%]}-->}. Mobile: {<!--{[%}-->provider.mobile<!--{%]}-->}. Fax: {<!--{[%}-->provider.fax<!--{%]}-->}</div>
|
||||
<div x="203" y="15" id="bgpage_companyaddress_sipwise__contact" text-anchor="end" >Page {<!--{[%}-->page<!--{%]}-->}</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.4 KiB |
@ -0,0 +1,30 @@
|
||||
[%MACRO adjustrow(data, rowtype, tt_type, row_vertical_interval, rownumber) BLOCK -%]
|
||||
[%# USE Dumper%]
|
||||
[%# Dumper.dump_html(data)%]
|
||||
[%IF rowtype == 'datarow' %]
|
||||
[%row = datarow(data)%]
|
||||
[%ELSIF rowtype == 'totalrow' %]
|
||||
[%row = totalrow(data)%]
|
||||
[%END%]
|
||||
[%# row = $rowtype(data) %]
|
||||
[%tt_type%]
|
||||
[% IF tt_type == 'svg' -%]
|
||||
[% heights = row.match('(?s)(<text[^>]*\s+y\s?=.*?)(\d+)(.*)' ) -%]
|
||||
[%END -%]
|
||||
[%row_vertical_interval%]
|
||||
[% IF heights.size > 0 -%]
|
||||
[% y = heights.1 + ( row_vertical_interval * ( rownumber - 1 ) ) %]
|
||||
[% row = heights.0 _ y _ heights.2 %]
|
||||
[%END -%]
|
||||
[%row%]
|
||||
[%END -%]
|
||||
|
||||
[%MACRO list_calls(zonecalls_rs, rowtype, total, tt_type, row_vertical_interval) BLOCK-%]
|
||||
[% FOR call IN zonecalls_rs -%]
|
||||
[% total.number = total.number + call.get_column('number') -%]
|
||||
[% total.duration = total.duration + call.get_column('duration') -%]
|
||||
[% total.free_time = total.free_time + call.get_column('free_time') -%]
|
||||
[% total.cost = total.cost + call.get_column('cost') -%]
|
||||
[% adjustrow(call, rowtype, tt_type, row_vertical_interval, loop.count) -%]
|
||||
[%END -%]
|
||||
[%END -%]
|
||||
Loading…
Reference in new issue