<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/22 01:49:40 $
    $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>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryUomPrecision() {
                $('fnd_uom_precision_result_ds').query();
            }
            
            function resetUomPrecision() {
                $('fnd_uom_precision_query_ds').reset();
            }
            
            function fnd_1050_grid_add() {
                $('fnd_uom_precision_grid').showEditorByRecord($('fnd_uom_precision_result_ds').create());
            }
            
            function fnd_1050_grid_clear() {
                $('fnd_uom_precision_grid').clear();
            }
            
            function fnd_1050_grid_remove() {
                $('fnd_uom_precision_grid').remove();
            }
            
            function fnd_1050_grid_submit() {
                var result_ds = $('fnd_uom_precision_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function fnd_1050_next() {
                history.go(1);
            }
            
            function fnd_1050_back() {
                history.go(-1);
            }
            
            function fnd_1050_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
            }
            
            function changePrecision(com, value, oldValue) {
                if (value < oldValue) {
                    Leaf.showInfoMessage('${l:PROMPT}', '${l:FND_UOM_PRECISION.MESSAGE_INFO}', function() {
                        com.setValue(oldValue);
                    }, 250, 100);
                }
            }
            
            function validatePrecision(record, name, value) {
                if (value < record.get('precision_old')) {
                    return '${l:FND_UOM_PRECISION.CHECK1}';
                } else {
                    return true;
                }
            }
            
            function submitSuccess() {
                queryUomPrecision();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_uom_precision_query_ds" autoCreate="true" model="fnd.FND1050.fnd_uom_precision">
                <a:fields>
                    <a:field name="uom_code"/>
                    <a:field name="uom_name"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_uom_precision_result_ds" autoQuery="true" model="fnd.FND1050.fnd_uom_precision" pageSize="15" queryDataSet="fnd_uom_precision_query_ds" selectable="true">
                <a:fields>
                    <a:field name="uom_code" lovGridHeight="300" lovHeight="460" lovService="fnd.FND1050.fnd_uom_codes_precision_lov" lovWidth="500" required="true" title="FND_UOM_CODES.UOM_CODE">
                        <a:mapping>
                            <a:map from="uom_code" to="uom_code"/>
                            <a:map from="uom_name" to="uom_name"/>
                            <a:map from="description_id" to="description_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="precision" required="true" validator="validatePrecision"/>
                    <a:field name="precision_old"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submitSuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="fnd_1050_back" text="HLS.BACK"/>
                <a:gridButton click="fnd_1050_next" text="HLS.FORWARD"/>
                <a:gridButton click="fnd_1050_quit" text="HLS.EXIT"/>
                <a:gridButton click="fnd_1050_grid_add" text="HLS.NEW"/>
                <a:gridButton click="fnd_1050_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="fnd_1050_grid_remove" text="HLS.REMOVE"/>
                <a:gridButton click="fnd_1050_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="queryUomPrecision" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="100" title="HLS.QUERY_TITLE">
                <a:textField name="uom_code" bindTarget="fnd_uom_precision_query_ds" prompt="FND_UOM_CODES.UOM_CODE" typeCase="UPPER">
                    <a:events>
                        <a:event name="enterdown" handler="queryUomPrecision"/>
                    </a:events>
                </a:textField>
                <a:textField name="uom_name" bindTarget="fnd_uom_precision_query_ds" prompt="FND_UOM_CODES.DESCRIPTION">
                    <a:events>
                        <a:event name="enterdown" handler="queryUomPrecision"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="fnd_uom_precision_grid" bindTarget="fnd_uom_precision_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="uom_code" align="center" editor="fnd_uom_code_lov" sortable="true" width="150"/>
                    <a:column name="uom_name" align="left" prompt="FND_UOM_CODES.DESCRIPTION" sortable="true" width="200"/>
                    <a:column name="precision" align="right" editor="fnd_uom_precision_number" sortable="true" width="200"/>
                </a:columns>
                <a:editors>
                    <a:lov id="fnd_uom_code_lov"/>
                    <a:numberField id="fnd_uom_precision_number" allowDecimals="false" allowNegative="false"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        ]]></script>
    </a:view>
</a:screen>