<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: 6590 Richen.Xu 
    $Date: 2015-5-15 下午4:45:49  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.document_category = &apos;JE&apos;" fetchAll="true" model="basic.hls_document_type_for_lov" queryOrderBy="document_type desc" rootPath="hls1001_document_type_path"/>
    </a:init-procedure>
    <a:view package="leaf.ui.std" template="default">
        <script type="text/javascript"><![CDATA[
	function query()
	{
	    $('hls1001_journal_data').query();
	}
	
	function reset()
	{
	    $('hls1001_journal_query_ds').reset();
	}
	
	function hls1001_journal_grid_excel(){
	    Leaf.showConfirm('提示','您确定要导出以下所有数据吗',function(){
	        
	        $('hls_1001_journal_grid')._export('xls','凭证接口字段');
	        
		    var recs = $('hls1001_journal_data').getAll();
		    for(var i=0;i<recs.length;i++){
		        recs[i].set('_status','update',false);
		    }
		    $('hls1001_journal_data').submit();
		    
	    });
	}
	
	function hls1001_onSubmitSuccess(ds,res){
	    $('hls1001_journal_data').query();
	}
	
	// function hls1001_journal_go_back(){
	    // $('export_journal_window').close();
	// }
	]]></script>
        <a:dataSets>
            <a:dataSet id="hls1001_post_gl_status_ds" lookupCode="SUBSYSTEM_POST_GL_FLAG"/>
            <a:dataSet id="hls1001_export_flag_ds" lookupCode="HLS_EXPORT_FLAG"/>
            <a:dataSet id="hls1001_document_type_ds">
                <a:datas dataSource="/model/hls1001_document_type_path"/>
            </a:dataSet>
            <a:dataSet id="hls1001_journal_query_ds">
                <a:fields>
                    <a:field name="journal_num"/>
                    <a:field name="category_code_desc" displayField="description" options="hls1001_document_type_ds" returnField="category_code" valueField="document_type"/>
                    <a:field name="journal_date_from"/>
                    <a:field name="journal_date_to"/>
                    <a:field name="total_amount_dr_from"/>
                    <a:field name="total_amount_dr_to"/>
                    <a:field name="period_name"/>
                    <a:field name="external_journal_num"/>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="bp_id_tenant_desc" lovGridHeight="350" lovHeight="550" lovService="basic.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_id_tenant_desc"/>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="source_table"/>
                    <a:field name="reference1"/>
                    <a:field name="je_transaction_code"/>
                    <a:field name="je_transaction_desc" lovGridHeight="420" lovHeight="550" lovPageSize="20" lovService="gld.GLD104.gld_je_transaction_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="je_transaction_code" to="je_transaction_code"/>
                            <a:map from="je_transaction_desc" to="je_transaction_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="post_gl_status" defaultValue="N"/>
                    <a:field name="post_gl_status_desc" defaultValue="未过账" displayField="code_value_name" options="hls1001_post_gl_status_ds" returnField="post_gl_status" valueField="code_value"/>
                    <a:field name="responsibility_center_name_from" lovHeight="500" lovLabelWidth="100" lovService="fnd.FND2110.fnd_responsibility_centers_lov" lovWidth="550" title="HLS.RESPONSIBILITY_CENTER_NAME">
                        <a:mapping>
                            <a:map from="responsibility_center_id" to="responsibility_center_id"/>
                            <a:map from="responsibility_center_code" to="responsibility_center_code_from"/>
                            <a:map from="responsibility_center_name" to="responsibility_center_name_from"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="responsibility_center_name_to" lovHeight="500" lovLabelWidth="100" lovService="fnd.FND2110.fnd_responsibility_centers_lov" lovWidth="550" title="HLS.RESPONSIBILITY_CENTER_NAME">
                        <a:mapping>
                            <a:map from="responsibility_center_code" to="responsibility_center_code_to"/>
                            <a:map from="responsibility_center_name" to="responsibility_center_name_to"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="account_code_from" autoComplete="true" lovHeight="500" lovLabelWidth="100" lovService="hls.HLS301.hls_journal_account_for_lov" lovWidth="500" title="HLS530.ACCOUNT_NAME">
                        <a:mapping>
                            <a:map from="account_code" to="account_code_from"/>
                            <a:map from="description" to="account_name_from"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="account_code_to" autoComplete="true" lovHeight="500" lovLabelWidth="100" lovService="hls.HLS301.hls_journal_account_for_lov" lovWidth="500" title="HLS530.ACCOUNT_NAME">
                        <a:mapping>
                            <a:map from="account_code" to="account_code_to"/>
                            <a:map from="description" to="account_name_to"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="company_short_name" lovHeight="500" lovLabelWidth="100" lovService="fnd.fnd_companies_lov" lovWidth="550" title="HLS530.JOURNAL_COMPANY">
                        <a:mapping>
                            <a:map from="company_id" to="je_company_id"/>
                            <a:map from="company_short_name" to="company_short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="currency_name" lovHeight="500" lovLabelWidth="100" lovService="basic.gld_currency_v_lov" lovWidth="550">
                        <a:mapping>
                            <a:map from="currency_code" to="currency_code"/>
                            <a:map from="currency_name" to="currency_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="export_flag_n" displayField="code_value_name" options="hls1001_export_flag_ds" returnField="export_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls1001_journal_data" model="hls.HLS1001.export_journal_data" queryDataSet="hls1001_journal_query_ds">
                <a:fields>
                    <a:field name="export_flag" checkedValue="Y" defaultValue="N" readOnly="true" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="hls1001_onSubmitSuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <!-- <a:toolbarButton click="hls1001_journal_go_back" text="HLS.EXIT"/> -->
                <a:toolbarButton click="reset" text="HLS.RESET"/>
                <a:toolbarButton click="query" text="HLS.QUERY"/>
                <a:toolbarButton click="hls1001_journal_grid_excel" text="导出"/>
            </a:screenTopToolbar>
            <a:form column="5" labelSeparator=" " labelWidth="100" marginWidth="30" title="HAP_QUERY_TITLE">
                <a:lov name="account_code_from" bindTarget="hls1001_journal_query_ds" prompt="HLS530.ACCOUNT_NAME_FROM"/>
                <a:lov name="account_code_to" bindTarget="hls1001_journal_query_ds" prompt="HLS530.ACCOUNT_NAME_TO"/>
                <a:lov name="responsibility_center_name_from" bindTarget="hls1001_journal_query_ds" prompt="HLS530.RESPONSIBILITY_CENTER_NAME_FROM"/>
                <a:lov name="responsibility_center_name_to" bindTarget="hls1001_journal_query_ds" prompt="HLS530.RESPONSIBILITY_CENTER_NAME_TO"/>
                <a:lov name="company_short_name" bindTarget="hls1001_journal_query_ds" prompt="HLS530.JOURNAL_COMPANY"/>
                <a:datePicker name="journal_date_from" bindTarget="hls1001_journal_query_ds" prompt="HLS530.JOURNAL_DATE_FROM"/>
                <a:datePicker name="journal_date_to" bindTarget="hls1001_journal_query_ds" prompt="HLS530.JOURNAL_DATE_TO"/>
                <a:numberField name="total_amount_dr_from" allowFormat="true" bindTarget="hls1001_journal_query_ds" prompt="HLS530.TOTAL_AMOUNT_DR_FROM"/>
                <a:numberField name="total_amount_dr_to" allowFormat="true" bindTarget="hls1001_journal_query_ds" prompt="HLS530.TOTAL_AMOUNT_DR_TO"/>
                <a:textField name="journal_num" bindTarget="hls1001_journal_query_ds" prompt="HLS530.JOURNAL_NUM"/>
                <a:textField name="project_name" bindTarget="hls1001_journal_query_ds" prompt="HLS.PROJECT_NAME"/>
                <a:lov name="je_transaction_desc" bindTarget="hls1001_journal_query_ds" prompt="HLS530.JE_TRANSACTION"/>
                <a:lov name="currency_name" bindTarget="hls1001_journal_query_ds" prompt="HLS.CURRENCY"/>
                <a:lov name="bp_id_tenant_desc" bindTarget="hls1001_journal_query_ds" prompt="HLS.TENANT_CODE"/>
                <a:comboBox name="post_gl_status_desc" bindTarget="hls1001_journal_query_ds" prompt="HLS530.IS_POSTED"/>
                <a:comboBox name="export_flag_n" bindTarget="hls1001_journal_query_ds" prompt="导出状态"/>
            </a:form>
            <a:grid id="hls_1001_journal_grid" bindTarget="hls1001_journal_data" marginHeight="255" marginWidth="20" navBar="true">
                <a:columns>
                    <a:column name="export_flag" editor="hls1001_cb" forExport="false" lock="true" prompt="已导出"/>
                    <a:column name="period_year" lock="true" prompt="会计年" width="60"/>
                    <a:column name="period_num" lock="true" prompt="会计期间" width="60"/>
                    <a:column name="journal_date" lock="true" prompt="制单日期" width="80"/>
                    <a:column name="journal_type" lock="true" prompt="凭证类别" width="50"/>
                    <a:column name="journal_num" lock="true" prompt="凭证号" width="100"/>
                    <a:column name="created_by_n" lock="true" prompt="制单人" width="60"/>
                    <a:column name="document" prompt="所附单据数"/>
                    <a:column name="note1" prompt="备注1"/>
                    <a:column name="note2" prompt="备注2"/>
                    <a:column name="account_id_n" prompt="科目编码"/>
                    <a:column name="line_description" prompt="摘要"/>
                    <a:column name="settle_method" prompt="结算方式编码"/>
                    <a:column name="bill_num" prompt="票据号"/>
                    <a:column name="bill_date" prompt="票据日期"/>
                    <a:column name="currency_code_n" prompt="币种名称"/>
                    <a:column name="rate" prompt="汇率"/>
                    <a:column name="price" prompt="单价"/>
                    <a:column name="dr_num" prompt="借方数量"/>
                    <a:column name="cr_num" prompt="贷方数量"/>
                    <a:column name="amount_dr" prompt="原币借方"/>
                    <a:column name="amount_cr" prompt="原币贷方"/>
                    <a:column name="amount_fuc_dr" prompt="借方金额" renderer="Leaf.formatMoney"/>
                    <a:column name="amount_fuc_cr" prompt="贷方金额" renderer="Leaf.formatMoney"/>
                    <a:column name="responsibility_center_code" prompt="部门编码"/>
                    <a:column name="em_code" prompt="职员编码"/>
                    <a:column name="ref_v05" prompt="客户编码"/>
                    <a:column name="ref_v10" prompt="供应商编码"/>
                    <a:column name="project_item_code" prompt="项目大类编码"/>
                    <a:column name="project_number" prompt="项目编码"/>
                    <a:column name="salesman" prompt="业务员"/>
                    <a:column name="define_1" prompt="自定义项1"/>
                    <a:column name="define_2" prompt="自定义项2"/>
                    <a:column name="define_3" prompt="自定义项3"/>
                    <a:column name="define_4" prompt="自定义项4"/>
                    <a:column name="define_5" prompt="自定义项5"/>
                    <a:column name="define_6" prompt="自定义项6"/>
                    <a:column name="define_7" prompt="自定义项7"/>
                    <a:column name="define_8" prompt="自定义项8"/>
                    <a:column name="define_9" prompt="自定义项9"/>
                    <a:column name="define_10" prompt="自定义项10"/>
                    <a:column name="define_11" prompt="自定义项11"/>
                    <a:column name="define_12" prompt="自定义项12"/>
                    <a:column name="define_13" prompt="自定义项13"/>
                    <a:column name="define_14" prompt="自定义项14"/>
                    <a:column name="define_15" prompt="自定义项15"/>
                    <a:column name="define_16" prompt="自定义项16"/>
                    <a:column name="cash_flow_item" prompt="现金流量项目"/>
                    <a:column name="cash_flow_dr" prompt="现金流量借方金额"/>
                    <a:column name="cash_flow_cr" prompt="现金流量贷方金额"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="hls1001_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        
        	Leaf.onReady(function(){
        	    if(!Leaf.isEmpty('${/parameter/@export_flag}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('export_flag','${/parameter/@export_flag}');
        	        $('hls1001_journal_query_ds').getAt(0).set('export_flag_n',decodeURI(decodeURI('${/parameter/@export_flag_n}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@journal_num}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('journal_num','${/parameter/@journal_num}');
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@account_code_from}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('account_code_from','${/parameter/@account_code_from}');
        	        $('hls1001_journal_query_ds').getAt(0).set('account_name_from',decodeURI(decodeURI('${/parameter/@account_name_from}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@account_code_to}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('account_code_to','${/parameter/@account_code_to}');
        	        $('hls1001_journal_query_ds').getAt(0).set('account_name_to',decodeURI(decodeURI('${/parameter/@account_name_to}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@responsibility_center_code_to}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('responsibility_center_code_to','${/parameter/@responsibility_center_code_to}');
        	        $('hls1001_journal_query_ds').getAt(0).set('responsibility_center_name_to',decodeURI(decodeURI('${/parameter/@responsibility_center_name_to}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@responsibility_center_code_from}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('responsibility_center_code_from','${/parameter/@responsibility_center_code_from}');
        	        $('hls1001_journal_query_ds').getAt(0).set('responsibility_center_name_from',decodeURI(decodeURI('${/parameter/@responsibility_center_name_from}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@je_company_id}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('je_company_id','${/parameter/@je_company_id}');
        	        $('hls1001_journal_query_ds').getAt(0).set('company_short_name',decodeURI(decodeURI('${/parameter/@company_short_name}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@journal_date_from}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('journal_date_from','${/parameter/@journal_date_from}');
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@journal_date_to}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('journal_date_to','${/parameter/@journal_date_to}');
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@total_amount_dr_from}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('total_amount_dr_from','${/parameter/@total_amount_dr_from}');
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@total_amount_dr_to}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('total_amount_dr_to','${/parameter/@total_amount_dr_to}');
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@project_name}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('project_name',decodeURI(decodeURI('${/parameter/@project_name}')));
        	    }
               
               	if(!Leaf.isEmpty('${/parameter/@je_transaction_code}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('je_transaction_code','${/parameter/@je_transaction_code}');
        	        $('hls1001_journal_query_ds').getAt(0).set('je_transaction_desc',decodeURI(decodeURI('${/parameter/@je_transaction_desc}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@currency_code}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('currency_code','${/parameter/@currency_code}');
        	        $('hls1001_journal_query_ds').getAt(0).set('currency_name',decodeURI(decodeURI('${/parameter/@currency_name}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@bp_id_tenant}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('bp_id_tenant','${/parameter/@bp_id_tenant}');
        	        $('hls1001_journal_query_ds').getAt(0).set('bp_id_tenant_desc',decodeURI(decodeURI('${/parameter/@bp_id_tenant_desc}')));
        	    }
        	    
        	    if(!Leaf.isEmpty('${/parameter/@post_gl_status}')){
        	        $('hls1001_journal_query_ds').getAt(0).set('post_gl_status','${/parameter/@post_gl_status}');
        	        $('hls1001_journal_query_ds').getAt(0).set('post_gl_status_desc',decodeURI(decodeURI('${/parameter/@post_gl_status_desc}')));
        	    }
        	    
        	    $('hls1001_journal_data').query();
        	});
        
        ]]></script>
    </a:view>
</a:screen>