From 0b37ca51f1d90aedaad7fa883e7248cd2ebe7b45 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 06 七月 2026 11:51:21 +0800
Subject: [PATCH] fix(database): 修正客户和供应商应收应付金额计算逻辑 公式:应收/应付 = 合同金额 - 回款/付款金额 - 退货金额
---
src/main/resources/mapper/basic/CustomerMapper.xml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 75327ef..ffaff4e 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -128,7 +128,7 @@
c.customer_name,
T1.contractAmounts AS contractAmounts,
IFNULL(T2.receiptPaymentAmount, 0) AS receiptPaymentAmount,
- T1.contractAmounts - (IFNULL(T2.receiptPaymentAmount, 0) - IFNULL(T4.returnAmount, 0)) AS receiptableAmount,
+ T1.contractAmounts - IFNULL(T2.receiptPaymentAmount, 0) - IFNULL(T4.returnAmount, 0) AS receiptableAmount,
IFNULL(T4.returnAmount, 0) AS returnAmount
from (select customer_id, sum(contract_amount) as contractAmounts from sales_ledger group by customer_id) T1
left join (select customer_id, sum(collection_amount) as receiptPaymentAmount from account_sales_collection group by customer_id) T2 on T1.customer_id = T2.customer_id
@@ -157,7 +157,7 @@
sl.execution_date,
sl.contract_amount AS contract_amount,
IFNULL(T1.receiptPaymentAmount, 0) AS receiptPaymentAmount,
- sl.contract_amount - (IFNULL(T1.receiptPaymentAmount, 0) - IFNULL(T3.returnAmount, 0)) AS receiptableAmount,
+ sl.contract_amount - IFNULL(T1.receiptPaymentAmount, 0) - IFNULL(T3.returnAmount, 0) AS receiptableAmount,
IFNULL(T3.returnAmount, 0) AS returnAmount
from sales_ledger sl
left join (
--
Gitblit v1.9.3