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
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2013-10-3 上午10:23:10
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure>
<a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="currency_path"/>
<a:model-query fetchAll="true" model="gld.gld_exchangerate_type_lov" rootPath="exchangerate_type_path"/>
<a:model-query fetchAll="true" model="csh.CSH511.csh_transaction_default_exchange_rate_type" rootPath="default_exchange_rate_type_path"/>
</a:init-procedure>
<a:view>
<a:link id="con_contract_inception_execute_link_id" model="cont.CON500.con_contract_inception_execute" modelaction="update"/>
<a:link id="get_exchange_rate_link_id" model="basic.hls_get_exchange_rate" modelaction="update"/>
<a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
<a:link id="con_contract_inception_link_id" url="${/request/@context_path}/modules/cont/CON503/con_contract_inception.lview"/>
<script type="text/javascript"><![CDATA[
var ajax_flag = 'N';
function con503_con_contract_inception_quit() {
location.href = $('sys_service_welcome_link').getUrl();
parent.shMenu('show');
}
function on_con_contract_inception_sure() {
lock_list_inception_window();
var current_ds = $('con_contract_inception_ds');
if (current_ds.validate()) {
var current_record = current_ds.getCurrentRecord();
var confirm_win = Leaf.showConfirm('${l:PROMPT}', '${l:HLS.CONTRACT_NUMBER}:' + current_record.get('contract_number') + ',${l:CON500.CONTRACT_INCEPTION_CONFIRM}', function() {
ajax_flag = 'Y';
Leaf.request({
url: $('con_contract_inception_execute_link_id').getUrl(),
para: current_record.data,
success: function(res) {
parent.Leaf.SideBar.enable = true;
parent.Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
window.location.href = $('con_contract_inception_link_id').getUrl();
},
error: function(res) {
unlock_list_inception_window();
},
faliure: function() {
unlock_list_inception_window();
},
scope: this
});
}, function(res) {
unlock_list_inception_window();
});
confirm_win.on('close', function() {
if (ajax_flag == 'N') {
unlock_list_inception_window();
}
});
} else {
unlock_list_inception_window();
}
}
function lock_list_inception_window() {
Leaf.Masker.mask(document.documentElement, '${l:HLS.EXECUTING}');
}
function unlock_list_inception_window() {
Leaf.Masker.unmask(document.documentElement);
}
function on_con_contract_inception_update(ds, record, name, value, oldvalue) {
if (name == 'rate_method_code' || name == 'inception_of_lease') {
if (record.get('currency') != '${/model/default_exchange_rate_type_path/record/@functional_currency_code}') {
var rate_method_code = record.get('rate_method_code');
record.set('exchange_rate_quotation', '');
record.set('exchange_rate', '');
if (rate_method_code == 'PERIOD' || rate_method_code == 'DAILY' || rate_method_code == 'FIXED') {
record.getField('exchange_rate').setReadOnly(true);
record.set('exchange_rate', '');
getExchangeRate({
fromCur: '${/model/default_exchange_rate_type_path/record/@functional_currency_code}',
toCur: record.get('currency'),
exchangeRateType: record.get('exchange_rate_type'),
exchangeDate: record.get('inception_of_lease')
});
} else {
record.getField('exchange_rate').setReadOnly(false);
record.set('exchange_rate', '');
}
}
} else if (name == 'currency') {
record.set('rate_method_code', '');
record.set('exchange_rate_quotation', '');
record.set('exchange_rate_type', '');
record.set('exchange_rate_type_display', '');
if (!Ext.isEmpty(value)) {
if (value == '${/model/default_exchange_rate_type_path/record/@functional_currency_code}') {
record.getField('base_rate_new').setRequired(false);
record.getField('base_rate_new').setReadOnly(true);
record.getField('exchange_rate_type_display').setRequired(false);
record.getField('exchange_rate_type_display').setReadOnly(true);
record.set('base_rate_new', '');
record.set('exchange_rate', 1);
} else {
record.set('exchange_rate', '');
record.getField('base_rate_new').setReadOnly(false);
record.getField('base_rate_new').setRequired(true);
record.getField('exchange_rate_type_display').setRequired(true);
record.getField('exchange_rate_type_display').setReadOnly(false);
}
}
} else if (name == 'base_rate_new') {
if (!Ext.isEmpty(value) && (value <= 0 || value >= 1)) {
Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.BASE_RATE_LIMIT}');
setTimeout(function() {
record.set('base_rate_new', '');
}, 1);
}
}
}
function getExchangeRate(param) {
Leaf.request({
url: $('get_exchange_rate_link_id').getUrl(),
para: {
from_currency: param.fromCur,
to_currency: param.toCur,
exchange_date: param.exchangeDate,
exchange_rate_type: param.exchangeRateType
},
success: setRateAndQuotation,
scope: this
});
}
function setRateAndQuotation(res) {
var record = $('con_contract_inception_ds').getAt(0);
if (Ext.isDefined(res.result.exchange_rate)) {
record.set('exchange_rate', res.result.exchange_rate);
}
if (Ext.isDefined(res.result.exchange_rate_quotation)) {
record.set('exchange_rate_quotation', res.result.exchange_rate_quotation);
} else {
record.set('exchange_rate_quotation', 'DIRECT QUOTATION');
}
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&function_code=CON502"/>
<a:dataSets>
<a:dataSet id="currency_ds">
<a:datas dataSource="/model/currency_path"/>
</a:dataSet>
<a:dataSet id="exchangerate_type_ds">
<a:datas dataSource="/model/exchangerate_type_path"/>
</a:dataSet>
<a:dataSet id="con_contract_inception_ds" autoCreate="true">
<a:fields>
<a:field name="contract_number" lovGridHeight="350" lovHeight="530" lovService="basic.con_contract_for_lov?document_type=PRJCON&inception_flag=N" lovWidth="550" required="true" title="HLS.CONTRACT">
<a:mapping>
<a:map from="contract_id" to="contract_id"/>
<a:map from="contract_number" to="contract_number"/>
<a:map from="contract_name" to="contract_name"/>
<a:map from="currency" to="currency"/>
<a:map from="currency_desc" to="currency_desc"/>
<a:map from="base_rate" to="base_rate_new"/>
</a:mapping>
</a:field>
<a:field name="contract_name" readOnly="true"/>
<a:field name="currency_desc" displayField="currency_name" options="currency_ds" readOnly="true" returnField="currency" valueField="currency_code"/>
<a:field name="currency"/>
<a:field name="inception_of_lease" required="true"/>
<a:field name="exchange_rate_type_display" displayField="type_name" options="exchangerate_type_ds" readOnly="true" returnField="exchange_rate_type" valueField="type_code">
<a:mapping>
<a:map from="type_code" to="exchange_rate_type"/>
<a:map from="rate_method_code" to="rate_method_code"/>
</a:mapping>
</a:field>
<a:field name="exchange_rate_type"/>
<a:field name="rate_method_code"/>
<a:field name="exchange_rate" readOnly="true"/>
<a:field name="base_rate_new" readOnly="true"/>
</a:fields>
<a:events>
<a:event name="update" handler="on_con_contract_inception_update"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton click="con503_con_contract_inception_quit" text="HLS.EXIT"/>
<a:gridButton click="on_con_contract_inception_sure" text="HLS.CONTRACT_INCEPTION"/>
</a:screenTopToolbar>
<a:form column="2" labelWidth="120" marginWidth="800" title="HLS.CONTRACT_INCEPTION">
<a:lov name="contract_number" bindTarget="con_contract_inception_ds" prompt="HLS.CONTRACT_NUMBER"/>
<a:textField name="contract_name" bindTarget="con_contract_inception_ds" prompt="HLS.CONTRACT_NAME"/>
<a:datePicker name="inception_of_lease" bindTarget="con_contract_inception_ds" prompt="HLS.INCEPTION_OF_LEASE"/>
<a:comboBox name="currency_desc" bindTarget="con_contract_inception_ds" prompt="HLS.CURRENCY"/>
<a:comboBox name="exchange_rate_type_display" bindTarget="con_contract_inception_ds" prompt="HLS.EXCHANGE_RATE_TYPE_DESC"/>
<a:numberField name="exchange_rate" allowNegative="false" bindTarget="con_contract_inception_ds" decimalPrecision="-1" prompt="HLS.EXCHANGE_RATE"/>
<a:percentField name="base_rate_new" bindTarget="con_contract_inception_ds" decimalPrecision="-1" prompt="HLS.BASE_RATE"/>
</a:form>
</a:screenBody>
</a:view>
</a:screen>