Browse Source

[feat]财务管理 销售管理

修改 根据销售订单信息填充发票信息 修改税率来源,来自客户资料
修改 销售订单新增开票信息后端接口:新增  开票提交前加上条件判断:累计开票比例不能超出开票限额100;新增区分国内和国外客户提交进行判断,分别处理对应的数据
修改销售订单开票-国内前端页面 修改税率来自查询;开票额度比例列表新增百分号作为后缀
修改销售订单前端列表页面:新增作废状态码,开篇前先进行是否作废判断,作废不可开票
修改客户资料和客户资料Dto数据的数据类型,由String->Double
新增 开票-国外客户前端页面;增加国外客户对应的前端展示字段,js查询方法,js提交方法;
dev
liuxiaoxu 1 month ago
parent
commit
0ccb6ab2f7
  1. 43
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java
  3. 19
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java
  4. 12
      ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html
  5. 566
      ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceUSD.html
  6. 25
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

43
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java

@ -3,8 +3,10 @@ package com.ruoyi.financial.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory;
@ -22,6 +24,7 @@ import com.ruoyi.financial.domain.FinancialTaxInvoice;
import com.ruoyi.financial.service.IFinancialTaxInvoiceService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* 国税发票Service业务层处理
@ -170,6 +173,7 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
financialTaxInvoice.setContactNumber(sysSalesOrder.getContactNumber());
financialTaxInvoice.setEnterpriseSum(sysSalesOrder.getEnterpriseSum());
financialTaxInvoice.setMaterialSum(sysSalesOrder.getMaterialSum());
// financialTaxInvoice.setTaxRate(BigDecimal.valueOf(sysSalesOrder.getTaxRate()));
financialTaxInvoice.setRmbTaxSum(BigDecimal.valueOf(sysSalesOrder.getRmbTaxSum()));
financialTaxInvoice.setNoRmbSum(BigDecimal.valueOf(sysSalesOrder.getNoRmbSum()));
financialTaxInvoice.setUsdTaxSum(BigDecimal.valueOf(sysSalesOrder.getUsdTaxSum()));
@ -179,10 +183,7 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
financialTaxInvoice.setInvoiceCompanyName(sysCustomerVo.getInvoicingCompanyName());
financialTaxInvoice.setBankAccount(sysCustomerVo.getBankAccount());
financialTaxInvoice.setDepositBank(sysCustomerVo.getDepositBank());
financialTaxInvoice.setTaxRate(BigDecimal.valueOf(sysCustomerVo.getTaxRate()));
return financialTaxInvoice;
}
@ -198,6 +199,8 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
public int makeInvoiceSave(FinancialTaxInvoice financialTaxInvoice) {
String loginName = ShiroUtils.getLoginName();
String salesOrderCode = financialTaxInvoice.getSalesOrderCode();
financialTaxInvoice.setCreateBy(loginName);
financialTaxInvoice.setCreateTime(new Date());
String taxInvoiceCode = redisCache.generateBillNo("FP");
@ -210,18 +213,41 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
List<FinancialTaxInvoiceMaterial> invoiceMaterialList = financialTaxInvoice.getInvoiceMaterialList();
invoiceMaterialList.parallelStream().forEach(invoiceMaterial -> {
invoiceMaterial.setTaxInvoiceCode(taxInvoiceCode);
invoiceMaterial.setSalesOrderCode(financialTaxInvoice.getSalesOrderCode());
invoiceMaterial.setSalesOrderCode(salesOrderCode);
invoiceMaterial.setCreateBy(loginName);
invoiceMaterial.setCreateTime(new Date());
});
invoiceMaterialMapper.insertFinancialTaxInvoiceMaterialBatch(invoiceMaterialList);
//获取历史开票信息
List<FinancialTaxInvoiceHistory> financialTaxInvoiceHistories = invoiceHistoryMapper.selectInvoiceHistoryListBySalesOrderCode(salesOrderCode);
//获取除了被审核拒接的历史开票信息
List<FinancialTaxInvoiceHistory> filterInvoiceHistories = financialTaxInvoiceHistories.stream().filter(item -> !item.getTaxInvoiceStatus().equals("3")).collect(Collectors.toList());
//判断历史开票信息是否超出开票限额
if (!CollectionUtils.isEmpty(filterInvoiceHistories)){
BigDecimal totalInvoiceQuotaRatio = filterInvoiceHistories.stream().map(FinancialTaxInvoiceHistory::getInvoiceQuotaRatio)
.reduce(BigDecimal.ZERO, BigDecimal::add);
//判断累计开票比例是否超出开票限额
if (totalInvoiceQuotaRatio.add(financialTaxInvoice.getInvoiceQuotaRatio()).compareTo(new BigDecimal("100")) > 0 ){
throw new BusinessException("累计开票比例超出开票限额100%");
}
}
//填充国税发票历史数据
FinancialTaxInvoiceHistory financialTaxInvoiceHistory = new FinancialTaxInvoiceHistory();
financialTaxInvoiceHistory.setTaxInvoiceCode(taxInvoiceCode);
financialTaxInvoiceHistory.setSalesOrderCode(financialTaxInvoice.getSalesOrderCode());
financialTaxInvoiceHistory.setInvoiceAmountRmb(financialTaxInvoice.getInvoiceAmountRmb());
//financialTaxInvoiceHistory.setInvoiceAmountUsd(financialTaxInvoice.getInvoiceAmountUsd());
financialTaxInvoiceHistory.setSalesOrderCode(salesOrderCode);
if ("1".equals(financialTaxInvoice.getCommonCurrency())){
financialTaxInvoiceHistory.setInvoiceAmountRmb(financialTaxInvoice.getInvoiceAmountRmb());
}else {
financialTaxInvoiceHistory.setInvoiceAmountUsd(financialTaxInvoice.getInvoiceAmountUsd());
}
financialTaxInvoiceHistory.setInvoicePurpose(financialTaxInvoice.getInvoicePurpose());
financialTaxInvoiceHistory.setInvoiceQuotaRatio(financialTaxInvoice.getInvoiceQuotaRatio());
financialTaxInvoiceHistory.setTaxInvoiceStatus("0");//待审核
@ -230,7 +256,6 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi
financialTaxInvoiceHistory.setCreateTime(new Date());
invoiceHistoryMapper.insertFinancialTaxInvoiceHistory(financialTaxInvoiceHistory);
return financialTaxInvoiceMapper.insertFinancialTaxInvoice(financialTaxInvoice);
}
}

