freemarker 模板使用记录

凭证打印特殊要求:单一凭证不足5行 补充至5行 ,超过5行 令起一张凭证保存 合计:为所有明细累加。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head><meta charset="UTF-8"/><title>凭证打印</title><style>body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, textarea, p, blockquote, th, td {margin: 0;padding: 0;}body {font-size: 12px;/*font-family:Tahoma !important;Verdana,"宋体",Arial, Helvetica, sans-serif;*//*font-family: 'lucida grande', tahoma, arial, 'bitstream vera sans',helvetica, sans-serif;*/font-family: SimHei;color: #474747;line-height: 1.5;background-color: #FFFFFF;scrollbar-face-color: #dcded6;scrollbar-highlight-color: #ebf0f4;scrollbar-shadow-color: #d0d2c8;scrollbar-3dlight-color: #f2ecdf;scrollbar-arrow-color: #b8893a;scrollbar-track-color: #efefef;scrollbar-darkshadow-color: #98aab1;}table.order_info tr td {width: 18%;font-size: 15px;}.order_bottom {text-align: right;font-size: 15px;}table.listtable {border: 0px;width: 100%;border-collapse: collapse;border: 1px solid #666666;border-width: 1px 0 0 1px;}table.listtable th, table.listtable td {border: 1px solid #666666;border-width: 0 1px 1px 0;padding: 2px;font-size: 15px;}table.listtable th {height: 26px;text-align: center;font-weight: normal;white-space: nowrap;}table.listtable th a {text-decoration: underline;}table.listtable tr {height: 23px;border: 1px;}table.listtable td {text-align: center;cursor: default;overflow: hidden;}table.listtable td.char {text-align: left;cursor: default;overflow: hidden;}table.listtable td.number {text-align: right;cursor: default;overflow: hidden;}div.header {width: 100%;font-weight: bold;font-size: 32px;}</style>
</head>
<body>
<#setting classic_compatible=true/>
<div align="center" class="header">记账凭证
</div>
<#list vouchers as voucher>//声明变量<#assign debitSum=0/><#assign creditSum=0/><#if voucher.getActVoucherDetailRese()?size gt 5><#if (voucher.getActVoucherDetailRese()?size/5) gt (voucher.getActVoucherDetailRese()?size/5)?int><#assign groups=(voucher.getActVoucherDetailRese()?size/5)?int + 1/></#if><#if (voucher.getActVoucherDetailRese()?size/5) == (voucher.getActVoucherDetailRese()?size/5)?int><#assign groups=(voucher.getActVoucherDetailRese()?size/5)?int/></#if><#list voucher.getActVoucherDetailRese() as voucherDetail><#if voucherDetail.voucherDebit??><#assign debitSum=debitSum +voucherDetail.voucherDebit></#if><#if voucherDetail.voucherCredit??><#assign creditSum=creditSum +voucherDetail.voucherCredit></#if></#list>//便利1到指定数<#list 1..groups as group><div style="float: left;width: 617px;position: relative;right: -40px;"><table class="order_info" style="width:100%;margin-bottom:10px;"><tr><td align="left" style="width:35%;">核算单位:${companyName}</td><td align="center" style="width:35%;">日期:${(voucher.createTime?number_to_datetime)?string('yyyy-MM-dd')}</td><td align="right" style="width:30%;">凭证编号:<#if voucher.voucherWord=1>记-${voucher.voucherNum}</#if><#if voucher.voucherWord=2>收-${voucher.voucherNum}</#if><#if voucher.voucherWord=3>付-${voucher.voucherNum}</#if><#if voucher.voucherWord=4>转-${voucher.voucherNum}</#if></td></tr></table><table id="listtb" class="listtable" cellpadding="0" cellspacing="1"><thead><tr><th style="width:30%;height:70px">摘要</th><th style="width:40%;height:70px">科目</th><th style="width:15%;height:70px">借方</th><th style="width:15%;height:70px">贷方</th></tr></thead><tbody><#if group==groups><#if voucher.getActVoucherDetailRese()?size%5 ==0><#assign listEndSize=5/></#if><#if voucher.getActVoucherDetailRese()?size%5 !=0><#assign listEndSize=voucher.getActVoucherDetailRese()?size%5/></#if></#if><#if group lt groups><#assign listEndSize=5/></#if><#list ((group-1)*5+1)..((group-1)*5+listEndSize) as detailIndex><tr><td style="height:70px" class="char">${voucher.getActVoucherDetailRese()[detailIndex-1].voucherNote}</td><td style="height:70px" class="char">${voucher.getActVoucherDetailRese()[detailIndex-1].actSubjectName}</td><td style="height:70px" class="number">// voucher.getActVoucherDetailRese()[i] 获取指定集合某个元素<#if voucher.getActVoucherDetailRese()[detailIndex-1].voucherDebit==0></#if><#if voucher.getActVoucherDetailRese()[detailIndex-1].voucherDebit!=0>${voucher.getActVoucherDetailRese()[detailIndex-1].voucherDebit?string(",##0.00")}</#if></td><td style="height:70px" class="number"><#if voucher.getActVoucherDetailRese()[detailIndex-1].voucherCredit=0></#if><#if voucher.getActVoucherDetailRese()[detailIndex-1].voucherCredit!=0>${voucher.getActVoucherDetailRese()[detailIndex-1].voucherCredit?string(",##0.00")}</#if></td></tr></#list><#if listEndSize==1><#list 1..4 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if><#if listEndSize==2><#list 1..3 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if><#if listEndSize==3><#list 1..2 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if><#if listEndSize==4><#list 1..1 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if></tbody><tfoot><tr><td class="char" style="height:60px;" colspan="2">合计:${voucher.getRMB(debitSum)}</td><td style="height:70px;" class="number">${debitSum?string(",##0.00")}</td><td style="height:70px;" class="number">${creditSum?string(",##0.00")}</td></tr></tfoot></table><table style="width:100%"><tr style="width:100%"><td class="char" style="width:25%;height:20px;border:0px;border-width:0px;font-size:15px">记账:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">审核:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">出纳:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">主管:</td></tr></table></div></#list></#if><#if voucher.getActVoucherDetailRese()?size lte 5><div style="float: left;width: 617px;position: relative;right: -40px;"><table class="order_info" style="width:100%;margin-bottom:10px;"><tr><td align="left" style="width:35%;">核算单位:${companyName}</td><td align="center" style="width:35%;">日期:${(voucher.createTime?number_to_datetime)?string('yyyy-MM-dd')}</td><td align="right" style="width:30%;">凭证编号:<#if voucher.voucherWord=1>记-${voucher.voucherNum}</#if><#if voucher.voucherWord=2>收-${voucher.voucherNum}</#if><#if voucher.voucherWord=3>付-${voucher.voucherNum}</#if><#if voucher.voucherWord=4>转-${voucher.voucherNum}</#if></td></tr></table><table id="listtb" class="listtable" cellpadding="0" cellspacing="1"><thead><tr><th style="width:30%;height:70px">摘要</th><th style="width:40%;height:70px">科目</th><th style="width:15%;height:70px">借方</th><th style="width:15%;height:70px">贷方</th></tr></thead><tbody><#list voucher.getActVoucherDetailRese() as voucherDetail><tr><td style="height:70px" class="char">${voucherDetail.voucherNote}</td><td style="height:70px" class="char">${voucherDetail.actSubjectName}</td><td style="height:70px" class="number"><#if voucherDetail.voucherDebit=0></#if><#if voucherDetail.voucherDebit!=0>${voucherDetail.voucherDebit?string(",##0.00")}</#if></td><#if voucherDetail.voucherDebit??><#assign debitSum=debitSum +voucherDetail.voucherDebit></#if><td style="height:70px" class="number"><#if voucherDetail.voucherCredit=0></#if><#if voucherDetail.voucherCredit!=0>${voucherDetail.voucherCredit?string(",##0.00")}</#if></td><#if voucherDetail.voucherCredit??><#assign creditSum=creditSum +voucherDetail.voucherCredit></#if></tr></#list><#if voucher.getActVoucherDetailRese()?size=2><#list 1..3 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if><#if voucher.getActVoucherDetailRese()?size=3><#list 1..2 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if><#if voucher.getActVoucherDetailRese()?size=4><#list 1..1 as t><tr><td style="height:70px" class="char"></td><td style="height:70px" class="char"></td><td style="height:70px" class="number"></td><td style="height:70px" class="number"></td></tr></#list></#if></tbody><tfoot><tr><td class="char" style="height:60px;" colspan="2">合计:${voucher.getRMB(debitSum)}</td><td style="height:70px;" class="number">${debitSum?string(",##0.00")}</td><td style="height:70px;" class="number">${creditSum?string(",##0.00")}</td></tr></tfoot></table><table style="width:100%"><tr style="width:100%"><td class="char" style="width:25%;height:20px;border:0px;border-width:0px;font-size:15px">记账:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">审核:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">出纳:</td><td class="char" style="width:25%;height:20px;border:0px;font-size:15px">主管:</td></tr></table></div></#if><br/><br/><br/>
</#list>
</body>
</html>

如图效果:

freemarker 模板使用记录相关推荐

  1. freemarker模板文件中文本域(textarea)的高度自适应实现

    2019独角兽企业重金招聘Python工程师标准>>> freemarker模板文件中实现文本域(textarea)的高度自适应实现. 从网上找的大部分办法中很多方法兼容性并不好,要 ...

  2. Struts2解析FreeMarker模板中变量的顺序

    http://zhxing.iteye.com/blog/391560 关于FreeMarker 的基础学习请参考文档..这里主要记录 FreeMarker 的一些问题.. 1.FreeMarker  ...

  3. 利用 freemarker 模板生成 word 小结

    在企业级开发时,不可避免的会遇到生成 word 文档的需求,有两种常用的方案,1.使用 Apache POI 在后台通过代码生成 word 文档:2.使用模板生成 word 文档.第二种方法比较简单, ...

  4. Java中利用freemarker模板动态生成word含表格

    最近公司有导出word的需求,由于word的样式有的很复杂所以记录一下Java中利用freemarker模板动态生成word含表格,以防以后忘记. 1.word表格的模板 删掉无用的数据留下基础的样式 ...

  5. java根据Freemarker模板渲染出Excel文件并在浏览器中下载

    **java根据Freemarker模板渲染出Excel文件并在浏览器中下载** 准备工作 1.导入的依赖 2.创建模板 Freemrker语法大全: [Freemarker语法使用请点击该链接跳转学 ...

  6. 使用freemarker模板导出excel

    话不多说直接进入正题,记录一次使用freemarker模板导出excel的过程: 1.先写个导出文件的工具类.代码如下: package com.xxxx.web.action.xxx;import ...

  7. (二)FreeMarker模板开发

    1.模板开发入门 1).模板的引入 假设在一个在线商店的应用系统中需要一个HTML页面,和下面这个页面类似: <html> <head> <title>Welcom ...

  8. Spring 4 使用Freemarker模板发送邮件添加附件

    前言 Spring对Java的邮件发送提供了很好的支持,提供了超级简单的API,大大简化了Java邮件发送功能的开发. Spring对Email的支持是基于JavaMail API开发的,所以,我们在 ...

  9. JFinal配合Shiro权限控制在FreeMarker模板引擎中控制到按钮粒度的使用

    实现在FreeMarker模板中控制对应按钮的显示隐藏主要用到了Shiro中的hasRole, hasAnyRoles, hasPermission以及Authenticated等方法,我们可以实现T ...

最新文章

  1. 用linux遇到的一个死循环
  2. 开源的pop3和smtp组件(支持中文及SSL)
  3. ES5-2 语法、规范、错误、运算符、判断分支、注释
  4. 训练时发生的错误:Couldn‘t open shared file mapping: <000001910A228862>, error code: <1455>
  5. (转)搭建Spring4.x.x开发环境
  6. IOS控件内容 对齐方式
  7. hadoop1 hadoop2 fair-schduler 配置和使用
  8. 实对称矩阵可对角化证明
  9. 巨详细一文教你如何撰写商业计划书
  10. python语言支持函数式编程_python 函数式编程学习笔记
  11. Wireshark:抓取微信网址
  12. 微信支付(扫码支付)微信公众平台开发教程(6)
  13. 使用 strace、tcpdump、nlmon、wireshark 探索 ethtool netlink 框架的原理
  14. 滑铁卢大学计算机专业就业,克服艰难 收获滑铁卢大学计算机专业offer
  15. 如何用python实现题目:一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
  16. 问题 K: 古罗马数字
  17. linux文件目录详解
  18. C2B的未来:大数据定制
  19. 2022年数据中心产业发展将呈现三大新趋势
  20. VQA 2.0数据集的学习和使用过程

热门文章

  1. 想骂人!开发语言不能统一成一个么?
  2. SRS Audio Sandbox(终极的音频增强软件)
  3. 打破“双十定律”,华为云AI推动超级抗菌药Drug X研发加速
  4. 如何屏蔽博客园中的Google广告
  5. 大连 Oracle LMS,oracle rac后台进程和LMS说明
  6. Android实现ListView的A-Z字母排序和过滤搜索功能
  7. 再见, Python, 你好, Julia
  8. Surface Pro 3电源方面注意事项
  9. 2020最新微信棋牌游戏H5域名防封的解决方案
  10. android汽车手机互联!阿里P8面试官都说太详细了,赶紧收藏备战金三银四!