From a0d55bcc8bfebd408d16166b27b7e05b3e4c9f4a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 02 十一月 2026 16:51:50 +0800
Subject: [PATCH] feat(erp): 采购/销售明细按含税单价口径拆税,供应商合同补供应商名称与附件

---
 yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java
index 7b136e3..9276791 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/MoneyUtils.java
@@ -128,4 +128,42 @@
         return price.multiply(percent).divide(PERCENT_100, PRICE_SCALE, RoundingMode.HALF_UP);
     }
 
+    /**
+     * 璁$畻鍚◣鎬讳环閲岀殑绋庨锛堝崟浠蜂负鍚◣鍗曚环鏃朵娇鐢級
+     *
+     * 绋庨 = 鍚◣鎬讳环 脳 绋庣巼 梅锛�100 + 绋庣巼锛�
+     * 渚嬪锛氬惈绋庢�讳环 113.00锛岀◣鐜� 13% 鈫� 绋庨 13.00
+     *
+     * @param totalPriceWithTax 鍚◣鎬讳环
+     * @param taxPercent        绋庣巼锛屼緥濡� 13% 浼犲叆 13
+     * @return 绋庨锛涘惈绋庢�讳环涓虹┖鏃惰繑鍥� null锛岀◣鐜囦负绌烘垨闈炴鏁版椂杩斿洖 0.00
+     */
+    public static BigDecimal priceCalculateTaxIncluded(BigDecimal totalPriceWithTax, BigDecimal taxPercent) {
+        if (totalPriceWithTax == null) {
+            return null;
+        }
+        if (taxPercent == null || taxPercent.compareTo(BigDecimal.ZERO) <= 0) {
+            return BigDecimal.ZERO.setScale(PRICE_SCALE, RoundingMode.HALF_UP);
+        }
+        return totalPriceWithTax.multiply(taxPercent)
+                .divide(PERCENT_100.add(taxPercent), PRICE_SCALE, RoundingMode.HALF_UP);
+    }
+
+    /**
+     * 鍚◣鎬讳环鎷嗗嚭涓嶅惈绋庨噾棰�
+     *
+     * 涓嶅惈绋庨噾棰� = 鍚◣鎬讳环 鈭� 绋庨锛堢◣棰濊 {@link #priceCalculateTaxIncluded}锛�
+     *
+     * @param totalPriceWithTax 鍚◣鎬讳环
+     * @param taxPercent        绋庣巼锛屼緥濡� 13% 浼犲叆 13
+     * @return 涓嶅惈绋庨噾棰濓紱鍚◣鎬讳环涓虹┖鏃惰繑鍥� null
+     */
+    public static BigDecimal priceExcludeTax(BigDecimal totalPriceWithTax, BigDecimal taxPercent) {
+        BigDecimal taxPrice = priceCalculateTaxIncluded(totalPriceWithTax, taxPercent);
+        if (taxPrice == null) {
+            return null;
+        }
+        return totalPriceWithTax.subtract(taxPrice).setScale(PRICE_SCALE, RoundingMode.HALF_UP);
+    }
+
 }

--
Gitblit v1.9.3