13
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java

@ -88,7 +88,7 @@ public class SysCustomer extends BaseEntity
/** 税率 */
@Excel(name = "税率")
private String taxRate;
private Double taxRate;
/** 诚信评级 */
@Excel(name = "诚信评级")
@ -556,16 +556,15 @@ public class SysCustomer extends BaseEntity
{
return confirmTax;
}
public void setTaxRate(String taxRate)
{
this.taxRate = taxRate;
}
public String getTaxRate()
{
public Double getTaxRate() {
return taxRate;
}
public void setTaxRate(Double taxRate) {
this.taxRate = taxRate;
}
public Long getDeliveryAddressId() {
return deliveryAddressId;
}

19
ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java

@ -190,7 +190,7 @@ public class SysCustomerDto extends SysCustomer
/** 税率 */
@ExcelProperty("税率")
private String taxRate;
private Double taxRate;
/** 国家/地区编号 */
@ExcelProperty("国家/地区编号")
@ -574,16 +574,19 @@ public class SysCustomerDto extends SysCustomer
{
return confirmTax;
}
public void setTaxRate(String taxRate)
{
this.taxRate = taxRate;
}
public String getTaxRate()
{
@Override
public Double getTaxRate() {
return taxRate;
}
public void setCountryNumber(String countryNumber)
@Override
public void setTaxRate(Double taxRate) {
this.taxRate = taxRate;
}
public void setCountryNumber(String countryNumber)
{
this.countryNumber = countryNumber;
}

12
ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html

@ -91,7 +91,10 @@
<div class="form-group">
<label class="col-sm-5 control-label">税率:</label>
<div class="col-sm-7">
<div class="input-group">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
@ -399,6 +402,13 @@
{
title: '开票额度比例',
field: 'invoiceQuotaRatio',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value + "%";
}
}
},
{
title: '开票金额(RMB)',
@ -478,6 +488,7 @@
$('input[name="invoiceCompanyCode"]').val(details.invoiceCompanyCode);
$('input[name="depositBank"]').val(details.depositBank);
$('input[name="bankAccount"]').val(details.bankAccount);
$('input[name="taxRate"]').val(details.taxRate);
}
// 封装清空发票详情的函数
@ -485,6 +496,7 @@
$('input[name="invoiceCompanyCode"]').val('');
$('input[name="depositBank"]').val('');
$('input[name="bankAccount"]').val('');
$('input[name="taxRate"]').val('');
}

