<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: copy from HLS500N by zhangyu  
    $Date: 2016-10-17 上午9:49:14  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="currency"/>
        <a:model-query defaultWhereClause="t1.price_list=${/session/@price_list}" fetchAll="true" model="hls.HLS050.hls_price_list_for_lov" rootPath="default_price_list_path"/>
        <a:model-query defaultWhereClause="t1.currency_code=&apos;CNY&apos;" fetchAll="true" model="gld.gld_currency_vl" rootPath="default_currency"/>
    </a:init-procedure>
    <a:view>
        <a:link id="hls_fin_calculator_id" url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_n.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls_hls500_confirm() {
                $('hls_hls500_confirm_id').disable();
                if (!$('hls_fin_calc_list_head_ds').validate()) {
                    $('hls_hls500_confirm_id').enable();
                    return;
                }
                var record = $('hls_fin_calc_list_head_ds').getAt(0);
                var url = $('hls_fin_calculator_id').getUrl() + '?price_list=' + record.get('price_list') + '&currency=' + record.get('currency_code') + '&precision=' + record.get('precision') + '&calc_method=' + record.get('calc_method');
                window.location.href = url;
            }
            Leaf.onReady(function() {
                document.onkeydown = function(event) {
                    var e = event || window.event || arguments.callee.caller.arguments[0];
                    if (e && e.keyCode == 13) { // enter 键
                        hls_hls500_confirm();
                    }
                };
            });
        ]]></script>
        <a:dataSets>
            <a:dataSet id="currency_ds">
                <a:datas dataSource="/model/currency"/>
            </a:dataSet>
            <a:dataSet id="hls_fin_calc_list_head_ds" autoCreate="true">
                <a:fields>
                    <a:field name="currency_code" defaultValue="${/model/default_currency/record/@currency_code}"/>
                    <a:field name="currency_name" defaultValue="${/model/default_currency/record/@currency_name}" displayField="currency_name" options="currency_ds" required="true" returnField="currency_code" valueField="currency_code">
                        <a:mapping>
                            <a:map from="precision" to="precision"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="precision" defaultValue="${/model/default_currency/record/@precision}"/>
                    <a:field name="price_list_name" autoComplete="true" defaultValue="${/model/default_price_list_path/record/@description}" fetchSingle="true" lovGridHeight="350" lovHeight="500" lovService="hls.HLS050.hls_price_list_for_lov" lovWidth="500" required="true" title="HLS.PRICE_LIST">
                        <a:mapping>
                            <a:map from="price_list" to="price_list"/>
                            <a:map from="description" to="price_list_name"/>
                            <a:map from="calc_method" to="calc_method"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="calc_method" defaultValue="${/model/default_price_list_path/record/@calc_method}"/>
                    <a:field name="price_list" autoComplete="true" defaultValue="${/model/default_price_list_path/record/@price_list}" fetchSingle="true" lovGridHeight="350" lovHeight="500" lovService="hls.HLS050.hn_hls_price_list_for_lov" lovWidth="500" required="true" title="HLS.PRICE_LIST">
                        <a:mapping>
                            <a:map from="price_list" to="price_list"/>
                            <a:map from="description" to="price_list_name"/>
                            <a:map from="calc_method" to="calc_method"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton id="hls_hls500_confirm_id" click="hls_hls500_confirm" text="HLS.CONFIRM"/>
            </a:screenTopToolbar>
            <a:form title="HLS.FIN_CALCULATOR" width="350">
                <a:lov name="price_list" bindTarget="hls_fin_calc_list_head_ds" prompt="HLS.PRICE_LIST_CODE" width="220"/>
                <a:lov name="price_list_name" bindTarget="hls_fin_calc_list_head_ds" prompt="HLS.PRICE_LIST_NAME" width="220"/>
                <a:comboBox name="currency_name" bindTarget="hls_fin_calc_list_head_ds" prompt="HLS.CURRENCY" width="220"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
