Browse Source

[feat]财务管理:

应收账款
新增非销售订单创建收款凭证和含有销售订单的数据展示不同页面的功能
新增非销售订单创建收款凭证addReceivablesVoucher.html页面
修改addReceivablesVouche.html和
addReceivablesVoucher.html的部分字段为只读
dev
liuxiaoxu 6 months ago
parent
commit
6475859ddd
  1. 14
      ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java
  2. 9
      ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesMapper.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java
  4. 49
      ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucher.html
  5. 295
      ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucherNoSales.html

14
ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java

@ -122,17 +122,20 @@ public class FinancialReceivablesController extends BaseController
{
FinancialReceivables financialReceivables = financialReceivablesService.selectFinancialReceivablesById(financialReceivablesId);
mmap.put("financialReceivables", financialReceivables);
if (financialReceivables.getSalesOrderCode()==null){
return prefix + "/addReceivablesVoucherNoSales";
}
return prefix + "/addReceivablesVoucher";
}
/**
* 新增保存销售订单创建收款凭证
* 新增保存销售订单创建收款凭证
*/
@RequiresPermissions("financial:receivables:addReceivablesVoucher")
@RequiresPermissions("financial:receivables:addReceivablesVoucherNoSales")
@Log(title = "财务应收账款", businessType = BusinessType.UPDATE)
@PostMapping("/addReceivablesVoucher")
@PostMapping("/addReceivablesVoucherNoSales")
@ResponseBody
public AjaxResult addReceivablesVoucherSave(@RequestBody FinancialReceivables financialReceivables)
public AjaxResult addReceivablesVoucherNoSalesSave(@RequestBody FinancialReceivables financialReceivables)
{
return toAjax(financialReceivablesService.updateFinancialReceivables(financialReceivables));
}
@ -197,7 +200,7 @@ public class FinancialReceivablesController extends BaseController
}
/**
* 查找收款记录列表
* 查找关联收款记录列表
*/
@PostMapping("/getReceivablesRecords")
@ResponseBody
@ -207,4 +210,5 @@ public class FinancialReceivablesController extends BaseController
List<FinancialReceivablesRecords> financialReceivablesRecords =receivablesRecordsService.selectFinancialReceivablesRecordsListByCode(financialReceivablesCode);
return getDataTable(financialReceivablesRecords);
}
}

9
ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesMapper.java

@ -83,4 +83,13 @@ public interface FinancialReceivablesMapper
*/
public String findMaxRoundCode(@Param("prefix") String prefix);
// /**
// * 查询财务应收账款
// *
// * @param financialReceivablesId 财务应收账款ID
// * @return 财务应收账款
// */
// 查询非销售订单财务应收账款
// FinancialReceivables selectFinancialReceivablesNoSalesById(Long financialReceivablesId);
}

5
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java