566
ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceUSD.html

@ -0,0 +1,566 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-taxInvoice-USDAdd" th:object="${taxInvoice}">
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden">
<div class="form-group">
<label class="col-sm-5 control-label">销售订单编号:</label>
<div class="col-sm-7">
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">订单类型:</label>
<div class="col-sm-7">
<select name="salesOrderType" class="form-control m-b" th:with="type=${@dict.getType('sys_order_type')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salesOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">报价币种:</label>
<div class="col-sm-7">
<select name="commonCurrency" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{commonCurrency}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">客户代码/ID:</label>
<div class="col-sm-7">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">客户名称:</label>
<div class="col-sm-7">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">联系电话:</label>
<div class="col-sm-7">
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司地址:</label>
<div class="col-sm-7">
<input name="enterpriseAddress" th:field="*{enterpriseAddress}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票公司名称:</label>
<div class="col-sm-7">
<select class="form-control" id="invoiceCompanyName" name="invoiceCompanyName" th:field="*{invoiceCompanyName}">
<!-- 这里动态生成开票公司名称选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票公司税号:</label>
<div class="col-sm-7">
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户行:</label>
<div class="col-sm-7">
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户账号:</label>
<div class="col-sm-7">
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">税率:</label>
<div class="col-sm-7">
<div class="input-group">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required" >发票种类:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_class')}">
<input type="radio" th:id="${'taxInvoiceClass_' + dict.dictCode}" name="taxInvoiceClass" th:value="${dict.dictValue}" th:field="*{taxInvoiceClass}" required>
<label th:for="${'taxInvoiceClass_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">发票类型:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_type')}">
<input type="radio" th:id="${'taxInvoiceType_' + dict.dictCode}" name="taxInvoiceType" th:value="${dict.dictValue}" th:field="*{taxInvoiceType}" required>
<label th:for="${'taxInvoiceType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">发票抬头:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_title')}">
<input type="radio" th:id="${'taxInvoiceTitle_' + dict.dictCode}" name="taxInvoiceTitle" th:value="${dict.dictValue}" th:field="*{taxInvoiceTitle}" required>
<label th:for="${'taxInvoiceTitle_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">邮箱:</label>
<div class="col-sm-7">
<input name="invoiceEmail" th:field="*{invoiceEmail}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">业务备注:</label>
<div class="col-sm-7">
<input name="businessRemark" th:field="*{businessRemark}" class="form-control" type="text">
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">开票物料</h4>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table-material"></table>
</div>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">开票历史</h4>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table-history"></table>
</div>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">开票额度</h4>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">不含税总价(美元):</label>
<div class="col-sm-7">
<input name="noUsdSum" th:field="*{noUsdSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">含税总价(美元):</label>
<div class="col-sm-7">
<input name="usdTaxSum" th:field="*{usdTaxSum}" class="form-control" type="text" id="usdTaxSumInput" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">物料数合计:</label>
<div class="col-sm-7">
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">数量合计:</label>
<div class="col-sm-7">
<input name="enterpriseSum" th:field="*{enterpriseSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票额度比例:</label>
<div class="col-sm-7">
<div class="input-group">
<input name="invoiceQuotaRatio" th:field="*{invoiceQuotaRatio}" class="form-control" type="text" id="invoiceQuotaRatioInput">
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票金额(美元):</label>
<div class="col-sm-7">
<input name="invoiceAmountUsd" th:field="*{invoiceAmountUsd}" class="form-control" type="text" id="invoiceAmountUsdInput" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票用途:</label>
<div class="col-sm-7">
<input name="invoicePurpose" th:field="*{invoicePurpose}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var taxInvoiceStatusDatas = [[${@dict.getType('tax_invoice_status')}]];
var taxInvoice = [[${taxInvoice}]];
var prefix = ctx + "system/salesOrder"
$("#form-taxInvoice-USDAdd").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
//获取表单的数据
const makeInvoiceRMBData = $('#form-taxInvoice-USDAdd').serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
var makeInvoiceMaterialTable = $("#bootstrap-table-material").bootstrapTable('getData');
//将makeInvoiceMaterialTable转换成和makeInvoiceRMBData一样的形式
var makeInvoiceMaterialList = makeInvoiceMaterialTable.map(function (item) {
return {
invoiceMaterialId: item.invoiceMaterialId,
materialCode: item.materialCode,
materialName: item.materialName,
materialType: item.materialType,
materialProcessMethod: item.processMethod,
materialBrand:item.brand,
materialUnit: item.unit,
noTaxUsd: item.materialNoUsd,
taxUsd: item.materialUsd,
materialNum: item.materialNum,
outBoundQuantity: item.outBoundQuantity,
hasCheckNum: item.hasCheckNum,
refundsNum: item.refundsNum
}
});
const combinedData = Object.assign(makeInvoiceRMBData, {
invoiceMaterialList: makeInvoiceMaterialList
});
const jsonData = JSON.stringify(combinedData);
$.operate.saveJson(prefix + "/makeInvoice",jsonData);
}
}
//开票物料
$(function() {
var options = {
id: 'bootstrap-table-material',
url: prefix + "/getSalesOrderChildListByCode",
queryParams: function(params) {
return {
salesOrderCode: $("#salesOrderCode").val(),
}
},
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
modalName: "国税发票物料",
columns: [{
checkbox: true
},
{
title: '国税发票物料ID',
field: 'invoiceMaterialId',
visible: false
},
{
title: '物料编号',
field: 'materialCode',
},
{
title: '物料名称',
field: 'materialName',
},
{
field: 'materialType',
title: '物料类型',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '物料加工方式',
field: 'processMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(materialProcessMethodDatas, value);
}
},
{
title: '物料品牌',
field: 'brand',
},
{
title: '物料图片',
field: 'photourl',
},
{
title: '物料单位',
field: 'unit',
},
{
title: '物料描述',
field: 'describe',
},
{
title: '物料的数量',
field: 'materialNum',
},
{
title: '物料的含税单价(美元)',
field: 'materialUsd',
},
{
title: '物料的不含税单价(美元)',
field: 'materialNoUsd',
},
{
title: '已出库数量',
field: 'outBoundQuantity',
},
{
title: '已验收数',
field: 'hasCheckNum',
},
{
title: '退货数',
field: 'refundsNum',
}]
};
$.table.init(options);
});
//开票历史
$(function() {
var options = {
id: 'bootstrap-table-history',
url: prefix + "/getInvoiceHistoryListBySalesOrderCode",
queryParams: function(params) {
return {
salesOrderCode: $("#salesOrderCode").val(),
}
},
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
modalName: "国税发票历史记录",
columns: [{
checkbox: true
},
{
title: '国税发票历史id',
field: 'invoiceHistoryId',
visible: false
},
{
title: '申请时间',
field: 'applyTime',
},
{
title: '国税发票单号',
field: 'taxInvoiceCode',
},
{
title: '开票额度比例',
field: 'invoiceQuotaRatio',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value + "%";
}
}
},
{
title: '开票金额(美元)',
field: 'invoiceAmountUsd',
},
{
title: '开票用途',
field: 'invoicePurpose',
},
{
title: '发票状态', //(0待审核、1待开具、2已开具、3审核拒绝)
field: 'taxInvoiceStatus',
formatter: function(value, row, index) {
return $.table.selectDictLabel(taxInvoiceStatusDatas, value);
}
},
{
title: '财务员',
field: 'financeMembers',
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.invoiceHistoryId + '\')"><i class="fa fa-edit"></i>详情</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
//获取客户发票信息
$(document).ready(function() {
// 初始化时默认加载客户编号列表
loadInvoiceCompanyNames();
// 监听开票公司名称下拉框的变化
$('#invoiceCompanyName').on('change', function() {
var selectedInvoiceCompanyName = $(this).val(); // 获取选中的开票公司名称
if (selectedInvoiceCompanyName) {
// 发起Ajax请求获取客户名称
$.ajax({
type: 'POST',
url: ctx + 'system/customer/getSysInvoiceInfoByName',
dataType: 'json', // 假设返回的数据格式是JSON
data: { invoiceCompanyName: selectedInvoiceCompanyName }, // 数据放在这里
success: function(data) {
console.log(data);
// 将获取到的客户名称填充到输入框
if (!data || !data.data) {
// 如果返回的数据有问题,可以给出提示或处理
$.modal.alertWarning('未能获取到开票公司信息!');
} else {
fillInvoiceDetails(data.data);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.alertWarning('查询开票公司名称时发生错误!');
}
});
} else {
// 如果没有选择开票公司名称,清开票信息输入框
clearInvoiceDetails();
}
});
});
// 封装填充发票详情的函数
function fillInvoiceDetails(details) {
$('input[name="invoiceCompanyCode"]').val(details.invoiceCompanyCode);
$('input[name="depositBank"]').val(details.depositBank);
$('input[name="bankAccount"]').val(details.bankAccount);
}
// 封装清空发票详情的函数
function clearInvoiceDetails() {
$('input[name="invoiceCompanyCode"]').val('');
$('input[name="depositBank"]').val('');
$('input[name="bankAccount"]').val('');
}
// 假设的加载客户编号列表函数
function loadInvoiceCompanyNames() {
var enterpriseCode = $("#enterpriseCode").val();
var url = ctx + 'system/customer/getAllInvoiceCompanyNameByCode' + '?enterpriseCode=' + enterpriseCode;
var tempInvoiceCompanyName = taxInvoice.invoiceCompanyName;
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#invoiceCompanyName'); // 获取开票公司名称下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// 添加默认选项
if (tempInvoiceCompanyName) {
selectElement.append('<option value="' + tempInvoiceCompanyName + '">' + tempInvoiceCompanyName + '</option>');
}
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 假设item有invoiceCompanyName属性,代表客户名称
selectElement.append('<option value="' + item.invoiceCompanyName + '">' + item.invoiceCompanyName + '</option>');
});
// 设置默认值
if (tempInvoiceCompanyName) {
selectElement.val(tempInvoiceCompanyName);
}
} else {
$.modal.errMsg("开票公司信息为空");
}
},
});
}
//通过监听额度比例输入框的值,动态计算开票金额
$(document).ready(function() {
var invoiceAmountUsdInput = $('#invoiceAmountUsdInput');
var invoiceQuotaRatioInput = $('#invoiceQuotaRatioInput');
var usdTaxSumInput = $('#usdTaxSumInput');
//监听开票额度比例输入框的变化
invoiceQuotaRatioInput.on('input', function() {
var usdTaxSum = parseFloat(usdTaxSumInput.val());
var invoiceQuotaRatio = parseFloat($(this).val());
if (!isNaN(usdTaxSum) && !isNaN(invoiceQuotaRatio)) {
//计算开票金额 = 税前总额 * 开票比例
var invoiceAmountUsd = usdTaxSum * (invoiceQuotaRatio / 100);
//更新开票金额输入框
invoiceAmountUsdInput.val(invoiceAmountUsd.toFixed(2));
} else {
invoiceAmountUsdInput.val('');
}
});
});
</script>
</body>
</html>

