diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java index 12abd152..76a656bd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java @@ -7,7 +7,9 @@ import java.util.List; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; import com.ruoyi.financial.domain.FinancialTaxInvoiceMaterial; +import com.ruoyi.financial.mapper.FinancialTaxInvoiceHistoryMapper; import com.ruoyi.financial.mapper.FinancialTaxInvoiceMaterialMapper; import com.ruoyi.financial.service.IFinancialTaxInvoiceMaterialService; import com.ruoyi.system.domain.SysCustomerVo; @@ -39,6 +41,9 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi @Autowired private IFinancialTaxInvoiceMaterialService invoiceMaterialService; + @Autowired + private FinancialTaxInvoiceHistoryMapper invoiceHistoryMapper; + @Autowired private SysCustomerMapper sysCustomerMapper; @@ -201,6 +206,7 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi financialTaxInvoice.setApplyUser(loginName); financialTaxInvoice.setBusinessMembers(loginName); + //填充国税发票物料数据 List invoiceMaterialList = financialTaxInvoice.getInvoiceMaterialList(); invoiceMaterialList.parallelStream().forEach(invoiceMaterial -> { invoiceMaterial.setTaxInvoiceCode(taxInvoiceCode); @@ -209,6 +215,22 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi invoiceMaterial.setCreateTime(new Date()); }); invoiceMaterialMapper.insertFinancialTaxInvoiceMaterialBatch(invoiceMaterialList); + + //填充国税发票历史数据 + FinancialTaxInvoiceHistory financialTaxInvoiceHistory = new FinancialTaxInvoiceHistory(); + financialTaxInvoiceHistory.setTaxInvoiceCode(taxInvoiceCode); + financialTaxInvoiceHistory.setSalesOrderCode(financialTaxInvoice.getSalesOrderCode()); + financialTaxInvoiceHistory.setInvoiceAmountRmb(financialTaxInvoice.getInvoiceAmountRmb()); + //financialTaxInvoiceHistory.setInvoiceAmountUsd(financialTaxInvoice.getInvoiceAmountUsd()); + financialTaxInvoiceHistory.setInvoicePurpose(financialTaxInvoice.getInvoicePurpose()); + financialTaxInvoiceHistory.setInvoiceQuotaRatio(financialTaxInvoice.getInvoiceQuotaRatio()); + financialTaxInvoiceHistory.setTaxInvoiceStatus("0");//待审核 + financialTaxInvoiceHistory.setApplyTime(new Date()); + financialTaxInvoiceHistory.setCreateBy(loginName); + financialTaxInvoiceHistory.setCreateTime(new Date()); + invoiceHistoryMapper.insertFinancialTaxInvoiceHistory(financialTaxInvoiceHistory); + + return financialTaxInvoiceMapper.insertFinancialTaxInvoice(financialTaxInvoice); } } diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html index 34a57450..3115902b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html @@ -25,13 +25,15 @@
-
- - -
+
+ + +
@@ -174,7 +176,7 @@
- +
@@ -194,7 +196,7 @@
- + %
@@ -203,7 +205,7 @@
- +
@@ -213,9 +215,6 @@
- - -
@@ -389,24 +388,13 @@ field: 'invoiceHistoryId', visible: false }, - { - title: '国税发票单号', - field: 'taxInvoiceCode', - }, - { - title: '发票状态', //(0待审核、1待开具、2已开具、3审核拒绝) - field: 'taxInvoiceStatus', - formatter: function(value, row, index) { - return $.table.selectDictLabel(taxInvoiceStatusDatas, value); - } - }, { title: '申请时间', field: 'applyTime', }, { - title: '财务员', - field: 'financeMembers', + title: '国税发票单号', + field: 'taxInvoiceCode', }, { title: '开票额度比例', @@ -416,16 +404,28 @@ title: '开票金额(RMB)', field: 'invoiceAmountRmb', }, + { 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('编辑 '); + actions.push('详情 '); return actions.join(''); } }] @@ -528,6 +528,29 @@ } + + //通过监听额度比例输入框的值,动态计算开票金额 + $(document).ready(function() { + + var invoiceAmountRmbInput = $('#invoiceAmountRmbInput'); + var invoiceQuotaRatioInput = $('#invoiceQuotaRatioInput'); + var rmbTaxSumInput = $('#rmbTaxSumInput'); + + //监听开票额度比例输入框的变化 + invoiceQuotaRatioInput.on('input', function() { + var rmbTaxSum = parseFloat(rmbTaxSumInput.val()); + var invoiceQuotaRatio = parseFloat($(this).val()); + if (!isNaN(rmbTaxSum) && !isNaN(invoiceQuotaRatio)) { + //计算开票金额 = 税前总额 * 开票比例 + var invoiceAmountRmb = rmbTaxSum * (invoiceQuotaRatio / 100); + //更新开票金额输入框 + invoiceAmountRmbInput.val(invoiceAmountRmb.toFixed(2)); + } else { + invoiceAmountRmbInput.val(''); + } + }); + }); + \ No newline at end of file