|
|
@@ -1402,24 +1402,26 @@
|
|
|
</foreach>
|
|
|
</select>
|
|
|
<select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
|
|
|
- select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,x.publicCount,y.orderUnauditedCount,
|
|
|
- y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
|
|
|
+ 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,sum(ifnull(counts,0))publicCount,
|
|
|
- sum(ifnull(c.counts))
|
|
|
- from finance_count a 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 aid= #{aid})b on a.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 a.aid=c.aid
|
|
|
- where a.aid= #{aid} group by a.aid)x,
|
|
|
+ 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.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
|
|
|
</select>
|
|
|
<select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
|
|
|
SELECT ifnull(sum(a.money),0) receivables
|
|
|
@@ -1436,4 +1438,12 @@
|
|
|
where c.finance_id = #{aid}
|
|
|
and a.process_state in (6,8,9) and a.status in(1,2) and b.delete_sign in (0,2,3)
|
|
|
</select>
|
|
|
+ <select id="selectFinanceReceivablesCount" resultType="java.math.BigDecimal">
|
|
|
+ SELECT sum(a.money) receivables
|
|
|
+ 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}
|
|
|
+ and a.start_time between #{startTime} and #{endTime}
|
|
|
+ </select>
|
|
|
</mapper>
|