<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: copy from hec  
    $Date: 2011-7-29 下午05:25:12  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <a:model-query model="acr.acr_get_sys_import_head_id" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="ACRIMPORT" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;ACRIMPORT&apos;" model="acr.acr_plan_import_get_header_status" rootPath="status"/>
        <a:model-query autoCount="false" defaultWhereClause="header_id=${/model/header/record/@header_id} order by line_id" fetchAll="true" model="acr.acr_plan_import_get_fnd_data" rootPath="importData"/>
        <a:model-query autoCount="false" defaultWhereClause="function_code=${/parameter/@function_code}=" fetchAll="true" model="hls.HLS_IMP.hls_import_columns_config" rootPath="dynamicColumnsData"/>
    </a:init-procedure>
    <a:view>
        <a:link id="hls_import_link" url="${/request/@context_path}/modules/hls/HLS_IMP/hls_csh_transaction_interface.lview"/>
        <a:link id="hls_import_save_data_link" url="${/request/@context_path}/modules/hls/HLS_IMP/ins_import_save_data.lsc"/>
        <a:link id="hls_submmit_link_id" model="hls.HLS_IMP.hls_import_columns_config" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            
            function view() {
                 // var record = $(ds_id).findById(record_id);
                var param = new Object();
                param['function_code'] = 'HLS900';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '自动收款核销入口';
                param['master_type']='BP_MASTER';
                param['master_id'] = param['bp_id'];
                hls_doc_get_layout_code('hls_get_layout_code_link_id',param,'hls_import_link','import_ds');
            }
            function color_render(value,record,name){
                var status = record.get('status');
                if(status == 'E'){
                    return '<font color="red">'+value+'</font>';
                }else{
                  return '<font color="green">'+value+'</font>';
                }
            }
            
            function submmit(){
                Leaf.request({
                            url: $('hls_submmit_link_id').getUrl(),
                            para: {batch_id :${/parameter/@batch_id}},
                            success: function() {
                                view();
                            },
                            scope: this
                        });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_data_ds">
                <a:datas dataSource="/model/importData"/>
            </a:dataSet>
            <a:dataSet id="import_query_ds" autoCount="true">
                <a:fields>
                    <a:field name="batch_id" defaultValue="${/parameter/@batch_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="import_ds" autoQuery="true" queryDataSet="import_query_ds">
                <a:fields>
                    <a:placeHolder id="dynamicFields"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form id="failure_form" title="导入信息" width="400">
                <a:hBox>
                    <a:button click="view" text="返回"/>
                    <a:button click="submmit" text="提交"/>
                </a:hBox>
                <a:grid bindTarget="fnd_data_ds" marginHeight="200" marginWidth="40" navBar="true">
                    <a:toolBar>
                        <a:button type="excel"/>
                    </a:toolBar>
                    <a:columns>
                        <a:placeHolder id="dynamicColumns"/>
                    </a:columns>
                </a:grid>
            </a:form>
        </a:screenBody>
        <!--         <script type="text/javascript"><![CDATA[
	  		loadComplete();
	  	]]></script> -->
    </a:view>
    <a:view-config>
        <c:create-config targetId="dynamicColumns">
            <p:loop source="/model/dynamicColumnsData">
                <c:process-config>
                    <a:column name="${@token_name}" prompt="${@description}"/>
                </c:process-config>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>
