<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng $
    $Date: 2010/11/15 07:47:05 $
    $Revision: 1.2 $
    $Purpose: 日历定义-规则
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure><![CDATA[     
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function ruleCreatePage_close() {
                $('fnd_calendar_rules_window').close();
            }
            
            function monthValidator(record, name, value) {
                if (value < 1 || value > 12) {
                    return '${l:FND_CALENDAR_RULES.MONTH_WRONG}';
                }
                return true;
            }
            
            function dayValidator(record, name, value) {
                if (value < 1 || value > 31) {
                    return '${l:FND_CALENDAR_RULES.DAY_EWRONG}';
                }
                return true;
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rule_type_ds" lookupCode="CALENDAR_RULE_TYPE"/>
            <a:dataSet id="ruleCreatePage_calendarDs" loadData="true" model="fnd.FND1060.fnd_calendar">
                <a:fields>
                    <a:field name="calendar_code" readOnly="true"/>
                    <a:field name="description" readOnly="true"/>
                    <a:field name="start_date" readOnly="true"/>
                    <a:field name="end_date" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="ruleCreateDs" autoQuery="true" model="fnd.FND1060.fnd_calendar_rules" queryUrl="${/request/@context_path}/autocrud/fnd.FND1060.fnd_calendar_rules/query?calendar_id=${/parameter/@calendar_id}" selectable="true">
                <a:fields>
                    <a:field name="calendar_id" defaultValue="${/parameter/@calendar_id}"/>
                    <a:field name="rule_type_display" displayField="code_value_name" options="rule_type_ds" required="true" returnField="rule_type" valueField="code_value"/>
                    <a:field name="year"/>
                    <a:field name="month" required="true" validator="monthValidator"/>
                    <a:field name="day" required="true" validator="dayValidator"/>
                    <a:field name="description" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="ruleCreatePage_close" text="HLS.CLOSE"/>
            </a:screenTopToolbar>
            <a:fieldSet column="2" title="FND_CALENDAR_RULES.CALENDAR_RULE_DEFINE">
                <a:textField name="calendar_code" bindTarget="ruleCreatePage_calendarDs"/>
                <a:textField name="description" bindTarget="ruleCreatePage_calendarDs"/>
                <a:datePicker name="start_date" bindTarget="ruleCreatePage_calendarDs"/>
                <a:datePicker name="end_date" bindTarget="ruleCreatePage_calendarDs"/>
            </a:fieldSet>
            <a:grid id="ruleCreateDs_grid" bindTarget="ruleCreateDs" height="300" navBar="true" width="600">
                <a:columns>
                    <a:column name="rule_type_display" sortable="true"/>
                    <a:column name="year" align="right" sortable="true"/>
                    <a:column name="month" align="right" sortable="true"/>
                    <a:column name="day" align="right" sortable="true"/>
                    <a:column name="description" sortable="true" width="150"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>