|
|
@@ -691,40 +691,42 @@ ORDER BY
|
|
|
|
|
|
<select id="salesCommission" resultType="org.springblade.purchase.sales.vo.SalesDetailsVo">
|
|
|
SELECT
|
|
|
- bgd.brand AS brand,
|
|
|
- bo.saleman AS salesName,
|
|
|
- bo.create_time AS careteTime,
|
|
|
- bgd.size AS specs,
|
|
|
- SUM( boi.Actual_quantity ) AS quantity,
|
|
|
- zboi.price_type AS priceType
|
|
|
- FROM business_delivery bo
|
|
|
- LEFT JOIN business_delivery_items boi on boi.pid = bo.id
|
|
|
- LEFT JOIN basic_goods_desc bgd on bgd.id = boi.item_id
|
|
|
- LEFT JOIN business_order_items zboi ON zboi.id = boi.src_id
|
|
|
+ BGD.brand AS brand,
|
|
|
+ BO.charge_member AS salesName,
|
|
|
+ BO.receipt_time AS careteTime,
|
|
|
+ BOI.size AS specs,
|
|
|
+ sum( BOI.actual_quantity ) AS quantity,
|
|
|
+ BOI.price_type AS priceType
|
|
|
+ FROM
|
|
|
+ business_order BO
|
|
|
+ LEFT JOIN business_order_items BOI ON BOI.pid = BO.id
|
|
|
+ LEFT JOIN basic_goods_desc BGD ON BGD.id = BOI.item_id
|
|
|
<where>
|
|
|
- bo.bill_type = 'FH'
|
|
|
- AND bo.is_deleted = 0
|
|
|
- AND bo.tenant_id = #{detailsVo.tenantId}
|
|
|
+ BO.is_deleted = 0
|
|
|
+ AND BOI.is_deleted = 0
|
|
|
+ and BO.bill_type = 'XS'
|
|
|
+ AND BO.receipt_time IS NOT NULL
|
|
|
+ AND BO.tenant_id = '681169'
|
|
|
<if test="detailsVo.brand != null and detailsVo.brand != ''">
|
|
|
- AND bgd.Brand like concat('%', #{detailsVo.brand}, '%')
|
|
|
+ AND BGD.brand like concat('%', #{detailsVo.brand}, '%')
|
|
|
</if>
|
|
|
<if test="detailsVo.salesName != null and detailsVo.salesName != ''">
|
|
|
- AND bo.saleman like concat('%', #{detailsVo.salesName}, '%')
|
|
|
+ AND BO.charge_member like concat('%', #{detailsVo.salesName}, '%')
|
|
|
</if>
|
|
|
<if test="detailsVo.beginCreateTime !=null and detailsVo.beginCreateTime != ''">
|
|
|
- and bo.create_time >= #{detailsVo.beginCreateTime}
|
|
|
+ and BO.receipt_time >= #{detailsVo.beginCreateTime}
|
|
|
</if>
|
|
|
<if test="detailsVo.endCreateTime !=null and detailsVo.endCreateTime != ''">
|
|
|
- and bo.create_time <= #{detailsVo.endCreateTime}
|
|
|
+ and BO.receipt_time <= #{detailsVo.endCreateTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
- bgd.brand,
|
|
|
- bo.saleman,
|
|
|
- bgd.size,
|
|
|
- zboi.price_type,
|
|
|
- DATE_FORMAT( bo.create_time, '%Y-%m' )
|
|
|
- order BY bo.saleman desc
|
|
|
+ BGD.brand,
|
|
|
+ BO.charge_member,
|
|
|
+ BOI.size,
|
|
|
+ BOI.price_type,
|
|
|
+ DATE_FORMAT( BO.receipt_time, '%Y-%m' )
|
|
|
+ order BY BO.charge_member desc
|
|
|
</select>
|
|
|
|
|
|
<select id="salesCommissionList" resultType="org.springblade.purchase.sales.excel.SalesCommissionExcel">
|