From 53319534a5dafb85488d7152e3a3c55af3e0e531 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 30 十月 2025 17:22:05 +0800
Subject: [PATCH] 提交

---
 CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderDAL.cs |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderDAL.cs
index 93627ef..08855cc 100644
--- a/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderDAL.cs
+++ b/CY_ECommercePlatform/CY.SQLDAL/EC/EC_OrderDAL.cs
@@ -1570,7 +1570,7 @@
             fromSouce += @" 
                       
      select occ.City+occ.County as quyu   ,oc.CompanyName as BuyerName,os.Name as BusinessManager,oc.CreateTime,contracttype.Name as ContracttypeName,oc.Contractmoney
-,expiretype.Name as ExpiretypeName,oc.ExpireTime,ob.SumPrice,  ob.PayedMoney,oc.CustomerId
+,expiretype.Name as ExpiretypeName,oc.ExpireTime,ob.SumPrice,  ob.PayedMoney,oc.CustomerId,ob.OrAllUnPayedMoney
 
 
 from  [OA_CorporateClients] oc
@@ -1578,13 +1578,13 @@
 left join  OA_Staff os  on oc.BusinessManagerId = os.Keyid
 left join [Sys_Dictionary] contracttype on contracttype.DicType='鍚堝悓閲戦' and contracttype.MeanValue = oc.Contracttype
 left join [Sys_Dictionary] expiretype on expiretype.DicType='鍒版湡鏃堕棿' and expiretype.MeanValue = oc.Expiretype
-left join ( select  ob.BuyerId,sum(ob.SumPrice) SumPrice,sum(ts.PayedMoney)  PayedMoney ,COUNT(*) as shuliang
-  from EC_OrderBasic ob Inner Join EC_OrderExtend as oe On(ob.Keyid=oe.Keyid) Inner Join Pay_TradingSingle as ts On(ob.Keyid = ts.OrderId)
-  left join EC_AwbInfo ea  on ob.Keyid = ea.Keyid  Inner Join OA_CorporateClients occ  on ob.BuyerId = occ.Keyid  where   (occ.WanjieTime IS NULL OR DATEDIFF(DAY,occ.WanjieTime,ob.CreateTime)>=0) 
-   
-  group by ob.BuyerId ) ob  on oc.Keyid = ob.BuyerId
+left join ( select  ob.BuyerId,sum(ob.SumPrice) SumPrice,sum(ts.PayedMoney)  PayedMoney ,COUNT(*) as shuliang,SUM( Case When ( (ob.SumPrice-ts.PayedMoney) <=0 or ob.PayState =-1) then 0 else (ob.SumPrice-ts.PayedMoney) end) OrAllUnPayedMoney "
+ + "  from EC_OrderBasic ob Inner Join EC_OrderExtend as oe On(ob.Keyid=oe.Keyid) Inner Join Pay_TradingSingle as ts On(ob.Keyid = ts.OrderId  and ob.OrderState != 0  and  ob.SellerId = '" + FirmId + "'   )  "
+ // + "left join EC_AwbInfo ea  on ob.Keyid = ea.Keyid  Inner Join OA_CorporateClients occ  on ob.BuyerId = occ.Keyid  "
+  + " and (ob.OrderState <> 0 or (ob.OrderState = 0 and ts.PayedMoney > 0))"
+  + "group by ob.BuyerId ) ob  on oc.Keyid = ob.BuyerId  " + where;
 
-                         " + where;
+
 
 
             fromSouce += " )as t   ";
@@ -1593,7 +1593,7 @@
 
 
 
-            var ssss = _dataBase.SelectModel<Model.OA_DeliverPlan>("  sum(t.Contractmoney) as Contractmoney,sum(t.SumPrice) as SumPrice,sum(t.PayedMoney) as PayedMoney ", fromSouce);
+            var ssss = _dataBase.SelectModel<Model.OA_DeliverPlan>("  sum(t.Contractmoney) as Contractmoney,sum(t.SumPrice) as SumPrice,sum(t.PayedMoney) as PayedMoney,sum(t.OrAllUnPayedMoney) OrAllUnPayedMoney ", fromSouce);
             if (ssss.Count > 0)
             {
                 var aaaaa = ssss.First();
@@ -1601,7 +1601,7 @@
                 pagination.heji2 = aaaaa.SumPrice ?? 0;
                 pagination.heji3 = aaaaa.UnorderMoney ?? 0;
                 pagination.heji4 = aaaaa.PayedMoney ?? 0;
-                pagination.heji5 = aaaaa.UnPayedMoney;
+                pagination.heji5 = aaaaa.OrAllUnPayedMoney;
             }
 
 

--
Gitblit v1.9.1