Browse Source

修改:收款凭证导出模版信息,添批量固定数量的收款凭证明细。最大数量为6,计算合计,超出最大的收款凭证记录数新增sheer表。

dev
zhangsiqi 3 months ago
parent
commit
607d2c263e
  1. 53
      ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivables.java
  3. 22
      ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivablesRecords.java
  4. 1
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java
  6. BIN
      ruoyi-admin/src/main/resources/attachments/FinancialReceiptVoucherTemplate.xlsx
  7. 21
      ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesMapper.xml
  8. 2
      ruoyi-admin/src/main/resources/templates/financial/receivables/add.html
  9. 40
      ruoyi-admin/src/main/resources/templates/financial/receivables/addDebit.html
  10. 4
      ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucher.html
  11. 8
      ruoyi-admin/src/main/resources/templates/financial/receivables/addReceivablesVoucherNoSales.html
  12. 4
      ruoyi-admin/src/main/resources/templates/financial/receivables/edit.html
  13. 20
      ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

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

@ -20,6 +20,7 @@ import com.ruoyi.common.utils.file.FileDownloadUtils;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.financial.domain.VO.ExportFinancialReceivablesVo;
import com.ruoyi.financial.service.IFinancialReceivablesRecordsService;
import com.ruoyi.framework.web.service.DictService;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
@ -64,6 +65,8 @@ public class FinancialReceivablesController extends BaseController
@Autowired
private IFinancialReceivablesRecordsService receivablesRecordsService;
@Autowired
private DictService dictService;
@RequiresPermissions("financial:receivables:view")
@GetMapping()
public String receivables()
@ -164,16 +167,6 @@ public class FinancialReceivablesController extends BaseController
List<FinancialReceivablesRecords> financialReceivablesRecordsList = receivablesRecordsService.selectFinancialReceivablesRecordsListByCode(financialReceivables.getFinancialReceivablesCode());
//
// Map<String, Object> map = financialReceivablesService.exportTemplate(financialReceivablesRecordsList);
Map<String, Object> map1 = new HashMap<>();
map1.put("debitAccount",financialReceivables.getDebitAccount());
String date = DateUtils.getDate();
String[] dateArray = date.split("-");
map1.put("year", dateArray[0]);
map1.put("month", dateArray[1]);
map1.put("day", dateArray[2]);
map1.put("openBank",financialReceivables.getOpenBank());
map1.put("debitAccount",financialReceivables.getDebitAccount());
map1.put("loginName", ShiroUtils.getLoginName());
// 模版位置
String name = "FinancialReceiptVoucherTemplate.xlsx";
@ -192,14 +185,23 @@ public class FinancialReceivablesController extends BaseController
final int maxRowsPerPage = 6;
// 计算需要多少页
int totalPages = (int) Math.ceil((double) financialReceivablesRecordsList.size() / maxRowsPerPage);
for (int i = 0; i < totalPages; i++) {
for (int i = 0; i < totalPages - 1; i++) {
List<FinancialReceivablesRecords> financialReceivablesRecordsListPage =
receivablesRecordsService.selectFinancialReceivablesRecordsListByCodePage(financialReceivables.getFinancialReceivablesCode(), i + 1, maxRowsPerPage);
Map<String, Object> map = financialReceivablesService.exportTemplate(financialReceivablesRecordsList);
Map<String, Object> map = financialReceivablesService.exportTemplate(financialReceivablesRecordsListPage);
Map<String, Object> map1 = new HashMap<>();
map1.put("debitAccount",dictService.getLabel("receivables_debit_entry", financialReceivables.getDebitAccount()));
String date = DateUtils.getDate();
String[] dateArray = date.split("-");
map1.put("year", dateArray[0]);
map1.put("month", dateArray[1]);
map1.put("day", dateArray[2]);
map1.put("debitBank", dictService.getLabel("receivables_bank", financialReceivables.getOpenBank()));
map1.put("loginName", ShiroUtils.getLoginName());
// 创建一个WriteSheet对象,并指定模板中的Sheet编号
WriteSheet writeSheet = EasyExcel.writerSheet("sheet" + (i + 1)).build();
FillConfig fillConfig = FillConfig.builder().forceNewRow(false).build();
excelWriter.fill(map1, writeSheet);
excelWriter.fill(map1,fillConfig, writeSheet);
excelWriter.fill(map.get("list"), fillConfig, writeSheet);
excelWriter.fill(map.get("amount"), writeSheet);
}
@ -319,7 +321,28 @@ public class FinancialReceivablesController extends BaseController
return getDataTable(financialReceivablesRecords);
}
/**
* 应收款账单借方详情
* @param financialReceivablesId
* @param mmap
* @return
*/
@GetMapping("/addDebit/{financialReceivablesId}")
public String addDebit(@PathVariable("financialReceivablesId") Long financialReceivablesId, ModelMap mmap)
{
FinancialReceivables financialReceivables = financialReceivablesService.selectFinancialReceivablesById(financialReceivablesId);
mmap.put("debit", financialReceivables);
return prefix + "/addDebit";
}
/**
* 应收款账单借方详情
* @return
*/
@PostMapping("/addDebitEntiry")
@ResponseBody
public AjaxResult addDebitEntiry(FinancialReceivables financialReceivables)
{
return AjaxResult.success( financialReceivablesService.updateReceivableDebit(financialReceivables));
}
}

