优化对账单
This commit is contained in:
@@ -739,13 +739,11 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
|
|||||||
PageUtil pageUtil = new PageUtil();
|
PageUtil pageUtil = new PageUtil();
|
||||||
pageUtil.setPageSize(model.getPageSize());
|
pageUtil.setPageSize(model.getPageSize());
|
||||||
pageUtil.setCurPage(model.getPageNo());
|
pageUtil.setCurPage(model.getPageNo());
|
||||||
Long pid =model.getProjectId();
|
|
||||||
String dids =model.getDepotIds();
|
|
||||||
String beginTime = model.getBeginTime();
|
String beginTime = model.getBeginTime();
|
||||||
String endTime = model.getEndTime();
|
String endTime = model.getEndTime();
|
||||||
Long organId = model.getOrganId();
|
Long organId = model.getOrganId();
|
||||||
try{
|
try{
|
||||||
depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId, pid, dids);
|
depotHeadService.findStatementAccount(pageUtil, beginTime, endTime, organId);
|
||||||
List dataList = pageUtil.getPageList();
|
List dataList = pageUtil.getPageList();
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", pageUtil.getTotalCount());
|
outer.put("total", pageUtil.getTotalCount());
|
||||||
@@ -757,15 +755,10 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
|
|||||||
Object dl = dataList.get(i); //获取对象
|
Object dl = dataList.get(i); //获取对象
|
||||||
Object[] arr = (Object[]) dl; //转为数组
|
Object[] arr = (Object[]) dl; //转为数组
|
||||||
item.put("number", arr[0]); //单据编号
|
item.put("number", arr[0]); //单据编号
|
||||||
item.put("materialName", arr[1]); //商品名称
|
item.put("changeAmount", arr[1]); //金额
|
||||||
item.put("materialModel", arr[2]); //商品型号
|
item.put("totalPrice", arr[2]); //金额
|
||||||
item.put("unitPrice", arr[3]); //单价
|
item.put("supplierName", arr[3]); //供应商
|
||||||
item.put("operNumber", arr[4]); //入库出库数量
|
item.put("operTime", arr[4]); //入库出库日期
|
||||||
item.put("allPrice", arr[5]); //金额
|
|
||||||
item.put("supplierName", arr[6]); //供应商
|
|
||||||
item.put("depotName", arr[7]); //仓库
|
|
||||||
item.put("operTime", arr[8]); //入库出库日期
|
|
||||||
item.put("type", arr[9]); //单据类型
|
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,24 +129,22 @@ public class DepotHeadDAO extends BaseDAO<DepotHead> implements DepotHeadIDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException {
|
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException {
|
||||||
StringBuffer queryString = new StringBuffer();
|
StringBuffer queryString = new StringBuffer();
|
||||||
queryString.append("select dh.Number,m.`name`,m.Model,di.UnitPrice,di.OperNumber,di.AllPrice,s.supplier,d.dName,date_format(dh.OperTime, '%Y-%m-%d'),dh.type " +
|
queryString.append("select dh.Number,dh.ChangeAmount,dh.TotalPrice,s.supplier,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh " +
|
||||||
"from jsh_depothead dh inner join jsh_depotitem di on di.HeaderId=dh.id " +
|
"inner join jsh_supplier s on s.id=dh.OrganId where s.type!='会员' " +
|
||||||
"inner join jsh_material m on m.id=di.MaterialId " +
|
"and dh.OperTime >='"+ beginTime +"' and dh.OperTime<='"+ endTime +"' ");
|
||||||
"inner join jsh_supplier s on s.id=dh.OrganId " +
|
|
||||||
"inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId " +
|
|
||||||
"where s.type!='会员' and dh.OperTime >='"+ beginTime +"' and dh.OperTime <='"+ endTime +"' ");
|
|
||||||
if(pid!=null){
|
|
||||||
queryString.append(" and di.DepotId=" + pid );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
queryString.append(" and di.DepotId in (" + dids + ")" );
|
|
||||||
}
|
|
||||||
if(organId!=null && !organId.equals("")) {
|
if(organId!=null && !organId.equals("")) {
|
||||||
queryString.append(" and dh.OrganId='"+ organId +"'");
|
queryString.append(" and dh.OrganId='"+ organId +"' ");
|
||||||
}
|
}
|
||||||
queryString.append(" ORDER BY OperTime DESC,Number desc");
|
queryString.append("UNION ALL " +
|
||||||
|
"select ah.BillNo,ah.ChangeAmount,ah.TotalPrice,s.supplier,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah " +
|
||||||
|
"inner join jsh_supplier s on s.id=ah.OrganId where s.type!='会员' " +
|
||||||
|
"and ah.BillTime >='"+ beginTime +"' and ah.BillTime<='"+ endTime +"' ");
|
||||||
|
if(organId!=null && !organId.equals("")) {
|
||||||
|
queryString.append(" and ah.OrganId='"+ organId +"' ");
|
||||||
|
}
|
||||||
|
queryString.append(" ORDER BY oTime");
|
||||||
Query query;
|
Query query;
|
||||||
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createSQLQuery(queryString + SearchConditionUtil.getCondition(pageUtil.getAdvSearch()));
|
||||||
pageUtil.setTotalCount(query.list().size());
|
pageUtil.setTotalCount(query.list().size());
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface DepotHeadIDAO extends BaseIDAO<DepotHead>
|
|||||||
|
|
||||||
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException;
|
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId) throws JshException;
|
||||||
|
|
||||||
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException;
|
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException;
|
||||||
|
|
||||||
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException;
|
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface DepotHeadIService extends BaseIService<DepotHead>
|
|||||||
|
|
||||||
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException;
|
public void findMaterialsListByHeaderId(PageUtil pageUtil,Long headerId)throws JshException;
|
||||||
|
|
||||||
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId, Long pid,String dids)throws JshException;
|
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime, Long organId)throws JshException;
|
||||||
|
|
||||||
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam)throws JshException;
|
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam)throws JshException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public class DepotHeadService extends BaseService<DepotHead> implements DepotHea
|
|||||||
depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId);
|
depotHeadDao.findMaterialsListByHeaderId(pageUtil, headerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId,Long pid,String dids) throws JshException {
|
public void findStatementAccount(PageUtil pageUtil,String beginTime,String endTime,Long organId) throws JshException {
|
||||||
depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId, pid, dids);
|
depotHeadDao.findStatementAccount(pageUtil, beginTime, endTime, organId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException {
|
public void getHeaderIdByMaterial(PageUtil pageUtil,String materialParam) throws JshException {
|
||||||
|
|||||||
@@ -30,11 +30,6 @@
|
|||||||
<div id = "searchPanel" class="easyui-panel" style="padding:10px;" title="查询窗口" iconCls="icon-search" collapsible="true" closable="false">
|
<div id = "searchPanel" class="easyui-panel" style="padding:10px;" title="查询窗口" iconCls="icon-search" collapsible="true" closable="false">
|
||||||
<table id="searchTable">
|
<table id="searchTable">
|
||||||
<tr>
|
<tr>
|
||||||
<td>仓库:</td>
|
|
||||||
<td>
|
|
||||||
<select name="searchProjectId" id="searchProjectId" style="width:100px;"></select>
|
|
||||||
</td>
|
|
||||||
<td> </td>
|
|
||||||
<td>单位名称:</td>
|
<td>单位名称:</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="OrganId" name="OrganId" style="width:100px;" />
|
<input id="OrganId" name="OrganId" style="width:100px;" />
|
||||||
@@ -65,9 +60,6 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var path = "<%=path %>";
|
var path = "<%=path %>";
|
||||||
var depotList = null;
|
|
||||||
var depotID = null;
|
|
||||||
var depotString = ""; //仓库列表
|
|
||||||
var cusUrl = path + "/supplier/findBySelect_cus.action?UBType=UserCustomer&UBKeyId=" + uid; //客户接口
|
var cusUrl = path + "/supplier/findBySelect_cus.action?UBType=UserCustomer&UBKeyId=" + uid; //客户接口
|
||||||
//初始化界面
|
//初始化界面
|
||||||
$(function()
|
$(function()
|
||||||
@@ -76,112 +68,14 @@
|
|||||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||||
$("#searchBeginTime").val(thisDate + "-01 00:00:00");
|
$("#searchBeginTime").val(thisDate + "-01 00:00:00");
|
||||||
$("#searchEndTime").val(thisDateTime);
|
$("#searchEndTime").val(thisDateTime);
|
||||||
var userBusinessList=null;
|
|
||||||
var userdepot=null;
|
|
||||||
initSystemData_UB();
|
|
||||||
initSelectInfo_UB();
|
|
||||||
initSystemData_depot();
|
|
||||||
initSelectInfo_depot();
|
|
||||||
initSupplier(); //初始化供应商、客户信息
|
initSupplier(); //初始化供应商、客户信息
|
||||||
initTableData();
|
initTableData();
|
||||||
ininPager();
|
ininPager();
|
||||||
search();
|
search();
|
||||||
print();
|
print();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//初始化系统基础信息
|
|
||||||
function initSystemData_UB(){
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "<%=path %>/userBusiness/getBasicData.action",
|
|
||||||
data: ({
|
|
||||||
KeyId: uid,
|
|
||||||
Type:"UserDepot"
|
|
||||||
}),
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (systemInfo)
|
|
||||||
{
|
|
||||||
if(systemInfo)
|
|
||||||
{
|
|
||||||
userBusinessList = systemInfo.showModel.map.userBusinessList;
|
|
||||||
var msgTip = systemInfo.showModel.msgTip;
|
|
||||||
if(msgTip == "exceptoin")
|
|
||||||
{
|
|
||||||
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
userBusinessList=null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
//初始化页面选项卡
|
|
||||||
function initSelectInfo_UB(){
|
|
||||||
|
|
||||||
if(userBusinessList !=null)
|
|
||||||
{
|
|
||||||
if(userBusinessList.length>0)
|
|
||||||
{
|
|
||||||
//用户对应的仓库列表 [1][2][3]...
|
|
||||||
userdepot =userBusinessList[0].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化系统基础信息
|
|
||||||
function initSystemData_depot(){
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url: "<%=path %>/depot/getBasicData.action",
|
|
||||||
//设置为同步
|
|
||||||
async:false,
|
|
||||||
dataType: "json",
|
|
||||||
success: function (systemInfo)
|
|
||||||
{
|
|
||||||
depotList = systemInfo.showModel.map.depotList;
|
|
||||||
var msgTip = systemInfo.showModel.msgTip;
|
|
||||||
if(msgTip == "exceptoin")
|
|
||||||
{
|
|
||||||
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//初始化页面选项卡
|
|
||||||
function initSelectInfo_depot(){
|
|
||||||
var options = "";
|
|
||||||
|
|
||||||
if(depotList !=null)
|
|
||||||
{
|
|
||||||
options = "";
|
|
||||||
for(var i = 0 ;i < depotList.length;i++)
|
|
||||||
{
|
|
||||||
var depot = depotList[i];
|
|
||||||
|
|
||||||
if(userdepot!=null)
|
|
||||||
{
|
|
||||||
if(userdepot.indexOf("["+depot.id+"]")!=-1)
|
|
||||||
{
|
|
||||||
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
|
|
||||||
depotString = depotString + depot.id + ",";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
depotString = depotString.substring(0, depotString.length-1);
|
|
||||||
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化供应商、客户
|
//初始化供应商、客户
|
||||||
function initSupplier(){
|
function initSupplier(){
|
||||||
$('#OrganId').combobox({
|
$('#OrganId').combobox({
|
||||||
@@ -213,28 +107,11 @@
|
|||||||
pageList: [10,50,100],
|
pageList: [10,50,100],
|
||||||
columns:[[
|
columns:[[
|
||||||
{ title: '单据编号',field: 'number',width:140},
|
{ title: '单据编号',field: 'number',width:140},
|
||||||
{ title: '商品名称',field: 'materialName',width:120},
|
|
||||||
{ title: '商品型号',field: 'materialModel',width:100},
|
|
||||||
{ title: '单价',field: 'unitPrice',width:60},
|
|
||||||
{ title: '数量',field: 'operNumber',width:60,formatter:function(value,rec){
|
|
||||||
if(rec.type==="出库"){
|
|
||||||
return rec.operNumber;
|
|
||||||
}
|
|
||||||
else if(rec.type==="入库"){
|
|
||||||
return 0-rec.operNumber;
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
{ title: '金额',field: 'allPrice',width:60,formatter: function(value,rec){
|
|
||||||
if(rec.type==="出库"){
|
|
||||||
return rec.allPrice;
|
|
||||||
}
|
|
||||||
else if(rec.type==="入库"){
|
|
||||||
return 0-rec.allPrice;
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
{ title: '单位名称',field: 'supplierName',width:200},
|
{ title: '单位名称',field: 'supplierName',width:200},
|
||||||
{ title: '仓库',field: 'depotName',width:120},
|
{ title: '金额',field: 'allPrice',width:60,formatter: function(value,rec){
|
||||||
{ title: '入库日期',field: 'operTime',width:80}
|
return (rec.changeAmount-rec.totalPrice).toFixed(2);
|
||||||
|
}},
|
||||||
|
{ title: '单据日期',field: 'operTime',width:140}
|
||||||
]],
|
]],
|
||||||
onLoadError:function()
|
onLoadError:function()
|
||||||
{
|
{
|
||||||
@@ -325,8 +202,6 @@
|
|||||||
data: ({
|
data: ({
|
||||||
pageNo:pageNo,
|
pageNo:pageNo,
|
||||||
pageSize:pageSize,
|
pageSize:pageSize,
|
||||||
ProjectId: $.trim($("#searchProjectId").val()),
|
|
||||||
DepotIds: depotString,
|
|
||||||
BeginTime: $("#searchBeginTime").val(),
|
BeginTime: $("#searchBeginTime").val(),
|
||||||
EndTime: $("#searchEndTime").val(),
|
EndTime: $("#searchEndTime").val(),
|
||||||
OrganId: $('#OrganId').combobox('getValue')
|
OrganId: $('#OrganId').combobox('getValue')
|
||||||
|
|||||||
Reference in New Issue
Block a user