<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: zhangyi2652 $ $Date: 2010/11/01 01:43:06 $ $Revision: 1.2 $ $Purpose: “科目层次定义”模块中,grid中的“子科目”页面 --> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:init-procedure> <a:model-query autoCount="false" fetchAll="true" model="gld.gld_account_set_sub_fieldset" rootPath="fieldset"/> </a:init-procedure> <a:view> <a:screen-include screen="modules/hls/hls_common_javascript.lview"/> <a:link id="gld_account_hierarchy_tree_link" url="${/request/@context_path}/modules/gld/public/gld_account_hierarchy_tree.lview"/> <a:link id="gld_account_hierarchy_details_arrange_link" model="db.gld_account_pkg.refresh_account_hierarchy" modelaction="execute"/> <script type="text/javascript"><![CDATA[ function saveFuncgtion() { var ds=$('hierarchyDetailDs'); var new_records = ds.getNewRecords(); var all_records = ds.getAll(); var p_error = 0; var v_error = 0; if (new_records.length > 0) { for (var i = 0;i < new_records.length;i++) { var new_from = new_records[i].get('from_account_code'); var new_to = new_records[i].get('to_account_code'); if (parseInt(new_from) > parseInt(new_to)) { Leaf.showInfoMessage('${l:PROMPT}', '${l:GLD_ACCOUNT_CODE.VERIFIED}'); } else { for (var j = 0;j < all_records.length;j++) { if (all_records[j].isNew == false) { var old_from = all_records[i].get('from_account_code'); var old_to = all_records[i].get('to_account_code'); if (parseInt(new_to) < parseInt(old_from) || parseInt(new_from) < parseInt(old_from)) { p_error = p_error + 1; } else if ((parseInt(old_from) < parseInt(new_to) && parseInt(new_to) < parseInt(old_to)) || (parseInt(old_from) < parseInt(new_from) && parseInt(new_from) < parseInt(old_to))) { v_error = v_error + 1; } } } } } } else { for (var i = 0;i < all_records.length;i++) { if (all_records[i].dirty == true) { var new_from = all_records[i].get('from_account_code'); var new_to = all_records[i].get('to_account_code'); for (var j = 0;j < all_records.length;j++) { if (all_records[j].dirty == false) { var old_from = all_records[j].get('from_account_code'); var old_to = all_records[j].get('to_account_code'); if (parseInt(new_to) < parseInt(old_from) || parseInt(new_from) < parseInt(old_from)) { p_error = p_error + 1; } else if ((parseInt(old_from) < parseInt(new_to) && parseInt(new_to) < parseInt(old_to)) || (parseInt(old_from) < parseInt(new_from) && parseInt(new_from) < parseInt(old_to))) { v_error = v_error + 1; } } } } } } if (p_error > 0) { Leaf.showInfoMessage('${l:PROMPT}', '${l:GLD_ACCOUNT_CODE.INTERVAL}'); } else if (v_error > 0) { Leaf.showInfoMessage('${l:PROMPT}', '${l:GLD_ACCOUNT_CODE.OVERLAPPING}'); } else { for (var i = 0;i < all_records.length;i++) { var old_from = all_records[i].get('from_account_code'); var old_to = all_records[i].get('to_account_code'); } if (parseInt(old_from) > parseInt(old_to)) { Leaf.showInfoMessage('${l:PROMPT}', '${l:GLD_ACCOUNT_CODE.VERIFIED}'); } else { $('hierarchyDetailDs').submit(); } } } function hierarchyArrange() { var ds = $('head_hierarchyDetailDs'); var record = ds.getCurrentRecord(); Leaf.request({ url: $('gld_account_hierarchy_details_arrange_link').getUrl(), para: record.data, success: function() { Leaf.showMessage('${l:PROMPT}', '${l:FND_DIMENSION_VALUES.OPR_SUC}'); }, scope: this }); } function viewTree() { new Leaf.Window({ id: 'tree_window', url: $('gld_account_hierarchy_tree_link').getUrl(), params:{ // account_set_id:'${/model/fieldset/record/@account_set_id}' account_set_id:'${/parameter/@account_set_id}' }, title: '${l:FND_COMPANY_HIERARCHY.VIEW_HIERARCHY}', height: 570, width: 550 }); } function setinitdata(ds, record, index) { record.set('account_set_id', '${/parameter/@account_set_id}'); record.set('parent_account_id', '${/parameter/@account_id}'); } function gld_public_account_tetails_grid_add(){ $('hierarchyDetailDs_grid').showEditorByRecord($('hierarchyDetailDs').create()); } function gld_public_account_tetails_grid_clear(){ $('hierarchyDetailDs_grid').clear(); } function gld_public_account_tetails_grid_remove(){ $('hierarchyDetailDs_grid').remove(); } function gld_public_account_tetails_grid_submit() { var result_ds = $('hierarchyDetailDs'); if (result_ds.validate()) { result_ds.submit(); } } ]]></script> <a:dataSets> <a:dataSet id="head_hierarchyDetailDs" model="gld.gld_account_set_sub_fieldset"> <a:datas dataSource="/model/fieldset"/> </a:dataSet> <a:dataSet id="hierarchyDetailDs" autoCount="true" autoQuery="true" fetchAll="false" model="gld.gld_account_hierarchy" notification="有数据没有保存" queryDataSet="head_hierarchyDetailDs" queryUrl="${/request/@context_path}/autocrud/gld.gld_account_hierarchy/query?ORDER_FIELD=sub_account_code&parent_account_id=${/parameter/@account_id}" selectable="true"> <a:fields> <a:field name="account_set_id" defaultValue="${/parameter/@account_set_id}"/> <a:field name="parent_account_id" defaultValue="${/parameter/@account_id}"/> <a:field name="sub_account_code" validator="hlsCommon_validateCode"/> <a:field name="from_account_code" validator="hlsCommon_validateCode"/> <a:field name="to_account_code" validator="hlsCommon_validateCode"/> </a:fields> <a:events> <a:event name="add" handler="setinitdata"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:gridButton click="gld_public_account_tetails_grid_add" text="HLS.NEW"/> <a:gridButton click="gld_public_account_tetails_grid_remove" text="HLS.REMOVE"/> <a:gridButton click="gld_public_account_tetails_grid_clear" text="HLS.CLEAR"/> <a:gridButton click="saveFuncgtion" text="HLS.SAVE"/> <a:gridButton click="viewTree" text="FND_COMPANY_HIERARCHY.VIEW_HIERARCHY"/> <a:gridButton click="hierarchyArrange" text="REGULATE_HIERARCHY"/> </a:screenTopToolbar> <a:fieldSet column="2" width="552"> <a:textField name="account_set_code" bindTarget="head_hierarchyDetailDs" prompt="GLD_ACCOUNT_SETS.ACCOUNT_CODE" readOnly="true"/> <a:textField name="account_set_name" bindTarget="head_hierarchyDetailDs" readOnly="true"/> <a:textField name="account_code" bindTarget="head_hierarchyDetailDs" prompt="GLD_ACCOUNTS.ACCOUNT_CODE" readOnly="true"/> <a:textField name="account_description" bindTarget="head_hierarchyDetailDs" prompt="FND_CALENDAR.DESCRIPTION" readOnly="true"/> </a:fieldSet> <a:grid id="hierarchyDetailDs_grid" bindTarget="hierarchyDetailDs" height="330" navBar="true" width="550"> <a:columns> <a:column name="sub_account_code" align="center" editor="hierarchyDetailDs_grid_tf_upper" prompt="GLD_ACCOUNTS.ACCOUNT_CODE" width="200"/> <a:column name="from_account_code" align="center" editor="hierarchyDetailDs_grid_tf" prompt="GLD_ACCOUNT_SETS.ACCOUNT_CODE_FROM" width="150"/> <a:column name="to_account_code" align="center" editor="hierarchyDetailDs_grid_tf" prompt="GLD_ACCOUNT_SETS.ACCOUNT_CODE_TO" width="150"/> </a:columns> <a:editors> <a:textField id="hierarchyDetailDs_grid_tf" typeCase="upper"/> <a:textField id="hierarchyDetailDs_grid_tf_upper" typeCase="upper"/> </a:editors> </a:grid> </a:screenBody> </a:view> </a:screen>