@ -48,6 +48,7 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
return financialReceivablesMapper.selectFinancialReceivablesById(financialReceivablesId);
}
/**
* 查询财务应收账款列表
*
@ -83,8 +84,8 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
financialReceivables.setCreateTime(DateUtils.getNowDate());
String loginName = ShiroUtils.getLoginName();
financialReceivables.setCreateBy(loginName);
//财务手动添加的数据,默认为待收款
financialReceivables.setReceivablesClosingStatus("0");
return financialReceivablesMapper.insertFinancialReceivables(financialReceivables);
}

49
ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucher.html

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改财务应收账款')" />
<th:block th:include="include :: header('创建收款凭据(销售订单)')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
@ -12,13 +12,13 @@
<div class="form-group">
<label class="col-sm-3 control-label">应收单号:</label>
<div class="col-sm-8">
<input name="financialReceivablesCode" th:field="*{financialReceivablesCode}" class="form-control" type="text">
<input name="financialReceivablesCode" th:field="*{financialReceivablesCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收款状态:</label>
<div class="col-sm-8">
<select name="receivablesClosingStatus" class="form-control m-b" th:with="type=${@dict.getType('receivables_closing_status')}">
<select name="receivablesClosingStatus" class="form-control m-b" th:with="type=${@dict.getType('receivables_closing_status')}" readonly disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{receivablesClosingStatus}"></option>
</select>
</div>
@ -50,25 +50,25 @@
<div class="form-group">
<label class="col-sm-3 control-label">开户账号:</label>
<div class="col-sm-8">
<input name="openAccount" th:field="*{openAccount}" class="form-control" type="text">
<input name="openAccount" th:field="*{openAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户ID:</label>
<div class="col-sm-8">
<input name="customerId" th:field="*{customerId}" class="form-control" type="text">
<input name="customerId" th:field="*{customerId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同编号:</label>
<div class="col-sm-8">
<input name="contractNumber" th:field="*{contractNumber}" class="form-control" type="text">
<input name="contractNumber" th:field="*{contractNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">币种:</label>
<div class="col-sm-8">
<select name="currencyType" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}">
<select name="currencyType" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{currencyType}"></option>
</select>
</div>
@ -76,25 +76,25 @@
<div class="form-group">
<label class="col-sm-3 control-label">不含税金额:</label>
<div class="col-sm-8">
<input name="priceExcludingTax" th:field="*{priceExcludingTax}" class="form-control" type="text">
<input name="priceExcludingTax" th:field="*{priceExcludingTax}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税金额:</label>
<div class="col-sm-8">
<input name="priceIncludesTax" th:field="*{priceIncludesTax}" class="form-control" type="text">
<input name="priceIncludesTax" th:field="*{priceIncludesTax}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">付款条件:</label>
<div class="col-sm-8">
<input name="paymentCondition" th:field="*{paymentCondition}" class="form-control" type="text">
<input name="paymentCondition" th:field="*{paymentCondition}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">发货状态:</label>
<div class="col-sm-8">
<select name="financialDeliverStatus" class="form-control m-b" th:with="type=${@dict.getType('financial_deliver_status')}">
<select name="financialDeliverStatus" class="form-control m-b" th:with="type=${@dict.getType('financial_deliver_status')}" readonly disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{financialDeliverStatus}"></option>
</select>
</div>
@ -102,7 +102,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">业务员:</label>
<div class="col-sm-8">
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text">
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text" readonly>
</div>
</div>
</form>
@ -168,9 +168,9 @@
var financialReceivablesRecordsList = table.map(function(item) {
// 根据实际字段名调整
return {
"receivablesDate": item.receivablesDate,
"receivablesPrice": item.receivablesPrice,
"receivablesAbstract": item.receivablesAbstract,
"receivablesPrice": item.receivablesPrice,
"receivablesDate": item.receivablesDate,
"receivablesRemark": item.receivablesRemark,
// ...其他字段
};
@ -219,8 +219,12 @@
visible: false
},
{
title: '收款日期',
field: 'receivablesDate',
title: '操作时间',
field: 'operatingTime',
},
{
title: '摘要',
field: 'receivablesAbstract',
},
{
title: '收款金额',
@ -231,12 +235,8 @@
}
},
{
title: '收款摘要',
field: 'receivablesAbstract',
},
{
title: '操作时间',
field: 'operatingTime',
title: '收款日期',
field: 'receivablesDate',
},
{
title: '收款备注',
@ -261,10 +261,9 @@
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义
var newRow = {
receivablesRecordsId:uniqueId,
receivablesDate: "",
receivablesPrice: "",
receivablesAbstract: "",
operatingTime: "",
receivablesPrice: "",
receivablesDate: "",
receivablesRemark: ""
};

295
ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucherNoSales.html

@ -0,0 +1,295 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('创建收款凭据(非销售订单)')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-receivables-edit" th:object="${financialReceivables}">
<input name="financialReceivablesId" th:field="*{financialReceivablesId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">应收单号:</label>
<div class="col-sm-8">
<input name="financialReceivablesCode" th:field="*{financialReceivablesCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收款状态:</label>
<div class="col-sm-8">
<select name="receivablesClosingStatus" class="form-control m-b" th:with="type=${@dict.getType('receivables_closing_status')}" readonly disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{receivablesClosingStatus}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">贷方科目:</label>
<div class="col-sm-8">
<input name="creditAccount" th:field="*{creditAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">贷方明细:</label>
<div class="col-sm-8">
<input name="creditDetail" th:field="*{creditDetail}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开户银行:</label>
<div class="col-sm-8">
<input name="openBank" th:field="*{openBank}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开户账号:</label>
<div class="col-sm-8">
<input name="openAccount" th:field="*{openAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">合同编号:</label>
<div class="col-sm-8">
<input name="contractNumber" th:field="*{contractNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">币种:</label>
<div class="col-sm-8">
<select name="currencyType" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{currencyType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税金额:</label>
<div class="col-sm-8">
<input name="priceExcludingTax" th:field="*{priceExcludingTax}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">含税金额:</label>
<div class="col-sm-8">
<input name="priceIncludesTax" th:field="*{priceIncludesTax}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">付款条件:</label>
<div class="col-sm-8">
<input name="paymentCondition" th:field="*{paymentCondition}" class="form-control" type="text" readonly>
</div>
</div>
</form>
<div class="container">
<!-- 收款记录 -->
<div class="row">
<div class="col-sm-12 select-table table-striped">
<h3 class="mb-4">收款记录</h3>
<table id="bootstrap-receivablesRecords-table"></table>
</div>
</div>
<!-- 间隔行,用于分隔 -->
<div class="row">
<div class="col-sm-12 mt-5"><!-- 使用mt-* 类来增加上边距,例如 mt-5 对应 Bootstrap 的 margin-top: 3rem; --></div>
</div>
<!-- 收款凭证 -->
<div class="row">
<div class="col-sm-12 d-flex align-items-center">
<span style="font-weight: bold; font-family: Arial, sans-serif; font-size: 15px;">收款凭证</span>
<a class="btn btn-success ml-auto" onclick="addReceivablesRecordsDetail()">
<i class="fa fa-plus"></i> 添加收款明细
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-receivablesVoucher-table"></table>
</div>
</div>
<div id="totalReceivablesAmount" class="col-sm-12 d-flex align-items-center mt-3">
<span style="font-family: Arial, sans-serif; font-size: 10px;">收款合计:</span>
<span id="totalAmountDisplay">0.00</span>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var financialReceivables = [[${financialReceivables}]];
var prefix = ctx + "financial/receivables";
$("#form-receivables-edit").validate({
focusCleanup: true
});
function submitHandler() {
// 获取表单数据
const financialReceivablesData = $("#form-receivables-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据
var table = $('#bootstrap-receivablesVoucher-table').bootstrapTable('getData');
// 检查表格数据是否为空
if (table.length===0){
$.modal.alertWarning("请至少添加一条收款明细后再保存!");
return;
}
// 将表数据转换成与complaintNoticeData格式一致的数组
var financialReceivablesRecordsList = table.map(function(item) {
// 根据实际字段名调整
return {
"receivablesAbstract": item.receivablesAbstract,
"receivablesPrice": item.receivablesPrice,
// ...其他字段
};
});
// 合并表单数据和表格数据
const combinedData = Object.assign({}, financialReceivablesData, { receivablesRecordsVOList: financialReceivablesRecordsList });
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addReceivablesVoucherNoSales", jsonData);
}
$("input[name='receivablesDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='operatingTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
/*根据收款编号对应的收款明细*/
$(function() {
var options = {
id:"bootstrap-receivablesRecords-table",
url: prefix + "/getReceivablesRecords",
modalName: "收款记录",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
queryParams:queryParams,
columns: [
{
title: '财务应收账款记录id',
field: 'receivablesRecordsId',
visible: false
},
{
title: '操作时间',
field: 'operatingTime',
},
{
title: '摘要',
field: 'receivablesAbstract',
},
{
title: '收款金额',
field: 'receivablesPrice',
formatter: function(value, row, index) {
// 格式化收款金额为保留两位小数的字符串
return parseFloat(value).toFixed(2);
}
},
]
};
$.table.init(options);
})
function queryParams(params) {
var curParams = {
// 传递参数查询参数
financialReceivablesCode: financialReceivables.financialReceivablesCode
};
return curParams;
}
//添加收款明细
function addReceivablesRecordsDetail() {
// 生成一个简单的唯一标识,这里使用时间戳作为示例
var uniqueId = new Date().getTime();
// 创建一个新行数据模板,这里仅为示例,具体根据表格列来定义
var newRow = {
receivablesRecordsId:uniqueId,
receivablesAbstract: "",
receivablesPrice: "",
};
// 使用Bootstrap Table的API插入新行
$('#bootstrap-receivablesVoucher-table').bootstrapTable('append', newRow);
}
//收款凭证table列表
$(function() {
var options = {
id:"bootstrap-receivablesVoucher-table",
modalName: "收款凭证",
showColumns: false,
pagination: false,
showToggle: false,
showRefresh:false,
showSearch:false,
singleSelect:true,
columns: [{
checkbox: false
},
{
title: '财务应收账款记录id',
field: 'receivablesRecordsId',
visible: false
},
{
title: '收款摘要',
field: 'receivablesAbstract',
editable: {
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '收款金额',
field: 'receivablesPrice',
editable: {
type: 'text', // 表示该列可以被编辑为文本
},
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.receivablesRecordsId + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
})
// 逻辑删除收款凭证前端的一行数据
function removeRow(receivablesRecordsId){
console.log(receivablesRecordsId);
// 直接使用 receivablesRecordsId 值进行删除操作
$("#bootstrap-receivablesVoucher-table").bootstrapTable('remove', {
field: 'receivablesRecordsId',
values: receivablesRecordsId
});
}
</script>
</body>
</html>
Loading…
Cancel
Save