新增账户流水功能
This commit is contained in:
@@ -9,6 +9,7 @@ import java.text.*;
|
||||
|
||||
import com.jsh.model.po.AccountHead;
|
||||
import com.jsh.model.po.AccountItem;
|
||||
import com.jsh.util.JshException;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
@@ -470,6 +471,46 @@ public class AccountAction extends BaseAction<AccountModel>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 账户流水信息
|
||||
*/
|
||||
public void findAccountInOutList(){
|
||||
PageUtil pageUtil = new PageUtil();
|
||||
pageUtil.setPageSize(model.getPageSize());
|
||||
pageUtil.setCurPage(model.getPageNo());
|
||||
Long accountId = model.getAccountID();
|
||||
try{
|
||||
accountService.findAccountInOutList(pageUtil, accountId);
|
||||
List dataList = pageUtil.getPageList();
|
||||
JSONObject outer = new JSONObject();
|
||||
outer.put("total", pageUtil.getTotalCount());
|
||||
//存放数据json数组
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if(dataList!=null){
|
||||
for(Integer i=0; i<dataList.size(); i++){
|
||||
JSONObject item = new JSONObject();
|
||||
Object dl = dataList.get(i); //获取对象
|
||||
Object[] arr = (Object[]) dl; //转为数组
|
||||
item.put("number", arr[0]); //单据编号
|
||||
item.put("type", arr[1]); //类型
|
||||
item.put("supplierName", arr[2]); //单位信息
|
||||
item.put("changeAmount", arr[3]); //金额
|
||||
item.put("operTime", arr[4]); //入库出库日期
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
outer.put("rows", dataArray);
|
||||
//回写查询结果
|
||||
toClient(outer.toString());
|
||||
}
|
||||
catch (JshException e) {
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>查找信息异常", e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>回写查询信息结果异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接搜索条件
|
||||
* @return
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseDAO;
|
||||
import com.jsh.model.po.Account;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.util.PageUtil;
|
||||
import com.jsh.util.SearchConditionUtil;
|
||||
import org.hibernate.Query;
|
||||
|
||||
public class AccountDAO extends BaseDAO<Account> implements AccountIDAO
|
||||
{
|
||||
@@ -14,4 +18,54 @@ public class AccountDAO extends BaseDAO<Account> implements AccountIDAO
|
||||
{
|
||||
return Account.class;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void findAccountInOutList(PageUtil<Account> pageUtil, Long accountId) throws JshException {
|
||||
StringBuffer queryString = new StringBuffer();
|
||||
queryString.append("select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime " +
|
||||
" from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id where 1=1 ");
|
||||
if(accountId!=null && !accountId.equals("")) {
|
||||
queryString.append(" and dh.AccountId='"+ accountId +"' ");
|
||||
}
|
||||
queryString.append("UNION ALL " +
|
||||
"select ah.BillNo,ah.Type as newType,s.supplier,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " +
|
||||
" from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id where 1=1 ");
|
||||
if(accountId!=null && !accountId.equals("")) {
|
||||
queryString.append(" and ah.AccountId='"+ accountId +"' ");
|
||||
}
|
||||
queryString.append("UNION ALL " +
|
||||
"select ah.BillNo,ah.Type as newType,s.supplier,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " +
|
||||
" from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id " +
|
||||
" inner join jsh_accountitem ai on ai.HeaderId=ah.Id " +
|
||||
" where ah.Type in ('收款','付款','收预付款') ");
|
||||
if(accountId!=null && !accountId.equals("")) {
|
||||
queryString.append(" and ai.AccountId='"+ accountId +"' ");
|
||||
}
|
||||
queryString.append("UNION ALL " +
|
||||
"select ah.BillNo,ah.Type as newType, '' as sName,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " +
|
||||
" from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " +
|
||||
" where ah.Type='转账' ");
|
||||
if(accountId!=null && !accountId.equals("")) {
|
||||
queryString.append(" and ah.AccountId='"+ accountId +"' ");
|
||||
}
|
||||
queryString.append("UNION ALL " +
|
||||
"select ah.BillNo,ah.Type as newType, '' as sName,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime " +
|
||||
" from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id " +
|
||||
" where ah.Type='转账' ");
|
||||
if(accountId!=null && !accountId.equals("")) {
|
||||
queryString.append(" and ai.AccountId='"+ accountId +"' ");
|
||||
}
|
||||
queryString.append(" ORDER BY oTime desc");
|
||||
Query query;
|
||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||
pageUtil.setTotalCount(query.list().size());
|
||||
// 分页查询
|
||||
int pageNo = pageUtil.getCurPage();
|
||||
int pageSize = pageUtil.getPageSize();
|
||||
if (0 != pageNo && 0 != pageSize) {
|
||||
query.setFirstResult((pageNo - 1) * pageSize);
|
||||
query.setMaxResults(pageSize);
|
||||
}
|
||||
pageUtil.setPageList(query.list());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.jsh.dao.basic;
|
||||
|
||||
import com.jsh.base.BaseIDAO;
|
||||
import com.jsh.model.po.Account;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountIDAO extends BaseIDAO<Account>
|
||||
{
|
||||
public interface AccountIDAO extends BaseIDAO<Account> {
|
||||
|
||||
public void findAccountInOutList(PageUtil<Account> pageUtil, Long accountId) throws JshException;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.jsh.service.basic;
|
||||
|
||||
import com.jsh.base.BaseIService;
|
||||
import com.jsh.model.po.Account;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public interface AccountIService extends BaseIService<Account>
|
||||
{
|
||||
|
||||
public void findAccountInOutList(PageUtil<Account> depotHead, Long accountId)throws JshException;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.jsh.service.basic;
|
||||
import com.jsh.base.BaseService;
|
||||
import com.jsh.dao.basic.AccountIDAO;
|
||||
import com.jsh.model.po.Account;
|
||||
import com.jsh.util.JshException;
|
||||
import com.jsh.util.PageUtil;
|
||||
|
||||
public class AccountService extends BaseService<Account> implements AccountIService
|
||||
{
|
||||
@@ -19,4 +21,8 @@ public class AccountService extends BaseService<Account> implements AccountIServ
|
||||
return Account.class;
|
||||
}
|
||||
|
||||
public void findAccountInOutList(PageUtil<Account> pageUtil, Long accountId) throws JshException {
|
||||
accountDao.findAccountInOutList(pageUtil, accountId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '名称',field: 'name',width:100},
|
||||
{ title: '编号', field: 'serialNo',width:100,align:"center"},
|
||||
{ title: '编号', field: 'serialNo',width:150,align:"center"},
|
||||
{ title: '期初金额', field: 'initialAmount',width:100,align:"center"},
|
||||
{ title: '当前余额', field: 'currentAmount',width:100,align:"center"},
|
||||
{ title: '备注',field: 'remark',width:100},
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
<div id = "tablePanel" class="easyui-panel" style="padding:1px;top:300px;" title="结算账户列表" iconCls="icon-list" collapsible="true" closable="false">
|
||||
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="accountDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true" modal="true" collapsible="false" closable="true">
|
||||
<table id="accountTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//初始化界面
|
||||
@@ -88,11 +92,18 @@
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ title: '名称',field: 'name',width:100},
|
||||
{ title: '编号', field: 'serialNo',width:100,align:"center"},
|
||||
{ title: '期初金额', field: 'initialAmount',width:100,align:"center"},
|
||||
{ title: '本月发生额', field: 'thisMonthAmount',width:100,align:"center"},
|
||||
{ title: '当前余额', field: 'currentAmount',width:100,align:"center"}
|
||||
{ title: '名称',field: 'name',width:100},
|
||||
{ title: '编号', field: 'serialNo',width:150,align:"center"},
|
||||
{ title: '期初金额', field: 'initialAmount',width:100,align:"center"},
|
||||
{ title: '本月发生额', field: 'thisMonthAmount',width:100,align:"center"},
|
||||
{ title: '当前余额', field: 'currentAmount',width:100,align:"center"},
|
||||
{ title: '操作', field: 'op',width:100,align:"center",formatter:function(value,rec) {
|
||||
var str = '';
|
||||
var rowInfo = rec.id;
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + rowInfo + '\');"/> <a onclick="showAccountInOutList(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">明细</a> ';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
@@ -184,6 +195,93 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountInOutList(accountInfo){
|
||||
var info = accountInfo.split("AaBb");
|
||||
var accountId = info[0];
|
||||
$('#accountDetailListDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
initAccountDetailData(accountId);
|
||||
getAccountInOutList(accountId,1,initPageSize);
|
||||
ininAccountDetailPager(accountId);
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initAccountDetailData(accountId){
|
||||
$('#accountTableData').datagrid({
|
||||
height:heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pagination: true,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ title: '单据编号',field: 'number',width:150},
|
||||
{ title: '类型', field: 'type',width:100},
|
||||
{ title: '单位信息', field: 'supplierName',width:150},
|
||||
{ title: '金额', field: 'changeAmount',width:80},
|
||||
{ title: '入库出库日期',field: 'operTime',width:180}
|
||||
]],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//分页信息处理
|
||||
function ininAccountDetailPager(accountId){
|
||||
try {
|
||||
var opts = $("#accountTableData").datagrid('options');
|
||||
var pager = $("#accountTableData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage:function(pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber:pageNum,
|
||||
pageSize:pageSize
|
||||
});
|
||||
getAccountInOutList(accountId,pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
function getAccountInOutList(accountId,pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "<%=path %>/account/findAccountInOutList.action",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
accountID: accountId,
|
||||
pageNo:pageNo,
|
||||
pageSize:pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
$("#accountTableData").datagrid('loadData',res);
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//报表打印
|
||||
function print() {
|
||||
$("#printBtn").off("click").on("click",function(){
|
||||
|
||||
Reference in New Issue
Block a user