Commit 0f39b775 authored by 王炜's avatar 王炜

10-25日修正租金计算器页面无法加载-起租日逻辑bug

parent 6b949168
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
$Author: gaoyang $Author: gaoyang
$Date: 2013-8-9 下午03:55:25 $Date: 2013-8-9 下午03:55:25
$Revision: 1.0 $Revision: 1.0
$Purpose: $Purpose:
--> -->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true"> <a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure> <a:init-procedure>
...@@ -17,352 +17,352 @@ ...@@ -17,352 +17,352 @@
<a:link id="hls_fin_calc_get_base_rate_link_id" model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/> <a:link id="hls_fin_calc_get_base_rate_link_id" model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/>
<a:link id="get_exchange_rate_link_id" model="basic.hls_get_exchange_rate" modelaction="update"/> <a:link id="get_exchange_rate_link_id" model="basic.hls_get_exchange_rate" modelaction="update"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
var new_calc_flag = 'N'; var new_calc_flag = 'N';
var body_winId = '${/parameter/@winId}', var body_winId = '${/parameter/@winId}',
body = body_winId == '' ? Ext.getBody() : $(body_winId).wrap; body = body_winId == '' ? Ext.getBody() : $(body_winId).wrap;
function lock_calc_current_window(msg) { function lock_calc_current_window(msg) {
Leaf.Masker.mask(body, msg || '${l:HLS.EXECUTING}'); Leaf.Masker.mask(body, msg || '${l:HLS.EXECUTING}');
} }
function unlock_calc_current_window() { function unlock_calc_current_window() {
Leaf.Masker.unmask(body); Leaf.Masker.unmask(body);
} }
function get_warning_message(msg) { function get_warning_message(msg) {
var warning_message, duration; var warning_message, duration;
if (msg) { if (msg) {
warning_message = msg; warning_message = msg;
warning_message = '<font color="red">'+warning_message + '</font>'; warning_message = '<font color="red">'+warning_message + '</font>';
duration = 8000; duration = 8000;
} else { } else {
warning_message = '${l:HLS.SUBMIT_SUCCESS}'; warning_message = '${l:HLS.SUBMIT_SUCCESS}';
duration = 2000; duration = 2000;
} }
parent.Leaf.SideBar.enable = true; parent.Leaf.SideBar.enable = true;
parent.Leaf.SideBar.show({ parent.Leaf.SideBar.show({
html: '<div style="background-color:#ccfbd5;position:absolute;padding-top:5px;padding-bottom:5px;padding-left:20px;padding-right:20px;border:0px solid #009900"><b>'+warning_message+'</b></div>', html: '<div style="background-color:#ccfbd5;position:absolute;padding-top:5px;padding-bottom:5px;padding-left:20px;padding-right:20px;border:0px solid #009900"><b>'+warning_message+'</b></div>',
duration: duration duration: duration
}); });
} }
function set_field_limit(config_record, field) { function set_field_limit(config_record, field) {
// if (config_record.get('lower_limit') || config_record.get('upper_limit')) { // if (config_record.get('lower_limit') || config_record.get('upper_limit')) {
// field.setPropertity('min', config_record.get('lower_limit')); // field.setPropertity('min', config_record.get('lower_limit'));
// field.setPropertity('max', config_record.get('upper_limit')); // field.setPropertity('max', config_record.get('upper_limit'));
// } // }
} }
function set_field_input_mode(record, field, name, input_mode) { function set_field_input_mode(record, field, name, input_mode) {
var current_value = record.get(name); var current_value = record.get(name);
if (input_mode == 'REQUIRED' || (input_mode == 'REQUIRED_ONLY_NOT_NULL' && !Ext.isEmpty(current_value)) || (input_mode == 'REQUIRED_ONLY_NULL' && Ext.isEmpty(current_value))) { if (input_mode == 'REQUIRED' || (input_mode == 'REQUIRED_ONLY_NOT_NULL' && !Ext.isEmpty(current_value)) || (input_mode == 'REQUIRED_ONLY_NULL' && Ext.isEmpty(current_value))) {
field.setRequired(true); field.setRequired(true);
field.setReadOnly(false); field.setReadOnly(false);
} else if (input_mode == 'OPTION' || (input_mode == 'OPTION_ONLY_NOT_NULL' && !Ext.isEmpty(current_value)) || (input_mode == 'OPTION_ONLY_NULL' && Ext.isEmpty(current_value))) { } else if (input_mode == 'OPTION' || (input_mode == 'OPTION_ONLY_NOT_NULL' && !Ext.isEmpty(current_value)) || (input_mode == 'OPTION_ONLY_NULL' && Ext.isEmpty(current_value))) {
field.setRequired(false); field.setRequired(false);
field.setReadOnly(false); field.setReadOnly(false);
} else { } else {
field.setReadOnly(true); field.setReadOnly(true);
}
}
function get_config_column_name(name) {
var query_name, length = name.length;
if (name.substring(length - 2, length) == '_n') {
query_name = name.substring(0, length - 2);
} else {
query_name = name;
}
return query_name;
} }
}
function success_sidebar_show() {
Leaf.SideBar.show({ function get_config_column_name(name) {
msg: '${l:HLS.SUBMIT_SUCCESS}', var query_name, length = name.length;
duration: 2000 if (name.substring(length - 2, length) == '_n') {
}); query_name = name.substring(0, length - 2);
} else {
query_name = name;
}
return query_name;
}
function success_sidebar_show() {
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
}
function get_ds_record(ds1, ds2, name) {
return ds1.find('column_name', name) || ds2.find('column_name', name);
}
function from_load_or_update_set(record, fromLoad, name, value) {
if (record.get('percent') == '%' && record.get('validation_type') == 'NUMBERFIELD') {
value = mul(value, 100);
} }
if (fromLoad) {
function get_ds_record(ds1, ds2, name) { record.data[name] = value;
return ds1.find('column_name', name) || ds2.find('column_name', name); } else {
record.set(name, value);
} }
}
function from_load_or_update_set(record, fromLoad, name, value) {
if (record.get('percent') == '%' && record.get('validation_type') == 'NUMBERFIELD') { function get_record_column_value(record) {
value = mul(value, 100); if (record) {
} if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV')) {
if (fromLoad) { return record.get('column_value_c');
record.data[name] = value;
} else { } else {
record.set(name, value); return record.get('column_value');
} }
} else {
return null;
} }
}
function get_record_column_value(record) {
if (record) { function get_data_column_value(record) {
if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV')) { if (record.data) {
return record.get('column_value_c'); if (record.data['lov_return_vcode'] == 'N' && (record.data['validation_type'] == 'COMBOBOX' || record.data['validation_type'] == 'LOV')) {
} else { return record.data['column_value_c'];
return record.get('column_value');
}
} else { } else {
return null; return record.data['column_value'];
} }
} else {
return null;
} }
}
function get_data_column_value(record) {
if (record.data) { function execute_hls_save_special_field(record, value, fromLoad, display_value) {
if (record.data['lov_return_vcode'] == 'N' && (record.data['validation_type'] == 'COMBOBOX' || record.data['validation_type'] == 'LOV')) { if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV')) {
return record.data['column_value_c']; from_load_or_update_set(record, fromLoad, 'column_value_c', value);
} else { if (!Ext.isEmpty(display_value)) {
return record.data['column_value']; from_load_or_update_set(record, fromLoad, 'column_value', display_value);
}
} else {
return null;
} }
} else {
from_load_or_update_set(record, fromLoad, 'column_value', value);
} }
}
function execute_hls_save_special_field(record, value, fromLoad, display_value) {
if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV')) { function data_or_record_set(record, name, value) {
from_load_or_update_set(record, fromLoad, 'column_value_c', value); if (record.set) {
if (!Ext.isEmpty(display_value)) { record.set(name, value);
from_load_or_update_set(record, fromLoad, 'column_value', display_value); } else {
} record.data[name] = value;
} else {
from_load_or_update_set(record, fromLoad, 'column_value', value);
}
} }
}
function data_or_record_set(record, name, value) {
if (record.set) { function get_hls_special_field(record, value, value_name) {
record.set(name, value); data_or_record_set(record, 'column_value_c', value);
} else { if (record.data['lov_return_vcode'] == 'N' && (record.data['validation_type'] == 'LOV' || record.data['validation_type'] == 'COMBOBOX')) {
record.data[name] = value; data_or_record_set(record, 'column_value', value_name);
} return value_name;
} else {
data_or_record_set(record, 'column_value', value);
return value;
}
}
function set_after_check_empty(record, old_value, value, fromLoad, display_value) {
if (Ext.isEmpty(old_value)) {
execute_hls_save_special_field(record, value, fromLoad, display_value);
} }
}
function get_hls_special_field(record, value, value_name) {
data_or_record_set(record, 'column_value_c', value); function special_editor_function(ds, record, name) {
if (record.data['lov_return_vcode'] == 'N' && (record.data['validation_type'] == 'LOV' || record.data['validation_type'] == 'COMBOBOX')) { var temp_hd_attribute_ds = $('temp_hd_attribute_ds'),
data_or_record_set(record, 'column_value', value_name); column_name = record.get('column_name'),
return value_name; exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type'),
exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate'),
currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency');
if (exchange_rate_type_record && exchange_rate_record && currency_record) {
var exchange_rate_type_field = exchange_rate_type_record.getField('column_value'),
exchange_rate_field = exchange_rate_record.getField('column_value');
var currency = get_record_column_value(currency_record),
exchange_rate_type = get_record_column_value(exchange_rate_type_record);
var rate_method_code_record = $('gld_exchage_rate_types_ds').find('type_code', exchange_rate_type);
var rate_method_code;
if (rate_method_code_record) {
rate_method_code = rate_method_code_record.get('rate_method_code');
}
if (currency == '${/model/doc_functional_currency_path/record/@functional_currency_code}') {
exchange_rate_type_field.setRequired(false);
exchange_rate_type_field.setReadOnly(true);
exchange_rate_field.setReadOnly(true);
exchange_rate_field.setRequired(false);
} else { } else {
data_or_record_set(record, 'column_value', value); exchange_rate_type_field.setRequired(true);
return value; exchange_rate_type_field.setReadOnly(false);
} if (check_rate_method_code(rate_method_code)) {
}
function set_after_check_empty(record, old_value, value, fromLoad, display_value) {
if (Ext.isEmpty(old_value)) {
execute_hls_save_special_field(record, value, fromLoad, display_value);
}
}
function special_editor_function(ds, record, name) {
var temp_hd_attribute_ds = $('temp_hd_attribute_ds'),
column_name = record.get('column_name'),
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type'),
exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate'),
currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency');
if (exchange_rate_type_record && exchange_rate_record && currency_record) {
var exchange_rate_type_field = exchange_rate_type_record.getField('column_value'),
exchange_rate_field = exchange_rate_record.getField('column_value');
var currency = get_record_column_value(currency_record),
exchange_rate_type = get_record_column_value(exchange_rate_type_record);
var rate_method_code_record = $('gld_exchage_rate_types_ds').find('type_code', exchange_rate_type);
var rate_method_code;
if (rate_method_code_record) {
rate_method_code = rate_method_code_record.get('rate_method_code');
}
if (currency == '${/model/doc_functional_currency_path/record/@functional_currency_code}') {
exchange_rate_type_field.setRequired(false);
exchange_rate_type_field.setReadOnly(true);
exchange_rate_field.setReadOnly(true); exchange_rate_field.setReadOnly(true);
exchange_rate_field.setRequired(false); exchange_rate_field.setRequired(false);
} else { } else {
exchange_rate_type_field.setRequired(true); exchange_rate_field.setRequired(true);
exchange_rate_type_field.setReadOnly(false); exchange_rate_field.setReadOnly(false);
if (check_rate_method_code(rate_method_code)) {
exchange_rate_field.setReadOnly(true);
exchange_rate_field.setRequired(false);
} else {
exchange_rate_field.setRequired(true);
exchange_rate_field.setReadOnly(false);
}
} }
} }
} }
}
function call_back_after_check_input_mode(ds, record, name, value, old_value, config_record, fromLine) {
var input_mode, lower_limit; function call_back_after_check_input_mode(ds, record, name, value, old_value, config_record, fromLine) {
if (fromLine) { var input_mode, lower_limit;
input_mode = config_record.get('input_mode'); if (fromLine) {
lower_limit = config_record.get('lower_limit'); input_mode = config_record.get('input_mode');
} else { lower_limit = config_record.get('lower_limit');
input_mode = record.get('input_mode'); } else {
lower_limit = record.get('lower_limit'); input_mode = record.get('input_mode');
} lower_limit = record.get('lower_limit');
if (Ext.isEmpty(value) && (input_mode == 'REQUIRED_ONLY_NOT_NULL' || input_mode == 'OPTION_ONLY_NOT_NULL')) { }
Leaf.SideBar.show({ if (Ext.isEmpty(value) && (input_mode == 'REQUIRED_ONLY_NOT_NULL' || input_mode == 'OPTION_ONLY_NOT_NULL')) {
html: '<div style="background-color:#ccfbd5;position:absolute;padding:3px;border:1px solid #009900;font-size:20px;">' + '${l:HLS500.FIELD_IS_NOT_NULL}' + '</div>', Leaf.SideBar.show({
duration: 2000 html: '<div style="background-color:#ccfbd5;position:absolute;padding:3px;border:1px solid #009900;font-size:20px;">' + '${l:HLS500.FIELD_IS_NOT_NULL}' + '</div>',
}); duration: 2000
setTimeout(function() { });
record.set(name, old_value); setTimeout(function() {
}, 5); record.set(name, old_value);
} }, 5);
} }
}
function create_record_column(temp_head_records, headRecord) {
for (var m = 0;m < temp_head_records.length;m++) { function create_record_column(temp_head_records, headRecord) {
var temp_head_record = temp_head_records[m]; for (var m = 0;m < temp_head_records.length;m++) {
var column_name = temp_head_record.get('column_name'), var temp_head_record = temp_head_records[m];
validation_type = temp_head_record.get('validation_type'), var column_name = temp_head_record.get('column_name'),
column_value_c = temp_head_record.get('column_value_c'), validation_type = temp_head_record.get('validation_type'),
column_value = temp_head_record.get('column_value'), column_value_c = temp_head_record.get('column_value_c'),
finnal_value = ''; column_value = temp_head_record.get('column_value'),
if (column_name == 'price_list') { finnal_value = '';
finnal_value = '${/parameter/@price_list}'; if (column_name == 'price_list') {
} finnal_value = '${/parameter/@price_list}';
if (column_name == 'currency') { }
finnal_value = '${/parameter/@currency}'; if (column_name == 'currency') {
} finnal_value = '${/parameter/@currency}';
if (column_name == 'currency_precision') { }
finnal_value = '${/parameter/@precision}'; if (column_name == 'currency_precision') {
} finnal_value = '${/parameter/@precision}';
if (!Ext.isEmpty(column_value) || !Ext.isEmpty(column_value_c)) { }
if (validation_type == 'DATEPICKER') { if (!Ext.isEmpty(column_value) || !Ext.isEmpty(column_value_c)) {
finnal_value = Leaf.formatDate(column_value); if (validation_type == 'DATEPICKER') {
} else if (temp_head_record.get('lov_return_vcode') == 'N' && (validation_type == 'COMBOBOX' || validation_type == 'LOV')) { finnal_value = Leaf.formatDate(column_value);
if (temp_head_record.get('percent') == '%') { } else if (temp_head_record.get('lov_return_vcode') == 'N' && (validation_type == 'COMBOBOX' || validation_type == 'LOV')) {
finnal_value = div(column_value_c, 100); if (temp_head_record.get('percent') == '%') {
} else { finnal_value = div(column_value_c, 100);
finnal_value = column_value_c;
}
} else if (temp_head_record.get('percent') == '%') {
finnal_value = div(column_value, 100);
} else { } else {
finnal_value = column_value; finnal_value = column_value_c;
} }
} else if (temp_head_record.get('percent') == '%') {
finnal_value = div(column_value, 100);
} else {
finnal_value = column_value;
} }
headRecord.set(column_name, finnal_value);
} }
headRecord.set(column_name, finnal_value);
} }
}
function call_back_after_check_limit(ds, record, name, value, old_value, config_record, fromLine) {
var lower_limit, upper_limit, finnal_value, set_value, current_record; function call_back_after_check_limit(ds, record, name, value, old_value, config_record, fromLine) {
var lower_limit, upper_limit, finnal_value, set_value, current_record;
if (fromLine) {
current_record = config_record;
} else {
current_record = record;
}
lower_limit = current_record.get('lower_limit');
upper_limit = current_record.get('upper_limit');
if (current_record.get('percent') == '%') {
finnal_value = div(value, 100);
set_value = mul(lower_limit, 100);
} else {
finnal_value = value;
set_value = lower_limit;
}
if (!set_value) {
set_value = 0;
}
if (!Ext.isEmpty(value) && (finnal_value < lower_limit || finnal_value > upper_limit)) {
if (fromLine) { if (fromLine) {
current_record = config_record; Leaf.showMessage('${l:PROMPT}', config_record.get('prompt') + '${l:HLS500.VALUE_IS_NOT_BEYOND}');
} else { setTimeout(function() {
current_record = record; if (config_record.get('input_mode') != 'REQUIRED_ONLY_NOT_NULL' && config_record.get('input_mode') != 'OPTION_ONLY_NOT_NULL') {
} record.set(name, null);
lower_limit = current_record.get('lower_limit'); } else {
upper_limit = current_record.get('upper_limit'); record.set(name, set_value);
if (current_record.get('percent') == '%') {
finnal_value = div(value, 100);
set_value = mul(lower_limit, 100);
} else {
finnal_value = value;
set_value = lower_limit;
}
if (!set_value) {
set_value = 0;
}
if (!Ext.isEmpty(value) && (finnal_value < lower_limit || finnal_value > upper_limit)) {
if (fromLine) {
Leaf.showMessage('${l:PROMPT}', config_record.get('prompt') + '${l:HLS500.VALUE_IS_NOT_BEYOND}');
setTimeout(function() {
if (config_record.get('input_mode') != 'REQUIRED_ONLY_NOT_NULL' && config_record.get('input_mode') != 'OPTION_ONLY_NOT_NULL') {
record.set(name, null);
} else {
record.set(name, set_value);
}
}, 5);
} else {
if (name != 'column_value_c') {
Leaf.showMessage('${l:PROMPT}', record.get('prompt') + '${l:HLS500.VALUE_IS_NOT_BEYOND}');
} }
setTimeout(function() { }, 5);
if (record.get('input_mode') != 'REQUIRED_ONLY_NOT_NULL' && record.get('input_mode') != 'OPTION_ONLY_NOT_NULL') { } else {
data_or_record_set(record, 'column_value_c', null); if (name != 'column_value_c') {
data_or_record_set(record, 'column_value', null); Leaf.showMessage('${l:PROMPT}', record.get('prompt') + '${l:HLS500.VALUE_IS_NOT_BEYOND}');
} else {
data_or_record_set(record, 'column_value_c', set_value);
data_or_record_set(record, 'column_value', set_value);
}
}, 5);
} }
setTimeout(function() {
if (record.get('input_mode') != 'REQUIRED_ONLY_NOT_NULL' && record.get('input_mode') != 'OPTION_ONLY_NOT_NULL') {
data_or_record_set(record, 'column_value_c', null);
data_or_record_set(record, 'column_value', null);
} else {
data_or_record_set(record, 'column_value_c', set_value);
data_or_record_set(record, 'column_value', set_value);
}
}, 5);
} }
} }
}
function onLineupdate_setEmpty(ds, record, name, value, old_value) {
var config_record = $('line_attribute_ds').find('column_name', name); function onLineupdate_setEmpty(ds, record, name, value, old_value) {
if (config_record) { var config_record = $('line_attribute_ds').find('column_name', name);
var input_mode = config_record.get('input_mode'); if (config_record) {
call_back_after_check_input_mode(ds, record, name, value, old_value, config_record, true); var input_mode = config_record.get('input_mode');
call_back_after_check_limit(ds, record, name, value, old_value, config_record, true); call_back_after_check_input_mode(ds, record, name, value, old_value, config_record, true);
} call_back_after_check_limit(ds, record, name, value, old_value, config_record, true);
} }
}
function clear_hd_lov_sql_mapping(hd_ds, column_name) {
var hd_lov_mapping_ds = $('hls_fin_calc_lov_getmapping_ds'); function clear_hd_lov_sql_mapping(hd_ds, column_name) {
var hd_records = hd_ds.getAll(); var hd_lov_mapping_ds = $('hls_fin_calc_lov_getmapping_ds');
hd_lov_mapping_ds.setQueryParameter('price_list', '${/parameter/@price_list}'); var hd_records = hd_ds.getAll();
hd_lov_mapping_ds.setQueryParameter('column_name', column_name); hd_lov_mapping_ds.setQueryParameter('price_list', '${/parameter/@price_list}');
hd_lov_mapping_ds.setQueryParameter('layout_area_seq', 'H'); hd_lov_mapping_ds.setQueryParameter('column_name', column_name);
hd_lov_mapping_ds.setQueryParameter('layout_area_seq', 'H');
function clear_mapping_detail(ds) {
hd_lov_mapping_ds.un('load', clear_mapping_detail); function clear_mapping_detail(ds) {
var detail_records = ds.getAll(); hd_lov_mapping_ds.un('load', clear_mapping_detail);
for (var m = 0;m < detail_records.length;m++) { var detail_records = ds.getAll();
var detail_record = detail_records[m]; for (var m = 0;m < detail_records.length;m++) {
for (var name in detail_record.data) { var detail_record = detail_records[m];
var current_name = detail_record.get(name).toLowerCase(); for (var name in detail_record.data) {
if (current_name != 'value_code' && current_name != 'value_name') { var current_name = detail_record.get(name).toLowerCase();
for (var i = 0;i < hd_records.length;i++) { if (current_name != 'value_code' && current_name != 'value_name') {
var single_record = hd_records[i]; for (var i = 0;i < hd_records.length;i++) {
if (single_record.get('column_name').toLowerCase() == current_name) { var single_record = hd_records[i];
data_or_record_set(single_record, 'column_value_c', null); if (single_record.get('column_name').toLowerCase() == current_name) {
data_or_record_set(single_record, 'column_value', null); data_or_record_set(single_record, 'column_value_c', null);
} data_or_record_set(single_record, 'column_value', null);
} }
} }
} }
} }
unlock_calc_current_window(); }
} unlock_calc_current_window();
hd_lov_mapping_ds.on('load', clear_mapping_detail); }
hd_lov_mapping_ds.query(); hd_lov_mapping_ds.on('load', clear_mapping_detail);
} hd_lov_mapping_ds.query();
}
function onEditorupdate_setEmpty(ds, record, name, value, old_value, fromLoad) {
if (!fromLoad) { function onEditorupdate_setEmpty(ds, record, name, value, old_value, fromLoad) {
var column_name = record.get('column_name'); if (!fromLoad) {
var all_records = ds.getAll(); var column_name = record.get('column_name');
for (var i = 0;i < all_records.length;i++) { var all_records = ds.getAll();
var all_record = all_records[i]; for (var i = 0;i < all_records.length;i++) {
var lov_cascade_para1 = all_record.get('lov_cascade_para1'), var all_record = all_records[i];
lov_cascade_para2 = all_record.get('lov_cascade_para2'), var lov_cascade_para1 = all_record.get('lov_cascade_para1'),
lov_cascade_para3 = all_record.get('lov_cascade_para3'); lov_cascade_para2 = all_record.get('lov_cascade_para2'),
if (column_name == lov_cascade_para1 || column_name == lov_cascade_para2 || column_name == lov_cascade_para3) { lov_cascade_para3 = all_record.get('lov_cascade_para3');
data_or_record_set(all_record, 'column_value_c', null); if (column_name == lov_cascade_para1 || column_name == lov_cascade_para2 || column_name == lov_cascade_para3) {
data_or_record_set(all_record, 'column_value', null); data_or_record_set(all_record, 'column_value_c', null);
} data_or_record_set(all_record, 'column_value', null);
}
if (Ext.isEmpty(value) && (record.get('validation_type') == 'LOV' || record.get('validation_type') == 'LOV_C') && !fromLoad) {
lock_calc_current_window();
clear_hd_lov_sql_mapping(ds, column_name);
} }
call_back_after_check_input_mode(ds, record, name, value, old_value);
call_back_after_check_limit(ds, record, name, value, old_value);
} }
if (Ext.isEmpty(value) && (record.get('validation_type') == 'LOV' || record.get('validation_type') == 'LOV_C') && !fromLoad) {
lock_calc_current_window();
clear_hd_lov_sql_mapping(ds, column_name);
}
call_back_after_check_input_mode(ds, record, name, value, old_value);
call_back_after_check_limit(ds, record, name, value, old_value);
} }
}
function getNextMonth(date) { function getNextMonth(date) {
debugger; debugger;
var arr = date.toString().split('-'); var arr = date.toString().split('-');
var year = arr[0]; //获取当前日期的年份 var year = arr[0]; //获取当前日期的年份
var month = arr[1]; //获取当前日期的月份 var month = arr[1]; //获取当前日期的月份
...@@ -384,519 +384,519 @@ ...@@ -384,519 +384,519 @@
var t2 = year + '-' + month2 + '-' + day2; var t2 = year + '-' + month2 + '-' + day2;
return t2; return t2;
} }
function onEditorupdate(ds, record, name, value, old_value, fromLoad) { function onEditorupdate(ds, record, name, value, old_value, fromLoad) {
if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV') && name == 'column_value') { if (record.get('lov_return_vcode') == 'N' && (record.get('validation_type') == 'COMBOBOX' || record.get('validation_type') == 'LOV') && name == 'column_value') {
return; return;
} }
var column_name = record.get('column_name'); var column_name = record.get('column_name');
var column_value = record.get('column_value'); var column_value = record.get('column_value');
var temp_hd_attribute_ds = $('temp_hd_attribute_ds'); var temp_hd_attribute_ds = $('temp_hd_attribute_ds');
var exchange_rate_type_record, exchange_rate_record, currency_record, lease_start_date_record, exchange_rate_type_field; var exchange_rate_type_record, exchange_rate_record, currency_record, lease_start_date_record, exchange_rate_type_field;
//add by niminmin 填写租赁开始日期 自动带出支付日 //add by niminmin 填写租赁开始日期 自动带出支付日
if (column_name == 'lease_start_date'&&value&&column_value==value&&'${/parameter/@document_category}'!='CONTRACT') { if (column_name == 'lease_start_date'&&value&&column_value==value) {
var lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'); var lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date');
var contract_inception_date_reocrd = get_ds_record(ds, temp_hd_attribute_ds, 'contract_inception_date'); var contract_inception_date_reocrd = get_ds_record(ds, temp_hd_attribute_ds, 'contract_inception_date');
var lease_start_date = get_record_column_value(lease_start_date_record); var lease_start_date = get_record_column_value(lease_start_date_record);
var contract_inception_date = get_record_column_value(contract_inception_date_reocrd); var contract_inception_date = get_record_column_value(contract_inception_date_reocrd);
if(lease_start_date_record){ if(lease_start_date_record){
//var day = new Date(value.replace(/-/g, '/')).getDate(); //var day = new Date(value.replace(/-/g, '/')).getDate();
var day = new Date(column_value).format('yyyy-mm-dd'); var day = new Date(column_value).format('yyyy-mm-dd');
var nextDay=getNextMonth(day); var nextDay=getNextMonth(day);
from_load_or_update_set(contract_inception_date_reocrd, fromLoad, 'column_value', nextDay); from_load_or_update_set(contract_inception_date_reocrd, fromLoad, 'column_value', nextDay);
} }
} }
if (column_name == 'lease_times' || column_name == 'annual_pay_times') { if (column_name == 'lease_times' || column_name == 'annual_pay_times') {
var lease_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_times'), var lease_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_times'),
annual_pay_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'annual_pay_times'), annual_pay_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'annual_pay_times'),
lease_term_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_term'), lease_term_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_term'),
lease_term, annual_pay_times = get_record_column_value(annual_pay_times_record), lease_term, annual_pay_times = get_record_column_value(annual_pay_times_record),
lease_times = get_record_column_value(lease_times_record); lease_times = get_record_column_value(lease_times_record);
if (column_name == 'lease_times' && !Ext.isEmpty(value)) { if (column_name == 'lease_times' && !Ext.isEmpty(value)) {
if (annual_pay_times_record && !Ext.isEmpty(annual_pay_times)) { if (annual_pay_times_record && !Ext.isEmpty(annual_pay_times)) {
if (lease_term_record) { if (lease_term_record) {
lease_term = div(value, annual_pay_times).toFixed(3) * 1; lease_term = div(value, annual_pay_times).toFixed(3) * 1;
from_load_or_update_set(lease_term_record, fromLoad, 'column_value', lease_term); from_load_or_update_set(lease_term_record, fromLoad, 'column_value', lease_term);
}
}
} else if (column_name == 'annual_pay_times' && !Ext.isEmpty(value)) {
if (lease_times_record && !Ext.isEmpty(lease_times)) {
if (lease_term_record) {
lease_term = div(lease_times, value).toFixed(3) * 1;
from_load_or_update_set(lease_term_record, fromLoad, 'column_value', lease_term);
}
} }
} }
} else if (column_name == 'lease_term') { } else if (column_name == 'annual_pay_times' && !Ext.isEmpty(value)) {
value = get_record_column_value(record); if (lease_times_record && !Ext.isEmpty(lease_times)) {
lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'); if (lease_term_record) {
var base_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'base_rate_type'); lease_term = div(lease_times, value).toFixed(3) * 1;
currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency'); from_load_or_update_set(lease_term_record, fromLoad, 'column_value', lease_term);
var base_rate_type = get_record_column_value(base_rate_type_record),
lease_start_date = get_record_column_value(lease_start_date_record),
currency;
if ('${/parameter/@calc_session_id}') {
currency = get_record_column_value(currency_record);
} else {
currency = '${/parameter/@currency}';
}
getBaseRate({
base_rate_type: base_rate_type,
currency: currency,
valid_date: lease_start_date,
month: mul(value, 12)
});
} else if (column_name == 'tax_type_id') {
var vat_flag_record = get_ds_record(ds, temp_hd_attribute_ds, 'vat_flag'),
vat_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'vat_rate');
if (!Ext.isEmpty(value)) {
var tax_type_codes_record = $('tax_type_codes_ds').find('tax_type_id', value);
from_load_or_update_set(vat_flag_record, fromLoad, 'column_value', tax_type_codes_record.get('vat_flag'));
// from_load_or_update_set(vat_rate_record, fromLoad, 'column_value', tax_type_codes_record.get('tax_type_rate'));
} else {
from_load_or_update_set(vat_flag_record, fromLoad, 'column_value', '');
// from_load_or_update_set(vat_rate_record, fromLoad, 'column_value', '');
}
} else if (column_name == 'currency') {
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type');
exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
if (exchange_rate_type_record && exchange_rate_record) {
exchange_rate_type_field = exchange_rate_type_record.getField('column_value');
if (value == '${/model/doc_functional_currency_path/record/@functional_currency_code}') {
// var default_exchage_rate_type_record = $('gld_exchage_rate_types_ds').find('type_code', 'MANUAL');
// if (default_exchage_rate_type_record) {
// from_load_or_update_set(exchange_rate_type_record, fromLoad, 'column_value_c', 'MANUAL');
// from_load_or_update_set(exchange_rate_type_record, fromLoad, 'column_value', default_exchage_rate_type_record.get('type_name'));
// }
from_load_or_update_set(exchange_rate_record, fromLoad, 'column_value', 1);
} else {
set_after_check_empty(exchange_rate_type_record, get_record_column_value(exchange_rate_type_record), '${/model/fnd_financial_option_path/record/@default_exchange_rate_type}', fromLoad, '${/model/fnd_financial_option_path/record/@exchange_rate_type_display}');
} }
} }
} else if (column_name == 'exchange_rate_type' || column_name == 'lease_start_date') {
exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency');
lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date');
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type');
getExchangeRate({
fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}',
toCur: get_record_column_value(currency_record),
exchangeRateType: get_record_column_value(exchange_rate_type_record),
exchangeDate: get_record_column_value(lease_start_date_record)
}, ds, temp_hd_attribute_ds, fromLoad);
if (!fromLoad && value != old_value) {
exchange_rate_record.set('column_value', '');
}
} }
onEditorupdate_setEmpty(ds, record, name, value, old_value, fromLoad); } else if (column_name == 'lease_term') {
} value = get_record_column_value(record);
lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date');
function execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad, success_flag) { var base_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'base_rate_type');
var rate_method_code, exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate'), currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency');
exchange_rate_field = exchange_rate_record.getField('column_value'); var base_rate_type = get_record_column_value(base_rate_type_record),
if (success_flag) { lease_start_date = get_record_column_value(lease_start_date_record),
var exchange_rate_quotation_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_quotation'), currency;
exchange_rate = res.result.exchange_rate; if ('${/parameter/@calc_session_id}') {
rate_method_code = res.result.rate_method_code; currency = get_record_column_value(currency_record);
if (check_rate_method_code(rate_method_code)) { } else {
exchange_rate_field.setReadOnly(true); currency = '${/parameter/@currency}';
exchange_rate_field.setRequired(false); }
if (!Ext.isDefined(exchange_rate)) { getBaseRate({
exchange_rate = ''; base_rate_type: base_rate_type,
} currency: currency,
execute_hls_save_special_field(exchange_rate_record, exchange_rate, false, null); valid_date: lease_start_date,
month: mul(value, 12)
});
} else if (column_name == 'tax_type_id') {
var vat_flag_record = get_ds_record(ds, temp_hd_attribute_ds, 'vat_flag'),
vat_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'vat_rate');
if (!Ext.isEmpty(value)) {
var tax_type_codes_record = $('tax_type_codes_ds').find('tax_type_id', value);
from_load_or_update_set(vat_flag_record, fromLoad, 'column_value', tax_type_codes_record.get('vat_flag'));
// from_load_or_update_set(vat_rate_record, fromLoad, 'column_value', tax_type_codes_record.get('tax_type_rate'));
} else {
from_load_or_update_set(vat_flag_record, fromLoad, 'column_value', '');
// from_load_or_update_set(vat_rate_record, fromLoad, 'column_value', '');
}
} else if (column_name == 'currency') {
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type');
exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
if (exchange_rate_type_record && exchange_rate_record) {
exchange_rate_type_field = exchange_rate_type_record.getField('column_value');
if (value == '${/model/doc_functional_currency_path/record/@functional_currency_code}') {
// var default_exchage_rate_type_record = $('gld_exchage_rate_types_ds').find('type_code', 'MANUAL');
// if (default_exchage_rate_type_record) {
// from_load_or_update_set(exchange_rate_type_record, fromLoad, 'column_value_c', 'MANUAL');
// from_load_or_update_set(exchange_rate_type_record, fromLoad, 'column_value', default_exchage_rate_type_record.get('type_name'));
// }
from_load_or_update_set(exchange_rate_record, fromLoad, 'column_value', 1);
} else { } else {
exchange_rate_field.setRequired(true); set_after_check_empty(exchange_rate_type_record, get_record_column_value(exchange_rate_type_record), '${/model/fnd_financial_option_path/record/@default_exchange_rate_type}', fromLoad, '${/model/fnd_financial_option_path/record/@exchange_rate_type_display}');
exchange_rate_field.setReadOnly(false);
} }
var exchange_rate_quotation = res.result.exchange_rate_quotation; }
if (!Ext.isDefined(exchange_rate_quotation)) { } else if (column_name == 'exchange_rate_type' || column_name == 'lease_start_date') {
exchange_rate_quotation = 'DIRECT QUOTATION'; exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
} currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency');
execute_hls_save_special_field(exchange_rate_quotation_record, exchange_rate_quotation, false, null); lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date');
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type');
getExchangeRate({
fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}',
toCur: get_record_column_value(currency_record),
exchangeRateType: get_record_column_value(exchange_rate_type_record),
exchangeDate: get_record_column_value(lease_start_date_record)
}, ds, temp_hd_attribute_ds, fromLoad);
if (!fromLoad && value != old_value) {
exchange_rate_record.set('column_value', '');
}
}
onEditorupdate_setEmpty(ds, record, name, value, old_value, fromLoad);
}
function execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad, success_flag) {
var rate_method_code, exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate'),
exchange_rate_field = exchange_rate_record.getField('column_value');
if (success_flag) {
var exchange_rate_quotation_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_quotation'),
exchange_rate = res.result.exchange_rate;
rate_method_code = res.result.rate_method_code;
if (check_rate_method_code(rate_method_code)) {
exchange_rate_field.setReadOnly(true);
exchange_rate_field.setRequired(false);
if (!Ext.isDefined(exchange_rate)) {
exchange_rate = '';
}
execute_hls_save_special_field(exchange_rate_record, exchange_rate, false, null);
} else { } else {
var exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type'), exchange_rate_field.setRequired(true);
exchange_rate_type = get_record_column_value(exchange_rate_type_record); exchange_rate_field.setReadOnly(false);
var rate_method_code_record = $('gld_exchage_rate_types_ds').find('type_code', exchange_rate_type); }
rate_method_code = rate_method_code_record.get('rate_method_code'); var exchange_rate_quotation = res.result.exchange_rate_quotation;
if (check_rate_method_code(rate_method_code)) { if (!Ext.isDefined(exchange_rate_quotation)) {
exchange_rate_field.setRequired(true); exchange_rate_quotation = 'DIRECT QUOTATION';
exchange_rate_field.setReadOnly(true); }
} execute_hls_save_special_field(exchange_rate_quotation_record, exchange_rate_quotation, false, null);
} else {
var exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate_type'),
exchange_rate_type = get_record_column_value(exchange_rate_type_record);
var rate_method_code_record = $('gld_exchage_rate_types_ds').find('type_code', exchange_rate_type);
rate_method_code = rate_method_code_record.get('rate_method_code');
if (check_rate_method_code(rate_method_code)) {
exchange_rate_field.setRequired(true);
exchange_rate_field.setReadOnly(true);
} }
} }
}
function getExchangeRate(param, ds, temp_hd_attribute_ds, fromLoad) {
Leaf.request({ function getExchangeRate(param, ds, temp_hd_attribute_ds, fromLoad) {
url: $('get_exchange_rate_link_id').getUrl(), Leaf.request({
para: { url: $('get_exchange_rate_link_id').getUrl(),
from_currency: param.fromCur, para: {
to_currency: param.toCur, from_currency: param.fromCur,
exchange_date: param.exchangeDate, to_currency: param.toCur,
exchange_rate_type: param.exchangeRateType exchange_date: param.exchangeDate,
}, exchange_rate_type: param.exchangeRateType
success: function(res) { },
execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad, true); success: function(res) {
}, execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad, true);
error: function(res) { },
execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad); error: function(res) {
}, execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad);
failure: function(res) { },
execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad); failure: function(res) {
}, execute_after_getexchangerate(res, ds, temp_hd_attribute_ds, fromLoad);
scope: this },
scope: this
});
}
function onEditor_load_fire(ds, record, name, value, old_value) {
var temp_hd_attribute_ds = $('temp_hd_attribute_ds');
var currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency'),
currency = get_record_column_value(currency_record),
lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'),
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'),
lease_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_times'),
lease_term_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_term'),
annual_pay_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'annual_pay_times'),
lease_times = get_record_column_value(lease_times_record),
annual_pay_times = get_record_column_value(annual_pay_times_record);
if (name == 'base_rate' && Ext.isEmpty(value)) {
var base_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'base_rate_type');
var base_rate_type = get_record_column_value(base_rate_type_record),
lease_start_date = get_record_column_value(lease_start_date_record),
lease_term = get_record_column_value(lease_term_record);
if (Ext.isEmpty(lease_term) && lease_times_record) {
onEditorupdate(ds, lease_times_record, 'lease_times', lease_times, '', true);
lease_term = get_record_column_value(lease_term_record);
}
getBaseRate({
base_rate_type: base_rate_type,
currency: currency,
valid_date: lease_start_date,
month: mul(lease_term, 12)
}); });
} } else if (name == 'lease_times' || name == 'annual_pay_times') {
if (Ext.isEmpty(lease_term)) {
function onEditor_load_fire(ds, record, name, value, old_value) { if (name == 'lease_times' && lease_times_record) {
var temp_hd_attribute_ds = $('temp_hd_attribute_ds');
var currency_record = get_ds_record(ds, temp_hd_attribute_ds, 'currency'),
currency = get_record_column_value(currency_record),
lease_start_date_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'),
exchange_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_start_date'),
lease_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_times'),
lease_term_record = get_ds_record(ds, temp_hd_attribute_ds, 'lease_term'),
annual_pay_times_record = get_ds_record(ds, temp_hd_attribute_ds, 'annual_pay_times'),
lease_times = get_record_column_value(lease_times_record),
annual_pay_times = get_record_column_value(annual_pay_times_record);
if (name == 'base_rate' && Ext.isEmpty(value)) {
var base_rate_type_record = get_ds_record(ds, temp_hd_attribute_ds, 'base_rate_type');
var base_rate_type = get_record_column_value(base_rate_type_record),
lease_start_date = get_record_column_value(lease_start_date_record),
lease_term = get_record_column_value(lease_term_record);
if (Ext.isEmpty(lease_term) && lease_times_record) {
onEditorupdate(ds, lease_times_record, 'lease_times', lease_times, '', true); onEditorupdate(ds, lease_times_record, 'lease_times', lease_times, '', true);
lease_term = get_record_column_value(lease_term_record); } else if (name == 'annual_pay_times' && annual_pay_times_record) {
} onEditorupdate(ds, annual_pay_times_record, 'annual_pay_times', annual_pay_times, '', true);
getBaseRate({
base_rate_type: base_rate_type,
currency: currency,
valid_date: lease_start_date,
month: mul(lease_term, 12)
});
} else if (name == 'lease_times' || name == 'annual_pay_times') {
if (Ext.isEmpty(lease_term)) {
if (name == 'lease_times' && lease_times_record) {
onEditorupdate(ds, lease_times_record, 'lease_times', lease_times, '', true);
} else if (name == 'annual_pay_times' && annual_pay_times_record) {
onEditorupdate(ds, annual_pay_times_record, 'annual_pay_times', annual_pay_times, '', true);
}
}
} else if (name == 'currency_precision') {
if (Ext.isEmpty(value)) {
var doc_currency_record = $('doc_currency_ds').find('currency_code', currency);
if (doc_currency_record) {
record.data['column_value'] = doc_currency_record.get('precision');
}
} }
} }
// else if (name == 'calc_method' && Ext.isEmpty(value)) { } else if (name == 'currency_precision') {
// var calc_method_record = get_ds_record(ds, temp_hd_attribute_ds, 'calc_method'); if (Ext.isEmpty(value)) {
// var calc_method = calc_method_record.get('calc_method'), var doc_currency_record = $('doc_currency_ds').find('currency_code', currency);
// calc_method_name = calc_method_record.get('calc_method_name'); if (doc_currency_record) {
// get_hls_special_field(calc_method_record, calc_method, calc_method_name); record.data['column_value'] = doc_currency_record.get('precision');
// }
else if (name == 'exchange_rate_type' || name == 'lease_start_date') {
var exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
if (Ext.isEmpty(get_record_column_value(exchange_rate_record))) {
getExchangeRate({
fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}',
toCur: get_record_column_value(currency_record),
exchangeRateType: get_record_column_value(exchange_rate_type_record),
exchangeDate: get_record_column_value(lease_start_date_record)
}, ds, temp_hd_attribute_ds, true);
} }
} }
} }
// else if (name == 'calc_method' && Ext.isEmpty(value)) {
// var calc_method_record = get_ds_record(ds, temp_hd_attribute_ds, 'calc_method');
function onEditorupdate_header(ds, record, name, value, old_value, fromAdd) { // var calc_method = calc_method_record.get('calc_method'),
if (name == 'lease_times' || name == 'annual_pay_times') { // calc_method_name = calc_method_record.get('calc_method_name');
var lease_term; // get_hls_special_field(calc_method_record, calc_method, calc_method_name);
if (name == 'lease_times' && !Ext.isEmpty(record.get('annual_pay_times'))) { // }
lease_term = div(value, record.get('annual_pay_times')).toFixed(3) * 1; else if (name == 'exchange_rate_type' || name == 'lease_start_date') {
} else if (name == 'annual_pay_times' && !Ext.isEmpty(record.get('lease_times'))) { var exchange_rate_record = get_ds_record(ds, temp_hd_attribute_ds, 'exchange_rate');
lease_term = div(record.get('lease_times'), value).toFixed(3) * 1; if (Ext.isEmpty(get_record_column_value(exchange_rate_record))) {
} getExchangeRate({
if (fromAdd) {
record.data['lease_term'] = lease_term;
} else {
record.set('lease_term', lease_term);
}
} else if (name == 'lease_term') {
if (value != old_value) {
new_calc_flag = 'Y';
getBaseRate({
base_rate_type: record.get('base_rate_type'),
currency: record.get('currency'),
valid_date: record.get('lease_start_date'),
month: mul(value, 12)
});
}
} else if (name == 'tax_type_id') {
if (!Ext.isEmpty(value) && (record.get('vat_flag') || record.get('vat_rate'))) {
var tax_type_codes_record = $('tax_type_codes_ds').find('tax_type_id', value);
from_load_or_update_set(record, fromAdd, 'vat_flag', tax_type_codes_record.get('vat_flag'));
// from_load_or_update_set(record, fromAdd, 'vat_rate', tax_type_codes_record.get('tax_type_rate'));
} else {
from_load_or_update_set(record, fromAdd, 'vat_flag', '');
// from_load_or_update_set(record, fromAdd, 'vat_rate', '');
}
} else if (name == 'currency_precision') {
if (Ext.isEmpty(value) && fromAdd) {
var doc_currency_record = $('doc_currency_ds').find('currency_code', record.get('currency'));
if (doc_currency_record) {
record.data['currency_precision'] = doc_currency_record.get('precision');
}
}
} else if (name == 'exchange_rate_type' || name == 'lease_start_date') {
get_quotation_ExchangeRate({
fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}', fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}',
toCur: record.get('currency'), toCur: get_record_column_value(currency_record),
exchangeRateType: record.get('exchange_rate_type'), exchangeRateType: get_record_column_value(exchange_rate_type_record),
exchangeDate: record.get('lease_start_date') exchangeDate: get_record_column_value(lease_start_date_record)
}, record, fromAdd); }, ds, temp_hd_attribute_ds, true);
} }
} }
}
function check_rate_method_code(rate_method_code) {
if (!rate_method_code || !Ext.isDefined(rate_method_code) || rate_method_code == 'PERIOD' || rate_method_code == 'DAILY' || rate_method_code == 'FIXED') {
return true; function onEditorupdate_header(ds, record, name, value, old_value, fromAdd) {
if (name == 'lease_times' || name == 'annual_pay_times') {
var lease_term;
if (name == 'lease_times' && !Ext.isEmpty(record.get('annual_pay_times'))) {
lease_term = div(value, record.get('annual_pay_times')).toFixed(3) * 1;
} else if (name == 'annual_pay_times' && !Ext.isEmpty(record.get('lease_times'))) {
lease_term = div(record.get('lease_times'), value).toFixed(3) * 1;
}
if (fromAdd) {
record.data['lease_term'] = lease_term;
} else { } else {
return false; record.set('lease_term', lease_term);
} }
} } else if (name == 'lease_term') {
if (value != old_value) {
function execute_after_quotation_getexchangerate(res, record, fromAdd, success_flag) { new_calc_flag = 'Y';
var rate_method_code, exchange_rate, exchange_rate_field = record.getField('exchange_rate'); getBaseRate({
if (success_flag) { base_rate_type: record.get('base_rate_type'),
rate_method_code = res.result.rate_method_code; currency: record.get('currency'),
exchange_rate = res.result.exchange_rate; valid_date: record.get('lease_start_date'),
if (check_rate_method_code(rate_method_code)) { month: mul(value, 12)
exchange_rate_field.setReadOnly(true); });
exchange_rate_field.setRequired(false); }
if (!Ext.isDefined(exchange_rate)) { } else if (name == 'tax_type_id') {
exchange_rate = ''; if (!Ext.isEmpty(value) && (record.get('vat_flag') || record.get('vat_rate'))) {
} var tax_type_codes_record = $('tax_type_codes_ds').find('tax_type_id', value);
from_load_or_update_set(record, fromAdd, 'exchange_rate', exchange_rate); from_load_or_update_set(record, fromAdd, 'vat_flag', tax_type_codes_record.get('vat_flag'));
} else { // from_load_or_update_set(record, fromAdd, 'vat_rate', tax_type_codes_record.get('tax_type_rate'));
exchange_rate_field.setRequired(true);
exchange_rate_field.setReadOnly(false);
}
var exchange_rate_quotation = res.result.exchange_rate_quotation;
if (!Ext.isDefined(exchange_rate_quotation)) {
exchange_rate_quotation = 'DIRECT QUOTATION';
}
from_load_or_update_set(record, fromAdd, 'exchange_rate_quotation', exchange_rate_quotation);
} else { } else {
rate_method_code = $('gld_exchage_rate_types_ds').find('type_code', record.get('exchange_rate_type')); from_load_or_update_set(record, fromAdd, 'vat_flag', '');
if (check_rate_method_code(rate_method_code)) { // from_load_or_update_set(record, fromAdd, 'vat_rate', '');
exchange_rate_field.setReadOnly(true); }
exchange_rate_field.setRequired(false); } else if (name == 'currency_precision') {
if (Ext.isEmpty(value) && fromAdd) {
var doc_currency_record = $('doc_currency_ds').find('currency_code', record.get('currency'));
if (doc_currency_record) {
record.data['currency_precision'] = doc_currency_record.get('precision');
} }
} }
} else if (name == 'exchange_rate_type' || name == 'lease_start_date') {
get_quotation_ExchangeRate({
fromCur: '${/model/doc_functional_currency_path/record/@functional_currency_code}',
toCur: record.get('currency'),
exchangeRateType: record.get('exchange_rate_type'),
exchangeDate: record.get('lease_start_date')
}, record, fromAdd);
} }
}
function get_quotation_ExchangeRate(param, record, fromAdd) {
Leaf.request({ function check_rate_method_code(rate_method_code) {
url: $('get_exchange_rate_link_id').getUrl(), if (!rate_method_code || !Ext.isDefined(rate_method_code) || rate_method_code == 'PERIOD' || rate_method_code == 'DAILY' || rate_method_code == 'FIXED') {
para: { return true;
from_currency: param.fromCur, } else {
to_currency: param.toCur, return false;
exchange_date: param.exchangeDate,
exchange_rate_type: param.exchangeRateType
},
success: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd, true);
},
error: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd);
},
failure: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd);
},
scope: this
});
}
function getBaseRate(param) {
Leaf.request({
url: $('hls_fin_calc_get_base_rate_link_id').getUrl(),
para: {
base_rate_type: param.base_rate_type,
currency: param.currency,
valid_date: param.valid_date,
month: param.month
},
sync: true,
success: setBaseRate,
failure: function() {},
error: function() {},
scope: this
});
} }
}
function setBaseRate(res) {
if (new_calc_flag == 'N') { function execute_after_quotation_getexchangerate(res, record, fromAdd, success_flag) {
base_rate_record = get_ds_record($('hls_fin_calculator_hd_ds'), $('temp_hd_attribute_ds'), 'base_rate'); var rate_method_code, exchange_rate, exchange_rate_field = record.getField('exchange_rate');
if (!base_rate_record) { if (success_flag) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS500.BASE_RATE_IS_NULL}'); rate_method_code = res.result.rate_method_code;
} exchange_rate = res.result.exchange_rate;
if (res.result.base_rate && base_rate_record) { if (check_rate_method_code(rate_method_code)) {
base_rate_record.set('column_value', mul(res.result.base_rate, 100)); exchange_rate_field.setReadOnly(true);
} exchange_rate_field.setRequired(false);
if (!Ext.isDefined(exchange_rate)) {
exchange_rate = '';
}
from_load_or_update_set(record, fromAdd, 'exchange_rate', exchange_rate);
} else { } else {
var head_record = $('hls_fin_calculator_hd_ds').getAt(0); exchange_rate_field.setRequired(true);
head_record.set('base_rate', mul(res.result.base_rate, 100)); exchange_rate_field.setReadOnly(false);
} }
} var exchange_rate_quotation = res.result.exchange_rate_quotation;
if (!Ext.isDefined(exchange_rate_quotation)) {
function set_calc_record_para(object, record, combobox_ds, field, param) { exchange_rate_quotation = 'DIRECT QUOTATION';
if (param && '${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') { }
record = get_ds_record($('hls_fin_calculator_hd_ds'), $('temp_hd_attribute_ds'), param); from_load_or_update_set(record, fromAdd, 'exchange_rate_quotation', exchange_rate_quotation);
if (object == 'LOV') { } else {
var temp = get_record_column_value(record); rate_method_code = $('gld_exchage_rate_types_ds').find('type_code', record.get('exchange_rate_type'));
field.setLovPara(param, get_record_column_value(record)); if (check_rate_method_code(rate_method_code)) {
} else if (object == 'COMBOBOX') { exchange_rate_field.setReadOnly(true);
combobox_ds.setQueryParameter(param, get_record_column_value(record)); exchange_rate_field.setRequired(false);
}
} else if (param && '${/parameter/@calc_type}' == 'LITE_CALCULATOR') {
var current_record = $('hls_fin_calculator_hd_ds').getCurrentRecord();
if (object == 'LOV') {
field.setLovPara(param, current_record.get(param));
} else if (object == 'COMBOBOX') {
combobox_ds.setQueryParameter(param, current_record.get(param));
}
} }
} }
}
function hls_fin_get_column_name(name) {
var query_name, length = name.length; function get_quotation_ExchangeRate(param, record, fromAdd) {
if (name.substring(length - 2, length) == '_n') { Leaf.request({
query_name = name.substring(0, length - 2); url: $('get_exchange_rate_link_id').getUrl(),
} else { para: {
query_name = name; from_currency: param.fromCur,
to_currency: param.toCur,
exchange_date: param.exchangeDate,
exchange_rate_type: param.exchangeRateType
},
success: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd, true);
},
error: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd);
},
failure: function(res) {
execute_after_quotation_getexchangerate(res, record, fromAdd);
},
scope: this
});
}
function getBaseRate(param) {
Leaf.request({
url: $('hls_fin_calc_get_base_rate_link_id').getUrl(),
para: {
base_rate_type: param.base_rate_type,
currency: param.currency,
valid_date: param.valid_date,
month: param.month
},
sync: true,
success: setBaseRate,
failure: function() {},
error: function() {},
scope: this
});
}
function setBaseRate(res) {
if (new_calc_flag == 'N') {
base_rate_record = get_ds_record($('hls_fin_calculator_hd_ds'), $('temp_hd_attribute_ds'), 'base_rate');
if (!base_rate_record) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS500.BASE_RATE_IS_NULL}');
}
if (res.result.base_rate && base_rate_record) {
base_rate_record.set('column_value', mul(res.result.base_rate, 100));
} }
return query_name; } else {
var head_record = $('hls_fin_calculator_hd_ds').getAt(0);
head_record.set('base_rate', mul(res.result.base_rate, 100));
} }
}
function get_lov_cascade(value) {
if (Ext.isEmpty(value)) { function set_calc_record_para(object, record, combobox_ds, field, param) {
return ''; if (param && '${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') {
} else { record = get_ds_record($('hls_fin_calculator_hd_ds'), $('temp_hd_attribute_ds'), param);
return value; if (object == 'LOV') {
var temp = get_record_column_value(record);
field.setLovPara(param, get_record_column_value(record));
} else if (object == 'COMBOBOX') {
combobox_ds.setQueryParameter(param, get_record_column_value(record));
}
} else if (param && '${/parameter/@calc_type}' == 'LITE_CALCULATOR') {
var current_record = $('hls_fin_calculator_hd_ds').getCurrentRecord();
if (object == 'LOV') {
field.setLovPara(param, current_record.get(param));
} else if (object == 'COMBOBOX') {
combobox_ds.setQueryParameter(param, current_record.get(param));
} }
} }
}
function setObjectPara(object, ds, field, para, record) {
if (para) { function hls_fin_get_column_name(name) {
if (object == 'LOV') { var query_name, length = name.length;
field.setLovPara(para, get_lov_cascade(record.get(para))); if (name.substring(length - 2, length) == '_n') {
} else if (object == 'COMBOBOX') { query_name = name.substring(0, length - 2);
ds.setQueryParameter(para, get_lov_cascade(record.get(para))); } else {
} query_name = name;
}
return query_name;
}
function get_lov_cascade(value) {
if (Ext.isEmpty(value)) {
return '';
} else {
return value;
}
}
function setObjectPara(object, ds, field, para, record) {
if (para) {
if (object == 'LOV') {
field.setLovPara(para, get_lov_cascade(record.get(para)));
} else if (object == 'COMBOBOX') {
ds.setQueryParameter(para, get_lov_cascade(record.get(para)));
} }
} }
}
function on_object_hd_calc_focus(object) {
var config_ds = '${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR' ? $('hls_fin_calculator_hd_ds') : $('hd_field_ds'), function on_object_hd_calc_focus(object) {
record = object.record, var config_ds = '${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR' ? $('hls_fin_calculator_hd_ds') : $('hd_field_ds'),
display_name = object.binder.name; record = object.record,
var column_name, field; display_name = object.binder.name;
if ('${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') { var column_name, field;
column_name = record.get('column_name'); if ('${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') {
field = record.getField('column_value'); column_name = record.get('column_name');
} else { field = record.getField('column_value');
column_name = hls_fin_get_column_name(display_name); } else {
field = record.getField(display_name); column_name = hls_fin_get_column_name(display_name);
} field = record.getField(display_name);
var config_record; }
var lov_cascade_para1 = record.get('lov_cascade_para1'), var config_record;
lov_cascade_para2 = record.get('lov_cascade_para2'), var lov_cascade_para1 = record.get('lov_cascade_para1'),
lov_cascade_para3 = record.get('lov_cascade_para3'); lov_cascade_para2 = record.get('lov_cascade_para2'),
if (object instanceof $L.Lov) { lov_cascade_para3 = record.get('lov_cascade_para3');
set_calc_record_para('LOV', config_record, '', field, lov_cascade_para1); if (object instanceof $L.Lov) {
set_calc_record_para('LOV', config_record, '', field, lov_cascade_para2); set_calc_record_para('LOV', config_record, '', field, lov_cascade_para1);
set_calc_record_para('LOV', config_record, '', field, lov_cascade_para3); set_calc_record_para('LOV', config_record, '', field, lov_cascade_para2);
} else if (object instanceof $L.ComboBox) { set_calc_record_para('LOV', config_record, '', field, lov_cascade_para3);
var combobox_ds = object.optionDataSet; } else if (object instanceof $L.ComboBox) {
set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para1); var combobox_ds = object.optionDataSet;
set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para2); set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para1);
set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para3); set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para2);
combobox_ds.query(); set_calc_record_para('COMBOBOX', config_record, combobox_ds, field, lov_cascade_para3);
} combobox_ds.query();
} }
}
function on_object_ln_calc_focus(object) {
var config_ds = $('line_field_ds'), function on_object_ln_calc_focus(object) {
record = object.record, var config_ds = $('line_field_ds'),
name = object.binder.name; record = object.record,
var config_record = config_ds.find('column_name', name); name = object.binder.name;
var lov_cascade_para1 = config_record.get('lov_cascade_para1'), var config_record = config_ds.find('column_name', name);
lov_cascade_para2 = config_record.get('lov_cascade_para2'), var lov_cascade_para1 = config_record.get('lov_cascade_para1'),
lov_cascade_para3 = config_record.get('lov_cascade_para3'), lov_cascade_para2 = config_record.get('lov_cascade_para2'),
field = record.getField(name); lov_cascade_para3 = config_record.get('lov_cascade_para3'),
if (object instanceof $L.Lov) { field = record.getField(name);
setObjectPara('LOV', '', field, lov_cascade_para1, record); if (object instanceof $L.Lov) {
setObjectPara('LOV', '', field, lov_cascade_para2, record); setObjectPara('LOV', '', field, lov_cascade_para1, record);
setObjectPara('LOV', '', field, lov_cascade_para3, record); setObjectPara('LOV', '', field, lov_cascade_para2, record);
} setObjectPara('LOV', '', field, lov_cascade_para3, record);
} }
}
function on_calc_success_query(dsId, document_category) {
if (!Ext.isEmpty(dsId)) { function on_calc_success_query(dsId, document_category) {
//王炜5743修改,租赁申请项目类不是树组件 if (!Ext.isEmpty(dsId)) {
if(!Ext.isEmpty(document.getElementById('mainFrame2_id'))){ //王炜5743修改,租赁申请项目类不是树组件
if(!Ext.isEmpty(document.getElementById('mainFrame2_id'))){
(document_category == 'PROJECT' ? document.getElementById('mainFrame2_id').contentWindow : self)['$'](dsId).query(); (document_category == 'PROJECT' ? document.getElementById('mainFrame2_id').contentWindow : self)['$'](dsId).query();
}else{ }else{
$(dsId).query(); $(dsId).query();
}
} }
} }
}
function current_win_close() {
$('${/parameter/@winId}').close(); function current_win_close() {
} $('${/parameter/@winId}').close();
}
function on_object_hd_calc_beforecommit(object, record, lov_record) {
var display_name = object.binder.name, function on_object_hd_calc_beforecommit(object, record, lov_record) {
exists_flag = false, var display_name = object.binder.name,
ds = object.binder.ds; exists_flag = false,
var all_records = ds.getAll(); ds = object.binder.ds;
for (var name in lov_record.data) { var all_records = ds.getAll();
if (name != 'value_code' && name != 'value_name') { for (var name in lov_record.data) {
for (var m = 0;m < all_records.length;m++) { if (name != 'value_code' && name != 'value_name') {
var single_record = all_records[m]; for (var m = 0;m < all_records.length;m++) {
if (single_record.get('column_name').toLowerCase() == name.toLowerCase()) { var single_record = all_records[m];
execute_hls_save_special_field(single_record, lov_record.get(name), false, lov_record.get(name + '_n')); if (single_record.get('column_name').toLowerCase() == name.toLowerCase()) {
} execute_hls_save_special_field(single_record, lov_record.get(name), false, lov_record.get(name + '_n'));
} }
} }
} }
} }
}
function on_object_ln_calc_beforecommit(object, record, lov_record) {
var display_name = object.binder.name, function on_object_ln_calc_beforecommit(object, record, lov_record) {
field = record.getField(display_name), var display_name = object.binder.name,
mapping = field.get('mapping'), field = record.getField(display_name),
exists_flag = false; mapping = field.get('mapping'),
for (var name in lov_record.data) { exists_flag = false;
exists_flag = false; for (var name in lov_record.data) {
for (var i = 0, exists_flag = false;
mapping_length = mapping.length;i < mapping_length;i++) { for (var i = 0,
if ((exists_flag = (name == mapping[i]['from']))) { mapping_length = mapping.length;i < mapping_length;i++) {
break; if ((exists_flag = (name == mapping[i]['from']))) {
} break;
} }
if (!exists_flag) { }
mapping.push({ if (!exists_flag) {
from: name, mapping.push({
to: name from: name,
}); to: name
} });
} }
field.setMapping(mapping);
} }
field.setMapping(mapping);
}
]]></script> ]]></script>
<a:dataSets> <a:dataSets>
<a:dataSet id="tax_type_codes_ds"> <a:dataSet id="tax_type_codes_ds">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment