<?xml version="1.0" encoding="UTF-8"?>
<!--
    $author:huangshengbo
    $date:2011/08/04
    $purpose:帐龄时段设置明细
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query defaultwhereclause="aging_bucket_id = ${/parameter/@aging_bucket_id}" model="fnd.FND1300.fnd_aging_buckets" rootpath="recordlist"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function backFunction(){
                $('fnd_aging_bucket_lines').close();
            }   
            function addFunction(ds,record,index){
                record.set('aging_bucket_id','${/parameter/@aging_bucket_id}');
            }   
            
            function saveFunction(){
            	$('fnd_aging_bucket_lines_result_ds').submit();
            }
            
            
            function deleteFunction(){
           		$('fnd_aging_bucket_lines_result_ds').remove();
           } 
            
           function fnd_1300_child_grid_add(){
                $('fnd_1300_child_grid').showEditorByRecord($('fnd_aging_bucket_lines_result_ds').create());
            }
            function fnd_1300_child_grid_clear(){
                $('fnd_1300_child_grid').clear();
            }
            function fnd_1300_child_grid_remove(){
                $('fnd_1300_child_grid').remove();
            }
            function fnd_1300_child_grid_submit() {
                var result_ds = $('fnd_aging_bucket_lines_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_aging_bucket_lines_query_ds">
                <a:datas dataSource="/model/recordlist"/>
                <a:fields>
                    <a:field name="aging_bucket_code" readOnly="true"/>
                    <a:field name="aging_bucket_name" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_aging_bucket_lines_result_ds" autoQuery="true" model="fnd.FND1300.fnd_aging_bucket_lines" notification="有数据没有保存" pageSize="15" queryUrl="${/request/@context_path}/autocrud/fnd.FND1300.fnd_aging_bucket_lines/query?aging_bucket_id=${/parameter/@aging_bucket_id}" selectable="true">
                <a:fields>
                    <a:field name="description" required="true"/>
                    <a:field name="days" required="true"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="addFunction"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="backFunction" text="HLS.EXIT"/>
                <a:gridButton click="fnd_1300_child_grid_add" text="HLS.NEW"/>
                <a:gridButton click="fnd_1300_child_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="deleteFunction" text="HLS.REMOVE"/>
                <a:gridButton click="saveFunction" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="120" title="FND_AGING_BUCKETS.AGING_PERIOD" width="600">
                <a:textField name="aging_bucket_code" bindTarget="fnd_aging_bucket_lines_query_ds" prompt="HLS.AGING_BUCKET_CODE" typeCase="upper"/>
                <a:textField name="aging_bucket_name" bindTarget="fnd_aging_bucket_lines_query_ds" prompt="HLS.AGING_BUCKET_NAME"/>
            </a:form>
            <a:grid id="fnd_1300_child_grid" bindTarget="fnd_aging_bucket_lines_result_ds" height="350" navBar="true" width="600">
                <a:columns>
                    <a:column name="description" align="left" editor="editor_ttf" prompt="ACP_INVOICE_REF_DIMENSION.DESCRIPTION" width="200"/>
                    <a:column name="days" align="right" editor="editor_nf" prompt="FND_AGING_BUCKET_LINES.DAYS" width="200"/>
                </a:columns>
                <a:editors>
                    <a:textField id="editor_ttf"/>
                    <a:numberField id="editor_nf"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>