<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure >
        <!--<a:model-execute model="hls.HLS536.delete_hls_journal_tmp"/>-->
        <a:model-query model="hls.HLS536.hls_journal_import_head_id" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" attribute5="D:\u01\hls_file\hls_journal,fnd_interface_headers,${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLS_JOURNAL_IMPORT" user_id="${/session/@user_id}" />
        <!--<a:import-excel header_id="${/session/@session_id}" attribute5="D:\u01,fnd_interface_headers,${/session/@session_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLS_JOURNAL_IMPORT" user_id="${/session/@user_id}" />-->
        <!--<a:model-execute model="hls.HLS536.insert_hls_journal_tmp"/>-->

     </a:init-procedure>
    <a:view>
    <a:link id="hls_journal_entrance_import_link" url="${/request/@context_path}/modules/hls/HLS536/hls_journal_import_entrance.lview"/>
    <a:link id="import_save_data_link" url="${/request/@context_path}/modules/hls/HLS536/hls_journal_import_save.lsc"/>
       <script type="text/javascript"><![CDATA[
        function loadComplete() {
          var param = {};
          param['template_type'] = '${/parameter/@template_type}';
          param['header_id'] = '${/model/header/record/@header_id}';
          Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
          Leaf.request({
              url: $('import_save_data_link').getUrl(),
              para: param,
              success: function (res) {
              Leaf.Masker.unmask(Ext.getBody());
              if(res.result.v_count>0){
                 Leaf.showInfoMessage('成功','导入成功!',function(){
                  window.location.href = $('hls_journal_entrance_import_link').getUrl();
                               });
              }else if (res.result.v_final_count>0){
                  Leaf.showInfoMessage('提示','贷款最终到期日为空，请检查!',function(){
                      window.location.href = $('hls_journal_entrance_import_link').getUrl();
                  });
              }else{
              Leaf.showInfoMessage('失败','导入失败!',function(){
                 window.location.href = $('hls_journal_entrance_import_link').getUrl();
                             });

             }
              },
              failure: function (res) {
                  Leaf.Masker.unmask(Ext.getBody());
              },
              error: function (res) {
                  Leaf.Masker.unmask(Ext.getBody());
               },
              sync: true,
              scope: this
          });

                  }
          loadComplete();
		]]></script>

    </a:view>
</a:screen>
