<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: copy from hec  
    $Date: 2014-11-24 下午05:25:12  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" 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="ACPIMPORT" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;ACPIMPORT&apos;" model="acp.ACP516.acp_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:init-procedure>
    <a:view>
        <a:link id="bgfl_acp_invoice_ipt_link_id" url="${/request/@context_path}/modules/acp/ACP516/bgfl_acp_invoice_ipt.lview"/>
        <a:link id="bgfl_acp_invoice_ipt_import_lind_id" model="acp.ACP516.bgfl_acp_invoice_ipt" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
           function submmit(){
               var header_id = ${/model/header/record/@header_id};
               Leaf.request({
	                url: $('bgfl_acp_invoice_ipt_import_lind_id').getUrl(),
	                para: {
	                    batch_id :header_id
	                },
	                success: function(res) {
	                    Leaf.SideBar.show({
	    	            	msg:'数据上传成功',
	    	            	duration:2000
	    	            });
               			setTimeout(function(){
               			    location.href = $('bgfl_acp_invoice_ipt_link_id').getUrl()+'?batch_id='+header_id;
               			},'500');
	                },
	                failure:function(){
	                    Leaf.showMessage('${l:PROMPT}','数据上传失败!',function(){
	                        location.href = $('bgfl_acp_invoice_ipt_link_id').getUrl()+'?batch_id='+header_id;
	                    });
	                },
	                error:function(){
	                    Leaf.showMessage('${l:PROMPT}','数据上传错误!',function(){
	                        location.href = $('bgfl_acp_invoice_ipt_link_id').getUrl()+'?batch_id='+header_id;
	                    });
	                },
	                scope: this
	            });
            }
            
        ]]></script>
        <script type="text/javascript"><![CDATA[
	  		Leaf.onReady(submmit());
	  	]]></script>
    </a:view>
</a:screen>