Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
c40e8e5a
Commit
c40e8e5a
authored
Jan 15, 2017
by
季圣华
Browse files
重构五张财务单据的js
parent
68d3c33d
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
WebRoot/js/pages/financial/financial_base.js
View file @
c40e8e5a
...
@@ -13,6 +13,13 @@
...
@@ -13,6 +13,13 @@
var
accountHeadID
=
0
;
var
accountHeadID
=
0
;
var
orgAccountHead
=
""
;
//保存编辑前的名称
var
orgAccountHead
=
""
;
//保存编辑前的名称
var
editIndex
=
undefined
;
var
editIndex
=
undefined
;
var
listTitle
=
""
;
//单据标题
var
payTypeTitle
=
""
;
//收入 支出
var
organUrl
=
""
;
//组织数据接口地址
var
itemType
=
true
;
//隐藏当前列
var
moneyType
=
true
;
//隐藏当前列
var
inOrOut
=
""
;
//链接类型为收入或者支出
getType
();
initSystemData_person
();
//经手人数据
initSystemData_person
();
//经手人数据
initSelectInfo_person
();
//经手人信息
initSelectInfo_person
();
//经手人信息
initSystemData_account
();
//账户数据
initSystemData_account
();
//账户数据
...
@@ -24,7 +31,52 @@
...
@@ -24,7 +31,52 @@
bindEvent
();
//绑定操作事件
bindEvent
();
//绑定操作事件
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
});
});
//根据单据名称获取类型
function
getType
(){
listTitle
=
$
(
"
#tablePanel
"
).
prev
().
text
();
var
supUrl
=
path
+
"
/supplier/findBySelect_sup.action
"
;
//供应商接口
var
cusUrl
=
path
+
"
/supplier/findBySelect_cus.action
"
;
//客户接口
if
(
listTitle
===
"
收入单列表
"
){
listType
=
"
收入
"
;
itemType
=
false
;
//显示当前列
moneyType
=
true
;
//隐藏当前列
payTypeTitle
=
"
收入项目
"
;
inOrOut
=
"
in
"
;
organUrl
=
supUrl
;
}
else
if
(
listTitle
===
"
支出单列表
"
){
listType
=
"
支出
"
;
itemType
=
false
;
//显示当前列
moneyType
=
true
;
//隐藏当前列
payTypeTitle
=
"
支出项目
"
;
inOrOut
=
"
out
"
;
organUrl
=
cusUrl
;
}
else
if
(
listTitle
===
"
收款单列表
"
){
listType
=
"
收款
"
;
itemType
=
true
;
//隐藏当前列
moneyType
=
false
;
//显示当前列
payTypeTitle
=
"
无标题
"
;
inOrOut
=
""
;
organUrl
=
supUrl
;
}
else
if
(
listTitle
===
"
付款单列表
"
){
listType
=
"
付款
"
;
itemType
=
true
;
//隐藏当前列
moneyType
=
false
;
//显示当前列
payTypeTitle
=
"
无标题
"
;
inOrOut
=
""
;
organUrl
=
cusUrl
;
}
else
if
(
listTitle
===
"
转账单列表
"
){
listType
=
"
转账
"
;
itemType
=
true
;
//隐藏当前列
moneyType
=
false
;
//显示当前列
payTypeTitle
=
"
无标题
"
;
inOrOut
=
""
;
organUrl
=
supUrl
;
}
}
//获取账户信息
//获取账户信息
function
initSystemData_account
(){
function
initSystemData_account
(){
$
.
ajax
({
$
.
ajax
({
...
@@ -51,7 +103,7 @@
...
@@ -51,7 +103,7 @@
if
(
accountList
!=
null
)
if
(
accountList
!=
null
)
{
{
options
=
""
;
options
=
""
;
for
(
var
i
=
0
;
i
<
accountList
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
accountList
.
length
;
i
++
)
{
{
var
account
=
accountList
[
i
];
var
account
=
accountList
[
i
];
options
+=
'
<option value="
'
+
account
.
id
+
'
">
'
+
account
.
name
+
'
</option>
'
;
options
+=
'
<option value="
'
+
account
.
id
+
'
">
'
+
account
.
name
+
'
</option>
'
;
...
@@ -63,7 +115,7 @@
...
@@ -63,7 +115,7 @@
//初始化单位信息
//初始化单位信息
function
initSupplier
(){
function
initSupplier
(){
$
(
'
#OrganId
'
).
combobox
({
$
(
'
#OrganId
'
).
combobox
({
url
:
path
+
"
/supplier/findBySelect_sup.action
"
,
url
:
organUrl
,
valueField
:
'
id
'
,
valueField
:
'
id
'
,
textField
:
'
supplier
'
textField
:
'
supplier
'
});
});
...
@@ -218,7 +270,7 @@
...
@@ -218,7 +270,7 @@
pageList
:
[
50
,
100
,
150
],
pageList
:
[
50
,
100
,
150
],
columns
:[[
columns
:[[
{
field
:
'
Id
'
,
width
:
35
,
align
:
"
center
"
,
checkbox
:
true
},
{
field
:
'
Id
'
,
width
:
35
,
align
:
"
center
"
,
checkbox
:
true
},
{
title
:
'
收入项目
'
,
field
:
'
InOutItemId
'
,
width
:
230
,
{
title
:
payTypeTitle
,
field
:
'
InOutItemId
'
,
width
:
230
,
hidden
:
itemType
,
formatter
:
function
(
value
,
row
,
index
){
formatter
:
function
(
value
,
row
,
index
){
return
row
.
InOutItemName
;
return
row
.
InOutItemName
;
},
},
...
@@ -228,7 +280,21 @@
...
@@ -228,7 +280,21 @@
valueField
:
'
Id
'
,
valueField
:
'
Id
'
,
textField
:
'
InOutItemName
'
,
textField
:
'
InOutItemName
'
,
method
:
'
get
'
,
method
:
'
get
'
,
url
:
path
+
"
/inOutItem/findBySelect.action?type=in
"
url
:
path
+
"
/inOutItem/findBySelect.action?type=
"
+
inOrOut
}
}
},
{
title
:
'
账户名称
'
,
field
:
'
AccountId
'
,
width
:
230
,
hidden
:
moneyType
,
formatter
:
function
(
value
,
row
,
index
){
return
row
.
AccountName
;
},
editor
:{
type
:
'
combobox
'
,
options
:{
valueField
:
'
Id
'
,
textField
:
'
AccountName
'
,
method
:
'
get
'
,
url
:
path
+
"
/account/findBySelect.action
"
}
}
}
}
},
},
...
@@ -277,7 +343,7 @@
...
@@ -277,7 +343,7 @@
function
initTableData_account_show
(){
function
initTableData_account_show
(){
$
(
'
#accountDataShow
'
).
datagrid
({
$
(
'
#accountDataShow
'
).
datagrid
({
height
:
300
,
height
:
300
,
rownumbers
:
fals
e
,
rownumbers
:
tru
e
,
//动画效果
//动画效果
animate
:
false
,
animate
:
false
,
//选中单行
//选中单行
...
@@ -296,8 +362,8 @@
...
@@ -296,8 +362,8 @@
pageSize
:
50
,
pageSize
:
50
,
pageList
:
[
50
,
100
,
150
],
pageList
:
[
50
,
100
,
150
],
columns
:[[
columns
:[[
{
field
:
'
Id
'
,
width
:
35
,
align
:
"
center
"
,
checkbox
:
tru
e
},
{
title
:
payTypeTitle
,
field
:
'
InOutItemName
'
,
width
:
230
,
hidden
:
itemTyp
e
},
{
title
:
'
收入项目
'
,
field
:
'
InOutItem
Name
'
,
width
:
230
}
,
{
title
:
'
账户名称
'
,
field
:
'
Account
Name
'
,
width
:
230
,
hidden
:
moneyType
},
{
title
:
'
金额
'
,
field
:
'
EachAmount
'
,
width
:
50
},
{
title
:
'
金额
'
,
field
:
'
EachAmount
'
,
width
:
50
},
{
title
:
'
备注
'
,
field
:
'
Remark
'
,
width
:
150
}
{
title
:
'
备注
'
,
field
:
'
Remark
'
,
width
:
150
}
]],
]],
...
@@ -434,7 +500,8 @@
...
@@ -434,7 +500,8 @@
function
addAccountHead
(){
function
addAccountHead
(){
$
(
"
#clientIp
"
).
val
(
clientIp
);
$
(
"
#clientIp
"
).
val
(
clientIp
);
$
(
'
#accountHeadFM
'
).
form
(
'
clear
'
);
$
(
'
#accountHeadFM
'
).
form
(
'
clear
'
);
$
(
'
#accountHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加财务信息
'
);
var
addTitle
=
listTitle
.
replace
(
"
列表
"
,
"
信息
"
);
$
(
'
#accountHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加
'
+
addTitle
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
#BillNo
"
).
val
(
""
).
focus
();
$
(
"
#BillNo
"
).
val
(
""
).
focus
();
...
@@ -455,13 +522,14 @@
...
@@ -455,13 +522,14 @@
$
(
"
#AccountId
"
).
val
(
accountHeadInfo
[
4
]);
$
(
"
#AccountId
"
).
val
(
accountHeadInfo
[
4
]);
$
(
'
#OrganId
'
).
combobox
(
'
setValue
'
,
accountHeadInfo
[
6
]);
$
(
'
#OrganId
'
).
combobox
(
'
setValue
'
,
accountHeadInfo
[
6
]);
$
(
"
#HandsPersonId
"
).
val
(
accountHeadInfo
[
8
]);
$
(
"
#HandsPersonId
"
).
val
(
accountHeadInfo
[
8
]);
$
(
"
#ChangeAmount
"
).
val
(
accountHeadInfo
[
10
]);
$
(
"
#ChangeAmount
"
).
val
(
accountHeadInfo
[
10
]);
$
(
'
#accountHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑财务信息
'
);
var
editTitle
=
listTitle
.
replace
(
"
列表
"
,
"
信息
"
);
$
(
'
#accountHeadDlg
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑
'
+
editTitle
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
accountHeadID
=
accountHeadInfo
[
0
];
accountHeadID
=
accountHeadInfo
[
0
];
initTableData_account
();
//明细列表
initTableData_account
();
//明细列表
reject
();
//撤销下、刷新
材料
列表
reject
();
//撤销下、刷新列表
url
=
path
+
'
/accountHead/update.action?accountHeadID=
'
+
accountHeadInfo
[
0
];
url
=
path
+
'
/accountHead/update.action?accountHeadID=
'
+
accountHeadInfo
[
0
];
}
}
...
@@ -475,7 +543,8 @@
...
@@ -475,7 +543,8 @@
$
(
'
#OrganIdShow
'
).
text
(
accountHeadInfo
[
7
]);
$
(
'
#OrganIdShow
'
).
text
(
accountHeadInfo
[
7
]);
$
(
"
#HandsPersonIdShow
"
).
text
(
accountHeadInfo
[
9
]);
$
(
"
#HandsPersonIdShow
"
).
text
(
accountHeadInfo
[
9
]);
$
(
"
#ChangeAmountShow
"
).
text
(
accountHeadInfo
[
10
]);
$
(
"
#ChangeAmountShow
"
).
text
(
accountHeadInfo
[
10
]);
$
(
'
#accountHeadDlgShow
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/list.png"/> 查看财务信息
'
);
var
showTitle
=
listTitle
.
replace
(
"
列表
"
,
"
信息
"
);
$
(
'
#accountHeadDlgShow
'
).
dialog
(
'
open
'
).
dialog
(
'
setTitle
'
,
'
<img src="
'
+
path
+
'
/js/easyui-1.3.5/themes/icons/list.png"/> 查看
'
+
showTitle
);
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
$
(
"
.window-mask
"
).
css
({
width
:
webW
,
height
:
webH
});
accountHeadID
=
accountHeadInfo
[
0
];
accountHeadID
=
accountHeadInfo
[
0
];
...
@@ -520,18 +589,27 @@
...
@@ -520,18 +589,27 @@
return
;
return
;
else
else
{
{
var
OrganId
=
null
;
var
ChangeAmount
=
$
.
trim
(
$
(
"
#ChangeAmount
"
).
val
());
if
(
listType
!==
"
转账
"
){
OrganId
=
$
(
'
#OrganId
'
).
combobox
(
'
getValue
'
);
}
if
(
listType
===
"
支出
"
){
//支出为负数
ChangeAmount
=
0
-
ChangeAmount
;
}
$
.
ajax
({
$
.
ajax
({
type
:
"
post
"
,
type
:
"
post
"
,
url
:
url
,
url
:
url
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
async
:
false
,
async
:
false
,
data
:
({
data
:
({
Type
:
"
收入
"
,
Type
:
listType
,
BillNo
:
$
.
trim
(
$
(
"
#BillNo
"
).
val
()),
BillNo
:
$
.
trim
(
$
(
"
#BillNo
"
).
val
()),
BillTime
:
$
.
trim
(
$
(
"
#BillTime
"
).
val
()),
BillTime
:
$
.
trim
(
$
(
"
#BillTime
"
).
val
()),
AccountId
:
$
.
trim
(
$
(
"
#AccountId
"
).
val
()),
AccountId
:
$
.
trim
(
$
(
"
#AccountId
"
).
val
()),
ChangeAmount
:
$
.
trim
(
$
(
"
#
ChangeAmount
"
).
val
()),
ChangeAmount
:
ChangeAmount
,
//付款/收款/优惠/实付
OrganId
:
$
(
'
#
OrganId
'
).
combobox
(
'
getValue
'
)
,
OrganId
:
OrganId
,
HandsPersonId
:
$
.
trim
(
$
(
"
#HandsPersonId
"
).
val
()),
HandsPersonId
:
$
.
trim
(
$
(
"
#HandsPersonId
"
).
val
()),
Remark
:
$
.
trim
(
$
(
"
#Remark
"
).
val
()),
Remark
:
$
.
trim
(
$
(
"
#Remark
"
).
val
()),
clientIp
:
clientIp
clientIp
:
clientIp
...
@@ -601,7 +679,7 @@
...
@@ -601,7 +679,7 @@
url
:
path
+
"
/accountHead/findBy.action
"
,
url
:
path
+
"
/accountHead/findBy.action
"
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
data
:
({
data
:
({
Type
:
"
收入
"
,
Type
:
listType
,
BillNo
:
$
.
trim
(
$
(
"
#searchBillNo
"
).
val
()),
BillNo
:
$
.
trim
(
$
(
"
#searchBillNo
"
).
val
()),
BeginTime
:
$
(
"
#searchBeginTime
"
).
val
(),
BeginTime
:
$
(
"
#searchBeginTime
"
).
val
(),
EndTime
:
$
(
"
#searchEndTime
"
).
val
(),
EndTime
:
$
(
"
#searchEndTime
"
).
val
(),
...
@@ -621,12 +699,21 @@
...
@@ -621,12 +699,21 @@
});
});
}
}
//结束编辑
//结束编辑
function
endEditing
()
{
function
endEditing
()
{
var
edField
=
""
;
if
(
!
itemType
){
edField
=
"
InOutItemId
"
;
edName
=
"
InOutItemName
"
;
}
else
{
edField
=
"
AccountId
"
;
edName
=
"
AccountName
"
;
}
if
(
editIndex
==
undefined
)
{
return
true
}
if
(
editIndex
==
undefined
)
{
return
true
}
if
(
$
(
'
#accountData
'
).
datagrid
(
'
validateRow
'
,
editIndex
))
{
if
(
$
(
'
#accountData
'
).
datagrid
(
'
validateRow
'
,
editIndex
))
{
var
ed
=
$
(
'
#accountData
'
).
datagrid
(
'
getEditor
'
,
{
index
:
editIndex
,
field
:
'
InOutItemId
'
});
var
ed
=
$
(
'
#accountData
'
).
datagrid
(
'
getEditor
'
,
{
index
:
editIndex
,
field
:
edField
});
var
InOutItem
Name
=
$
(
ed
.
target
).
combobox
(
'
getText
'
);
var
text
Name
=
$
(
ed
.
target
).
combobox
(
'
getText
'
);
$
(
'
#accountData
'
).
datagrid
(
'
getRows
'
)[
editIndex
][
'
InOutItem
Name
'
]
=
InOutItem
Name
;
$
(
'
#accountData
'
).
datagrid
(
'
getRows
'
)[
editIndex
][
ed
Name
]
=
text
Name
;
$
(
'
#accountData
'
).
datagrid
(
'
endEdit
'
,
editIndex
);
$
(
'
#accountData
'
).
datagrid
(
'
endEdit
'
,
editIndex
);
editIndex
=
undefined
;
editIndex
=
undefined
;
return
true
;
return
true
;
...
@@ -671,9 +758,16 @@
...
@@ -671,9 +758,16 @@
var
row
=
$
(
'
#accountData
'
).
datagrid
(
'
getRows
'
);
var
row
=
$
(
'
#accountData
'
).
datagrid
(
'
getRows
'
);
var
totalRowNum
=
""
;
var
totalRowNum
=
""
;
for
(
var
i
=
0
;
i
<
row
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
row
.
length
;
i
++
)
{
if
(
row
[
i
].
InOutItemId
==
""
)
{
if
(
!
itemType
){
totalRowNum
+=
(
i
+
1
)
+
"
、
"
;
if
(
row
[
i
].
InOutItemId
==
""
)
{
}
totalRowNum
+=
(
i
+
1
)
+
"
、
"
;
}
}
else
{
if
(
row
[
i
].
AccountId
==
""
)
{
totalRowNum
+=
(
i
+
1
)
+
"
、
"
;
}
}
}
}
if
(
totalRowNum
!=
""
)
{
if
(
totalRowNum
!=
""
)
{
var
totalRowNum
=
totalRowNum
.
substring
(
0
,
totalRowNum
.
length
-
1
);
var
totalRowNum
=
totalRowNum
.
substring
(
0
,
totalRowNum
.
length
-
1
);
...
...
WebRoot/js/pages/materials/in_out.js
View file @
c40e8e5a
...
@@ -456,7 +456,7 @@
...
@@ -456,7 +456,7 @@
function
initTableData_material_show
(
TotalPrice
){
function
initTableData_material_show
(
TotalPrice
){
$
(
'
#materialDataShow
'
).
datagrid
({
$
(
'
#materialDataShow
'
).
datagrid
({
height
:
300
,
height
:
300
,
rownumbers
:
fals
e
,
rownumbers
:
tru
e
,
//动画效果
//动画效果
animate
:
false
,
animate
:
false
,
//选中单行
//选中单行
...
@@ -471,7 +471,6 @@
...
@@ -471,7 +471,6 @@
striped
:
true
,
striped
:
true
,
showFooter
:
true
,
showFooter
:
true
,
//loadFilter: pagerFilter,
//loadFilter: pagerFilter,
rownumbers
:
true
,
onClickRow
:
onClickRow
,
onClickRow
:
onClickRow
,
pageSize
:
50
,
pageSize
:
50
,
pageList
:
[
50
,
100
,
150
],
pageList
:
[
50
,
100
,
150
],
...
...
WebRoot/pages/financial/giro.jsp
View file @
c40e8e5a
This diff is collapsed.
Click to expand it.
WebRoot/pages/financial/item_out.jsp
View file @
c40e8e5a
This diff is collapsed.
Click to expand it.
WebRoot/pages/financial/money_in.jsp
View file @
c40e8e5a
This diff is collapsed.
Click to expand it.
WebRoot/pages/financial/money_out.jsp
View file @
c40e8e5a
This diff is collapsed.
Click to expand it.
src/com/jsh/action/materials/AccountHeadAction.java
View file @
c40e8e5a
...
@@ -254,7 +254,7 @@ public class AccountHeadAction extends BaseAction<AccountHeadModel>
...
@@ -254,7 +254,7 @@ public class AccountHeadAction extends BaseAction<AccountHeadModel>
item
.
put
(
"AccountName"
,
accountHead
.
getAccountId
()==
null
?
""
:
accountHead
.
getAccountId
().
getName
());
item
.
put
(
"AccountName"
,
accountHead
.
getAccountId
()==
null
?
""
:
accountHead
.
getAccountId
().
getName
());
item
.
put
(
"BillNo"
,
accountHead
.
getBillNo
());
item
.
put
(
"BillNo"
,
accountHead
.
getBillNo
());
item
.
put
(
"BillTime"
,
Tools
.
getCurrentMonth
(
accountHead
.
getBillTime
()));
item
.
put
(
"BillTime"
,
Tools
.
getCurrentMonth
(
accountHead
.
getBillTime
()));
item
.
put
(
"ChangeAmount"
,
accountHead
.
getChangeAmount
());
item
.
put
(
"ChangeAmount"
,
accountHead
.
getChangeAmount
()
==
null
?
""
:
Math
.
abs
(
accountHead
.
getChangeAmount
())
);
item
.
put
(
"Remark"
,
accountHead
.
getRemark
());
item
.
put
(
"Remark"
,
accountHead
.
getRemark
());
item
.
put
(
"op"
,
1
);
item
.
put
(
"op"
,
1
);
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment