From df1f128feb96f999f6b2fcbcae8eae72f584dbe5 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 04 六月 2026 15:55:24 +0800
Subject: [PATCH] 过程检、成品检报告需展示客户名称(生产订单对应带出来的),检测单位固定是 天津阳光彩印股份有限公司

---
 src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
index 6da8a75..2a1425c 100644
--- a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
+++ b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
@@ -115,10 +115,11 @@
         <!--                and a.month = #{month}-->
         <!--            </if>-->
         <!--        </where>-->
+        select * from (
         SELECT
         month,
-        SUM(sales_tax_amount) AS sales_tax_amount,
-        SUM(purchase_tax_amount) AS purchase_tax_amount
+        SUM(sales_tax_amount) AS j_tax_amount,
+        SUM(purchase_tax_amount) AS x_tax_amount
         FROM (
         SELECT
         DATE_FORMAT(entry_date, '%Y-%m') AS month,
@@ -135,17 +136,18 @@
         0 AS sales_tax_amount,
         ROUND(SUM(contract_amount * 0.26), 2) AS purchase_tax_amount
         FROM purchase_ledger
-        <where>
-
-            a.month is not null
-            <if test="month != null">
-                and a.month = #{month}
-            </if>
-        </where>
+        WHERE entry_date IS NOT NULL
         GROUP BY DATE_FORMAT(entry_date, '%Y-%m')
         ) t
         GROUP BY month
-        ORDER BY month;
+        ORDER BY month
+        ) a
+        <where>
+            a.month is not null
+            <if test="month != null and month != ''">
+                and a.month = #{month}
+            </if>
+        </where>
 
     </select>
     <select id="listVat1" resultType="com.ruoyi.purchase.dto.VatDto">

--
Gitblit v1.9.3