25
ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

@ -419,22 +419,29 @@
// 定义状态码常量
const AUDIT_STATUS_APPROVED = "1";//审核通过
const INVOICE_ALLOWED = "1";//允许开票
const DELETE_FLAG = "2"; //作废
// 检查是否选择了恰好一行数据
if (selectedRows.length === 1) {
const row = selectedRows[0];
// 检查是否已审核
if (row.auditStatus === AUDIT_STATUS_APPROVED) {
// 检查是否允许开票
if (row.invoice === INVOICE_ALLOWED) {
const invoiceUrl = prefix + "/makeInvoice/" + row.salesOrderId;
$.modal.open("开票", invoiceUrl);
// 检查是否已作废
if (row.useStatus === DELETE_FLAG) {
showWarning("该订单已作废");
}else {
// 检查是否已审核
if (row.auditStatus === AUDIT_STATUS_APPROVED) {
// 检查是否允许开票
if (row.invoice === INVOICE_ALLOWED) {
const invoiceUrl = prefix + "/makeInvoice/" + row.salesOrderId;
$.modal.open("开票", invoiceUrl);
} else {
showWarning("该订单不允许开票");
}
} else {
showWarning("该订单不允许开票");
showWarning("请先审核");
}
} else {
showWarning("请先审核");
}
} else {
showWarning("请先选择一条销售订单");

Loading…
Cancel
Save