con_contract_print_signatures.lview 8.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-11-20 下午8:50:38  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
          trace="true">
    <a:init-procedure>
        <s:server-script import="con_print_path.js"><![CDATA[
12
            set_pdf_parameter_file_path();
13 14 15 16 17 18 19 20
        ]]></s:server-script>
        <a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con_contract_content_asset_detail_link_id"
                url="${/request/@context_path}/modules/cont/CON505/con_contract_content_asset_detail.lview"/>
        <a:link id="con_doc_batch_create_link_id"
                url="${/request/@context_path}/modules/cont/CON500/con_doc_batch_create.lsc"/>
21 22
        <!--        <a:link id="con301n_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>-->
        <a:link id="con301n_downloadFile_id" url="${/request/@context_path}/modules/cont/CON301N/con_downfile.lsc"/>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
        <a:link id="con301n_print_excel_link"
                url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/>
        <a:link id="con301n_print_pdf_link"
                url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/>
        <script type="text/javascript"><![CDATA[


        function lock_current_window() {
            Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
        }

        function unlock_current_window() {
            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
        }

        function con_print_excel_create() {
            Leaf.Masker.mask(Ext.getBody(), '请稍等......');
            var contract_id = '${/parameter/@contract_id}';
            var contract_number = '${/parameter/@contract_number}';
            var tenant_name = '${/parameter/@tenant_name}';
            var file_path  = '${/parameter/@file_path}';
            //var file_name  = '对账单('+ tenant_name + '_'+contract_number+').xlsx';
            var file_name  = '对账单('+ tenant_name + '_'+contract_number+')';
            Leaf.request({
                url: $('con301n_print_excel_link').getUrl(),
                para: {
                    contract_id : contract_id,
                    contract_number : contract_number,
                    file_path : file_path,
                    file_name : file_name
                },
                success: function(res) {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                },
                failure: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                },
                error: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                }
            });


        }

        function con_print_signatures_create() {
            Leaf.Masker.mask(Ext.getBody(), '请稍等......');
            var contract_id = '${/parameter/@contract_id}';
            var contract_number = '${/parameter/@contract_number}';
            var tenant_name = '${/parameter/@tenant_name}';
            var file_path  = '${/parameter/@file_path}';
            //var file_name  = '对账单('+ tenant_name + '_'+contract_number+').xlsx';
            var file_name  = '对账单('+ tenant_name + '_'+contract_number+')';
            Leaf.request({
                url: $('con301n_print_pdf_link').getUrl(),
                para: {
                    contract_id : contract_id,
                    contract_number : contract_number,
                    file_path : file_path,
                    file_name : file_name
                },
                success: function(res) {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                },
                failure: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                },
                error: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                    $('con_contract_print_detail_line_ds').query();
                }
            });
        }

        function update_attachment_renderer(value, record, name) {
            var content_id = record.get('content_id');
            return '<a href="javascript:open_uploadfile_win(' + content_id + ')">附件</a>';
        }


        function attachment_download(val,rec,name) {
            return '<a href=javascript:detail_download_window('+rec.get('print_id')+')>下载</a>';}

        function detail_download_window(record_id) {
            var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id;
113 114 115 116 117 118 119 120 121 122 123 124 125
            // var win = new Leaf.Window({
            //     url: url,
            //     title: '${l:HLS.SUPPORTING_DOCUMENT}',
            //     id: 'con301n_records_uploadFile_id',
            //     width: 850,
            //     height: 400
            // });
            // win.on('close', function() {
            // });

            var url = $('con301n_downloadFile_id').getUrl() + '?record_id=' + record_id + '&table_name=CUX_CONTRACT_PRINT';
            window.open(url, '_self');

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_contract_update_print_detail_header_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
                    <a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
                </a:fields>

            </a:dataSet>
            <a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON301N.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="contract_id"/>
                    <a:field name="content_number" readOnly="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <div id="screenTopToolbardiv">
                <a:screenTopToolbar style="width:700px">
                    <a:gridButton id="con_print_id" click="con_print_excel_create" text="生成对账单excel"/>
                    <a:gridButton id="con_print_signatures_id" click="con_print_signatures_create" text="生成对账单PDF"/>
                </a:screenTopToolbar>
                <a:form column="2"  width="700">
                    <a:textField name="contract_number" bindTarget="con_contract_update_print_detail_header_ds"
                                 prompt="HLS.CONTRACT_NUMBER"/>
                    <a:textField name="contract_name" bindTarget="con_contract_update_print_detail_header_ds"
                                 prompt="HLS.CONTRACT_NAME" width="330"/>
                </a:form>
            </div>
            <a:grid id="con_contract_update_print_detail_grid_id" bindTarget="con_contract_print_detail_line_ds"
                    height="350" navBar="true" width="700">
                <a:toolBar>
                    <a:button prompt="PROMPT.EXPORT_EXCEL" type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="file_name" prompt="文本名称" width="260"/>
165
                    <a:column name="user_name" prompt="打印人" width="160"/>
166 167 168 169 170 171 172
                    <a:column name="print_date" prompt="生成日期" width="180"/>
                    <a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        Leaf.onReady(function() {
173 174 175 176 177
            if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
                document.getElementById("con_print_signatures_id").style.display = "";
            } else {
               document.getElementById("con_print_signatures_id").style.display = "none";
            }
178 179 180 181
        });
        ]]></script>
    </a:view>
</a:screen>