5
ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivables.java

@ -41,7 +41,8 @@ public class FinancialReceivables extends BaseEntity
/*借方科目*/
@Excel(name = "借方科目", readConverterExp="0=银行存款,1=现金")
private String debitAccount;
@Excel(name = "借方开户银行" ,readConverterExp="0=中行基本户,建行一般户")
private String debitBank;
/** 贷方科目 */
@Excel(name = "贷方科目")
private String creditAccount;
@ -51,7 +52,7 @@ public class FinancialReceivables extends BaseEntity
private String creditDetail;
/** 开户银行 */
@Excel(name = "开户银行",readConverterExp="0=中行基本户,建行一般户")
@Excel(name = "开户银行")
private String openBank;
/** 开户账号 */

22
ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialReceivablesRecords.java

@ -30,6 +30,12 @@ public class FinancialReceivablesRecords extends BaseEntity
/** 关联销售订单号 */
private String salesOrderCode;
/*借方科目*/
@Excel(name = "借方科目")
private String debitAccount;
@Excel(name = "借方科目开户银行")
private String debitBank;
/** 收款日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "收款日期", width = 30, dateFormat = "yyyy-MM-dd")
@ -144,6 +150,22 @@ public class FinancialReceivablesRecords extends BaseEntity
return receivablesRemark;
}
public String getDebitAccount() {
return debitAccount;
}
public void setDebitAccount(String debitAccount) {
this.debitAccount = debitAccount;
}
public String getDebitBank() {
return debitBank;
}
public void setDebitBank(String debitBank) {
this.debitBank = debitBank;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

1
ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java

@ -101,4 +101,5 @@ public interface IFinancialReceivablesService
Map<String, Object> exportTemplate(List<FinancialReceivablesRecords> financialReceivablesRecordsList) throws IOException;
Integer updateReceivableDebit(FinancialReceivables financialReceivables);
}

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

@ -397,4 +397,9 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
//金额对象
return exportFinancialReceivablesVo;
}
@Override
public Integer updateReceivableDebit(FinancialReceivables financialReceivables){
return financialReceivablesMapper.updateFinancialReceivables(financialReceivables);
}
}

BIN
ruoyi-admin/src/main/resources/attachments/FinancialReceiptVoucherTemplate.xlsx

Binary file not shown.

21
ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesMapper.xml

@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="receivablesClosingStatus" column="receivables_closing_status" />
<result property="salesOrderCode" column="sales_order_code" />
<result property="debitAccount" column="debit_account" />
<result property="debitBank" column="debit_bank" />
<result property="creditAccount" column="credit_account" />
<result property="creditDetail" column="credit_detail" />
<result property="openBank" column="open_bank" />
@ -37,7 +38,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectFinancialReceivablesVo">
select financial_receivables_id, financial_receivables_code, receivables_closing_status, sales_order_code, credit_account, credit_detail, open_bank, open_account, customer_id, customer_name, contract_number, currency_type, price_excluding_tax, price_includes_tax, payment_condition, received_includes_tax, not_received_includes_tax, business_members, financial_deliver_status, receivables_date, receivables_price, receivables_abstract, operating_time, receivables_remark, create_time, create_by, update_by, update_time from financial_receivables
select financial_receivables_id, financial_receivables_code, receivables_closing_status,
sales_order_code,debit_account, debit_bank, credit_account, credit_detail, open_bank,
open_account,customer_id, customer_name, contract_number, currency_type,price_excluding_tax,
price_includes_tax, payment_condition,received_includes_tax, not_received_includes_tax,
business_members,financial_deliver_status, receivables_date, receivables_price,receivables_abstract,
operating_time, receivables_remark,create_time, create_by, update_by, update_time
from financial_receivables
</sql>
<select id="selectFinancialReceivablesList" parameterType="FinancialReceivables" resultMap="FinancialReceivablesResult">
@ -46,6 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="financialReceivablesCode != null and financialReceivablesCode != ''"> and financial_receivables_code = #{financialReceivablesCode}</if>
<if test="receivablesClosingStatus != null and receivablesClosingStatus != ''"> and receivables_closing_status = #{receivablesClosingStatus}</if>
<if test="salesOrderCode != null and salesOrderCode != ''"> and sales_order_code = #{salesOrderCode}</if>
<if test="debitAccount != null and debitAccount != ''"> and debit_account = #{debitAccount}</if>
<if test="debitBank != null and debitBank != ''"> and debit_bank = #{debitBank}</if>
<if test="creditAccount != null and creditAccount != ''"> and credit_account = #{creditAccount}</if>
<if test="creditDetail != null and creditDetail != ''"> and credit_detail = #{creditDetail}</if>
<if test="openBank != null and openBank != ''"> and open_bank = #{openBank}</if>
@ -71,7 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="financialReceivablesCode != null">financial_receivables_code,</if>
<if test="receivablesClosingStatus != null">receivables_closing_status,</if>
<if test="salesOrderCode != null">sales_order_code,</if>
<if test="creditAccount != null">debit_account,</if>
<if test="debitAccount != null">debit_account,</if>
<if test="debitBank != null">debit_bank,</if>
<if test="creditAccount != null">credit_account,</if>
<if test="creditDetail != null">credit_detail,</if>
<if test="openBank != null">open_bank,</if>
@ -101,7 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="financialReceivablesCode != null">#{financialReceivablesCode},</if>
<if test="receivablesClosingStatus != null">#{receivablesClosingStatus},</if>
<if test="salesOrderCode != null">#{salesOrderCode},</if>
<if test="creditAccount != null">#{debitAccount},</if>
<if test="debitAccount != null">#{debitAccount},</if>
<if test="debitBank != null">#{debitBank},</if>
<if test="creditAccount != null">#{creditAccount},</if>
<if test="creditDetail != null">#{creditDetail},</if>
<if test="openBank != null">#{openBank},</if>
@ -135,7 +146,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="financialReceivablesCode != null">financial_receivables_code = #{financialReceivablesCode},</if>
<if test="receivablesClosingStatus != null">receivables_closing_status = #{receivablesClosingStatus},</if>
<if test="salesOrderCode != null">sales_order_code = #{salesOrderCode},</if>
<if test="creditAccount != null">debit_account = #{debitAccount},</if>
<if test="debitAccount != null">debit_account = #{debitAccount},</if>
<if test="debitBank != null">debit_bank = #{debitBank},</if>
<if test="creditAccount != null">credit_account = #{creditAccount},</if>
<if test="creditDetail != null">credit_detail = #{creditDetail},</if>
<if test="openBank != null">open_bank = #{openBank},</if>
@ -190,5 +202,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findMaxRoundCode" resultType="String">
SELECT MAX(SUBSTRING(financial_receivables_code, 7)) FROM financial_receivables WHERE financial_receivables_code LIKE CONCAT(#{prefix}, '%')
</select>
</mapper>

2
ruoyi-admin/src/main/resources/templates/financial/receivables/add.html

@ -169,7 +169,7 @@
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-receivables-add').serialize());
$.operate.save(prefix + "/edit", $('#form-receivables-add').serialize());
}
}

40
ruoyi-admin/src/main/resources/templates/financial/receivables/addDebit.html

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增借方明细')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-receivables-addDebit" th:object="${debit}">
<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">
<select name="debitAccount" class="form-control" th:with="dict=${@dict.getType('receivables_debit_entry')}">
<option th:each="dict : ${dict}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">借方开户银行类型:</label>
<div class="col-sm-8">
<select name="debitBank" class="form-control" th:with="dict=${@dict.getType('receivables_bank')}">
<option th:each="dict : ${dict}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "financial/receivables"
$("#form-receivables-addDebit").validate({focusCleanup: true});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/addDebitEntiry", $('#form-receivables-addDebit').serialize());
}
}
</script>
</body>
</html>

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

@ -53,9 +53,9 @@
<div class="form-group">
<label class="col-sm-3 control-label">开户银行:</label>
<div class="col-sm-8">
<select name="openBank" th:field="*{openBank}" class="form-control" th:with="type=${@dict.getType('receivables_bank')}">
<select name="debitBank" th:field="*{debitBank}" class="form-control" th:with="type=${@dict.getType('receivables_bank')}">
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{openBank}"></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{debitBank}"></option>
</select>
<!-- <input name="openBank" th:field="*{openBank}" class="form-control" type="text" readonly>-->
</div>

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

@ -18,7 +18,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">借方科目:</label>
<div class="col-sm-8">
<select name="debitAccount" th:field="*{debitAccount}" class="form-control" th:with="type=${@dict.getType('receivables_debit_entry')}">
<select name="debitAccount" th:field="*{debitAccount}" class="form-control" th:with="type=${@dict.getType('receivables_debit_entry')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{debitAccount}"></option>
</select>
<!-- <input name="openBank" th:field="*{openBank}" class="form-control" type="text" readonly>-->
@ -27,7 +27,7 @@
<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>
<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>
@ -47,8 +47,8 @@
<div class="form-group">
<label class="col-sm-3 control-label">开户银行:</label>
<div class="col-sm-8">
<select name="openBank" th:field="*{openBank}" class="form-control" th:with="type=${@dict.getType('receivables_bank')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{openBank}"></option>
<select name="debitBank" th:field="*{debitBank}" class="form-control" th:with="type=${@dict.getType('receivables_bank')}" disabled />
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{debitBank}"></option>
</select>
<!-- <input name="openBank" th:field="*{openBank}" class="form-control" type="text" readonly>-->
</div>

4
ruoyi-admin/src/main/resources/templates/financial/receivables/edit.html

@ -164,9 +164,7 @@
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "financial/receivables";
$("#form-receivables-edit").validate({
focusCleanup: true
});
$("#form-receivables-edit").validate({focusCleanup: true});
function submitHandler() {
if ($.validate.form()) {

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

@ -121,6 +121,11 @@
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
modalName: "财务应收账款",
fixedColumns: true, // 是否启用冻结列(左侧)
fixedNumber: 1, // 列冻结的个数(左侧)
rightFixedColumns: true, // 是否启用冻结列(右侧)
fixedRightNumber: 1,
height: $(window).height() - 100,
columns: [
{checkbox: true},
{title: '财务应收账款id', field: 'financialReceivablesId', visible: false},
@ -144,13 +149,21 @@
{title: '录入时间', field: 'createTime',},
{title: '更新人', field: 'updateBy',},
{title: '上次更新时间', field: 'updateTime',},
{title:'借方科目', field: 'debitAccount',hidden:true},
{title:'借方开户银行', field: 'debitBank',hidden:true},
{title: '操作', align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> ');
if (row.debitAccount =="" || row.debitBank =="") {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="addDebit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>添加借方明细</a> ')
}else{
actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> ');
}
if (row.receivablesClosingStatus !== '2') {
actions.push('<a class="btn btn-success btn-xs ' + closingFlag + '" href="javascript:void(0)" onclick="confirmAndClose(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>结案</a> ');
}
actions.push('<a class="btn btn-success btn-xs ' + receivablesVoucherDetailFlag + '" href="javascript:void(0)" onclick="receivablesVoucherDetail(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
@ -165,7 +178,10 @@
var url=ctx+'financial/receivables/addFinancialReceivables';
$.modal.open("添加应收账款",url);
}
function addDebit(financialReceivablesId){
var url=ctx+'financial/receivables/addDebit/' + financialReceivablesId;
$.modal.open("添加借方明细",url);
}
//创建收款凭证
function addReceivablesVoucher(financialReceivablesId){
var url = ctx+'financial/receivables/addReceivablesVoucher/'+financialReceivablesId;

Loading…
Cancel
Save