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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: LR
$Date: 2013-7-18 上午09:34:43
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
<a:init-procedure>
<a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="acr514_currency_list"/>
<a:model-query fetchAll="true" model="acr.ACR512.acr_invoice_business_type_list" rootPath="acr514_business_type_list"/>
</a:init-procedure>
<a:view>
<a:link id="acr514_invoice_readonly_page" url="${/request/@context_path}/modules/cont/CON500/con_contract_update.lview"/>
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="acr514_update_for_submit_id" url="${/request/@context_path}/modules/acr/ACR512/acr_invoice_update_for_submit.lsc"/>
<a:link id="acr_invoice_reverse_apply_detail_link" url="${/request/@context_path}/modules/acr/ACR620/acr_invoice_reverse_apply_detail.lview"/>
<script><![CDATA[
function lock_current_window() {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
}
function unlock_current_window() {
Leaf.Masker.unmask(Ext.getBody());
}
function acr514_invoice_query() {
$('acr514_invoice_result_ds').query();
}
function acr514_invoice_reset() {
$('acr514_invoice_query_ds').reset();
}
function acr514_formatMoney(value, record, name) {
return Leaf.formatNumber(value);
}
function acr514_invoice_query_Onupdate(ds, record, name, value, oldVlaue) {
if (name == 'document_number_f') {
if (Leaf.isEmpty(record.get('document_number_t'))) {
record.set('document_number_t', value);
}
} else if (name == 'project_number_f') {
if (Leaf.isEmpty(record.get('project_number_t'))) {
record.set('project_number_t', value);
}
} else if (name == 'invoice_number_f') {
if (Leaf.isEmpty(record.get('invoice_number_t'))) {
record.set('invoice_number_t', value);
}
} else if (name == 'contract_number_f') {
if (Leaf.isEmpty(record.get('contract_number_t'))) {
record.set('contract_number_t', value);
}
} else if (name == 'invoice_bp_code_f') {
if (Leaf.isEmpty(record.get('invoice_bp_code_t'))) {
record.set('invoice_bp_code_t', value);
}
} else if (name == 'total_amount_f') {
if (Leaf.isEmpty(record.get('total_amount_t'))) {
record.set('total_amount_t', value);
}
}
if (Ext.isEmpty(record.get('project_number_f')) && Ext.isEmpty(record.get('project_number_t'))) {
record.set('query_project_number', '');
} else {
record.set('query_project_number', 'Y');
}
if (Ext.isEmpty(record.get('contract_number_f')) && Ext.isEmpty(record.get('contract_number_t'))) {
record.set('query_contract_number', '');
} else {
record.set('query_contract_number', 'Y');
}
}
function acr514_grid_query(reocrd_id, invoice_hd_id, status) {
var maintain_type = 'READONLY';
var currency_reocrd = $('acr514_invoice_result_ds').findById(reocrd_id);
var param = currency_reocrd.data;
param['function_code'] = 'ACR514';
param['document_id'] = invoice_hd_id;
param['function_usage'] = 'QUERY';
param['maintain_type'] = maintain_type;
param['url_title'] = '${l:ACR.INVOICE_DETAIL}';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'acr514_invoice_readonly_page', 'acr514_invoice_result_ds');
}
function acr514_document_number_render(value, record, name) {
return '<a href="javascript:acr514_grid_query(' + record.id + ',' + record.get('invoice_hd_id') + ',\'' + record.get('invoice_status') + '\');">' + value + '</a>';
}
function acr514_invoice_reverse() {
acr514_invoice_handle('REVERSE');
}
function acr514_invoice_invalid() {
acr514_invoice_handle('INVALID');
}
function is_over_month(start_str, end_str) {
var start = Leaf.formatDate(start_str);
var end = Leaf.formatDate(end_str);
var year = Number(end.substr(0, 4)) - Number(start.substr(0, 4));
var month = Number(end.substr(5, 2)) - Number(start.substr(5, 2));
var day = Number(end.substr(8, 2)) - Number(start.substr(8, 2));
if (year == 1 && month == -11 && day <= 0) {
return false;
}
if (year == 0 && month == 0) {
return false;
}
if (year == 0 && month == 1 && day <= 0) {
return false;
}
return true;
}
function acr514_invoice_handle(type) {
var ds = $('acr514_invoice_result_ds');
var records = ds.getSelected();
if (records.length == 0) {
return;
}
if (type == 'REVERSE') {
for (var i = 0;i < records.length;i++) {
if (records[i].get('invoice_kind') == '0') {
records[i].getField('vat_red_notice_num').setRequired(true);
}
}
} else if (type == 'INVALID') {
for (var i = 0;i < records.length;i++) {
if (is_over_month(records[i].get('invoice_date'), records[i].get('reverse_date'))) {
Leaf.showMessage('${l:HLS.PROMPT}', '单据号:' + records[i].get('document_number') + '日期跨月');
return;
}
}
// for (var i = 0;i < records.length;i++) {
// if (records[i].get('vat_interface_status')=='BACK') {
// Leaf.showMessage('${l:HLS.PROMPT}', '单据号:' + records[i].get('document_number') + '金税状态已回写,不可反冲');
// return;
// }
// }
for (var i = 0;i < records.length;i++) {
records[i].getField('vat_red_notice_num').setRequired(false);
}
} else {
return;
}
Leaf.showConfirm('${l:HLS.PROMPT}', '是否确认?', function() {
ds.submitSelected();
}, function() {
});
}
function acr514_invoice_result_ds_submitsuccess(ds) {
$('acr514_invoice_grid_id').clear();
}
function vat_red_notice_num_editorFunction(record, name) {
if (record.get('invoice_kind') == '0') {
if (name == 'vat_red_notice_num') {
return 'invoice_grid_tf';
}
}
return '';
}
function acr514_invoice_update(ds, record, name, value, oldVlaue)
{
var time,year,month,day,string;
var d,d_year_month;
if(name=='reverse_date')
{
time = new Date();
year = time.getFullYear();
month = time.getMonth()+1;
if(month<10)
string = String(year)+'0'+String(month);
else
string = String(year)+String(month);
d= new Date(value);
d_year=d.getFullYear();
d_month=d.getMonth()+1;
if(d_month<10)
d_year_month = String(d_year)+'0'+String(d_month);
else
d_year_month = String(d_year)+String(d_month);
//如果小于系统时间
if( d_year_month<string)
{
record.getField('vat_red_notice_num').setRequired(true);
}
else
{
record.getField('vat_red_notice_num').setRequired(false);
}
record.set(name,value);
}
}
function acr514_invoice_insert() {
var records = $('acr514_invoice_result_ds').getSelected();
if (records.length < 1) {
Leaf.showMessage('${l:HLS.PROMPT}', '请选择需要审批的发票!');
return;
}
var datas = {};
var saveData = [];
var invoice_hd_ids = '';
for (var i = 0; i < records.length; i++) {
if (invoice_hd_ids == '') {
invoice_hd_ids = records[i].get('invoice_hd_id');
} else {
invoice_hd_ids = invoice_hd_ids + ',' + records[i].get('invoice_hd_id');
}
records[i].set('_status', 'update');
saveData.push(records[i].data);
}
saveData.sort(function (a, b) {
return a.invoice_hd_id - b.invoice_hd_id;
});
datas['invoice_hd_ids'] = invoice_hd_ids;
datas['apply_mode'] = 'REVERSE';
datas['details'] = saveData;
Leaf.showConfirm('提示', '<span style="color: #ff0000; ">所选发票即将创建反冲申请!如需要取消发票反冲申请,请点击取消申请!</span>', function () {
lock_current_window();
Leaf.request({
url: $('acr514_update_for_submit_id').getUrl(),
para: datas,
success: function (res) {
Leaf.SideBar.show({
msg: '申请成功',
duration: 3000
});
unlock_current_window();
var win = new Leaf.Window({
id: 'acr_invoice_reverse_apply_detail_link_winid',
params: {
invoice_apply_id: res.result.invoice_apply_id,
winId: 'acr_invoice_reverse_apply_detail_link_winid'
},
url: $('acr_invoice_reverse_apply_detail_link').getUrl(),
title: '申请明细',
fullScreen: true
});
win.on('close',function(){
$('acr514_invoice_result_ds').query();
});
},
failure: function () {
unlock_current_window();
},
error: function () {
unlock_current_window();
},
scope: this
});
});
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="acr514_business_type_ds">
<a:datas dataSource="/model/acr514_business_type_list"/>
</a:dataSet>
<a:dataSet id="acr514_currency_ds">
<a:datas dataSource="/model/acr514_currency_list"/>
</a:dataSet>
<a:dataSet id="acr514_invoice_kind_ds" lookupCode="ACR510_INVOICE_KIND"/>
<a:dataSet id="acr514_invoice_statu_ds" lookupCode="ACR510_AR_INVOICE_STATUS"/>
<a:dataSet id="acr514_express_status_ds" lookupCode="ACR518_EXPRESS_STATUS"/>
<a:dataSet id="acr514_vat_interface_status_ds" lookupCode="ACR515_VAT_INTERFACE_STATUS"/>
<a:dataSet id="acr514_invoice_query_ds" autoCreate="true">
<a:fields>
<a:field name="currency_name" displayField="currency_name" options="acr514_currency_ds" returnField="currency" valueField="currency_code"/>
<a:field name="invoice_kind_desc" displayField="code_value_name" options="acr514_invoice_kind_ds" returnField="invoice_kind" valueField="code_value"/>
<a:field name="invoice_status_desc" displayField="code_value_name" options="acr514_invoice_statu_ds" returnField="invoice_status" valueField="code_value"/>
<a:field name="vat_interface_status_desc" displayField="code_value_name" options="acr514_vat_interface_status_ds" returnField="vat_interface_status" valueField="code_value"/>
<a:field name="business_type_desc" displayField="business_type_desc" options="acr514_business_type_ds" returnField="business_type" valueField="business_type"/>
<a:field name="created_by_name" lovGridHeight="320" lovHeight="500" lovService="acr.ACR512.acr_invoice_sys_user_lov" lovWidth="500" title="开票人选择">
<a:mapping>
<a:map from="user_id" to="created_by"/>
<a:map from="description" to="created_by_name"/>
</a:mapping>
</a:field>
<a:field name="confirmed_by_name" lovGridHeight="320" lovHeight="500" lovService="acr.ACR512.acr_invoice_sys_user_lov" lovWidth="500" title="复核人选择">
<a:mapping>
<a:map from="user_id" to="confirmed_by"/>
<a:map from="description" to="confirmed_by_name"/>
</a:mapping>
</a:field>
<a:field name="invoice_bp_code_f" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_bp_master_list" lovWidth="500" title="客户选择">
<a:mapping>
<a:map from="bp_code" to="invoice_bp_code_f"/>
</a:mapping>
</a:field>
<a:field name="invoice_bp_code_t" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_bp_master_list" lovWidth="500" title="客户选择">
<a:mapping>
<a:map from="bp_code" to="invoice_bp_code_t"/>
</a:mapping>
</a:field>
<a:field name="project_number_f" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_project_list" lovWidth="500" title="项目选择">
<a:mapping>
<a:map from="project_number" to="project_number_f"/>
</a:mapping>
</a:field>
<a:field name="project_number_t" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_project_list" lovWidth="500" title="项目选择">
<a:mapping>
<a:map from="project_number" to="project_number_t"/>
</a:mapping>
</a:field>
<a:field name="contract_number_f" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_contract_list" lovWidth="500" title="合同选择">
<a:mapping>
<a:map from="contract_number" to="contract_number_f"/>
</a:mapping>
</a:field>
<a:field name="contract_number_t" lovGridHeight="320" lovHeight="480" lovService="acr.ACR512.acr_invoice_contract_list" lovWidth="500" title="合同选择">
<a:mapping>
<a:map from="contract_number" to="contract_number_t"/>
</a:mapping>
</a:field>
<a:field name="received_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
<a:field name="express_status_name" displayField="code_value_name" options="acr514_express_status_ds" returnField="express_status" valueField="code_value"/>
</a:fields>
<a:events>
<a:event name="update" handler="acr514_invoice_query_Onupdate"/>
</a:events>
</a:dataSet>
<a:dataSet id="acr514_invoice_result_ds" autoQuery="true" autoPageSize="true" model="acr.ACR514.acr_invoice_reverse" queryDataSet="acr514_invoice_query_ds" selectable="true">
<!--<a:fields>
<a:field name="reverse_date" required="true"/>
</a:fields>
<a:events>
<a:event name="submitsuccess" handler="acr514_invoice_result_ds_submitsuccess"/>
<a:event name="update" handler="acr514_invoice_update"/>
</a:events>-->
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:toolbarButton click="acr514_invoice_query" text="HLS.QUERY"/>
<a:toolbarButton click="acr514_invoice_reset" text="HLS.RESET"/>
<!-- <a:toolbarButton click="acr514_invoice_reverse" text="HLS.REVERSE"/>-->
<!--<a:toolbarButton click="acr514_invoice_invalid" text="作废"/>-->
<a:toolbarButton click="acr514_invoice_insert" text="新建申请"/>
</a:screenTopToolbar>
<a:form marginWidth="30" padding="0" title="应收发票反冲" labelWidth="130">
<a:hBox labelSeparator="" labelWidth="120">
<a:textField name="document_number_f" bindTarget="acr514_invoice_query_ds" prompt="HLS.DOCUMENT_NUMBER_FROM" width="135"/>
<!--<div><![CDATA[${l:HLS.DOCUMENT_NUMBER_TO}]]></div>-->
<a:textField name="document_number_t" bindTarget="acr514_invoice_query_ds" prompt="单据号到" width="135"/>
<!-- <a:lov name="project_number_f" bindTarget="acr514_invoice_query_ds" prompt="HLS.PROJECT_NUMBER_FROM" width="135"/>-->
<!--<div><![CDATA[${l:HLS.DOCUMENT_NUMBER_TO}]]></div>-->
<!-- <a:lov name="project_number_t" bindTarget="acr514_invoice_query_ds" prompt="申请编号到" width="135"/>-->
<!-- <a:comboBox name="business_type_desc" bindTarget="acr514_invoice_query_ds" prompt="HLS.BUSINESS_TYPE_DESC" width="135"/>-->
<a:comboBox name="currency_name" bindTarget="acr514_invoice_query_ds" prompt="HLS.CURRENCY" width="135"/>-->
<a:textField name="invoice_number_f" bindTarget="acr514_invoice_query_ds" prompt="ACR.INVOICE_NUMBER_FROM" width="135"/>
<a:textField name="invoice_number_t" bindTarget="acr514_invoice_query_ds" prompt="发票编号到" width="135"/>
</a:hBox>
<a:hBox labelSeparator="" labelWidth="120">
<!--<div><![CDATA[${l:ACR.INVOICE_NUMBER_TO}]]></div>-->
<a:lov name="contract_number_f" bindTarget="acr514_invoice_query_ds" prompt="合同编号" width="135"/>
<!--<div><![CDATA[${l:HLS.CONTRACT_NUMBER_TO}]]></div>-->
<!--
<a:lov name="contract_number_t" bindTarget="acr514_invoice_query_ds" prompt="合同编号到" width="135"/>
-->
<a:comboBox name="invoice_kind_desc" bindTarget="acr514_invoice_query_ds" prompt="ACR.INVOICE_KIND" width="135"/>
<a:lov name="created_by_name" bindTarget="acr514_invoice_query_ds" prompt="创建人" width="135"/>
<a:datePicker name="invoice_date_f" bindTarget="acr514_invoice_query_ds" prompt="ACR.INVOICE_DATE_FROM" width="135"/>
<a:datePicker name="invoice_date_t" bindTarget="acr514_invoice_query_ds" prompt="发票日期到" width="135"/>
</a:hBox>
<a:hBox labelSeparator="" labelWidth="120">
<!--<div><![CDATA[${l:ACR.INVOICE_DATE_TO}]]></div>-->
<a:lov name="invoice_bp_code_f" bindTarget="acr514_invoice_query_ds" prompt="客户编号" width="135"/>
<!--<div><![CDATA[${l:HLS.CUSTOMER_NUMBER_TO}]]></div>-->
<!-- <a:lov name="invoice_bp_code_t" bindTarget="acr514_invoice_query_ds" prompt="客户编号到" width="135"/>-->
<a:textField name="invoice_title" bindTarget="acr514_invoice_query_ds" prompt="ACR.INVOICE_TITLE" width="135"/>
<a:lov name="confirmed_by_name" bindTarget="acr514_invoice_query_ds" prompt="确认人" width="135"/>
<a:datePicker name="accounting_date_f" bindTarget="acr514_invoice_query_ds" prompt="HLS.ACCOUNT_DATE_FROM" width="135"/>
<a:datePicker name="accounting_date_t" bindTarget="acr514_invoice_query_ds" prompt="记账日期到" width="135"/>
</a:hBox>
<a:hBox labelSeparator="" labelWidth="120">
<!--<div><![CDATA[${l:HLS.ACCOUNT_DATE_TO}]]></div>-->
<a:numberField name="total_amount_f" allowFormat="true" bindTarget="acr514_invoice_query_ds" prompt="ACR.TOTAL_AMOUNT_FROM" width="135"/>
<!--<div><![CDATA[${l:ACR.TOTAL_AMOUNT_TO}]]></div>-->
<a:numberField name="total_amount_t" allowFormat="true" bindTarget="acr514_invoice_query_ds" prompt="发票金额到" width="135"/>
<a:comboBox name="invoice_status_desc" bindTarget="acr514_invoice_query_ds" prompt="ACR.INVOICE_STATUS" width="135"/>
<a:comboBox name="vat_interface_status_desc" bindTarget="acr514_invoice_query_ds" prompt="金税状态" width="135"/>
</a:hBox>
</a:form>
<a:grid id="acr514_invoice_grid_id" bindTarget="acr514_invoice_result_ds" marginHeight="260" marginWidth="30" navBar="true">
<a:columns>
<a:column name="document_number" lock="true" prompt="HLS.DOCUMENT_NUMBER" renderer="acr514_document_number_render" width="120"/>
<a:column name="contract_name" autoAdjust="false" prompt="HLS.CONTRACT_NAME" showTitle="true" width="150"/>
<a:column name="invoice_bp_name" autoAdjust="false" prompt="HLS.CUSTOMER_NAME" showTitle="true" width="150"/>
<a:column name="business_type_desc" prompt="HLS.BUSINESS_TYPE_DESC" width="80"/>
<a:column name="invoice_kind_desc" prompt="ACR.INVOICE_KIND" width="100"/>
<!-- <a:column name="invoice_number" prompt="ACR.INVOICE_NUMBER" width="120"/>-->
<a:column name="invoice_date" prompt="ACR.INVOICE_DATE" width="100"/>
<!--<a:column name="reverse_date" editor="invoice_grid_dp" prompt="HLS.REVERSE_DATE" renderer="Leaf.formatDate" width="100"/>-->
<!-- <a:column name="vat_red_notice_num" editorFunction="vat_red_notice_num_editorFunction" prompt="ACR.VAT_RED_NOTICE_NUM" width="120"/>-->
<!-- <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" width="120"/>
<a:column name="bp_code" prompt="HLS.CUSTOMER_NUMBER" width="100"/> -->
<a:column name="invoice_title" autoAdjust="false" prompt="ACR.INVOICE_TITLE" showTitle="true" width="150"/>
<a:column name="total_amount" align="right" prompt="ACR.TOTAL_AMOUNT" renderer="Leaf.formatMoney" width="90"/>
<!-- <a:column name="currency" prompt="HLS.CURRENCY" width="80"/> -->
<a:column name="created_by_name" autoAdjust="false" prompt="创建人" showTitle="true" width="150"/>
<a:column name="confirmed_by_name" align="center" autoAdjust="false" prompt="确认人" showTitle="true" width="150"/>
<a:column name="invoice_status_desc" prompt="ACR.INVOICE_STATUS" width="100"/>
<a:column name="vat_interface_status_desc" prompt="ACR.VAT_INTERFACE_STATUS_NAME" width="100"/>
<a:column name="accounting_date" prompt="HLS.ACCOUNT_DATE" width="100"/>
<!--<a:column name="create_je_flag" align="center" prompt="ACR.CREATE_JE_FLAG" width="60"/>-->
<!-- <a:column name="project_number" prompt="HLS.PROJECT_NUMBER" width="120"/>
<a:column name="project_name" autoAdjust="false" prompt="HLS.PROJECT_NAME" showTitle="true" width="150"/> -->
</a:columns>
<!--<a:editors>
<a:datePicker id="invoice_grid_dp"/>
<a:textField id="invoice_grid_tf"/>
</a:editors>-->
</a:grid>
</a:screenBody>
</a:view>
</a:screen>