| | |
| | | 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 |
| | |
| | | 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 "; |
| | |
| | | |
| | | |
| | | |
| | | 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(); |
| | |
| | | pagination.heji2 = aaaaa.SumPrice ?? 0; |
| | | pagination.heji3 = aaaaa.UnorderMoney ?? 0; |
| | | pagination.heji4 = aaaaa.PayedMoney ?? 0; |
| | | pagination.heji5 = aaaaa.UnPayedMoney; |
| | | pagination.heji5 = aaaaa.OrAllUnPayedMoney; |
| | | } |
| | | |
| | | |