给财务单据增加合计的功能
This commit is contained in:
parent
4a632b58d7
commit
a1701cce81
Binary file not shown.
Binary file not shown.
@ -27,6 +27,11 @@
|
||||
<comment>变动金额(优惠/收款/付款/实付)</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="TotalPrice" type="java.lang.Double">
|
||||
<column name="TotalPrice" precision="22" scale="3">
|
||||
<comment>合计金额</comment>
|
||||
</column>
|
||||
</property>
|
||||
<many-to-one name="AccountId" class="com.jsh.model.po.Account" lazy="false">
|
||||
<column name="AccountId">
|
||||
<comment>账户(收款/付款)</comment>
|
||||
|
||||
Binary file not shown.
@ -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 += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/> <a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a> ';
|
||||
@ -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','<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + 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','<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = accountHeadInfo[0];
|
||||
initTableData_account_show(); //明细列表-查看状态
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
@ -591,6 +631,7 @@
|
||||
{
|
||||
var OrganId = null;
|
||||
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()),
|
||||
@ -629,7 +675,6 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
|
||||
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ public class AccountHeadAction extends BaseAction<AccountHeadModel>
|
||||
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<AccountHeadModel>
|
||||
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<AccountHeadModel>
|
||||
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);
|
||||
|
||||
@ -27,6 +27,11 @@
|
||||
<comment>变动金额(优惠/收款/付款/实付)</comment>
|
||||
</column>
|
||||
</property>
|
||||
<property generated="never" lazy="false" name="TotalPrice" type="java.lang.Double">
|
||||
<column name="TotalPrice" precision="22" scale="3">
|
||||
<comment>合计金额</comment>
|
||||
</column>
|
||||
</property>
|
||||
<many-to-one name="AccountId" class="com.jsh.model.po.Account" lazy="false">
|
||||
<column name="AccountId">
|
||||
<comment>账户(收款/付款)</comment>
|
||||
|
||||
@ -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;
|
||||
@ -90,7 +92,15 @@ public class AccountHead implements java.io.Serializable
|
||||
return ChangeAmount;
|
||||
}
|
||||
|
||||
public void setAccountId(Account accountId)
|
||||
public void setTotalPrice(Double totalPrice) {
|
||||
TotalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public Double getTotalPrice() {
|
||||
return TotalPrice;
|
||||
}
|
||||
|
||||
public void setAccountId(Account accountId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user