fnd_dimensions.lview 11.1 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <div/>
        <script type="text/javascript"><![CDATA[
            
            function queryFndDimensions(){
                $('fnd_dimension_result_ds').query();
            }
            
            function resetFndDimensions(){
                $('fnd_dimension_query_ds').reset();
            }
            
            function sequenceValidator(record, name ,value){
                var dimensionSequence=record.get('dimension_sequence');
                if (record.isNew){
                    if (!(dimensionSequence>=2 && dimensionSequence<=10)){
                        Leaf.showErrorMessage( '${l:PROMPT.ERROR}', '${l:USER_DEFINED_DIMENSIONS_ERROR}');
                        return false;
                    }
                }
                return true;
            }

            function enableValidator(record ,name,value){
                if (name=='enabled_flag' || name=='system_level'|| name=='company_level'){
                    var enableFlag=record.get('enabled_flag');
                    var systemLevel=record.get('system_level');
                    var companyLevel=record.get('company_level');
                    if (enableFlag=="Y" && systemLevel=="N" && companyLevel=="N"){
                        Leaf.showErrorMessage( '${l:PROMPT.ERROR}', '${l:ENABLED_DIMENSION_ERROR}');
                        return false;
                    }
                }
                return true;
            }

            function dimensionSquenceEdit(record , name){
                var dimensionSequence=record.get('dimension_sequence');
                if (!record.isNew && ( dimensionSequence>=11 && dimensionSequence<=15)){
                    return '';
                }
                return 'dimension_sequence_tf';
            }
            
            function dimensionCodeEdit(record , name){
                if (!record.isNew){
                    return '';
                }
                return 'dimension_code_tf_upper';
            }
            function dimensionSequenceEdit(record , name){
                if (!record.isNew){
                    return '';
                }
                return 'dimension_sequence_tf';
            }
            function descriptionEdit(record, name){
                var dimensionSequence=record.get('dimension_sequence');
                if (!record.isNew && ( dimensionSequence>=11 && dimensionSequence<=15)){
                    return '';
                }
                return 'description_tf';
            }
            
            function sysLevelEdit(record, name){
                var dimensionSequence=record.get('dimension_sequence');
                if (!record.isNew && ( dimensionSequence>=11 && dimensionSequence<=15)){
                    return '';
                }
                return 'system_level_cb';
            }

            
            
            function enbFlagFunction(record,name){
                var dimensionSequence=record.get('dimension_sequence');
                if (!record.isNew && ( dimensionSequence>=11 && dimensionSequence<=15)){
                    return '';
                }
                return 'enabled_flag_cb';
            }
            
            function updateFunction(dataSet,record,name,value,oldValue){
                if(!record.isNew){                  
                    if(name == 'company_level' && value != oldValue){
                        if(record.get('value_exist_flag') != '0'){
                            record.data['company_level'] = oldValue;
                            Leaf.showInfoMessage('${l:PROMPT}','${l:DIMENSION_VALUE_EXIST_WARNING}',null,250,100);
                        }
                    }
                    if(name == 'system_level' && value != oldValue){
                        if(record.get('value_exist_flag') != '0'){
                            record.data['system_level'] = oldValue;
                            Leaf.showInfoMessage('${l:PROMPT}','${l:DIMENSION_VALUE_EXIST_WARNING}',null,250,100);
                        }
                    }
                }
            }
            
            function saveDimensions(){
                var records=$('fnd_dimension_result_ds').getAll();
                for(var i=0;i<records.length;i++){
                    var record=records[i];
                    var enableFlag=record.get('enabled_flag');
                    var systemLevel=record.get('system_level');
                    var companyLevel=record.get('company_level');
                    if (enableFlag=="Y" && systemLevel=="N" && companyLevel=="N"){
                        Leaf.showErrorMessage( '${l:PROMPT.ERROR}', '${l:ENABLED_DIMENSION_ERROR}');
                        return false;
                    }
                }
                $('fnd_dimension_result_ds').submit();
            }
            
            
                    	function fnd_2210_grid_add(){
                $('fnd_dimensions_grid').showEditorByRecord($('fnd_dimension_result_ds').create());
            }
            function fnd_2210_grid_clear(){
                $('fnd_dimensions_grid').clear();
            }
            function fnd_2210_next(){
                 history.go(1);
            }
            function fnd_2210_back(){
                history.go(-1);
            }
            function fnd_2210_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_dimension_query_ds" model="fnd.FND2210.fnd_dimensions">
                <a:fields>
                    <a:field name="dimension_code"/>
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_dimension_result_ds" autoQuery="true" model="fnd.FND2210.fnd_dimensions_value_flag" pageSize="15" queryDataSet="fnd_dimension_query_ds" queryUrl="${/request/@context_path}/autocrud/fnd.FND2210.fnd_dimensions_value_flag/query?ORDER_FIELD=dimension_sequence" selectable="true" submitUrl="${/request/@context_path}/autocrud/fnd.FND2210.fnd_dimensions_operation/batch_update">
                <a:fields>
                    <a:field name="dimension_sequence" required="true" validator="sequenceValidator"/>
                    <a:field name="dimension_code" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="system_level" checkedValue="Y" defaultValue="N" uncheckedValue="N" validator="enableValidator"/>
                    <a:field name="company_level" checkedValue="Y" defaultValue="N" uncheckedValue="N" validator="enableValidator"/>
                    <a:field name="system_flag" checkedValue="Y" defaultValue="N" prompt="FND_DIMENSION.SYS_PRESET" uncheckedValue="N"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N" validator="enableValidator"/>
                    <a:field name="value_exist_flag"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="updateFunction"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="fnd_2210_back" height="20" icon="${/request/@context_path}/images/back.png" iconAlign="left" text="HLS.BACK" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="fnd_2210_next" height="20" icon="${/request/@context_path}/images/forward.png" iconAlign="left" text="HLS.FORWARD" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="fnd_2210_grid_add" height="20" icon="${/request/@context_path}/images/add.png" iconAlign="left" text="HLS.NEW" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="fnd_2210_grid_clear" height="20" icon="${/request/@context_path}/images/clear.png" iconAlign="left" text="HLS.CLEAR" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="saveDimensions" height="20" icon="${/request/@context_path}/images/save.png" iconAlign="left" text="HLS.SAVE" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="fnd_2210_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="HLS.EXIT" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="queryFndDimensions" height="20" icon="${/request/@context_path}/images/search.png" iconAlign="left" text="HLS.QUERY" width="50"/>
                <a:separator style="margin-left:3px;"/>
            </a:screenTopToolbar>
            <a:form row="1" title="FND_DIMENSIONS.QUERY" width="600">
                <a:textField name="dimension_code" bindTarget="fnd_dimension_query_ds" prompt="FND_DIMENSIONS.DIMENSION_CODE" typeCase="upper" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="queryFndDimensions"/>
                    </a:events>
                </a:textField>
                <a:textField name="description" bindTarget="fnd_dimension_query_ds" prompt="FND_DIMENSIONS.DESCRIPTION" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="queryFndDimensions"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="fnd_dimensions_grid" bindTarget="fnd_dimension_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="dimension_sequence" align="right" editorFunction="dimensionSequenceEdit" sortable="true"/>
                    <a:column name="dimension_code" align="center" editorFunction="dimensionCodeEdit" sortable="true" width="150"/>
                    <a:column name="description" align="center" editorFunction="descriptionEdit" sortable="true"/>
                    <a:column name="system_level" align="center" editorFunction="sysLevelEdit" sortable="true"/>
                    <a:column name="company_level" align="center" editorFunction="sysLevelEdit" sortable="true"/>
                    <a:column name="system_flag" align="center" sortable="true"/>
                    <a:column name="enabled_flag" align="center" editorFunction="enbFlagFunction" sortable="true"/>
                </a:columns>
                <a:editors>
                    <a:textField id="dimension_sequence_tf"/>
                    <a:textField id="dimension_code_tf_upper" typeCase="upper"/>
                    <a:textField id="description_tf"/>
                    <a:checkBox id="system_level_cb"/>
                    <a:checkBox id="company_level_cb"/>
                    <a:checkBox id="system_flag_cb"/>
                    <a:checkBox id="enabled_flag_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>