|
|
@@ -1401,4 +1401,32 @@
|
|
|
#{e}
|
|
|
</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
|
|
|
+ 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,
|
|
|
+ (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
|
|
|
+ </select>
|
|
|
+ <select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
|
|
|
+ SELECT ifnull(sum(a.money),0) 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>
|