空间管理 您的位置: ERP100社区 » jiacx » 日志
freshblue

rtf template里重新分组

上一篇 / 下一篇  2008-09-01 15:27:30

当报表因不同group条件而分出多个子报表


不妨用Data templaterow data...然而直接在RTF template上做动态的分組和加总就好

以下为几个常用技巧

假设资料为:
<ROW>
<AAA> ... </AAA>
<BBB> ... </BBB>
<CCC> ... </CCC>
</ROW>
架构
1. Dynamic Grouping
一般用<?for-each?> ~ <?end for-each?>只能抓取row data
需要用<?for-each-group:ROW;AAA?> ~ <?end for-each-group?>
则可以对每一个不同的AAA做分組...

对于分组内资料的取用..
则使用<?for-each:current-group()?> ~ <?end for-each?>

假设做操是巢式分组...AAA组内还要依照BBB再分
则这么写:
-------<?for-each-group:ROW;AAA?>
---------------<?for-each-group:current-group();BBB?>
---------------------<?for-each:current-group()?>
-----------------------------do some thing in current-group
---------------------<?end for-each?>
---------------<?end for-each-group?>
-------<?end for-each-group?>

----------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------

实际分组练习

------<?for-each-group@section:ROW;./PREPAY_REGISTER_CLASS_NAME?>
---------------
 <?for-each-group@section:current-group();./ACCT_CODE?>
---------------------<?for-each:current-group()?>
-----------------------------do some thing in current-group
---------------------<?end for-each?>
---------------
 <?end for-each-group?>
-----
-<?end for-each-group?>

                                                             

Viewàshow Paragraph Marks 去掉段落标记

@section:按块分段                        

 

2. Group Calculating
在分组小计的时候:
特別要注意的是...目前在第几层:
原本得资料位在ROW这一层

-------<?for-each-group:ROW;AAA?>
---------------<?for-each-group:current-group();BBB?>
--------------------- <?for-each:current-group()?>
-----------------------------do some thing in current-group
-----------------------------
<?sum(current-group()//CCC)?>加总AAA-BBBCCC
--------------------- <?end for-each?>
---------------<?end for-each-group?>
---------------
<?sum(current-group()/CCC)?>加总AAACCC
------- <?end for-each-group?>

3. Powerful and Flexible-Variables
定义变量
<?xdoxslt:set_variable($_XDOCTX,'VAR_NM',VAR_Val)?>
指定变量
<?xdoxslt:set_variable($_XDOCTX,'VAR_NM',VAR_Val)?>
取变量值:
<?xdoxslt:get_variable($_XDOCTX,'VAR_NM')?>
可以轻易的做grant total总计等运算
也可更具条件做分页

例子:

---将现在的行数赋值给变量row_num
<? xdoxslt:set_variable($_XDOCTX,'row_num',position())?>

---row_num自加1

<?xdoxslt:set_variable($_XDOCTX,'row_num',xdoxslt:get_variable($_XDOCTX,'row_num') + 1)?>

 

---如果这一行数不为十的倍数  则显示

<?if:xdoxslt:get_variable($_XDOCTX,‘row_num’) mod 10 !=0?>Row<?end if?>


4. Page Break
例子:

每页显示十行

<?if:position() mod 10 =1 and position() != 1 ?><xsl:attribute name="break-before">page</xsl:attribute><? end if?>


TAG: rtf template 分组 分页

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-11-30  
      1
2345678
9101112131415
16171819202122
23242526272829
30      

数据统计

  • 访问量: 172
  • 日志数: 4
  • 建立时间: 2008-08-28
  • 更新时间: 2008-10-30

RSS订阅

Open Toolbar