diff --git a/erp-modular/src/main/java/com/skyeye/dao/AccountDao.java b/erp-modular/src/main/java/com/skyeye/dao/AccountDao.java index bb6a3265..b9f7263f 100644 --- a/erp-modular/src/main/java/com/skyeye/dao/AccountDao.java +++ b/erp-modular/src/main/java/com/skyeye/dao/AccountDao.java @@ -36,4 +36,6 @@ public interface AccountDao { public List> queryAccountStreamById(Map params, PageBounds pageBounds) throws Exception; public List> queryAccountListToSelect(Map params) throws Exception; + + Map queryAccountItemMoneyById(Map params) throws Exception; } diff --git a/erp-modular/src/main/java/com/skyeye/service/impl/AccountServiceImpl.java b/erp-modular/src/main/java/com/skyeye/service/impl/AccountServiceImpl.java index b020e957..364fb8f0 100644 --- a/erp-modular/src/main/java/com/skyeye/service/impl/AccountServiceImpl.java +++ b/erp-modular/src/main/java/com/skyeye/service/impl/AccountServiceImpl.java @@ -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 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); } diff --git a/erp-modular/src/main/resources/dbmapper/erp/AccountMapper.xml b/erp-modular/src/main/resources/dbmapper/erp/AccountMapper.xml index 9a93679b..1d280b02 100644 --- a/erp-modular/src/main/resources/dbmapper/erp/AccountMapper.xml +++ b/erp-modular/src/main/resources/dbmapper/erp/AccountMapper.xml @@ -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 + + \ No newline at end of file diff --git a/erp-modular/src/main/resources/mapping/erp.xml b/erp-modular/src/main/resources/mapping/erp.xml index a1dac0f6..79832598 100644 --- a/erp-modular/src/main/resources/mapping/erp.xml +++ b/erp-modular/src/main/resources/mapping/erp.xml @@ -289,7 +289,6 @@ - @@ -304,7 +303,6 @@ - diff --git a/erp-modular/src/main/resources/template/js/account/accountadd.js b/erp-modular/src/main/resources/template/js/account/accountadd.js index 6c915708..59600fc7 100644 --- a/erp-modular/src/main/resources/template/js/account/accountadd.js +++ b/erp-modular/src/main/resources/template/js/account/accountadd.js @@ -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); }); diff --git a/erp-modular/src/main/resources/template/js/account/accountitem.js b/erp-modular/src/main/resources/template/js/account/accountitem.js index b18c16a4..95b30b41 100644 --- a/erp-modular/src/main/resources/template/js/account/accountitem.js +++ b/erp-modular/src/main/resources/template/js/account/accountitem.js @@ -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 "出库"; }else if(d.type == '2'){ @@ -50,22 +49,27 @@ layui.config({ return "零售"; }else if(d.subType == '9'){ return "其他出库"; + }else if(d.subType == '10'){ + return "采购单"; }else{ return "参数错误"; } }}, - { 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 "未审核"; + }else if(d.status == '1'){ + return "审核中"; }else if(d.status == '2'){ - return "已审核"; + return "审核通过"; }else if(d.status == '3'){ + return "审核拒绝"; + }else if(d.status == '4'){ return "已转采购|销售"; } }}, - { 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 "现金"; }else if(d.payType == '2'){ diff --git a/erp-modular/src/main/resources/template/tpl/account/accountadd.html b/erp-modular/src/main/resources/template/tpl/account/accountadd.html index 2a833e13..0352cecc 100644 --- a/erp-modular/src/main/resources/template/tpl/account/accountadd.html +++ b/erp-modular/src/main/resources/template/tpl/account/accountadd.html @@ -28,12 +28,6 @@ -
- -
- -
-
diff --git a/erp-modular/src/main/resources/template/tpl/account/accounteditTemplate.tpl b/erp-modular/src/main/resources/template/tpl/account/accounteditTemplate.tpl index 01ae2954..6cffc0ab 100644 --- a/erp-modular/src/main/resources/template/tpl/account/accounteditTemplate.tpl +++ b/erp-modular/src/main/resources/template/tpl/account/accounteditTemplate.tpl @@ -17,16 +17,10 @@
-
- -
- -
-
- +
diff --git a/erp-modular/src/main/resources/template/tpl/account/accountitem.html b/erp-modular/src/main/resources/template/tpl/account/accountitem.html index cfd0b765..a66da075 100644 --- a/erp-modular/src/main/resources/template/tpl/account/accountitem.html +++ b/erp-modular/src/main/resources/template/tpl/account/accountitem.html @@ -8,11 +8,6 @@ -
-
- -
-
diff --git a/erp-modular/src/main/resources/template/tpl/account/accountlist.html b/erp-modular/src/main/resources/template/tpl/account/accountlist.html index 2c621c4e..f0446643 100644 --- a/erp-modular/src/main/resources/template/tpl/account/accountlist.html +++ b/erp-modular/src/main/resources/template/tpl/account/accountlist.html @@ -49,9 +49,6 @@ {{# if(d.isDefault == 0 && auth('1570756580639')){ }} 默认 {{# } }} - {{# if(auth('1570756594966')){ }} - 详情 - {{# } }} {{# if(auth('1570756608495')){ }} 流水 {{# } }} diff --git a/erp-modular/src/main/resources/template/tpl/customer/customerlist.html b/erp-modular/src/main/resources/template/tpl/customer/customerlist.html index 653dd95d..8792d1ef 100644 --- a/erp-modular/src/main/resources/template/tpl/customer/customerlist.html +++ b/erp-modular/src/main/resources/template/tpl/customer/customerlist.html @@ -64,9 +64,6 @@ {{# if(d.enabled == 2 && auth('1569133194236')){ }} 启用 {{# } }} - {{# if(auth('1570719022357')){ }} - 详情 - {{# } }} diff --git a/erp-modular/src/main/resources/template/tpl/inoutitem/inoutitemlist.html b/erp-modular/src/main/resources/template/tpl/inoutitem/inoutitemlist.html index 0b3ffa4e..27df7b65 100644 --- a/erp-modular/src/main/resources/template/tpl/inoutitem/inoutitemlist.html +++ b/erp-modular/src/main/resources/template/tpl/inoutitem/inoutitemlist.html @@ -50,9 +50,6 @@ {{# if(auth('1570755603899')){ }} 删除 {{# } }} - {{# if(auth('1570755631013')){ }} - 详情 - {{# } }} diff --git a/erp-modular/src/main/resources/template/tpl/member/memberlist.html b/erp-modular/src/main/resources/template/tpl/member/memberlist.html index 1f28dcb0..2279cdd6 100644 --- a/erp-modular/src/main/resources/template/tpl/member/memberlist.html +++ b/erp-modular/src/main/resources/template/tpl/member/memberlist.html @@ -55,7 +55,7 @@ {{# if(d.enabled == 2 && auth('1569133258254')){ }} 编辑 {{# } }} - {{# if(d.enabled == 2 && auth('1569133240001')){ }} + {{# if(d.enabled == 2 && auth('1571154301068')){ }} 删除 {{# } }} {{# if(d.enabled == 1 && auth('1569133276824')){ }} @@ -64,9 +64,6 @@ {{# if(d.enabled == 2 && auth('1569133267244')){ }} 启用 {{# } }} - {{# if(auth('1570719070280')){ }} - 详情 - {{# } }} diff --git a/erp-modular/src/main/resources/template/tpl/storehouse/storehouselist.html b/erp-modular/src/main/resources/template/tpl/storehouse/storehouselist.html index d5cfdf71..d397ddf4 100644 --- a/erp-modular/src/main/resources/template/tpl/storehouse/storehouselist.html +++ b/erp-modular/src/main/resources/template/tpl/storehouse/storehouselist.html @@ -41,9 +41,6 @@ {{# if(d.isDefault == 2 && auth('1568526024398')){ }} 设置默认 {{# } }} - {{# if(auth('1570718931655')){ }} - 详情 - {{# } }} diff --git a/erp-modular/src/main/resources/template/tpl/supplier/supplierlist.html b/erp-modular/src/main/resources/template/tpl/supplier/supplierlist.html index d650ceed..f38495d8 100644 --- a/erp-modular/src/main/resources/template/tpl/supplier/supplierlist.html +++ b/erp-modular/src/main/resources/template/tpl/supplier/supplierlist.html @@ -64,9 +64,6 @@ {{# if(d.enabled == 2 && auth('1569133121921')){ }} 启用 {{# } }} - {{# if(auth('1570718983424')){ }} - 详情 - {{# } }}