freemarker 模板使用记录

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>




	    	

如图效果:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u011445756/article/details/88028506
今日推荐