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
6d7aa039
Commit
6d7aa039
authored
Nov 05, 2017
by
季圣华
Browse files
多账户单个金额中的数值优化
parent
9f8d3e60
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/webapp/js/common/common.js
View file @
6d7aa039
$
(
function
()
$
(
function
()
{
{
domresize
();
domresize
();
});
});
//========================页面高度自动调节================================
//========================页面高度自动调节================================
var
heightInfo
;
var
heightInfo
;
var
widthInfo
;
var
widthInfo
;
var
initPageSize
;
var
initPageSize
;
var
initPageNum
;
var
initPageNum
;
var
webH
;
var
webH
;
var
webW
;
var
webW
;
//改变表格宽高
//改变表格宽高
function
domresize
()
function
domresize
()
{
{
webH
=
document
.
documentElement
.
clientHeight
;
webH
=
document
.
documentElement
.
clientHeight
;
webW
=
document
.
documentElement
.
offsetWidth
;
webW
=
document
.
documentElement
.
offsetWidth
;
widthInfo
=
$
(
"
body
"
).
outerWidth
()
-
27
;
widthInfo
=
$
(
"
body
"
).
outerWidth
()
-
27
;
...
@@ -30,12 +30,12 @@ function domresize()
...
@@ -30,12 +30,12 @@ function domresize()
initPageSize
=
10
;
initPageSize
=
10
;
initPageNum
=
[
10
,
20
,
30
,
50
];
initPageNum
=
[
10
,
20
,
30
,
50
];
}
}
}
}
//========================页面高度自动调节================================
//========================页面高度自动调节================================
//判断浏览器的类型
//判断浏览器的类型
function
getOs
()
function
getOs
()
{
{
if
(
navigator
.
userAgent
.
indexOf
(
"
MSIE
"
)
>
0
)
if
(
navigator
.
userAgent
.
indexOf
(
"
MSIE
"
)
>
0
)
{
{
return
"
MSIE
"
;
return
"
MSIE
"
;
...
@@ -56,14 +56,14 @@ function getOs()
...
@@ -56,14 +56,14 @@ function getOs()
{
{
return
"
Gecko
"
;
return
"
Gecko
"
;
}
}
}
}
/**
/**
* js生成唯一ID值 32位值随机值
* js生成唯一ID值 32位值随机值
* @returns 生成的字符串
* @returns 生成的字符串
*/
*/
function
uuid
()
function
uuid
()
{
{
var
s
=
[];
var
s
=
[];
var
hexDigits
=
"
0123456789abcdef
"
;
var
hexDigits
=
"
0123456789abcdef
"
;
for
(
var
i
=
0
;
i
<
36
;
i
++
)
for
(
var
i
=
0
;
i
<
36
;
i
++
)
...
@@ -72,22 +72,22 @@ function uuid()
...
@@ -72,22 +72,22 @@ function uuid()
s
[
19
]
=
hexDigits
.
substr
((
s
[
19
]
&
0x3
)
|
0x8
,
1
);
// bits 6-7 of the clock_seq_hi_and_reserved to 01
s
[
19
]
=
hexDigits
.
substr
((
s
[
19
]
&
0x3
)
|
0x8
,
1
);
// bits 6-7 of the clock_seq_hi_and_reserved to 01
s
[
8
]
=
s
[
13
]
=
s
[
18
]
=
s
[
23
]
=
""
;
s
[
8
]
=
s
[
13
]
=
s
[
18
]
=
s
[
23
]
=
""
;
return
s
.
join
(
""
);
return
s
.
join
(
""
);
}
}
/**
/**
* js获取浏览器的地址参数
* js获取浏览器的地址参数
* @param name 地址参数
* @param name 地址参数
* @return
* @return
*/
*/
function
getUrlParam
(
name
)
{
function
getUrlParam
(
name
)
{
var
reg
=
new
RegExp
(
"
(^|&)
"
+
name
+
"
=([^&]*)(&|$)
"
);
//构造一个含有目标参数的正则表达式对象
var
reg
=
new
RegExp
(
"
(^|&)
"
+
name
+
"
=([^&]*)(&|$)
"
);
//构造一个含有目标参数的正则表达式对象
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
//匹配目标参数
var
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
reg
);
//匹配目标参数
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
//返回参数值
if
(
r
!=
null
)
return
unescape
(
r
[
2
]);
return
null
;
//返回参数值
}
}
/**
/**
* 获取按钮的权限
* 获取按钮的权限
*/
*/
function
getBtnStr
()
{
function
getBtnStr
()
{
var
funId
=
window
.
parent
.
window
.
funId
;
//功能id
var
funId
=
window
.
parent
.
window
.
funId
;
//功能id
var
btnStrList
=
window
.
parent
.
window
.
winBtnStrList
;
//按钮功能列表 JSON字符串
var
btnStrList
=
window
.
parent
.
window
.
winBtnStrList
;
//按钮功能列表 JSON字符串
var
btnEnableList
=
""
;
//按钮列表
var
btnEnableList
=
""
;
//按钮列表
...
@@ -105,12 +105,12 @@ function getBtnStr() {
...
@@ -105,12 +105,12 @@ function getBtnStr() {
}
}
}
}
return
btnEnableList
;
return
btnEnableList
;
}
}
/**
/**
* js获取当前时间, 格式“yyyy-MM-dd HH:MM:SS”
* js获取当前时间, 格式“yyyy-MM-dd HH:MM:SS”
*/
*/
function
getNowFormatDateTime
()
{
function
getNowFormatDateTime
()
{
var
date
=
new
Date
();
var
date
=
new
Date
();
var
seperator1
=
"
-
"
;
var
seperator1
=
"
-
"
;
var
seperator2
=
"
:
"
;
var
seperator2
=
"
:
"
;
...
@@ -138,12 +138,12 @@ function getNowFormatDateTime() {
...
@@ -138,12 +138,12 @@ function getNowFormatDateTime() {
+
"
"
+
strHours
+
seperator2
+
strMinutes
+
"
"
+
strHours
+
seperator2
+
strMinutes
+
seperator2
+
strSeconds
;
+
seperator2
+
strSeconds
;
return
currentdate
;
return
currentdate
;
}
}
/**
/**
* js获取当前时间, 格式“yyyy-MM”
* js获取当前时间, 格式“yyyy-MM”
*/
*/
function
getNowFormatMonth
()
{
function
getNowFormatMonth
()
{
var
date
=
new
Date
();
var
date
=
new
Date
();
var
seperator1
=
"
-
"
;
var
seperator1
=
"
-
"
;
var
month
=
date
.
getMonth
()
+
1
;
var
month
=
date
.
getMonth
()
+
1
;
...
@@ -152,12 +152,12 @@ function getNowFormatMonth() {
...
@@ -152,12 +152,12 @@ function getNowFormatMonth() {
}
}
var
currentdate
=
date
.
getFullYear
()
+
seperator1
+
month
;
var
currentdate
=
date
.
getFullYear
()
+
seperator1
+
month
;
return
currentdate
;
return
currentdate
;
}
}
/**
/**
* js获取当前时间, 格式“yyyy-MM-dd”
* js获取当前时间, 格式“yyyy-MM-dd”
*/
*/
function
getNowFormatDate
()
{
function
getNowFormatDate
()
{
var
date
=
new
Date
();
var
date
=
new
Date
();
var
seperator1
=
"
-
"
;
var
seperator1
=
"
-
"
;
var
seperator2
=
"
:
"
;
var
seperator2
=
"
:
"
;
...
@@ -171,12 +171,12 @@ function getNowFormatDate() {
...
@@ -171,12 +171,12 @@ function getNowFormatDate() {
}
}
var
currentdate
=
date
.
getFullYear
()
+
seperator1
+
month
+
seperator1
+
strDate
;
var
currentdate
=
date
.
getFullYear
()
+
seperator1
+
month
+
seperator1
+
strDate
;
return
currentdate
;
return
currentdate
;
}
}
/**
/**
* js获取当前时间, 格式“yyyyMMdd”
* js获取当前时间, 格式“yyyyMMdd”
*/
*/
function
getNowFormatDateTwo
()
{
function
getNowFormatDateTwo
()
{
var
date
=
new
Date
();
var
date
=
new
Date
();
var
month
=
date
.
getMonth
()
+
1
;
var
month
=
date
.
getMonth
()
+
1
;
var
strDate
=
date
.
getDate
();
var
strDate
=
date
.
getDate
();
...
@@ -188,12 +188,12 @@ function getNowFormatDateTwo() {
...
@@ -188,12 +188,12 @@ function getNowFormatDateTwo() {
}
}
var
currentdate
=
date
.
getFullYear
()
+
month
.
toString
()
+
strDate
.
toString
();
var
currentdate
=
date
.
getFullYear
()
+
month
.
toString
()
+
strDate
.
toString
();
return
currentdate
;
return
currentdate
;
}
}
/**
/**
* js根据时间生成编号, 格式“yyyyMMddHHMMSS”
* js根据时间生成编号, 格式“yyyyMMddHHMMSS”
*/
*/
function
getNowFormatDateNum
()
{
function
getNowFormatDateNum
()
{
var
date
=
new
Date
();
var
date
=
new
Date
();
var
seperator1
=
"
-
"
;
var
seperator1
=
"
-
"
;
var
seperator2
=
"
:
"
;
var
seperator2
=
"
:
"
;
...
@@ -220,8 +220,44 @@ function getNowFormatDateNum() {
...
@@ -220,8 +220,44 @@ function getNowFormatDateNum() {
var
currentdate
=
date
.
getFullYear
()
+
month
.
toString
()
+
strDate
.
toString
()
+
strHours
var
currentdate
=
date
.
getFullYear
()
+
month
.
toString
()
+
strDate
.
toString
()
+
strHours
+
strMinutes
+
strSeconds
;
+
strMinutes
+
strSeconds
;
return
currentdate
;
return
currentdate
;
}
}
function
encode
(
name
){
function
encode
(
name
){
return
encodeURI
(
encodeURI
(
name
));
return
encodeURI
(
encodeURI
(
name
));
}
}
\ No newline at end of file
/**
* 将数组单个金额中的数值转为正数
* @param arr
* @returns {Array}
*/
function
changeListFmtPlus
(
arr
)
{
var
newArr
=
new
Array
();
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
<
0
){
newArr
.
push
((
0
-
arr
[
i
]).
toString
());
}
else
{
newArr
.
push
((
arr
[
i
]
-
0
).
toString
());
}
}
return
newArr
;
}
/**
* 将数组单个金额中的数值转为负数
* @param arr
* @returns {Array}
*/
function
changeListFmtMinus
(
arr
)
{
var
newArr
=
new
Array
();
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
]
<
0
){
newArr
.
push
((
arr
[
i
]
-
0
).
toString
());
}
else
{
newArr
.
push
((
0
-
arr
[
i
]).
toString
());
}
}
return
newArr
;
}
\ No newline at end of file
src/main/webapp/js/pages/materials/in_out.js
View file @
6d7aa039
...
@@ -1683,6 +1683,7 @@
...
@@ -1683,6 +1683,7 @@
$("#AccountId").val("many"); //下拉框选中多账户
$("#AccountId").val("many"); //下拉框选中多账户
var accountArr = depotHeadInfo[22].split(",");
var accountArr = depotHeadInfo[22].split(",");
var accountMoneyArr = depotHeadInfo[23].split(",");
var accountMoneyArr = depotHeadInfo[23].split(",");
accountMoneyArr = changeListFmtPlus(accountMoneyArr) //将数组单个金额中的数值转为正数
if(listSubType == "零售" || listSubType == "零售退货") {
if(listSubType == "零售" || listSubType == "零售退货") {
var manyAccountMoney = 0; //多账户合计-零售
var manyAccountMoney = 0; //多账户合计-零售
...
@@ -1739,7 +1740,11 @@
...
@@ -1739,7 +1740,11 @@
for(var i = 0 ;i < accountList.length;i++){
for(var i = 0 ;i < accountList.length;i++){
var account = accountList[i];
var account = accountList[i];
if(accountArr[j] == account.id) {
if(accountArr[j] == account.id) {
accountIdShow = accountIdShow + account.name + "(" + accountMoneyArr[j] +"元) ";
var currentAccountMoney = accountMoneyArr[j]-0;
if(currentAccountMoney < 0){
currentAccountMoney = 0-currentAccountMoney;
}
accountIdShow = accountIdShow + account.name + "(" + currentAccountMoney +"元) ";
manyAccountMoney += accountMoneyArr[j]-0; //多账户合计-零售
manyAccountMoney += accountMoneyArr[j]-0; //多账户合计-零售
}
}
}
}
...
@@ -1984,10 +1989,16 @@
...
@@ -1984,10 +1989,16 @@
if($('#OrganId').length){
if($('#OrganId').length){
OrganId = $('#OrganId').combobox('getValue');
OrganId = $('#OrganId').combobox('getValue');
}
}
var accountMoneyList = $("#AccountId").attr("data-accountmoneyarr"); //账户金额列表-多账户
accountMoneyList = accountMoneyList.replace("[","").replace("]","").toString();
var reg=new RegExp("\"","g"); //创建正则RegExp对象
accountMoneyList = accountMoneyList.replace(reg,""); //替换所有的双引号
var accountMoneyArr = accountMoneyList.split(","); //转为数组
if(listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
if(listSubType === "采购"||listSubType === "零售退货"||listSubType === "销售退货"){
//付款为负数
//付款为负数
ChangeAmount = 0 - ChangeAmount;
ChangeAmount = 0 - ChangeAmount;
TotalPrice = 0 - TotalPrice;
TotalPrice = 0 - TotalPrice;
accountMoneyArr = changeListFmtMinus(accountMoneyArr); //将数组单个金额中的数值转为负数
}
}
//零售时候,可以从会员预付款中扣款
//零售时候,可以从会员预付款中扣款
var thisPayType = "现付";
var thisPayType = "现付";
...
@@ -2035,7 +2046,7 @@
...
@@ -2035,7 +2046,7 @@
PayType: thisPayType, //现付/预付款
PayType: thisPayType, //现付/预付款
Remark: $.trim($("#Remark").val()),
Remark: $.trim($("#Remark").val()),
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
AccountIdList: $("#AccountId").attr("data-accountarr"), //账户列表-多账户
AccountMoneyList:
$("#AccountId").attr("data-
account
m
oney
a
rr
"
), //账户金额列表-多账户
AccountMoneyList:
JSON.stringify(
account
M
oney
A
rr), //账户金额列表-多账户
Discount: $.trim($("#Discount").val()),
Discount: $.trim($("#Discount").val()),
DiscountMoney: $.trim($("#DiscountMoney").val()),
DiscountMoney: $.trim($("#DiscountMoney").val()),
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
...
...
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