|
|
@@ -538,22 +538,71 @@ ORDER BY
|
|
|
BO.Corp_id AS corpid,
|
|
|
BCD.cname AS corpName,
|
|
|
BO.create_time AS careteTime,
|
|
|
- BO.Sales_name AS salesName,
|
|
|
+ BO.charge_member AS salesName,
|
|
|
BGD.id AS commodityId,
|
|
|
BGD.code AS commodityCode,
|
|
|
BGD.Typeno AS typeno,
|
|
|
BGD.brand_item AS brandItem,
|
|
|
- BOI.Actual_quantity AS quantity,
|
|
|
+ BOI.order_quantity AS quantity,
|
|
|
Round(BOI.Amount, 2) AS amount,
|
|
|
- BGD.Price AS price,
|
|
|
+ BOI.Price AS price,
|
|
|
BO.Settlment_amount AS settlmentAmount,
|
|
|
(CASE WHEN
|
|
|
BO.package_remarks != '有包装'
|
|
|
THEN
|
|
|
+ 0.00
|
|
|
+ ELSE
|
|
|
BOF.Amount
|
|
|
+ END) AS feesAmount,
|
|
|
+ BGD.Brand AS brand,
|
|
|
+ BO.order_no as orderNo
|
|
|
+ FROM business_order_items AS BOI
|
|
|
+ LEFT JOIN business_order BO ON BOI.pid = BO.id
|
|
|
+ LEFT JOIN basic_goods_desc BGD ON BOI.Item_id = BGD.id
|
|
|
+ LEFT JOIN business_order_fees BOF ON BOF.pid = BO.id
|
|
|
+ LEFT JOIN basic_corps_desc BCD ON BO.Corp_id = BCD.id
|
|
|
+ <where>
|
|
|
+ BOI.is_deleted = 0
|
|
|
+ AND BO.bill_type = 'XS'
|
|
|
+ AND BO.tenant_id = #{detailsVo.tenantId}
|
|
|
+ <if test="detailsVo.corpName != null and detailsVo.corpName != ''">
|
|
|
+ AND BCD.cname like concat('%', #{detailsVo.corpName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.brand != null and detailsVo.brand != ''">
|
|
|
+ AND BGD.Brand like concat('%', #{detailsVo.brand}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.salesName != null and detailsVo.salesName != ''">
|
|
|
+ AND BO.Sales_name like concat('%', #{detailsVo.salesName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.beginCreateTime !=null and detailsVo.beginCreateTime != ''">
|
|
|
+ and BO.create_time >= #{detailsVo.beginCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.endCreateTime !=null and detailsVo.endCreateTime != ''">
|
|
|
+ and BO.create_time <= #{detailsVo.endCreateTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by BO.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="salesDetailsExport" resultType="org.springblade.purchase.sales.excel.SalesDetailsExcel">
|
|
|
+ SELECT
|
|
|
+ BCD.cname AS corpName,
|
|
|
+ BO.create_time AS careteTime,
|
|
|
+ BO.charge_member AS salesName,
|
|
|
+ BGD.code AS commodityCode,
|
|
|
+ BGD.Typeno AS typeno,
|
|
|
+ BGD.brand_item AS brandItem,
|
|
|
+ BOI.order_quantity AS quantity,
|
|
|
+ Round(BOI.Amount, 2) AS amount,
|
|
|
+ BOI.Price AS price,
|
|
|
+ BO.Settlment_amount AS settlmentAmount,
|
|
|
+ (CASE WHEN
|
|
|
+ BO.package_remarks != '有包装'
|
|
|
+ THEN
|
|
|
+ BOF.Amount
|
|
|
ELSE ''
|
|
|
END) AS feesAmount,
|
|
|
- BGD.Brand AS brand
|
|
|
+ BO.order_no as orderNo
|
|
|
FROM business_order_items AS BOI
|
|
|
LEFT JOIN business_order BO ON BOI.pid = BO.id
|
|
|
LEFT JOIN basic_goods_desc BGD ON BOI.Item_id = BGD.id
|
|
|
@@ -561,7 +610,8 @@ ORDER BY
|
|
|
LEFT JOIN basic_corps_desc BCD ON BO.Corp_id = BCD.id
|
|
|
<where>
|
|
|
BOI.is_deleted = 0
|
|
|
- AND BO.tenant_id = #{detailsVo.tenandId}
|
|
|
+ AND BO.bill_type = 'XS'
|
|
|
+ AND BO.tenant_id = #{detailsVo.tenantId}
|
|
|
<if test="detailsVo.corpName != null and detailsVo.corpName != ''">
|
|
|
AND BCD.cname like concat('%', #{detailsVo.corpName}, '%')
|
|
|
</if>
|
|
|
@@ -586,22 +636,52 @@ ORDER BY
|
|
|
bo.id as orderId,
|
|
|
boi.id as itemsId,
|
|
|
bgd.brand as brand,
|
|
|
- bo.sales_name as salesName,
|
|
|
+ bo.saleman as salesName,
|
|
|
bo.create_time as careteTime,
|
|
|
- bgd.specs as specs,
|
|
|
- boi.actual_quantity as quantity
|
|
|
- FROM business_order bo
|
|
|
- LEFT JOIN business_order_items boi on boi.pid = bo.id
|
|
|
+ bgd.size as specs,
|
|
|
+ boi.Actual_quantity as quantity
|
|
|
+ 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
|
|
|
+ <where>
|
|
|
+ bo.bill_type = 'FH'
|
|
|
+ AND bo.is_deleted = 0
|
|
|
+ AND bo.tenant_id = #{detailsVo.tenantId}
|
|
|
+ <if test="detailsVo.brand != null and 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}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.beginCreateTime !=null and detailsVo.beginCreateTime != ''">
|
|
|
+ and bo.create_time >= #{detailsVo.beginCreateTime}
|
|
|
+ </if>
|
|
|
+ <if test="detailsVo.endCreateTime !=null and detailsVo.endCreateTime != ''">
|
|
|
+ and bo.create_time <= #{detailsVo.endCreateTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by bo.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="salesCommissionList" resultType="org.springblade.purchase.sales.excel.SalesCommissionExcel">
|
|
|
+ SELECT
|
|
|
+ bgd.brand as brand,
|
|
|
+ bo.saleman as salesName,
|
|
|
+ bo.create_time as careteTime,
|
|
|
+ bgd.size as specs,
|
|
|
+ boi.Actual_quantity as quantity
|
|
|
+ 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
|
|
|
<where>
|
|
|
- bo.bill_type = 'XS'
|
|
|
+ bo.bill_type = 'FH'
|
|
|
AND bo.is_deleted = 0
|
|
|
- AND bo.tenant_id = #{detailsVo.tenandId}
|
|
|
+ AND bo.tenant_id = #{detailsVo.tenantId}
|
|
|
<if test="detailsVo.brand != null and detailsVo.brand != ''">
|
|
|
AND bgd.Brand like concat('%', #{detailsVo.brand}, '%')
|
|
|
</if>
|
|
|
<if test="detailsVo.salesName != null and detailsVo.salesName != ''">
|
|
|
- AND bo.Sales_name like concat('%', #{detailsVo.salesName}, '%')
|
|
|
+ AND bo.saleman like concat('%', #{detailsVo.salesName}, '%')
|
|
|
</if>
|
|
|
<if test="detailsVo.beginCreateTime !=null and detailsVo.beginCreateTime != ''">
|
|
|
and bo.create_time >= #{detailsVo.beginCreateTime}
|