<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-9-12 下午04:17:21  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.enabled_flag=&apos;Y&apos;" fetchAll="true" model="rsc.RSC200.rsc_five_class_plan" rootPath="rsc501_five_class_plan_path"/>
    </a:init-procedure>
    <a:view package="leaf.ui.std" template="default">
        <a:link id="rsc501_fc_estimate_result_link" url="${/request/@context_path}/modules/rsc/RSC501/rsc_fc_estimate_result.lview"/>
        <script type="text/javascript"><![CDATA[
            function rsc501_fc_estimate_query() {
                $('rsc501_fc_estimate_ds').query();
            }
            
            function rsc501_fc_estimate_result_open(fc_estimate_id, five_class_plan) {
                new Leaf.Window({
                    id: 'rsc501_fc_estimate_result_window',
                    url: $('rsc501_fc_estimate_result_link').getUrl(),
                    params: {
                        fc_estimate_id: fc_estimate_id,
                        five_class_plan: five_class_plan
                    },
                    title: '${l:RSC501.ESTIMATE_DETAIL}',
                    fullScreen: true
                });
            }
            
            function rsc501_fc_estimate_grid_render(value, record, name) {
                if (!record.isNew) {
                    return '<a href="javascript:rsc501_fc_estimate_result_open(' + record.get('fc_estimate_id') + ',\'' + record.get('five_class_plan') + '\');">' + '${l:RSC501.ESTIMATE_DETAIL}' + '</a>';
                }
                return '';
            }
            
            function rsc501_fc_estimate_grid_editorFunc(record, name) {
                if (record.isNew) {
                    if (name == 'five_class_plan_name') {
                        return 'rsc501_fc_estimate_grid_cb';
                    } else if (name == 'internal_period_num') {
                        return 'rsc501_fc_estimate_grid_nf';
                    }
                }
                return '';
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rsc501_five_class_plan_ds">
                <a:datas dataSource="/model/rsc501_five_class_plan_path"/>
            </a:dataSet>
            <a:dataSet id="rsc501_fc_estimate_query_ds">
                <a:fields>
                    <a:field name="five_class_plan_name" displayField="description" options="rsc501_five_class_plan_ds" returnField="five_class_plan" valueField="five_class_plan"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="rsc501_fc_estimate_ds" autoPageSize="true" autoQuery="true" model="rsc.RSC501.rsc_fc_estimate" queryDataSet="rsc501_fc_estimate_query_ds" selectable="true">
                <a:fields>
                    <a:field name="estimate_num" required="true"/>
                    <a:field name="internal_period_num" required="true"/>
                    <a:field name="five_class_plan_name" displayField="description" options="rsc501_five_class_plan_ds" required="true" returnField="five_class_plan" valueField="five_class_plan"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="rsc501_fc_estimate_query" text="HLS.QUERY"/>
                <a:gridButton bind="rsc501_fc_estimate_grid" type="add"/>
                <!-- <a:gridButton bind="rsc501_fc_estimate_grid" type="delete"/> -->
                <a:gridButton bind="rsc501_fc_estimate_grid" type="save"/>
            </a:screenTopToolbar>
            <a:form column="3" labelSeparator=" " labelWidth="100">
                <a:textField name="estimate_num" bindTarget="rsc501_fc_estimate_query_ds" prompt="RSC501.ESTIMATE_NUM" typeCase="upper"/>
                <a:comboBox name="five_class_plan_name" bindTarget="rsc501_fc_estimate_query_ds" prompt="RSC501.FIVE_CLASS_PLAN_NAME"/>
                <a:numberField name="internal_period_num" allowDecimals="false" allowNegative="false" bindTarget="rsc501_fc_estimate_query_ds" prompt="RSC501.INTERNAL_PERIOD_NUM"/>
            </a:form>
            <a:grid id="rsc501_fc_estimate_grid" bindTarget="rsc501_fc_estimate_ds" marginHeight="120" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="estimate_num" editor="rsc501_fc_estimate_grid_tf_upper" prompt="RSC501.ESTIMATE_NUM" width="120"/>
                    <a:column name="five_class_plan_name" editorFunction="rsc501_fc_estimate_grid_editorFunc" prompt="RSC501.FIVE_CLASS_PLAN_NAME" width="220"/>
                    <a:column name="internal_period_num" editorFunction="rsc501_fc_estimate_grid_editorFunc" prompt="RSC501.INTERNAL_PERIOD_NUM" width="120"/>
                    <a:column name="description" editor="rsc501_fc_estimate_grid_tf" prompt="RSC501.DESCRIPTION" width="280"/>
                    <a:column name="detail" align="center" prompt="RSC501.ESTIMATE_DETAIL" renderer="rsc501_fc_estimate_grid_render" width="100"/>
                </a:columns>
                <a:editors>
                    <a:textField id="rsc501_fc_estimate_grid_tf_upper" typeCase="upper"/>
                    <a:textField id="rsc501_fc_estimate_grid_tf"/>
                    <a:comboBox id="rsc501_fc_estimate_grid_cb"/>
                    <a:numberField id="rsc501_fc_estimate_grid_nf" allowDecimals="false" allowNegative="false"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>