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
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zhuxianfei
$Date: 2018年10月8日 下午5:50:32
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
<a:init-procedure>
<a:model-query model="basic.get_sys_default_time" rootPath="default_date"/>
</a:init-procedure>
<a:view>
<a:link id="acp_recoil_link" model="acp.ACP521.acp_invoice_recoil" modelaction="update"/>
<script type="text/javascript"><![CDATA[
//锁屏
function lock_window() {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
}
//解屏
function unlock_window() {
Leaf.Masker.unmask(Ext.getBody());
}
//退出
function acp_exit() {
$('acp_recoil_winId').close();
}
//保存
function acp_recoil_save() {
$('acp_invoice_recoil_ds').submit();
}
//确认反冲
function acp_recoil_confirm() {
var ds = $('acp_invoice_recoil_ds');
var record = ds.getAt(0);
var right_amount = record.get('reversed_amount') + record.get('left_amount');
if(!ds.validate()){
return;
}
if (record.get('reversed_amount') <= 0) {
Leaf.showMessage('提示', '反冲金额要大于等于0');
return;
} else if (record.get('reversed_amount') > record.get('total_amount')) {
Leaf.showMessage('提示', '反冲金额不得大于该发票的价税合计');
return;
}
else if (right_amount > record.get('total_amount')) {
Leaf.showMessage('提示', '反冲总金额不得大于该发票的价税合计');
return;
}
//反冲前保存
lock_window();
Leaf.request({
url: $('acp_recoil_link').getUrl(),
para: {
invoice_line_id: '${/parameter/@invoice_line_id}',
reversed_date: record.get('reversed_date'),
reversed_amount: record.get('reversed_amount')
},
success: function () {
Leaf.SideBar.show({
msg: '反冲成功!',
duration: 2000
});
unlock_window();
},
failure: function () {
unlock_window();
},
error: function () {
unlock_window();
},
scope: this
});
}
function acp_recoil_onLoad() {
var record = $('acp_invoice_recoil_ds').getAt(0);
var targetStr = '${/parameter/@agent_name}';
var inStr = '直销';
if (targetStr.indexOf(inStr) != -1) {
record.set('reversed_amount', '${/parameter/@lease_mgt_fee}');
} else {
record.set('reversed_amount', '');
}
record.set('reversed_date', '${/model/default_date/record/@now_date}');
}
]]></script>
<a:dataSets>
<a:dataSet id="acp_invoice_recoil_ds" autoPageSize="true" autoQuery="true"
model="acp.ACP521.acp_invoice_recoil"
queryUrl="${/request/@context_path}/autocrud/acp.ACP521.acp_invoice_recoil/query?invoice_line_id=${/parameter/@invoice_line_id}"
selectable="true">
<a:fields>
<a:field name="reversed_date" required="true" prompt="反冲日期"/>
<a:field name="reversed_amount" required="true" prompt="反冲金额"/>
</a:fields>
<a:events>
<a:event name="load" handler="acp_recoil_onLoad"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:form column="3" marginHight="170" title="应付发票反冲">
<a:textField name="invoice_code" bindTarget="acp_invoice_recoil_ds" prompt="发票代码" readOnly="true"/>
<a:textField name="invoice_number" bindTarget="acp_invoice_recoil_ds" prompt="发票代码" readOnly="true"/>
<a:datePicker name="invoice_date" bindTarget="acp_invoice_recoil_ds" prompt="开票日期"
renderer="Leaf.formatDate" readOnly="true"/>
<a:textField name="contract_id_n" bindTarget="acp_invoice_recoil_ds" prompt="合同名称" readOnly="true"/>
<a:numberField name="total_amount" bindTarget="acp_invoice_recoil_ds" prompt="价税合计" readOnly="true"/>
<a:textField name="invoice_status_n" bindTarget="acp_invoice_recoil_ds" prompt="发票状态" readOnly="true"/>
<a:datePicker name="invoice_date" bindTarget="acp_invoice_recoil_ds" prompt="发票日期"
renderer="Leaf.formatDate" readOnly="true"/>
<a:datePicker name="reversed_date" bindTarget="acp_invoice_recoil_ds" prompt="反冲日期"
renderer="Leaf.formatDate"/>
<a:textField name="reversed_amount" bindTarget="acp_invoice_recoil_ds" prompt="反冲金额"/>
</a:form>
<a:screenTopToolbar>
<!-- <a:screenTitle/>-->
<a:gridButton click="acp_exit" text="HLS.EXIT"/>
<!--<a:gridButton click="acp_recoil_save" text="HLS.SAVE"/>-->
<a:gridButton click="acp_recoil_confirm" text="确认反冲"/>
</a:screenTopToolbar>
</a:screenBody>
</a:view>
</a:screen>