修改仓库,会员,供应商,客户,账户详情问题,以及账户流水问题

This commit is contained in:
1812004768@qq.com 2019-10-16 09:57:15 +08:00
parent 22c8d5c555
commit bf5a3f9949
15 changed files with 49 additions and 62 deletions

View file

@ -36,4 +36,6 @@ public interface AccountDao {
public List<Map<String, Object>> queryAccountStreamById(Map<String, Object> params, PageBounds pageBounds) throws Exception;
public List<Map<String, Object>> queryAccountListToSelect(Map<String, Object> params) throws Exception;
Map<String, Object> queryAccountItemMoneyById(Map<String, Object> params) throws Exception;
}

View file

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -60,8 +61,13 @@ public class AccountServiceImpl implements AccountService {
return;
}
params.put("id", ToolUtil.getSurFaceId());
if(params.get("isDefault").toString().equals("1")){
params.put("isDefault", 0);
accountDao.editAccountByIsDefault(params);
params.put("isDefault", 1);
}
params.put("currentAmount", params.get("initialAmount"));
params.put("createTime", ToolUtil.getTimeAndToString());
params.put("isDefault", 0);
params.put("deleteFlag", 0);
accountDao.insertAccount(params);
}
@ -114,6 +120,18 @@ public class AccountServiceImpl implements AccountService {
outputObject.setreturnMessage("账户名称已存在!");
return;
}
if(params.get("isDefault").toString().equals("1")){
params.put("isDefault", 0);
accountDao.editAccountByIsDefault(params);
params.put("isDefault", 1);
}
//查询单据金额计算当前余额
Map<String, Object> account = accountDao.queryAccountItemMoneyById(params);
String total = (account == null) ? "0" : account.get("totalPrice").toString();
BigDecimal totalPrice = new BigDecimal(total);
BigDecimal initialAmount = new BigDecimal(params.get("initialAmount").toString());
BigDecimal currentAmount = initialAmount.add(totalPrice);
params.put("currentAmount", currentAmount);
accountDao.editAccountById(params);
}

View file

@ -166,21 +166,16 @@
d.number,
CONVERT (d.oper_time, CHAR) operTime,
CONVERT (d.create_time, CHAR) createTime,
FORMAT(d.change_amount, 2) changeAmount,
FORMAT(d.total_price, 2) totalPrice,
d.pay_type payType,
d.remark,
FORMAT(a.current_amount, 2) currentAmount
d.status
FROM
erp_account a,
erp_depothead d
WHERE
a.id = d.account_id
AND a.tenant_id = d.tenant_id
AND a.delete_flag = d.delete_flag
AND a.id = #{id}
AND a.tenant_id = #{userId}
AND a.delete_flag = 0
d.account_id = #{id}
AND d.tenant_id = #{userId}
AND d.delete_flag = 0
</select>
<select id="queryAccountListToSelect" parameterType="java.util.Map" resultType="java.util.Map">
@ -194,5 +189,15 @@
AND a.delete_flag = '0'
ORDER BY a.is_default ASC
</select>
<select id="queryAccountItemMoneyById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
SUM(d.total_price) totalPrice
FROM
erp_depothead d
WHERE
d.account_id = #{id}
AND d.tenant_id = #{userId}
</select>
</mapper>

View file

@ -289,7 +289,6 @@
<property id="accountName" name="accountName" ref="required" var="结算账户名称"/>
<property id="serialNo" name="serialNo" ref="required" var="结算账户编号"/>
<property id="initialAmount" name="initialAmount" ref="" var="结算账户期初金额"/>
<property id="currentAmount" name="currentAmount" ref="" var="结算账户当前余额"/>
<property id="remark" name="remark" ref="" var="结算账户备注"/>
<property id="isDefault" name="isDefault" ref="required,num" var="结算账户默认状态"/>
</url>
@ -304,7 +303,6 @@
<property id="accountName" name="accountName" ref="required" var="结算账户名称"/>
<property id="serialNo" name="serialNo" ref="required" var="结算账户编号"/>
<property id="initialAmount" name="initialAmount" ref="" var="结算账户期初金额"/>
<property id="currentAmount" name="currentAmount" ref="" var="结算账户当前余额"/>
<property id="remark" name="remark" ref="" var="结算账户备注"/>
<property id="isDefault" name="isDefault" ref="required,num" var="结算账户默认状态"/>
</url>

View file

