<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author:   
    $Date: 2014-8-4 下午01:58:31  
    $Revision: 1.0  
    $Purpose: 商业伙伴查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:init-procedure>
        <a:model-query model="acr.ACR516.acr_vat_import_batch_id" rootPath="batch_id"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="pageLink_bpQueryScreen_welcome" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="ins_import_upload_link" url="${/request/@context_path}/modules/hls/HLS900/ins_import_upload.lview"/>
        <a:link id="ins_import_trans_upload_link" url="${/request/@context_path}/modules/hls/HLS900/ins_import_trans_upload.lview"/>
        <a:link id="hls_write_off_link_id" model="hls.HLS900.hls_import_interface" modelaction="batch_update"/>
        <a:link id="pageLink_transaction" url="${/request/@context_path}/modules/ebank/EBANK120/csh_transaction_receipt_detail.lview"/>
        <a:link id="pageLink_write_off_details" url="${/request/@context_path}/modules/ebank/EBANK120/csh_transaction_receipt_write_off_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_bp_modify_win(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var param = record.data;
                if (name == 'csh_transaction_num') {
                    new Leaf.Window({
                        id: 'transaction_window',
                        url: $('pageLink_transaction').getUrl() + '?transaction_id=' + param['transaction_id'],
                        title: '收款明细',
                        width: 850,
                        height: 460
                    });
                }
                if (name == 'write_off_amount') {
                    new Leaf.Window({
                        id: 'write_off_window',
                        url: $('pageLink_write_off_details').getUrl() + '?transaction_id=' + param['transaction_id'],
                        title: '核销明细',
                        width: 850,
                        height: 460
                    });
                }
            
            }
            
            function color_render(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                var status = record.get('post_flag');
                if (post_flag == 'N') {
                    return '<font color="red">' + value + '</font>';
                } else {
                    return '<font color="green">' + value + '</font>';
                }
            }
            
            window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
                if (name == 'csh_transaction_num' && value) {
                    return '<a href="javascript:open_bp_modify_win(\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\')">' + value + '</a>';
                }
                if (name == 'write_off_amount' && value) {
                    return '<a href="javascript:open_bp_modify_win(\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\')">' + Leaf.formatMoney(value) + '</a>';
                }
                if (name == 'bank_slip_num' && value) {
                    var status = record.get('post_flag');
                    if (status == 'Y') {
                        return '<a>' + '<font color="green">' + value + '</font>' + '</a>';
                    } else {
                        return '<a>' + '<font color="red">' + value + '</font>' + '</a>';
                    }
                }
                return value;
            };
            
            //导出
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var grid_id = ds_id.replace('ds', 'layout_grid_id').replace('DS', 'grid_id');
                $(grid_id)._export();
            };
            
            //导入
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                new Leaf.Window({
                    id: 'upload_window',
                    url: $('ins_import_upload_link').getUrl() + '?batch_id=${/model/batch_id/record/@batch_id}',
                    title: '导入待核销信息',
                    width: 420,
                    height: 280
                });
            };
            
            //收款核销
            window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
                var records = $(ds_id).getSelected();
            
            
                if (records.length == 0) {
                    Leaf.showInfoMessage('信息', '请至少选择一行！', null, 200, 100);
                    return;
                }
                var datas = [];
                var data = {};
                for (var i = 0;i < records.length;i++) {
                    data = {};
                    data['interface_id'] = records[i].get('interface_id');
                    data['_status'] = 'update';
                    datas.push(data);
            
            
                }
            
                Leaf.showConfirm('${l:PROMPT}', '是否收款核销?', function() {
                    Leaf.request({
                        url: $('hls_write_off_link_id').getUrl(),
                        para: datas,
                        success: function() {
                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            $(ds_id).query();
                        },
                        scope: this
                    });
                }, function() {
                    return;
                }, null, null);
            };
            
            
            
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            
                if (ds == $(ds_id)) {
                    aut_authority_list_validate_query(ds, qpara);
            
                }
            };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=HLS900"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
