<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" xmlns:dr="leaf.plugin.excelreport"  trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="contract_id=${/parameter/@contract_id}" fetchAll="true" model="cont.CON1300.get_contract_op_print_info" rootPath="/model/head_info"/>
        <a:model-query fetchAll="true" model="cont.CON1300.get_con_print_op_grid_info" rootPath="/model/grid_data"/>
        <s:server-script><![CDATA[
            importPackage(java.io);

            function getdate() {
            var now = new Date()
            y = now.getFullYear()
            m = now.getMonth() + 1
            d = now.getDate()
            m = m < 10 ? "0" + m : m
            d = d < 10 ? "0" + d : d
            return y + "" + m + "" + d
            }

            $ctx.parameter.file_name   = $ctx.parameter.file_name+getdate()+'.xlsx';
            ]]></s:server-script>
        <dr:excel-report enableTask="false" fileName="${/parameter/@file_name}">
            <styles>
                <dr:cell-style name="title" align="ALIGN_CENTER">
                    <dr:font fontName="黑体" height="12" italic="false"/>
                </dr:cell-style>
                <dr:cell-style name="left" align="ALIGN_LEFT">
                    <dr:font fontName="黑体" height="10" italic="false"/>
                </dr:cell-style>
                <dr:cell-style name="right" align="ALIGN_RIGHT">
                    <dr:font fontName="黑体" height="10" italic="false"/>
                </dr:cell-style>
                <dr:cell-style name="grid_title"  align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN" borderTop="BORDER_THIN" borderRight="BORDER_THIN">
                    <dr:font fontName="黑体" height="9" italic="false"/>

                </dr:cell-style>
                <dr:cell-style name="grid_cell" align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN" borderTop="BORDER_THIN" borderRight="BORDER_THIN">
                    <dr:font fontName="黑体" height="9" italic="false"/>

                </dr:cell-style>
                <dr:cell-style name="header" align="ALIGN_CENTER">
                    <dr:font bold="false" fontName="宋体" height="12"/>
                </dr:cell-style>
                <dr:cell-style name="foot">
                    <dr:font bold="false" fontName="宋体" height="12"/>
                </dr:cell-style>
                <dr:cell-style name="footNumber" dataFormat="#,##0.000">
                    <dr:font bold="false" fontName="宋体" height="12"/>
                </dr:cell-style>
                <dr:cell-style name="dateFormat" dataFormat="YYYY-MM-DD">
                    <dr:font bold="false" fontName="宋体" height="12"/>
                </dr:cell-style>
                <dr:cell-style name="group">
                    <dr:font bold="false" fontName="宋体" height="12"/>
                </dr:cell-style>
            </styles>
            <sheets>
                <dr:sheet name="第一页" autoSizeColumns="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20" displayGridlines="true">
                    <dr:static-content>
                        <dr:cell-data cell="A"    row="1" stylename="right" type="content" value="设备金额："/>
                        <dr:cell-data cell="B"    row="1" stylename="left"  type="content" value="${/model/head_info/record/@lease_item_amount}"/>
                        <dr:cell-data cell="C"    row="1" stylename="right" type="content" value="起租日："/>
                        <dr:cell-data cell="D"    row="1" stylename="left"  type="content" value="${/model/head_info/record/@lease_start_date}"/>
                        <dr:cell-data cell="E"    row="1" stylename="right" type="content" value="回转率："/>
                        <dr:cell-data cell="F"    row="1" stylename="left"  type="content" value="${/model/head_info/record/@int_rate}"/>
                        <dr:cell-data cell="A"    row="2" stylename="right" type="content" value="保证金："/>
                        <dr:cell-data cell="B"    row="2" stylename="left"  type="content" value="${/model/head_info/record/@deposit_ratio}"/>
                        <dr:cell-data cell="C"    row="2" stylename="right" type="content" value="第一期租金日："/>
                        <dr:cell-data cell="D"    row="2" stylename="left"  type="content" value="${/model/head_info/record/@first_pay_date}"/>
                        <dr:cell-data cell="E"    row="2" stylename="right" type="content" value="月租金："/>
                        <dr:cell-data cell="F"    row="2" stylename="left"  type="content" value="${/model/head_info/record/@pmt}"/>
                        <dr:cell-data cell="A"    row="3" stylename="right" type="content" value="保证金收入日："/>
                        <dr:cell-data cell="B"    row="3" stylename="left"  type="content" value="${/model/head_info/record/@margin_date}"/>
                        <dr:cell-data cell="C"    row="3" stylename="right" type="content" value="期限（月）："/>
                        <dr:cell-data cell="D"    row="3" stylename="left"  type="content" value="${/model/head_info/record/@lease_times}"/>
                        <dr:cell-data cell="A"    row="4" stylename="right" type="content" value="保证金金额："/>
                        <dr:cell-data cell="B"    row="4" stylename="left"  type="content" value="${/model/head_info/record/@deposit}"/>
                        <dr:cell-data cell="A"    row="5" stylename="right" type="content" value="总租金"/>
                        <dr:cell-data cell="B"    row="5" stylename="left" type="content" value="${/model/head_info/record/@total_rental}"/>
                    </dr:static-content>
                    <dr:dynamic-content cell="A" datamodel="/model/grid_data" row="7">
                        <dr:columns>
                            <dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="439" field="times" title="期数"  type="content"/>
                            <dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="440" field="due_date" title="支付日"  type="content"/>
                            <dr:table-column cellStyle="grid_cell" titleStyle="grid_title" column_id="441" field="due_amount" title="当期应收金额"  type="content" groupDesc="计数"/>
                        </dr:columns>
                    </dr:dynamic-content>
                </dr:sheet>
            </sheets>
        </dr:excel-report>
    </a:init-procedure>
    <a:service-output output="/parameter"/>
</a:service>
