优化供应商对账

This commit is contained in:
季圣华
2020-06-22 23:50:07 +08:00
parent e3837616d4
commit eb942485fc
7 changed files with 56 additions and 15 deletions

View File

@@ -253,32 +253,35 @@ public class DepotHeadController {
if ((p1.compareTo(BigDecimal.ZERO))==-1) {
p1 = p1.abs();
}
if(dha.getOtherMoney()!=null) {
p1 = p1.add(dha.getOtherMoney()); //与其它费用相加
}
if ((p2 .compareTo(BigDecimal.ZERO))==-1) {
p2 = p2.abs();
}
if (type.equals("采购入库")) {
allPrice = p2 .subtract(p1);
allPrice = p2.subtract(p1);
} else if (type.equals("销售退货入库")) {
allPrice = p2 .subtract(p1);
allPrice = p2.subtract(p1);
} else if (type.equals("销售出库")) {
allPrice = p1 .subtract(p2);
allPrice = p1.subtract(p2);
} else if (type.equals("采购退货出库")) {
allPrice = p1 .subtract(p2);
allPrice = p1.subtract(p2);
} else if (type.equals("付款")) {
allPrice = p1.add(p2);
} else if (type.equals("收款")) {
allPrice = BigDecimal.ZERO.subtract(p1.add(p2));
} else if (type.equals("收入")) {
allPrice = p1 .subtract(p2);
allPrice = p1.subtract(p2);
} else if (type.equals("支出")) {
allPrice = p2 .subtract(p1);
allPrice = p2.subtract(p1);
}
dha.setDiscountLastMoney(p1); //金额
dha.setChangeAmount(p2); //金额
dha.setBillMoney(p1); //单据金额
dha.setChangeAmount(p2); //实际支付
DecimalFormat df = new DecimalFormat(".##");
dha.setAllPrice(new BigDecimal(df.format(allPrice .multiply(new BigDecimal(j))))); //计算后的金额
dha.setSupplierName(dha.getSupplierName()); //供应商
dha.setoTime(dha.getoTime()); //入库出库日期
dha.setAllPrice(new BigDecimal(df.format(allPrice.multiply(new BigDecimal(j))))); //本期变化
dha.setSupplierName(dha.getSupplierName()); //单位名称
dha.setoTime(dha.getoTime()); //单据日期
resList.add(dha);
}
}

View File

@@ -100,6 +100,12 @@ public interface DepotHeadMapperEx {
@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);
List<DepotHeadVo4List> getDetailByNumber(
@Param("number") String number);

View File

@@ -11,6 +11,10 @@ public class DepotHeadVo4StatementAccount {
private BigDecimal discountLastMoney;
private BigDecimal otherMoney;
private BigDecimal billMoney;
private BigDecimal changeAmount;
private BigDecimal allPrice;
@@ -45,6 +49,22 @@ public class DepotHeadVo4StatementAccount {
this.discountLastMoney = discountLastMoney;
}
public BigDecimal getOtherMoney() {
return otherMoney;
}
public void setOtherMoney(BigDecimal otherMoney) {
this.otherMoney = otherMoney;
}
public BigDecimal getBillMoney() {
return billMoney;
}
public void setBillMoney(BigDecimal billMoney) {
this.billMoney = billMoney;
}
public BigDecimal getChangeAmount() {
return changeAmount;
}

View File

@@ -343,10 +343,12 @@ public class DepotHeadService {
public BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime)throws Exception {
String modeName = "";
BigDecimal allOtherMoney = BigDecimal.ZERO;
if (mode.equals("实际")) {
modeName = "ChangeAmount";
} else if (mode.equals("合计")) {
modeName = "DiscountLastMoney";
allOtherMoney = depotHeadMapperEx.findAllOtherMoney(supplierId, type, subType, endTime);
}
BigDecimal result = null;
try{
@@ -354,6 +356,9 @@ public class DepotHeadService {
}catch(Exception e){
JshException.readFail(logger, e);
}
if(allOtherMoney!=null) {
result = result.add(allOtherMoney);
}
return result;
}