<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:47:04 $
    $Revision: 1.3 $
    $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 weekdayPage_close() {
                $('fnd_weekday_rules_window').close();
            }
            function weekdayPage_save()
            {
                var ds = $('fnd_weekday_rules_ds');
                if (ds.validate()) {
                    ds.submit();
                }
            }
            
            function rateOfUsageEditor(record, name){
                if(record.get('business_day_flag') == 'Y'){
                    return 'rate_of_usage_grid_numberField';
                }else{
                    return '';
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="weekday_desc_ds" lookupCode="WEEKDAY"/>
            <a:dataSet id="fnd_calendar_info_ds" 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="fnd_weekday_rules_ds" autoQuery="true" fetchAll="false" model="fnd.fnd_weekday_rules" queryUrl="${/request/@context_path}/autocrud/fnd.fnd_weekday_rules/query?ORDER_FIELD=weekday_number&amp;calendar_id=${/parameter/@calendar_id}" selectable="true">
                <a:fields>
                    <a:field name="calendar_id" defaultValue="${/parameter/@calendar_id}"/>
                    <a:field name="weekday_display" displayField="code_value_name" options="weekday_desc_ds" returnField="weekday" valueField="code_value"/>
                    <a:field name="business_day_flag" checkedValue="Y" uncheckedValue="N"/>
                    <a:field name="rate_of_usage" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="weekdayPage_close" text="HLS.CLOSE"/>
                <a:gridButton click="weekdayPage_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:fieldSet column="2" labelWidth="120" title="FND_WEEKDAY_RULES.WORKDAY_DEFINE">
                <a:textField name="calendar_code" bindTarget="fnd_calendar_info_ds"/>
                <a:textField name="description" bindTarget="fnd_calendar_info_ds"/>
                <a:datePicker name="start_date" bindTarget="fnd_calendar_info_ds"/>
                <a:datePicker name="end_date" bindTarget="fnd_calendar_info_ds"/>
            </a:fieldSet>
            <a:grid id="fnd_weekday_rules_grid" bindTarget="fnd_weekday_rules_ds" height="300" navBar="true" width="600">
                <a:columns>
                    <a:column name="weekday_display" width="180"/>
                    <a:column name="business_day_flag" editor="fnd_business_day_cb" sortable="true" width="150"/>
                    <!-- <a:column name="rate_of_usage" editorFunction="rateOfUsageEditor" sortable="true" width="200"/> -->
                </a:columns>
                <a:editors>
                    <a:checkBox id="fnd_business_day_cb"/>
                    <a:numberField id="rate_of_usage_grid_numberField"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>