<?xml version="1.0" encoding="UTF-8"?>
<!--
	&author:DJ
	$date:2013/05/08
	$purpose:银行定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
			function rateScreen_close() {
            	$('fnd_base_rate_detail_winid').close();
        	}
        
	        function rateDs_grid_query() {
	            $('rateDs').query();
	        }
	    	
	        function rateDs_grid_add() {
	            var data={
	                currency : '${/parameter/@currency}',
	                batch_hd_id : '${/parameter/@batch_hd_id}'
	            };
	            $('rateDs_grid').showEditorByRecord($('rateDs').create(data));
	        }
	        
	        function rateDs_grid_remove() {
	            $('rateDs_grid').remove();
	        }
	        
	        function rateDs_grid_clear() {
	            $('rateDs_grid').clear();
	        }
	        
	        function rateDs_grid_save() {
	            var result_ds = $('rateDs');
	            result_ds.setSubmitParameter('batch_hd_id','${/parameter/@batch_hd_id}');
	            if (result_ds.validate()) {
	                result_ds.submit();
	            }
	        }
	        	        
			function editorFunction_rateDs_grid(record,name){
				if(record.isNew){
					if(name=='batch_hd_id'){
						return 'rateDs_grid_editor_tf_upper';
					}
					else if(name=='currency')
					{
					    if(Ext.isEmpty('${/parameter/@currency}'))
					    {
					        return 'rateDs_grid_editor_comb';
					    }
					}
					else if(name=='valid_from')
					{
					    return 'rateDs_grid_editor_dp';
					}
					return '';
				}
				return '';
			}
			
			function render_rateDs_grid(value,record,name)
			{
			    if(name=='base_rate')
			    {
			        if(value == undefined)
			        {
			            return '';
			        }
			        return value.toFixed(6);
			    }
			}
			
			
		]]></script>
        <a:dataSets>
            <a:dataSet id="rateScreen_currencyDs" loadData="true" model="gld.gld_currency_vl"/>
            <a:dataSet id="rateDs" autoQuery="true" model="cont.CON115.fnd_base_rate" queryUrl="${/request/@context_path}/autocrud/cont.CON115.fnd_base_rate/query?batch_hd_id=${/parameter/@batch_hd_id}" selectable="true">
                <a:fields>
                    <a:field name="base_rate" required="true"/>
                    <a:field name="months_from" required="true"/>
                    <a:field name="months_to" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="currency" displayField="currency_code" options="rateScreen_currencyDs" required="true" returnField="currency" valueField="currency_code"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="rateScreen_close" text="HLS.CLOSE"/>
                <a:gridButton click="rateDs_grid_query" text="HLS.QUERY"/>
                <a:gridButton click="rateDs_grid_add" text="HLS.NEW"/>
                <a:gridButton click="rateDs_grid_remove" text="HLS.REMOVE"/>
                <a:gridButton click="rateDs_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="rateDs_grid_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="rateDs_grid" bindTarget="rateDs" height="300" width="780">
                <a:columns>
                    <a:column name="currency" editorFunction="editorFunction_rateDs_grid"/>
                    <a:column name="base_rate" align="right" editor="rateDs_grid_editor_nf" renderer="render_rateDs_grid"/>
                    <a:column name="months_from" align="right" editor="rateDs_grid_editor_nf_integer"/>
                    <a:column name="months_to" align="right" editor="rateDs_grid_editor_nf_integer"/>
                    <a:column name="description" editor="rateDs_grid_editor_tf" width="250"/>
                </a:columns>
                <a:editors>
                    <a:textField id="rateDs_grid_editor_tf_upper" maxLength="30" typeCase="upper"/>
                    <a:textField id="rateDs_grid_editor_tf"/>
                    <a:numberField id="rateDs_grid_editor_nf" allowDecimals="true" decimalPrecision="6"/>
                    <a:numberField id="rateDs_grid_editor_nf_integer" allowDecimals="false" allowNegative="false"/>
                    <a:comboBox id="rateDs_grid_editor_comb"/>
                    <a:checkBox id="rateDs_grid_editor_check"/>
                    <a:datePicker id="rateDs_grid_editor_dp"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>