@ -16,7 +16,6 @@ layui.config({
accountName: $("#accountName").val(),
serialNo: $("#serialNo").val(),
initialAmount: $("#initialAmount").val(),
currentAmount: $("#currentAmount").val(),
isDefault: $("input[name='isDefault']:checked").val(),
remark: $("#remark").val(),
};
@ -32,10 +31,6 @@ layui.config({
return false;
});
$("body").on("change", "#initialAmount", function () {
$("#currentAmount").val($(this).val());
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});

View file

@ -20,9 +20,8 @@ layui.config({
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'defaultNumber', title: '初始票据号', align: 'center',width: 200},
{ field: 'number', title: '票据号', align: 'center',width: 200},
{ field: 'type', title: '类型', align: 'center',width: 150, template: function (d) {
{ field: 'type', title: '类型', align: 'center',width: 150, templet: function (d) {
if(d.type == '1'){
return "<span class='state-down'>出库</span>";
}else if(d.type == '2'){
@ -50,22 +49,27 @@ layui.config({
return "<span class='state-down'>零售</span>";
}else if(d.subType == '9'){
return "<span class='state-down'>其他出库</span>";
}else if(d.subType == '10'){
return "采购单";
}else{
return "<span class='state-error'>参数错误</span>";
}
}},
{ field: 'status', title: '状态', align: 'left',width: 150, template: function () {
if(d.status == '1'){
{ field: 'status', title: '状态', align: 'left',width: 150, templet: function (d) {
if(d.status == '0'){
return "<span class='state-error'>未审核</span>";
}else if(d.status == '1'){
return "<span class='state-down'>审核中</span>";
}else if(d.status == '2'){
return "<span class='state-up'>已审核</span>";
return "<span class='state-up'>审核通过</span>";
}else if(d.status == '3'){
return "<span class='state-error'>审核拒绝</span>";
}else if(d.status == '4'){
return "<span class='state-up'>已转采购|销售</span>";
}
}},
{ field: 'changeAmount', title: '变动金额', align: 'left',width: 100},
{ field: 'currentAmount', title: '余额', align: 'left',width: 100},
{ field: 'payType', title: '付款类型', align: 'center',width: 100, template: function (d) {
{ field: 'totalPrice', title: '合计金额', align: 'left',width: 100},
{ field: 'payType', title: '付款类型', align: 'center',width: 100, templet: function (d) {
if(d.payType == '1'){
return "<span class='state-up'>现金</span>";
}else if(d.payType == '2'){

View file

@ -28,12 +28,6 @@
<input type="text" id="initialAmount" name="initialAmount" win-verify="required|money" placeholder="请输入期初金额" class="layui-input"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">当前余额</label>
<div class="layui-input-block">
<input type="text" id="currentAmount" name="currentAmount" win-verify="required|money" placeholder="账户当前余额" class="layui-input" readonly="readonly"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">是否默认<i class="red">*</i></label>
<div class="layui-input-block winui-radio">

View file

@ -17,16 +17,10 @@
<input type="text" id="initialAmount" name="initialAmount" value="{{initialAmount}}" win-verify="required|money" placeholder="请输入期初金额" class="layui-input"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">当前余额</label>
<div class="layui-input-block">
<input type="text" id="currentAmount" name="currentAmount" value="{{currentAmount}}" win-verify="required|money" placeholder="0" class="layui-input" readonly="readonly"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">是否默认<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<input type="radio" name="isDefault" value="0" title="否" checked="checked"/>
<input type="radio" name="isDefault" value="0" title="否"/>
<input type="radio" name="isDefault" value="1" title="是"/>
</div>
</div>

View file

@ -8,11 +8,6 @@
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
</div>

View file

@ -49,9 +49,6 @@
{{# if(d.isDefault == 0 && auth('1570756580639')){ }}
<a class="layui-btn layui-btn-xs" lay-event="default">默认</a>
{{# } }}
{{# if(auth('1570756594966')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
{{# if(auth('1570756608495')){ }}
<a class="layui-btn layui-btn-xs" lay-event="item">流水</a>
{{# } }}

View file

@ -64,9 +64,6 @@
{{# if(d.enabled == 2 && auth('1569133194236')){ }}
<a class="layui-btn layui-btn-xs" lay-event="enabled">启用</a>
{{# } }}
{{# if(auth('1570719022357')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>

View file

@ -50,9 +50,6 @@
{{# if(auth('1570755603899')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
{{# } }}
{{# if(auth('1570755631013')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>

View file

@ -55,7 +55,7 @@
{{# if(d.enabled == 2 && auth('1569133258254')){ }}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{{# } }}
{{# if(d.enabled == 2 && auth('1569133240001')){ }}
{{# if(d.enabled == 2 && auth('1571154301068')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
{{# } }}
{{# if(d.enabled == 1 && auth('1569133276824')){ }}
@ -64,9 +64,6 @@
{{# if(d.enabled == 2 && auth('1569133267244')){ }}
<a class="layui-btn layui-btn-xs" lay-event="enabled">启用</a>
{{# } }}
{{# if(auth('1570719070280')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>

View file

@ -41,9 +41,6 @@
{{# if(d.isDefault == 2 && auth('1568526024398')){ }}
<a class="layui-btn layui-btn-xs" lay-event="default">设置默认</a>
{{# } }}
{{# if(auth('1570718931655')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>

View file

@ -64,9 +64,6 @@
{{# if(d.enabled == 2 && auth('1569133121921')){ }}
<a class="layui-btn layui-btn-xs" lay-event="enabled">启用</a>
{{# } }}
{{# if(auth('1570718983424')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="select">详情</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>