修改财务管理部分财务明细未做操作时也可以保存

This commit is contained in:
qiankunpingtai
2019-05-22 16:40:05 +08:00
parent 79d4c7d24c
commit 3a78eb511a
7 changed files with 295 additions and 307 deletions

View File

@@ -896,59 +896,57 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -803,58 +803,56 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -819,58 +819,56 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -825,58 +825,56 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -815,58 +815,56 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -837,58 +837,56 @@ function CheckData() {
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) { function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
append(); append();
removeit(); removeit();
if ($("#accountData").datagrid('getChanges').length) { if (!CheckData())
if (!CheckData()) return false;
return false; var inserted = $("#accountData").datagrid('getChanges', "inserted");
var inserted = $("#accountData").datagrid('getChanges', "inserted"); var deleted = $("#accountData").datagrid('getChanges', "deleted");
var deleted = $("#accountData").datagrid('getChanges', "deleted"); var updated = $("#accountData").datagrid('getChanges', "updated");
var updated = $("#accountData").datagrid('getChanges', "updated"); $.ajax({
$.ajax({ type: "post",
type: "post", url: url,
url: url, dataType: "json",
dataType: "json", data: {
data: { inserted: JSON.stringify(inserted),
inserted: JSON.stringify(inserted), deleted: JSON.stringify(deleted),
deleted: JSON.stringify(deleted), updated: JSON.stringify(updated),
updated: JSON.stringify(updated), info : JSON.stringify({
info : JSON.stringify({ Type: listType,
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: ChangeAmount, //付款/收款/优惠/实付
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付 TotalPrice: TotalPrice, //合计
TotalPrice: TotalPrice, //合计 OrganId: OrganId,
OrganId: OrganId, HandsPersonId: $.trim($("#HandsPersonId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()), Remark: $.trim($("#Remark").val())
Remark: $.trim($("#Remark").val()) }),
}), listType: listType
listType: listType },
}, success: function (tipInfo)
success: function (tipInfo) {
{ if (tipInfo) {
if (tipInfo) { $.messager.alert('提示','保存成功!','info');
$.messager.alert('提示','保存成功!','info'); $('#accountHeadDlg').dialog('close');
$('#accountHeadDlg').dialog('close'); var opts = $("#tableData").datagrid('options');
var opts = $("#tableData").datagrid('options'); showAccountHeadDetails(opts.pageNumber, opts.pageSize);
showAccountHeadDetails(opts.pageNumber, opts.pageSize); if (endEditing()) {
if (endEditing()) { $('#accountData').datagrid('acceptChanges');
$('#accountData').datagrid('acceptChanges');
}
} }
else{
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
} }
}); else{
}
$.messager.show({
title: '错误提示',
msg: '保存信息失败,请稍后重试!'
});
}
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
} }

View File

@@ -202,7 +202,7 @@ public class SupplierService {
int result=0; int result=0;
try{ try{
if(supplier!=null){ if(supplier!=null){
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值 supplier.setAdvancein((supplier.getAdvancein()==null?BigDecimal.ZERO:supplier.getAdvancein()).add(advanceIn)); //增加预收款的金额,可能增加的是负值
result=supplierMapper.updateByPrimaryKeySelective(supplier); result=supplierMapper.updateByPrimaryKeySelective(supplier);
} }
}catch(Exception e){ }catch(Exception e){