多账户单个金额中的数值优化
This commit is contained in:
@@ -225,3 +225,39 @@ function getNowFormatDateNum() {
|
|||||||
function encode(name){
|
function encode(name){
|
||||||
return encodeURI(encodeURI(name));
|
return encodeURI(encodeURI(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将数组单个金额中的数值转为正数
|
||||||
|
* @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;
|
||||||
|
}
|
||||||
@@ -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 @@
|
|||||||
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 @@
|
|||||||
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 @@
|
|||||||
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-accountmoneyarr"), //账户金额列表-多账户
|
AccountMoneyList: JSON.stringify(accountMoneyArr), //账户金额列表-多账户
|
||||||
Discount: $.trim($("#Discount").val()),
|
Discount: $.trim($("#Discount").val()),
|
||||||
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
DiscountMoney: $.trim($("#DiscountMoney").val()),
|
||||||
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
DiscountLastMoney: $.trim($("#DiscountLastMoney").val()),
|
||||||
|
|||||||
Reference in New Issue
Block a user