优化收付款相关接口,支持退款单修改退款金额
This commit is contained in:
@@ -96,6 +96,12 @@ public class BusinessConstants {
|
|||||||
public static final String SUB_TYPE_REPLAY = "盘点复盘";
|
public static final String SUB_TYPE_REPLAY = "盘点复盘";
|
||||||
public static final String SUB_TYPE_ASSEMBLE = "组装单";
|
public static final String SUB_TYPE_ASSEMBLE = "组装单";
|
||||||
public static final String SUB_TYPE_DISASSEMBLE = "拆卸单";
|
public static final String SUB_TYPE_DISASSEMBLE = "拆卸单";
|
||||||
|
/**
|
||||||
|
* 财务单据分类
|
||||||
|
* 收款、付款
|
||||||
|
* */
|
||||||
|
public static final String TYPE_MONEY_IN = "收款";
|
||||||
|
public static final String TYPE_MONEY_OUT = "付款";
|
||||||
/**
|
/**
|
||||||
* 批量插入sql时最大的数据条数
|
* 批量插入sql时最大的数据条数
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -361,9 +361,6 @@ public class ExceptionConstants {
|
|||||||
//单据录入-请修改多账户的结算金额
|
//单据录入-请修改多账户的结算金额
|
||||||
public static final int DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE = 8500008;
|
public static final int DEPOT_HEAD_MANY_ACCOUNT_FAILED_CODE = 8500008;
|
||||||
public static final String DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG = "请修改多账户的结算金额";
|
public static final String DEPOT_HEAD_MANY_ACCOUNT_FAILED_MSG = "请修改多账户的结算金额";
|
||||||
//单据录入-关联单据实际不存在欠款
|
|
||||||
public static final int DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE = 8500009;
|
|
||||||
public static final String DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG = "抱歉,关联单据为空时不能欠款";
|
|
||||||
//单据录入-调入仓库与原仓库不能重复
|
//单据录入-调入仓库与原仓库不能重复
|
||||||
public static final int DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_CODE = 8500010;
|
public static final int DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_CODE = 8500010;
|
||||||
public static final String DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_MSG = "调入仓库与原仓库不能重复";
|
public static final String DEPOT_HEAD_ANOTHER_DEPOT_EQUAL_FAILED_MSG = "调入仓库与原仓库不能重复";
|
||||||
@@ -391,9 +388,6 @@ public class ExceptionConstants {
|
|||||||
//单据录入-商品条码XXX的单价低于最低售价
|
//单据录入-商品条码XXX的单价低于最低售价
|
||||||
public static final int DEPOT_HEAD_UNIT_PRICE_LOW_CODE = 8000018;
|
public static final int DEPOT_HEAD_UNIT_PRICE_LOW_CODE = 8000018;
|
||||||
public static final String DEPOT_HEAD_UNIT_PRICE_LOW_MSG = "商品条码%s的单价低于最低售价";
|
public static final String DEPOT_HEAD_UNIT_PRICE_LOW_MSG = "商品条码%s的单价低于最低售价";
|
||||||
//单据录入-本次欠款金额不能大于关联单据实际的欠款
|
|
||||||
public static final int DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE = 8500019;
|
|
||||||
public static final String DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG = "抱歉,本次欠款金额不能大于关联单据实际的欠款";
|
|
||||||
//单据录入-单据明细中必须要有组合件和普通子件
|
//单据录入-单据明细中必须要有组合件和普通子件
|
||||||
public static final int DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE = 8000020;
|
public static final int DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE = 8000020;
|
||||||
public static final String DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG = "抱歉,单据明细中必须要有组合件和普通子件";
|
public static final String DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG = "抱歉,单据明细中必须要有组合件和普通子件";
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.jsh.erp.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
import com.jsh.erp.datasource.vo.AccountItemVo4List;
|
||||||
|
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||||
import com.jsh.erp.service.accountItem.AccountItemService;
|
import com.jsh.erp.service.accountItem.AccountItemService;
|
||||||
import com.jsh.erp.utils.BaseResponseInfo;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
@@ -35,15 +37,20 @@ public class AccountItemController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AccountItemService accountItemService;
|
private AccountItemService accountItemService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AccountHeadService accountHeadService;
|
||||||
|
|
||||||
@GetMapping(value = "/getDetailList")
|
@GetMapping(value = "/getDetailList")
|
||||||
@ApiOperation(value = "明细列表")
|
@ApiOperation(value = "明细列表")
|
||||||
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
|
||||||
HttpServletRequest request)throws Exception {
|
HttpServletRequest request)throws Exception {
|
||||||
BaseResponseInfo res = new BaseResponseInfo();
|
BaseResponseInfo res = new BaseResponseInfo();
|
||||||
try {
|
try {
|
||||||
|
String type = null;
|
||||||
List<AccountItemVo4List> dataList = new ArrayList<>();
|
List<AccountItemVo4List> dataList = new ArrayList<>();
|
||||||
if(headerId != 0) {
|
if(headerId != 0) {
|
||||||
dataList = accountItemService.getDetailList(headerId);
|
dataList = accountItemService.getDetailList(headerId);
|
||||||
|
type = accountHeadService.getAccountHead(headerId).getType();
|
||||||
}
|
}
|
||||||
JSONObject outer = new JSONObject();
|
JSONObject outer = new JSONObject();
|
||||||
outer.put("total", dataList.size());
|
outer.put("total", dataList.size());
|
||||||
@@ -64,7 +71,13 @@ public class AccountItemController {
|
|||||||
item.put("needDebt", ai.getNeedDebt());
|
item.put("needDebt", ai.getNeedDebt());
|
||||||
item.put("finishDebt", ai.getFinishDebt());
|
item.put("finishDebt", ai.getFinishDebt());
|
||||||
BigDecimal eachAmount = ai.getEachAmount();
|
BigDecimal eachAmount = ai.getEachAmount();
|
||||||
item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount);
|
if(BusinessConstants.TYPE_MONEY_IN.equals(type)) {
|
||||||
|
item.put("eachAmount", eachAmount);
|
||||||
|
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(type)) {
|
||||||
|
item.put("eachAmount", BigDecimal.ZERO.subtract(eachAmount));
|
||||||
|
} else {
|
||||||
|
item.put("eachAmount", (eachAmount.compareTo(BigDecimal.ZERO))==-1 ? BigDecimal.ZERO.subtract(eachAmount): eachAmount);
|
||||||
|
}
|
||||||
item.put("remark", ai.getRemark());
|
item.put("remark", ai.getRemark());
|
||||||
dataArray.add(item);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -531,14 +531,11 @@ public class DepotHeadController {
|
|||||||
String number = StringUtil.getInfo(search, "number");
|
String number = StringUtil.getInfo(search, "number");
|
||||||
String beginTime = StringUtil.getInfo(search, "beginTime");
|
String beginTime = StringUtil.getInfo(search, "beginTime");
|
||||||
String endTime = StringUtil.getInfo(search, "endTime");
|
String endTime = StringUtil.getInfo(search, "endTime");
|
||||||
String type = StringUtil.getInfo(search, "type");
|
|
||||||
String subType = StringUtil.getInfo(search, "subType");
|
|
||||||
String roleType = StringUtil.getInfo(search, "roleType");
|
String roleType = StringUtil.getInfo(search, "roleType");
|
||||||
String status = StringUtil.getInfo(search, "status");
|
String status = StringUtil.getInfo(search, "status");
|
||||||
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, type,
|
List<DepotHeadVo4List> list = depotHeadService.debtList(organId, materialParam, number, beginTime, endTime, roleType,
|
||||||
subType, roleType, status, (currentPage-1)*pageSize, pageSize);
|
status, (currentPage-1)*pageSize, pageSize);
|
||||||
int total = depotHeadService.debtListCount(organId, materialParam, number, beginTime, endTime, type,
|
int total = depotHeadService.debtListCount(organId, materialParam, number, beginTime, endTime, roleType, status);
|
||||||
subType, roleType, status);
|
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
objectMap.put("rows", list);
|
objectMap.put("rows", list);
|
||||||
objectMap.put("total", total);
|
objectMap.put("total", total);
|
||||||
|
|||||||
@@ -42,12 +42,6 @@ public interface AccountHeadMapperEx {
|
|||||||
@Param("remark") String remark,
|
@Param("remark") String remark,
|
||||||
@Param("number") String number);
|
@Param("number") String number);
|
||||||
|
|
||||||
BigDecimal findAllMoney(
|
|
||||||
@Param("supplierId") Integer supplierId,
|
|
||||||
@Param("type") String type,
|
|
||||||
@Param("modeName") String modeName,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
|
|
||||||
List<AccountHeadVo4ListEx> getDetailByNumber(
|
List<AccountHeadVo4ListEx> getDetailByNumber(
|
||||||
@Param("billNo") String billNo);
|
@Param("billNo") String billNo);
|
||||||
|
|
||||||
|
|||||||
@@ -179,25 +179,6 @@ public interface DepotHeadMapperEx {
|
|||||||
@Param("subTypeBack") String subTypeBack,
|
@Param("subTypeBack") String subTypeBack,
|
||||||
@Param("billType") String billType);
|
@Param("billType") String billType);
|
||||||
|
|
||||||
BigDecimal findAllMoney(
|
|
||||||
@Param("supplierId") Integer supplierId,
|
|
||||||
@Param("type") String type,
|
|
||||||
@Param("subType") String subType,
|
|
||||||
@Param("modeName") String modeName,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
|
|
||||||
BigDecimal findAllOtherMoney(
|
|
||||||
@Param("supplierId") Integer supplierId,
|
|
||||||
@Param("type") String type,
|
|
||||||
@Param("subType") String subType,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
|
|
||||||
BigDecimal findDepositMoney(
|
|
||||||
@Param("supplierId") Integer supplierId,
|
|
||||||
@Param("type") String type,
|
|
||||||
@Param("subType") String subType,
|
|
||||||
@Param("endTime") String endTime);
|
|
||||||
|
|
||||||
List<DepotHeadVo4List> getDetailByNumber(
|
List<DepotHeadVo4List> getDetailByNumber(
|
||||||
@Param("number") String number);
|
@Param("number") String number);
|
||||||
|
|
||||||
@@ -228,8 +209,6 @@ public interface DepotHeadMapperEx {
|
|||||||
|
|
||||||
List<DepotHeadVo4List> debtList(
|
List<DepotHeadVo4List> debtList(
|
||||||
@Param("organId") Long organId,
|
@Param("organId") Long organId,
|
||||||
@Param("type") String type,
|
|
||||||
@Param("subType") String subType,
|
|
||||||
@Param("creatorArray") String[] creatorArray,
|
@Param("creatorArray") String[] creatorArray,
|
||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("number") String number,
|
@Param("number") String number,
|
||||||
@@ -242,8 +221,6 @@ public interface DepotHeadMapperEx {
|
|||||||
|
|
||||||
int debtListCount(
|
int debtListCount(
|
||||||
@Param("organId") Long organId,
|
@Param("organId") Long organId,
|
||||||
@Param("type") String type,
|
|
||||||
@Param("subType") String subType,
|
|
||||||
@Param("creatorArray") String[] creatorArray,
|
@Param("creatorArray") String[] creatorArray,
|
||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("number") String number,
|
@Param("number") String number,
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class DepotHeadVo4StatementAccount {
|
|||||||
private BigDecimal returnDebtMoney;
|
private BigDecimal returnDebtMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本期收款
|
* 本期收付款
|
||||||
*/
|
*/
|
||||||
private BigDecimal backMoney;
|
private BigDecimal backMoney;
|
||||||
|
|
||||||
|
|||||||
@@ -102,10 +102,22 @@ public class AccountHeadService {
|
|||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (AccountHeadVo4ListEx ah : list) {
|
for (AccountHeadVo4ListEx ah : list) {
|
||||||
if(ah.getChangeAmount() != null) {
|
if(ah.getChangeAmount() != null) {
|
||||||
ah.setChangeAmount(ah.getChangeAmount().abs());
|
if(BusinessConstants.TYPE_MONEY_IN.equals(ah.getType())) {
|
||||||
|
ah.setChangeAmount(ah.getChangeAmount());
|
||||||
|
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(ah.getType())) {
|
||||||
|
ah.setChangeAmount(BigDecimal.ZERO.subtract(ah.getChangeAmount()));
|
||||||
|
} else {
|
||||||
|
ah.setChangeAmount(ah.getChangeAmount().abs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ah.getTotalPrice() != null) {
|
if(ah.getTotalPrice() != null) {
|
||||||
ah.setTotalPrice(ah.getTotalPrice().abs());
|
if(BusinessConstants.TYPE_MONEY_IN.equals(ah.getType())) {
|
||||||
|
ah.setTotalPrice(ah.getTotalPrice());
|
||||||
|
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(ah.getType())) {
|
||||||
|
ah.setTotalPrice(BigDecimal.ZERO.subtract(ah.getTotalPrice()));
|
||||||
|
} else {
|
||||||
|
ah.setTotalPrice(ah.getTotalPrice().abs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ah.getBillTime() !=null) {
|
if(ah.getBillTime() !=null) {
|
||||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||||
@@ -340,66 +352,6 @@ public class AccountHeadService {
|
|||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(accountHead.getBillNo()).toString(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
|
|
||||||
String modeName = "";
|
|
||||||
if (mode.equals("实际")) {
|
|
||||||
modeName = "change_amount";
|
|
||||||
} else if (mode.equals("合计")) {
|
|
||||||
modeName = "total_price";
|
|
||||||
}
|
|
||||||
BigDecimal result = null;
|
|
||||||
try{
|
|
||||||
result = accountHeadMapperEx.findAllMoney(supplierId, type, modeName, endTime);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.readFail(logger, e);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 统计总金额
|
|
||||||
* @param getS
|
|
||||||
* @param type
|
|
||||||
* @param mode 合计或者金额
|
|
||||||
* @param endTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BigDecimal allMoney(String getS, String type, String mode, String endTime) {
|
|
||||||
BigDecimal allMoney = BigDecimal.ZERO;
|
|
||||||
try {
|
|
||||||
Integer supplierId = Integer.valueOf(getS);
|
|
||||||
BigDecimal sum = findAllMoney(supplierId, type, mode, endTime);
|
|
||||||
if(sum != null) {
|
|
||||||
allMoney = sum;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//返回正数,如果负数也转为正数
|
|
||||||
if ((allMoney.compareTo(BigDecimal.ZERO))==-1) {
|
|
||||||
allMoney = allMoney.abs();
|
|
||||||
}
|
|
||||||
return allMoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询往来单位的累计应收和累计应付,只计入收款或付款
|
|
||||||
* @param supplierId
|
|
||||||
* @param endTime
|
|
||||||
* @param supType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BigDecimal findTotalPay(Integer supplierId, String endTime, String supType) {
|
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
|
||||||
String getS = supplierId.toString();
|
|
||||||
if (("客户").equals(supType)) { //客户
|
|
||||||
sum = allMoney(getS, "收款", "合计",endTime);
|
|
||||||
} else if (("供应商").equals(supType)) { //供应商
|
|
||||||
sum = allMoney(getS, "付款", "合计",endTime);
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AccountHeadVo4ListEx> getDetailByNumber(String billNo)throws Exception {
|
public List<AccountHeadVo4ListEx> getDetailByNumber(String billNo)throws Exception {
|
||||||
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
List<AccountHeadVo4ListEx> resList = new ArrayList<AccountHeadVo4ListEx>();
|
||||||
List<AccountHeadVo4ListEx> list = null;
|
List<AccountHeadVo4ListEx> list = null;
|
||||||
@@ -411,10 +363,22 @@ public class AccountHeadService {
|
|||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (AccountHeadVo4ListEx ah : list) {
|
for (AccountHeadVo4ListEx ah : list) {
|
||||||
if(ah.getChangeAmount() != null) {
|
if(ah.getChangeAmount() != null) {
|
||||||
ah.setChangeAmount(ah.getChangeAmount().abs());
|
if(BusinessConstants.TYPE_MONEY_IN.equals(ah.getType())) {
|
||||||
|
ah.setChangeAmount(ah.getChangeAmount());
|
||||||
|
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(ah.getType())) {
|
||||||
|
ah.setChangeAmount(BigDecimal.ZERO.subtract(ah.getChangeAmount()));
|
||||||
|
} else {
|
||||||
|
ah.setChangeAmount(ah.getChangeAmount().abs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ah.getTotalPrice() != null) {
|
if(ah.getTotalPrice() != null) {
|
||||||
ah.setTotalPrice(ah.getTotalPrice().abs());
|
if(BusinessConstants.TYPE_MONEY_IN.equals(ah.getType())) {
|
||||||
|
ah.setTotalPrice(ah.getTotalPrice());
|
||||||
|
} else if(BusinessConstants.TYPE_MONEY_OUT.equals(ah.getType())) {
|
||||||
|
ah.setTotalPrice(BigDecimal.ZERO.subtract(ah.getTotalPrice()));
|
||||||
|
} else {
|
||||||
|
ah.setTotalPrice(ah.getTotalPrice().abs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ah.getBillTime() !=null) {
|
if(ah.getBillTime() !=null) {
|
||||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||||
|
|||||||
@@ -712,76 +712,6 @@ public class DepotHeadService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime)throws Exception {
|
|
||||||
String modeName = "";
|
|
||||||
BigDecimal allOtherMoney = BigDecimal.ZERO;
|
|
||||||
BigDecimal allDepositMoney = BigDecimal.ZERO;
|
|
||||||
if (mode.equals("实际")) {
|
|
||||||
modeName = "change_amount";
|
|
||||||
} else if (mode.equals("合计")) {
|
|
||||||
modeName = "discount_last_money";
|
|
||||||
allOtherMoney = depotHeadMapperEx.findAllOtherMoney(supplierId, type, subType, endTime);
|
|
||||||
allDepositMoney = depotHeadMapperEx.findDepositMoney(supplierId, type, subType, endTime);
|
|
||||||
}
|
|
||||||
BigDecimal result = BigDecimal.ZERO;
|
|
||||||
try{
|
|
||||||
result =depotHeadMapperEx.findAllMoney(supplierId, type, subType, modeName, endTime);
|
|
||||||
}catch(Exception e){
|
|
||||||
JshException.readFail(logger, e);
|
|
||||||
}
|
|
||||||
if(allOtherMoney!=null) {
|
|
||||||
result = result.add(allOtherMoney);
|
|
||||||
}
|
|
||||||
if(allDepositMoney!=null) {
|
|
||||||
result = result.subtract(allDepositMoney);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 统计总金额
|
|
||||||
* @param getS
|
|
||||||
* @param type
|
|
||||||
* @param subType
|
|
||||||
* @param mode 合计或者金额
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BigDecimal allMoney(String getS, String type, String subType, String mode, String endTime) {
|
|
||||||
BigDecimal allMoney = BigDecimal.ZERO;
|
|
||||||
try {
|
|
||||||
Integer supplierId = Integer.valueOf(getS);
|
|
||||||
BigDecimal sum = findAllMoney(supplierId, type, subType, mode, endTime);
|
|
||||||
if(sum != null) {
|
|
||||||
allMoney = sum;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//返回正数,如果负数也转为正数
|
|
||||||
if ((allMoney.compareTo(BigDecimal.ZERO))==-1) {
|
|
||||||
allMoney = allMoney.abs();
|
|
||||||
}
|
|
||||||
return allMoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询单位的累计应收和累计应付,零售不能计入
|
|
||||||
* @param supplierId
|
|
||||||
* @param endTime
|
|
||||||
* @param supType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BigDecimal findTotalPay(Integer supplierId, String endTime, String supType) {
|
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
|
||||||
String getS = supplierId.toString();
|
|
||||||
if (("客户").equals(supType)) { //客户
|
|
||||||
sum = allMoney(getS, "出库", "销售", "合计",endTime).subtract(allMoney(getS, "出库", "销售", "实际",endTime));
|
|
||||||
} else if (("供应商").equals(supType)) { //供应商
|
|
||||||
sum = allMoney(getS, "入库", "采购", "合计",endTime).subtract(allMoney(getS, "入库", "采购", "实际",endTime));
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DepotHeadVo4List> getDetailByNumber(String number)throws Exception {
|
public List<DepotHeadVo4List> getDetailByNumber(String number)throws Exception {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
List<DepotHeadVo4List> resList = new ArrayList<DepotHeadVo4List>();
|
||||||
try{
|
try{
|
||||||
@@ -927,10 +857,6 @@ public class DepotHeadService {
|
|||||||
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//欠款校验
|
|
||||||
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
|
|
||||||
checkDebtByParam(beanJson, depotHead);
|
|
||||||
}
|
|
||||||
//判断用户是否已经登录过,登录过不再处理
|
//判断用户是否已经登录过,登录过不再处理
|
||||||
User userInfo=userService.getCurrentUser();
|
User userInfo=userService.getCurrentUser();
|
||||||
depotHead.setCreator(userInfo==null?null:userInfo.getId());
|
depotHead.setCreator(userInfo==null?null:userInfo.getId());
|
||||||
@@ -1029,10 +955,6 @@ public class DepotHeadService {
|
|||||||
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//欠款校验
|
|
||||||
if("采购退货".equals(subType) || "销售退货".equals(subType)) {
|
|
||||||
checkDebtByParam(beanJson, depotHead);
|
|
||||||
}
|
|
||||||
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
|
if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
|
||||||
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
|
depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
|
||||||
}
|
}
|
||||||
@@ -1084,29 +1006,6 @@ public class DepotHeadService {
|
|||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 针对退货单,校验欠款
|
|
||||||
* @param beanJson
|
|
||||||
* @param depotHead
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public void checkDebtByParam(String beanJson, DepotHead depotHead) throws Exception {
|
|
||||||
JSONObject billObj = JSONObject.parseObject(beanJson);
|
|
||||||
if(StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
|
||||||
//退货单对应的原单实际欠款(这里面要除去收付款的金额)
|
|
||||||
BigDecimal originalRealDebt = getOriginalRealDebt(depotHead.getLinkNumber(), depotHead.getNumber());
|
|
||||||
if(billObj!=null && billObj.get("debt")!=null && originalRealDebt.compareTo(billObj.getBigDecimal("debt"))<0) {
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_OVER_CODE,
|
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_OVER_MSG));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(billObj!=null && billObj.get("debt")!=null && BigDecimal.ZERO.compareTo(billObj.getBigDecimal("debt"))!=0) {
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_CODE,
|
|
||||||
String.format(ExceptionConstants.DEPOT_HEAD_BACK_BILL_DEBT_FAILED_MSG));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退货单对应的原单实际欠款(这里面要除去收付款的金额)
|
* 退货单对应的原单实际欠款(这里面要除去收付款的金额)
|
||||||
* @param linkNumber 原单单号
|
* @param linkNumber 原单单号
|
||||||
@@ -1238,7 +1137,7 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<DepotHeadVo4List> debtList(Long organId, String materialParam, String number, String beginTime, String endTime,
|
public List<DepotHeadVo4List> debtList(Long organId, String materialParam, String number, String beginTime, String endTime,
|
||||||
String type, String subType, String roleType, String status, Integer offset, Integer rows) {
|
String roleType, String status, Integer offset, Integer rows) {
|
||||||
List<DepotHeadVo4List> resList = new ArrayList<>();
|
List<DepotHeadVo4List> resList = new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
String depotIds = depotService.findDepotStrByCurrentUser();
|
String depotIds = depotService.findDepotStrByCurrentUser();
|
||||||
@@ -1246,7 +1145,7 @@ public class DepotHeadService {
|
|||||||
String [] creatorArray = getCreatorArray(roleType);
|
String [] creatorArray = getCreatorArray(roleType);
|
||||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||||
List<DepotHeadVo4List> list=depotHeadMapperEx.debtList(organId, type, subType, creatorArray, status, number,
|
List<DepotHeadVo4List> list=depotHeadMapperEx.debtList(organId, creatorArray, status, number,
|
||||||
beginTime, endTime, materialParam, depotArray, offset, rows);
|
beginTime, endTime, materialParam, depotArray, offset, rows);
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
List<Long> idList = new ArrayList<>();
|
List<Long> idList = new ArrayList<>();
|
||||||
@@ -1272,28 +1171,18 @@ public class DepotHeadService {
|
|||||||
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
BigDecimal otherMoney = dh.getOtherMoney()!=null?dh.getOtherMoney():BigDecimal.ZERO;
|
||||||
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
BigDecimal deposit = dh.getDeposit()!=null?dh.getDeposit():BigDecimal.ZERO;
|
||||||
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount().abs():BigDecimal.ZERO;
|
BigDecimal changeAmount = dh.getChangeAmount()!=null?dh.getChangeAmount().abs():BigDecimal.ZERO;
|
||||||
//本单欠款
|
//本单欠款(如果退货则为负数)
|
||||||
dh.setNeedDebt(discountLastMoney.add(otherMoney).subtract(deposit.add(changeAmount)));
|
dh.setNeedDebt(discountLastMoney.add(otherMoney).subtract(deposit.add(changeAmount)));
|
||||||
List<DepotHead> billList = getBillListByLinkNumber(dh.getNumber());
|
if(BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(dh.getSubType()) || BusinessConstants.SUB_TYPE_SALES_RETURN.equals(dh.getSubType())) {
|
||||||
//退货单欠款(总数)
|
dh.setNeedDebt(BigDecimal.ZERO.subtract(dh.getNeedDebt()));
|
||||||
BigDecimal allBillDebt = BigDecimal.ZERO;
|
|
||||||
for(DepotHead depotHead: billList) {
|
|
||||||
BigDecimal billDiscountLastMoney = depotHead.getDiscountLastMoney()!=null?depotHead.getDiscountLastMoney():BigDecimal.ZERO;
|
|
||||||
BigDecimal billOtherMoney = depotHead.getOtherMoney()!=null?depotHead.getOtherMoney():BigDecimal.ZERO;
|
|
||||||
BigDecimal billDeposit = depotHead.getDeposit()!=null?depotHead.getDeposit():BigDecimal.ZERO;
|
|
||||||
BigDecimal billChangeAmount = depotHead.getChangeAmount()!=null?depotHead.getChangeAmount().abs():BigDecimal.ZERO;
|
|
||||||
BigDecimal billDebt = billDiscountLastMoney.add(billOtherMoney).subtract((billDeposit.add(billChangeAmount)));
|
|
||||||
allBillDebt = allBillDebt.add(billDebt);
|
|
||||||
}
|
}
|
||||||
BigDecimal needDebt = dh.getNeedDebt()!=null?dh.getNeedDebt():BigDecimal.ZERO;
|
BigDecimal needDebt = dh.getNeedDebt()!=null?dh.getNeedDebt():BigDecimal.ZERO;
|
||||||
//实际欠款 实际欠款=本单欠款-退货单欠款(主要针对存在退货的情况)
|
|
||||||
dh.setRealNeedDebt(needDebt.subtract(allBillDebt));
|
|
||||||
BigDecimal finishDebt = accountItemService.getEachAmountByBillId(dh.getId());
|
BigDecimal finishDebt = accountItemService.getEachAmountByBillId(dh.getId());
|
||||||
finishDebt = finishDebt!=null?finishDebt:BigDecimal.ZERO;
|
finishDebt = finishDebt!=null?finishDebt:BigDecimal.ZERO;
|
||||||
//已收欠款
|
//已收欠款
|
||||||
dh.setFinishDebt(finishDebt);
|
dh.setFinishDebt(finishDebt);
|
||||||
//待收欠款
|
//待收欠款
|
||||||
dh.setDebt(needDebt.subtract(allBillDebt).subtract(finishDebt));
|
dh.setDebt(needDebt.subtract(finishDebt));
|
||||||
//商品信息简述
|
//商品信息简述
|
||||||
if(materialsListMap!=null) {
|
if(materialsListMap!=null) {
|
||||||
dh.setMaterialsList(materialsListMap.get(dh.getId()));
|
dh.setMaterialsList(materialsListMap.get(dh.getId()));
|
||||||
@@ -1308,7 +1197,7 @@ public class DepotHeadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int debtListCount(Long organId, String materialParam, String number, String beginTime, String endTime,
|
public int debtListCount(Long organId, String materialParam, String number, String beginTime, String endTime,
|
||||||
String type, String subType, String roleType, String status) {
|
String roleType, String status) {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
try {
|
try {
|
||||||
String depotIds = depotService.findDepotStrByCurrentUser();
|
String depotIds = depotService.findDepotStrByCurrentUser();
|
||||||
@@ -1316,7 +1205,7 @@ public class DepotHeadService {
|
|||||||
String[] creatorArray = getCreatorArray(roleType);
|
String[] creatorArray = getCreatorArray(roleType);
|
||||||
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
|
beginTime = Tools.parseDayToTime(beginTime, BusinessConstants.DAY_FIRST_TIME);
|
||||||
endTime = Tools.parseDayToTime(endTime, BusinessConstants.DAY_LAST_TIME);
|
endTime = Tools.parseDayToTime(endTime, BusinessConstants.DAY_LAST_TIME);
|
||||||
total = depotHeadMapperEx.debtListCount(organId, type, subType, creatorArray, status, number,
|
total = depotHeadMapperEx.debtListCount(organId, creatorArray, status, number,
|
||||||
beginTime, endTime, materialParam, depotArray);
|
beginTime, endTime, materialParam, depotArray);
|
||||||
} catch(Exception e){
|
} catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.jsh.erp.service.supplier;
|
package com.jsh.erp.service.supplier;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
import com.jsh.erp.constants.BusinessConstants;
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
import com.jsh.erp.constants.ExceptionConstants;
|
||||||
import com.jsh.erp.datasource.entities.*;
|
import com.jsh.erp.datasource.entities.*;
|
||||||
import com.jsh.erp.datasource.mappers.*;
|
import com.jsh.erp.datasource.mappers.*;
|
||||||
|
import com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||||
import com.jsh.erp.exception.JshException;
|
import com.jsh.erp.exception.JshException;
|
||||||
import com.jsh.erp.service.accountHead.AccountHeadService;
|
import com.jsh.erp.service.accountHead.AccountHeadService;
|
||||||
@@ -17,6 +17,7 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
|
|||||||
import com.jsh.erp.utils.BaseResponseInfo;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
import com.jsh.erp.utils.ExcelUtils;
|
import com.jsh.erp.utils.ExcelUtils;
|
||||||
import com.jsh.erp.utils.StringUtil;
|
import com.jsh.erp.utils.StringUtil;
|
||||||
|
import com.jsh.erp.utils.Tools;
|
||||||
import jxl.Sheet;
|
import jxl.Sheet;
|
||||||
import jxl.Workbook;
|
import jxl.Workbook;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -33,7 +34,6 @@ import java.io.File;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.jsh.erp.utils.Tools.getNow3;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SupplierService {
|
public class SupplierService {
|
||||||
@@ -104,24 +104,45 @@ public class SupplierService {
|
|||||||
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, offset, rows);
|
List<Supplier> list = supplierMapperEx.selectByConditionSupplier(supplier, type, phonenum, telephone, offset, rows);
|
||||||
for(Supplier s : list) {
|
for(Supplier s : list) {
|
||||||
Integer supplierId = s.getId().intValue();
|
Integer supplierId = s.getId().intValue();
|
||||||
String endTime = getNow3();
|
String beginTime = Tools.getYearBegin();
|
||||||
String supType = s.getType();
|
String endTime = Tools.getCenternTime(new Date());
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
BigDecimal sum = BigDecimal.ZERO;
|
||||||
BigDecimal beginNeedGet = s.getBeginNeedGet();
|
String supplierType = type;
|
||||||
if(beginNeedGet==null) {
|
String inOutType = "";
|
||||||
beginNeedGet = BigDecimal.ZERO;
|
String subType = "";
|
||||||
|
String typeBack = "";
|
||||||
|
String subTypeBack = "";
|
||||||
|
String billType = "";
|
||||||
|
if (("供应商").equals(supplierType)) {
|
||||||
|
inOutType = "入库";
|
||||||
|
subType = "采购";
|
||||||
|
typeBack = "出库";
|
||||||
|
subTypeBack = "采购退货";
|
||||||
|
billType = "付款";
|
||||||
|
} else if (("客户").equals(supplierType)) {
|
||||||
|
inOutType = "出库";
|
||||||
|
subType = "销售";
|
||||||
|
typeBack = "入库";
|
||||||
|
subTypeBack = "销售退货";
|
||||||
|
billType = "收款";
|
||||||
}
|
}
|
||||||
BigDecimal beginNeedPay = s.getBeginNeedPay();
|
List<DepotHeadVo4StatementAccount> saList = depotHeadService.getStatementAccount(beginTime, endTime, supplierId, null,
|
||||||
if(beginNeedPay==null) {
|
supplierType, inOutType, subType, typeBack, subTypeBack, billType, null, null);
|
||||||
beginNeedPay = BigDecimal.ZERO;
|
if(saList.size()>0) {
|
||||||
|
DepotHeadVo4StatementAccount item = saList.get(0);
|
||||||
|
//期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
|
||||||
|
BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreReturnDebtMoney()).subtract(item.getPreBackMoney());
|
||||||
|
item.setPreNeed(preNeed);
|
||||||
|
//实际欠款 = 本期欠款-本期退货的欠款金额
|
||||||
|
BigDecimal realDebtMoney = item.getDebtMoney().subtract(item.getReturnDebtMoney());
|
||||||
|
item.setDebtMoney(realDebtMoney);
|
||||||
|
//期末 = 期初+实际欠款-本期收款
|
||||||
|
BigDecimal allNeedGet = preNeed.add(realDebtMoney).subtract(item.getBackMoney());
|
||||||
|
sum = sum.add(allNeedGet);
|
||||||
}
|
}
|
||||||
sum = sum.add(depotHeadService.findTotalPay(supplierId, endTime, supType))
|
|
||||||
.subtract(accountHeadService.findTotalPay(supplierId, endTime, supType));
|
|
||||||
if(("客户").equals(s.getType())) {
|
if(("客户").equals(s.getType())) {
|
||||||
sum = sum.add(beginNeedGet);
|
|
||||||
s.setAllNeedGet(sum);
|
s.setAllNeedGet(sum);
|
||||||
} else if(("供应商").equals(s.getType())) {
|
} else if(("供应商").equals(s.getType())) {
|
||||||
sum = sum.add(beginNeedPay);
|
|
||||||
s.setAllNeedPay(sum);
|
s.setAllNeedPay(sum);
|
||||||
}
|
}
|
||||||
resList.add(s);
|
resList.add(s);
|
||||||
@@ -602,24 +623,46 @@ public class SupplierService {
|
|||||||
if (null != dataList) {
|
if (null != dataList) {
|
||||||
for (Supplier s : dataList) {
|
for (Supplier s : dataList) {
|
||||||
Integer supplierId = s.getId().intValue();
|
Integer supplierId = s.getId().intValue();
|
||||||
String endTime = getNow3();
|
|
||||||
String supType = s.getType();
|
String beginTime = Tools.getYearBegin();
|
||||||
|
String endTime = Tools.getCenternTime(new Date());
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
BigDecimal sum = BigDecimal.ZERO;
|
||||||
BigDecimal beginNeedGet = s.getBeginNeedGet();
|
String supplierType = type;
|
||||||
if(beginNeedGet==null) {
|
String inOutType = "";
|
||||||
beginNeedGet = BigDecimal.ZERO;
|
String subType = "";
|
||||||
|
String typeBack = "";
|
||||||
|
String subTypeBack = "";
|
||||||
|
String billType = "";
|
||||||
|
if (("供应商").equals(supplierType)) {
|
||||||
|
inOutType = "入库";
|
||||||
|
subType = "采购";
|
||||||
|
typeBack = "出库";
|
||||||
|
subTypeBack = "采购退货";
|
||||||
|
billType = "付款";
|
||||||
|
} else if (("客户").equals(supplierType)) {
|
||||||
|
inOutType = "出库";
|
||||||
|
subType = "销售";
|
||||||
|
typeBack = "入库";
|
||||||
|
subTypeBack = "销售退货";
|
||||||
|
billType = "收款";
|
||||||
}
|
}
|
||||||
BigDecimal beginNeedPay = s.getBeginNeedPay();
|
List<DepotHeadVo4StatementAccount> saList = depotHeadService.getStatementAccount(beginTime, endTime, supplierId, null,
|
||||||
if(beginNeedPay==null) {
|
supplierType, inOutType, subType, typeBack, subTypeBack, billType, null, null);
|
||||||
beginNeedPay = BigDecimal.ZERO;
|
if(saList.size()>0) {
|
||||||
|
DepotHeadVo4StatementAccount item = saList.get(0);
|
||||||
|
//期初 = 起始期初金额+上期欠款金额-上期退货的欠款金额-上期收付款
|
||||||
|
BigDecimal preNeed = item.getBeginNeed().add(item.getPreDebtMoney()).subtract(item.getPreReturnDebtMoney()).subtract(item.getPreBackMoney());
|
||||||
|
item.setPreNeed(preNeed);
|
||||||
|
//实际欠款 = 本期欠款-本期退货的欠款金额
|
||||||
|
BigDecimal realDebtMoney = item.getDebtMoney().subtract(item.getReturnDebtMoney());
|
||||||
|
item.setDebtMoney(realDebtMoney);
|
||||||
|
//期末 = 期初+实际欠款-本期收款
|
||||||
|
BigDecimal allNeedGet = preNeed.add(realDebtMoney).subtract(item.getBackMoney());
|
||||||
|
sum = sum.add(allNeedGet);
|
||||||
}
|
}
|
||||||
sum = sum.add(depotHeadService.findTotalPay(supplierId, endTime, supType))
|
|
||||||
.subtract(accountHeadService.findTotalPay(supplierId, endTime, supType));
|
|
||||||
if(("客户").equals(s.getType())) {
|
if(("客户").equals(s.getType())) {
|
||||||
sum = sum.add(beginNeedGet);
|
|
||||||
s.setAllNeedGet(sum);
|
s.setAllNeedGet(sum);
|
||||||
} else if(("供应商").equals(s.getType())) {
|
} else if(("供应商").equals(s.getType())) {
|
||||||
sum = sum.add(beginNeedPay);
|
|
||||||
s.setAllNeedPay(sum);
|
s.setAllNeedPay(sum);
|
||||||
}
|
}
|
||||||
String[] objs = new String[20];
|
String[] objs = new String[20];
|
||||||
|
|||||||
@@ -133,13 +133,6 @@
|
|||||||
and ifnull(ah.delete_flag,'0') !='1') tb
|
and ifnull(ah.delete_flag,'0') !='1') tb
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
|
||||||
select sum(${modeName}) as allMoney from jsh_account_head
|
|
||||||
where type=#{type}
|
|
||||||
and organ_id =#{supplierId} and bill_time <= #{endTime}
|
|
||||||
and ifnull(delete_flag,'0') !='1'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
|
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
|
||||||
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
|
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
|
||||||
from jsh_account_head ah
|
from jsh_account_head ah
|
||||||
|
|||||||
@@ -619,7 +619,9 @@
|
|||||||
<select id="getStatementAccount" resultType="com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount">
|
<select id="getStatementAccount" resultType="com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount">
|
||||||
select * from
|
select * from
|
||||||
(select s.id, s.supplier, s.contacts, s.telephone, s.phone_num, s.email,
|
(select s.id, s.supplier, s.contacts, s.telephone, s.phone_num, s.email,
|
||||||
|
-- 起始期初金额
|
||||||
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
||||||
|
-- 上期欠款金额
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
@@ -627,6 +629,7 @@
|
|||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
and dh.oper_time <= #{beginTime}
|
and dh.oper_time <= #{beginTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
||||||
|
-- 上期退货的欠款金额
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
@@ -634,11 +637,13 @@
|
|||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
and dh.oper_time <= #{beginTime}
|
and dh.oper_time <= #{beginTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
-- 上期收付款
|
||||||
left join jsh_depot_head dh on ai.bill_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
where dh.organ_id=s.id
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
and dh.oper_time <= #{beginTime}
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
|
and ah.bill_time <= #{beginTime}
|
||||||
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
||||||
|
-- 本期欠款
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
@@ -646,6 +651,7 @@
|
|||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
||||||
|
-- 本期退货的欠款金额
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
@@ -653,7 +659,8 @@
|
|||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
-- 本期收付款
|
||||||
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
where ah.organ_id=s.id and ah.type=#{billType}
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
||||||
@@ -672,7 +679,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
and ifnull(s.delete_flag,'0') !='1') tb
|
and ifnull(s.delete_flag,'0') !='1') tb
|
||||||
where begin_need+preDebtMoney-preBackMoney+debtMoney-backMoney>0
|
where begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney!=0
|
||||||
order by begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney desc
|
order by begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney desc
|
||||||
<if test="offset != null and rows != null">
|
<if test="offset != null and rows != null">
|
||||||
limit #{offset},#{rows}
|
limit #{offset},#{rows}
|
||||||
@@ -682,45 +689,52 @@
|
|||||||
<select id="getStatementAccountCount" resultType="java.lang.Integer">
|
<select id="getStatementAccountCount" resultType="java.lang.Integer">
|
||||||
select count(1) from
|
select count(1) from
|
||||||
(select s.id, s.supplier, s.contacts, s.telephone, s.phone_num, s.email,
|
(select s.id, s.supplier, s.contacts, s.telephone, s.phone_num, s.email,
|
||||||
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
-- 起始期初金额
|
||||||
(select
|
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
-- 上期欠款金额
|
||||||
from jsh_depot_head dh
|
(select
|
||||||
where dh.organ_id=s.id
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
from jsh_depot_head dh
|
||||||
and dh.oper_time <= #{beginTime}
|
where dh.organ_id=s.id
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
(select
|
and dh.oper_time <= #{beginTime}
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
||||||
from jsh_depot_head dh
|
-- 上期退货的欠款金额
|
||||||
where dh.organ_id=s.id
|
(select
|
||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
and dh.oper_time <= #{beginTime}
|
from jsh_depot_head dh
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
where dh.organ_id=s.id
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
left join jsh_depot_head dh on ai.bill_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
and dh.oper_time <= #{beginTime}
|
||||||
where dh.organ_id=s.id
|
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
||||||
and dh.oper_time <= #{beginTime}
|
-- 上期收付款
|
||||||
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
(select
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
from jsh_depot_head dh
|
and ah.bill_time <= #{beginTime}
|
||||||
where dh.organ_id=s.id
|
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
-- 本期欠款
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
(select
|
||||||
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
(select
|
from jsh_depot_head dh
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
where dh.organ_id=s.id
|
||||||
from jsh_depot_head dh
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
where dh.organ_id=s.id
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
-- 本期退货的欠款金额
|
||||||
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
(select
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
from jsh_depot_head dh
|
||||||
where ah.organ_id=s.id and ah.type=#{billType}
|
where dh.organ_id=s.id
|
||||||
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
and ifnull(ai.delete_flag,'0') !='1') backMoney
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
|
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
||||||
|
-- 本期收付款
|
||||||
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
|
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
||||||
|
and ifnull(ai.delete_flag,'0') !='1') backMoney
|
||||||
from jsh_supplier s
|
from jsh_supplier s
|
||||||
where s.enabled=1
|
where s.enabled=1
|
||||||
and s.type=#{supplierType}
|
and s.type=#{supplierType}
|
||||||
@@ -735,52 +749,52 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
and ifnull(s.delete_flag,'0') !='1') tb
|
and ifnull(s.delete_flag,'0') !='1') tb
|
||||||
where begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney>0
|
where begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney!=0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getStatementAccountTotalPay" resultType="com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount">
|
<select id="getStatementAccountTotalPay" resultType="com.jsh.erp.datasource.vo.DepotHeadVo4StatementAccount">
|
||||||
select sum(begin_need) begin_need, sum(preDebtMoney) preDebtMoney, sum(preReturnDebtMoney) preReturnDebtMoney, sum(preBackMoney) preBackMoney,
|
select sum(begin_need) begin_need, sum(preDebtMoney) preDebtMoney, sum(preReturnDebtMoney) preReturnDebtMoney, sum(preBackMoney) preBackMoney,
|
||||||
sum(debtMoney) debtMoney, sum(returnDebtMoney) returnDebtMoney, sum(backMoney) backMoney from
|
sum(debtMoney) debtMoney, sum(returnDebtMoney) returnDebtMoney, sum(backMoney) backMoney from
|
||||||
(select s.id,
|
(select s.id,
|
||||||
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
(case when s.type='供应商' then ifnull(s.begin_need_pay,0) else ifnull(s.begin_need_get,0) end) begin_need,
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
where dh.organ_id=s.id
|
where dh.organ_id=s.id
|
||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
and dh.oper_time <= #{beginTime}
|
and dh.oper_time <= #{beginTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') preDebtMoney,
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
where dh.organ_id=s.id
|
where dh.organ_id=s.id
|
||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
and dh.oper_time <= #{beginTime}
|
and dh.oper_time <= #{beginTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') preReturnDebtMoney,
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
left join jsh_depot_head dh on ai.bill_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
where dh.organ_id=s.id
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
and dh.oper_time <= #{beginTime}
|
and ah.bill_time <= #{beginTime}
|
||||||
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
and ifnull(ai.delete_flag,'0') !='1') preBackMoney,
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
where dh.organ_id=s.id
|
where dh.organ_id=s.id
|
||||||
and dh.type=#{type} and dh.sub_type=#{subType}
|
and dh.type=#{type} and dh.sub_type=#{subType}
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') debtMoney,
|
||||||
(select
|
(select
|
||||||
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
ifnull(sum(dh.discount_last_money),0)+ifnull(sum(dh.other_money),0)-ifnull(sum(dh.deposit),0)-abs(ifnull(sum(dh.change_amount),0))
|
||||||
from jsh_depot_head dh
|
from jsh_depot_head dh
|
||||||
where dh.organ_id=s.id
|
where dh.organ_id=s.id
|
||||||
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
and dh.type=#{typeBack} and dh.sub_type=#{subTypeBack}
|
||||||
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
and dh.oper_time>#{beginTime} and dh.oper_time <= #{endTime}
|
||||||
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
and ifnull(dh.delete_flag,'0') !='1') returnDebtMoney,
|
||||||
(select abs(ifnull(sum(ai.each_amount),0)) from jsh_account_item ai
|
(select (case when ah.type='收款' then ifnull(sum(ai.each_amount),0) else 0-ifnull(sum(ai.each_amount),0) end) from jsh_account_item ai
|
||||||
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
left join jsh_account_head ah on ai.header_id=ah.id and ifnull(ah.delete_flag,'0') !='1'
|
||||||
where ah.organ_id=s.id and ah.type=#{billType}
|
where ah.organ_id=s.id and ah.type=#{billType}
|
||||||
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
and ah.bill_time>#{beginTime} and ah.bill_time <= #{endTime}
|
||||||
and ifnull(ai.delete_flag,'0') !='1') backMoney
|
and ifnull(ai.delete_flag,'0') !='1') backMoney
|
||||||
from jsh_supplier s
|
from jsh_supplier s
|
||||||
where s.enabled=1
|
where s.enabled=1
|
||||||
and s.type=#{supplierType}
|
and s.type=#{supplierType}
|
||||||
@@ -795,25 +809,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
and ifnull(s.delete_flag,'0') !='1') tb
|
and ifnull(s.delete_flag,'0') !='1') tb
|
||||||
where begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney>0
|
where begin_need+preDebtMoney-preReturnDebtMoney-preBackMoney+debtMoney-returnDebtMoney-backMoney!=0
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
|
||||||
select ifnull(sum(${modeName}),0) as allMoney from jsh_depot_head where type=#{type} and sub_type = #{subType}
|
|
||||||
and organ_id =#{supplierId} and oper_time <=#{endTime}
|
|
||||||
and ifnull(delete_flag,'0') !='1'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findAllOtherMoney" resultType="java.math.BigDecimal">
|
|
||||||
select ifnull(sum(other_money),0) as allOtherMoney from jsh_depot_head where type=#{type} and sub_type = #{subType}
|
|
||||||
and organ_id =#{supplierId} and oper_time <=#{endTime}
|
|
||||||
and ifnull(delete_flag,'0') !='1'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="findDepositMoney" resultType="java.math.BigDecimal">
|
|
||||||
select ifnull(sum(deposit),0) as allDepositMoney from jsh_depot_head where type=#{type} and sub_type = #{subType}
|
|
||||||
and organ_id =#{supplierId} and oper_time <=#{endTime}
|
|
||||||
and ifnull(delete_flag,'0') !='1'
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
|
||||||
@@ -958,15 +954,11 @@
|
|||||||
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
||||||
where 1=1
|
where 1=1
|
||||||
|
and (dh.type='入库' or dh.type='出库')
|
||||||
|
and (dh.sub_type='采购' or dh.sub_type='销售' or dh.sub_type='采购退货' or dh.sub_type='销售退货')
|
||||||
<if test="organId != null">
|
<if test="organId != null">
|
||||||
and dh.organ_id = #{organId}
|
and dh.organ_id = #{organId}
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
|
||||||
and dh.type=#{type}
|
|
||||||
</if>
|
|
||||||
<if test="subType != null">
|
|
||||||
and dh.sub_type=#{subType}
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
and dh.status =#{status}
|
and dh.status =#{status}
|
||||||
</if>
|
</if>
|
||||||
@@ -1016,15 +1008,11 @@
|
|||||||
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
left join jsh_depot_item di on dh.id = di.header_id and ifnull(di.delete_flag,'0') !='1'
|
||||||
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
left join jsh_material m on di.material_id = m.id and ifnull(m.delete_flag,'0') !='1'
|
||||||
where 1=1
|
where 1=1
|
||||||
|
and (dh.type='入库' or dh.type='出库')
|
||||||
|
and (dh.sub_type='采购' or dh.sub_type='销售' or dh.sub_type='采购退货' or dh.sub_type='销售退货')
|
||||||
<if test="organId != null">
|
<if test="organId != null">
|
||||||
and dh.organ_id = #{organId}
|
and dh.organ_id = #{organId}
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
|
||||||
and dh.type=#{type}
|
|
||||||
</if>
|
|
||||||
<if test="subType != null">
|
|
||||||
and dh.sub_type=#{subType}
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
and dh.status =#{status}
|
and dh.status =#{status}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user