diff --git a/WebRoot/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class b/WebRoot/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class
index 61b23ea41..8cb4eb75c 100644
Binary files a/WebRoot/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class and b/WebRoot/WEB-INF/classes/com/jsh/action/materials/AccountHeadAction.class differ
diff --git a/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.class b/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.class
index 0c7635e07..d7007e90a 100644
Binary files a/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.class and b/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.class differ
diff --git a/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.hbm.xml b/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.hbm.xml
index f3c4ace33..c854333e3 100644
--- a/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.hbm.xml
+++ b/WebRoot/WEB-INF/classes/com/jsh/model/po/AccountHead.hbm.xml
@@ -1,51 +1,56 @@
-
-
-
-
-
-
-
-
-
-
- 类型(支出/收入/收款/付款/转账)
-
-
-
-
- 单位Id(收款/付款单位)
-
-
-
-
- 经手人Id
-
-
-
-
- 变动金额(优惠/收款/付款/实付)
-
-
-
-
- 账户(收款/付款)
-
-
-
-
- 单据编号
-
-
-
-
- 单据日期
-
-
-
-
- 备注
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 类型(支出/收入/收款/付款/转账)
+
+
+
+
+ 单位Id(收款/付款单位)
+
+
+
+
+ 经手人Id
+
+
+
+
+ 变动金额(优惠/收款/付款/实付)
+
+
+
+
+ 合计金额
+
+
+
+
+ 账户(收款/付款)
+
+
+
+
+ 单据编号
+
+
+
+
+ 单据日期
+
+
+
+
+ 备注
+
+
+
+
diff --git a/WebRoot/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class b/WebRoot/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class
index 66618000c..b89f35541 100644
Binary files a/WebRoot/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class and b/WebRoot/WEB-INF/classes/com/jsh/model/vo/materials/AccountHeadModel.class differ
diff --git a/WebRoot/js/pages/financial/financial_base.js b/WebRoot/js/pages/financial/financial_base.js
index 4c60833b3..54d87576a 100644
--- a/WebRoot/js/pages/financial/financial_base.js
+++ b/WebRoot/js/pages/financial/financial_base.js
@@ -201,13 +201,14 @@
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据编号',field: 'BillNo',width:100},
{ title: '单据时间 ',field: 'BillTime',width:100},
+ { title: '合计',field: 'TotalPrice',width:80},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.BillNo+ 'AaBb' + rec.BillTime+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.AccountName + 'AaBb' + rec.OrganId + 'AaBb' + rec.OrganName
- + 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount;
+ + 'AaBb' + rec.HandsPersonId + 'AaBb' + rec.HandsPersonName + 'AaBb' + rec.ChangeAmount + 'AaBb' + rec.TotalPrice;
if(1 == value)
{
str += '
查看 ';
@@ -247,7 +248,7 @@
}
//初始化表格数据-明细列表-编辑状态
- function initTableData_account(){
+ function initTableData_account(type,TotalPrice){
$('#accountData').datagrid({
height:300,
rownumbers: false,
@@ -260,10 +261,10 @@
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
- url: path + '/accountItem/findBy.action?HeaderId=' + accountHeadID,
pagination: true,
//交替出现背景
striped : true,
+ showFooter: true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
@@ -336,11 +337,31 @@
return;
}
});
+ $.ajax({
+ type:"post",
+ url: path + '/accountItem/findBy.action?HeaderId=' + accountHeadID,
+ dataType: "json",
+ success: function (res) {
+ var EachAmount = 0;
+ if(type === "edit") {
+ EachAmount = TotalPrice;
+ }
+ var array = [];
+ array.push({
+ "EachAmount": EachAmount
+ });
+ res.footer = array;
+ $("#accountData").datagrid('loadData',res);
+ },
+ error:function() {
+ $.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
+ }
+ });
}
//初始化表格数据-明细列表-查看状态
- function initTableData_account_show(){
+ function initTableData_account_show(TotalPrice){
$('#accountDataShow').datagrid({
height:300,
rownumbers: true,
@@ -353,10 +374,10 @@
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
- url: path + '/accountItem/findBy.action?HeaderId=' + accountHeadID,
pagination: true,
//交替出现背景
striped : true,
+ showFooter: true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
@@ -373,6 +394,23 @@
return;
}
});
+ $.ajax({
+ type:"post",
+ url: path + '/accountItem/findBy.action?HeaderId=' + accountHeadID,
+ dataType: "json",
+ success: function (res) {
+ var EachAmount = TotalPrice;
+ var array = [];
+ array.push({
+ "EachAmount": EachAmount
+ });
+ res.footer = array;
+ $("#accountDataShow").datagrid('loadData',res);
+ },
+ error:function() {
+ $.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
+ }
+ });
}
@@ -507,7 +545,7 @@
orgAccountHead = "";
accountHeadID = 0;
- initTableData_account(); //明细列表
+ initTableData_account("add"); //明细列表
reject(); //撤销下、刷新材料列表
url = path + '/accountHead/create.action';
}
@@ -523,12 +561,13 @@
$('#OrganId').combobox('setValue', accountHeadInfo[6]);
$("#HandsPersonId").val(accountHeadInfo[8]);
$("#ChangeAmount").val(accountHeadInfo[10]);
+ var TotalPrice = accountHeadInfo[11];
var editTitle = listTitle.replace("列表","信息");
$('#accountHeadDlg').dialog('open').dialog('setTitle','
编辑' + editTitle);
$(".window-mask").css({ width: webW ,height: webH});
accountHeadID = accountHeadInfo[0];
- initTableData_account(); //明细列表
+ initTableData_account("edit",TotalPrice); //明细列表
reject(); //撤销下、刷新列表
url = path + '/accountHead/update.action?accountHeadID=' + accountHeadInfo[0];
}
@@ -543,12 +582,13 @@
$('#OrganIdShow').text(accountHeadInfo[7]);
$("#HandsPersonIdShow").text(accountHeadInfo[9]);
$("#ChangeAmountShow").text(accountHeadInfo[10]);
+ var TotalPrice = accountHeadInfo[11];
var showTitle = listTitle.replace("列表","信息");
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','
查看' + showTitle);
$(".window-mask").css({ width: webW ,height: webH});
accountHeadID = accountHeadInfo[0];
- initTableData_account_show(); //明细列表-查看状态
+ initTableData_account_show(TotalPrice); //明细列表-查看状态
}
//绑定操作事件
@@ -590,7 +630,8 @@
else
{
var OrganId = null;
- var ChangeAmount = $.trim($("#ChangeAmount").val());
+ var ChangeAmount = $.trim($("#ChangeAmount").val());
+ var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
if(listType !=="转账"){
OrganId = $('#OrganId').combobox('getValue');
}
@@ -598,6 +639,10 @@
//支出为负数
ChangeAmount = 0 - ChangeAmount;
}
+ if(listType === "支出" || listType === "付款"){
+ //支出和付款为负数
+ TotalPrice = 0 - TotalPrice;
+ }
$.ajax({
type:"post",
url: url,
@@ -609,6 +654,7 @@
BillTime : $.trim($("#BillTime").val()),
AccountId: $.trim($("#AccountId").val()),
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
+ TotalPrice: TotalPrice, //合计
OrganId: OrganId,
HandsPersonId: $.trim($("#HandsPersonId").val()),
Remark: $.trim($("#Remark").val()),
@@ -628,8 +674,7 @@
{
accept(accountHeadID); //修改
}
-
-
+
$('#accountHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showAccountHeadDetails(opts.pageNumber,opts.pageSize);
@@ -698,6 +743,30 @@
}
});
}
+
+ //自动计算事件
+ function autoReckon() {
+ //延时绑定事件
+ setTimeout(function(){
+ var body =$("#accountHeadFM .datagrid-body");
+ var footer =$("#accountHeadFM .datagrid-footer");
+ var input = ".datagrid-editable-input";
+
+ //修改金额,自动计算单价和合计
+ body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
+ var TotalPrice = 0;
+ var EachAmount =$(this).val()-0; //金额
+ body.find("[field='EachAmount']").each(function(){
+ if($(this).find("div").text()!==""){
+ TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
+ }
+ });
+ TotalPrice = TotalPrice + EachAmount;
+ footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
+ });
+ },500);
+ }
+
//结束编辑
function endEditing() {
var edField = "";
@@ -728,6 +797,7 @@
$('#accountData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
+ autoReckon();
} else {
$('#accountData').datagrid('selectRow', editIndex);
}
@@ -739,6 +809,7 @@
$('#accountData').datagrid('appendRow', {});
editIndex = $('#accountData').datagrid('getRows').length - 1;
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
+ autoReckon();
}
}
//删除
diff --git a/WebRoot/js/pages/materials/in_out.js b/WebRoot/js/pages/materials/in_out.js
index 64c4763dd..5b92e57b4 100644
--- a/WebRoot/js/pages/materials/in_out.js
+++ b/WebRoot/js/pages/materials/in_out.js
@@ -786,13 +786,11 @@
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
- //changeAmountFn(); //改变账户金额
closeDialog();
}
else
{
accept(depotHeadID); //修改
- //changeAmountFn(); //改变账户金额
closeDialog();
}
}
@@ -1056,28 +1054,6 @@
}
}
}
- //改变账户金额
- function changeAmountFn(){
- var currentAmount = $("#AccountId option:selected").attr("data-currentamount")-0;
- var ChangeAmount = $("#ChangeAmount").val()-0;
- var oldChangeAmount = $("#ChangeAmount").attr("data-changeamount")-0;
- $.ajax({
- url: path + "/account/updateAmount.action",
- type: "get",
- dataType: "json",
- data:{
- accountID: $("#AccountId").val(),
- currentAmount: currentAmount + ChangeAmount - oldChangeAmount
- },
- success: function(res){
-
- },
- error:function(){
- $.messager.alert('提示','请检查网络连接!','error');
- return;
- }
- });
- }
diff --git a/src/com/jsh/action/materials/AccountHeadAction.java b/src/com/jsh/action/materials/AccountHeadAction.java
index cbb0093ec..3a055bdbc 100644
--- a/src/com/jsh/action/materials/AccountHeadAction.java
+++ b/src/com/jsh/action/materials/AccountHeadAction.java
@@ -69,6 +69,7 @@ public class AccountHeadAction extends BaseAction
if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
accountHead.setChangeAmount(model.getChangeAmount());
+ accountHead.setTotalPrice(model.getTotalPrice());
if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));}
accountHead.setBillNo(model.getBillNo());
try
@@ -154,6 +155,7 @@ public class AccountHeadAction extends BaseAction
if(model.getOrganId()!=null){accountHead.setOrganId(new Supplier(model.getOrganId()));}
if(model.getHandsPersonId()!=null){accountHead.setHandsPersonId(new Person(model.getHandsPersonId()));}
accountHead.setChangeAmount(model.getChangeAmount());
+ accountHead.setTotalPrice(model.getTotalPrice());
if(model.getAccountId()!=null){accountHead.setAccountId(new Account(model.getAccountId()));}
accountHead.setBillNo(model.getBillNo());
try
@@ -255,6 +257,7 @@ public class AccountHeadAction extends BaseAction
item.put("BillNo", accountHead.getBillNo());
item.put("BillTime", Tools.getCurrentMonth(accountHead.getBillTime()));
item.put("ChangeAmount", accountHead.getChangeAmount()==null?"":Math.abs(accountHead.getChangeAmount()));
+ item.put("TotalPrice", accountHead.getTotalPrice()==null?"":Math.abs(accountHead.getTotalPrice()));
item.put("Remark", accountHead.getRemark());
item.put("op", 1);
dataArray.add(item);
diff --git a/src/com/jsh/model/po/AccountHead.hbm.xml b/src/com/jsh/model/po/AccountHead.hbm.xml
index f3c4ace33..c854333e3 100644
--- a/src/com/jsh/model/po/AccountHead.hbm.xml
+++ b/src/com/jsh/model/po/AccountHead.hbm.xml
@@ -1,51 +1,56 @@
-
-
-
-
-
-
-
-
-
-
- 类型(支出/收入/收款/付款/转账)
-
-
-
-
- 单位Id(收款/付款单位)
-
-
-
-
- 经手人Id
-
-
-
-
- 变动金额(优惠/收款/付款/实付)
-
-
-
-
- 账户(收款/付款)
-
-
-
-
- 单据编号
-
-
-
-
- 单据日期
-
-
-
-
- 备注
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 类型(支出/收入/收款/付款/转账)
+
+
+
+
+ 单位Id(收款/付款单位)
+
+
+
+
+ 经手人Id
+
+
+
+
+ 变动金额(优惠/收款/付款/实付)
+
+
+
+
+ 合计金额
+
+
+
+
+ 账户(收款/付款)
+
+
+
+
+ 单据编号
+
+
+
+
+ 单据日期
+
+
+
+
+ 备注
+
+
+
+
diff --git a/src/com/jsh/model/po/AccountHead.java b/src/com/jsh/model/po/AccountHead.java
index 4c2dc7506..ac4b5de97 100644
--- a/src/com/jsh/model/po/AccountHead.java
+++ b/src/com/jsh/model/po/AccountHead.java
@@ -10,6 +10,7 @@ public class AccountHead implements java.io.Serializable
private Supplier OrganId;
private Person HandsPersonId;
private Double ChangeAmount;
+ private Double TotalPrice;
private Account AccountId;
private String BillNo;
private Timestamp BillTime;
@@ -26,14 +27,15 @@ public class AccountHead implements java.io.Serializable
}
public AccountHead(String type, Supplier organId,
- Person handsPersonId, Double changeAmount, Account accountId,
- String billNo, Timestamp billTime, String remark)
+ Person handsPersonId, Double changeAmount, Double totalPrice,
+ Account accountId, String billNo, Timestamp billTime, String remark)
{
super();
Type = type;
OrganId = organId;
HandsPersonId = handsPersonId;
ChangeAmount = changeAmount;
+ TotalPrice = totalPrice;
AccountId = accountId;
BillNo = billNo;
BillTime = billTime;
@@ -89,8 +91,16 @@ public class AccountHead implements java.io.Serializable
{
return ChangeAmount;
}
+
+ public void setTotalPrice(Double totalPrice) {
+ TotalPrice = totalPrice;
+ }
+
+ public Double getTotalPrice() {
+ return TotalPrice;
+ }
- public void setAccountId(Account accountId)
+ public void setAccountId(Account accountId)
{
AccountId = accountId;
}
diff --git a/src/com/jsh/model/vo/materials/AccountHeadModel.java b/src/com/jsh/model/vo/materials/AccountHeadModel.java
index 41ac20646..0c0b14324 100644
--- a/src/com/jsh/model/vo/materials/AccountHeadModel.java
+++ b/src/com/jsh/model/vo/materials/AccountHeadModel.java
@@ -12,6 +12,7 @@ public class AccountHeadModel implements Serializable
private Long OrganId;
private Long HandsPersonId;
private Double ChangeAmount;
+ private Double TotalPrice;
private Long AccountId;
private String BillNo;
private String BillTime;
@@ -94,7 +95,15 @@ public class AccountHeadModel implements Serializable
return ChangeAmount;
}
- public void setAccountId(Long accountId)
+ public void setTotalPrice(Double totalPrice) {
+ TotalPrice = totalPrice;
+ }
+
+ public Double getTotalPrice() {
+ return TotalPrice;
+ }
+
+ public void setAccountId(Long accountId)
{
AccountId = accountId;
}