优化供应商对账

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

@@ -104,7 +104,7 @@
},
{title: '类型', field: 'type', width: 100},
{title: '单位名称', field: 'supplierName', width: 200},
{title: '单据金额', field: 'discountLastMoney', width: 80},
{title: '单据金额', field: 'billMoney', width: 80},
{title: '实际支付', field: 'changeAmount', width: 80},
{title: '本期变化', field: 'allPrice', width: 80},
{title: '单据日期', field: 'oTime', width: 160}

View File

@@ -103,7 +103,7 @@
},
{title: '类型', field: 'type', width: 100},
{title: '单位名称', field: 'supplierName', width: 200},
{title: '单据金额', field: 'discountLastMoney', width: 80},
{title: '单据金额', field: 'billMoney', width: 80},
{title: '实际支付', field: 'changeAmount', width: 80},
{title: '本期变化', field: 'allPrice', width: 80},
{title: '单据日期', field: 'oTime', width: 160}

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;
}

View File

@@ -34,6 +34,7 @@
<result column="Number" jdbcType="VARCHAR" property="number" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="DiscountLastMoney" jdbcType="DECIMAL" property="discountLastMoney" />
<result column="OtherMoney" jdbcType="DECIMAL" property="otherMoney" />
<result column="ChangeAmount" jdbcType="DECIMAL" property="changeAmount" />
<result column="supplierName" jdbcType="VARCHAR" property="supplierName" />
<result column="oTime" jdbcType="VARCHAR" property="oTime" />
@@ -251,7 +252,7 @@
</select>
<select id="findStatementAccount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStatementAccount">
select dh.Number,concat(dh.SubType,dh.Type) as type,dh.DiscountLastMoney,dh.ChangeAmount,s.supplier supplierName,
select dh.Number,concat(dh.SubType,dh.Type) as type,dh.DiscountLastMoney,dh.OtherMoney,dh.ChangeAmount,s.supplier supplierName,
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
@@ -261,7 +262,7 @@
</if>
and ifnull(dh.delete_Flag,'0') !='1'
UNION ALL
select ah.BillNo Number,ah.Type as newType,ah.TotalPrice DiscountLastMoney,ah.ChangeAmount,s.supplier supplierName,
select ah.BillNo Number,ah.Type as newType,ah.TotalPrice DiscountLastMoney, 0 OtherMoney,ah.ChangeAmount,s.supplier supplierName,
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 and ifnull(s.delete_Flag,'0') !='1'
where s.type='${supType}'
@@ -305,6 +306,12 @@
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="findAllOtherMoney" resultType="java.math.BigDecimal">
select sum(OtherMoney) as allOtherMoney from jsh_depothead where Type='${type}' and SubType = '${subType}'
and OrganId =${supplierId} and OperTime &lt;='${endTime}'
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select dh.*, s.supplier OrganName, p.name HandsPersonName, a.name AccountName
from jsh_depothead dh