|
|
@@ -1405,23 +1405,15 @@
|
|
|
select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
|
|
|
c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
|
|
|
from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
|
|
|
- sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount
|
|
|
- from finance_count a
|
|
|
- where a.aid= #{aid} )x,
|
|
|
- (select aid,sum(if(a.`type` in (0,1,2),1,0)) counts
|
|
|
- from public_release a left join public_release_details b on a.id=b.prid
|
|
|
-
|
|
|
- where a.status=2 and a.aid= #{aid} )b ,
|
|
|
- (SELECT c.finance_id aid,sum(a.money) counts
|
|
|
- from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
- left join department c on b.order_dep =c.id
|
|
|
- where a.status =1 and b.delete_sign in (0,2,3)
|
|
|
- and c.finance_id = #{aid} )c ,
|
|
|
- (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount ,sum(a.expense_unaudited_count)expenseUnauditedCount ,
|
|
|
- SUM(a.invoice_unaudited_count) invoiceUnauditedCount,sum(a.member_unaudited_count) memberUnauditedCount ,
|
|
|
- sum(a.payment_unaudited_count)paymentUnauditedCount
|
|
|
- from finance_count a where a.aid= #{aid} and a.date_time BETWEEN #{startTime} and #{endTime}
|
|
|
- group by a.aid)y
|
|
|
+ sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
|
|
|
+ left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
|
|
|
+ where a.status=2 and a.aid= #{aid} )b on x.aid=b.aid
|
|
|
+ left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
+ left join department c on b.order_dep =c.id where a.status =1 and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
|
|
|
+ left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
|
|
|
+ SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
|
|
|
+ sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
|
|
|
+ and a.date_time BETWEEN #{startTime} and #{endTime} group by a.aid)y on x.aid=y.aid
|
|
|
</select>
|
|
|
<select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
|
|
|
SELECT ifnull(sum(a.money),0) receivables
|