|
@@ -994,13 +994,7 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <sql id="ConditionSalesTrackingReport">
|
|
|
|
|
- <where>
|
|
|
|
|
- <if test="cpId != null">
|
|
|
|
|
- tpo.cp_id = #{cpId}
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
- </sql>
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
<sql id="ConditionPurTrackingReport">
|
|
<sql id="ConditionPurTrackingReport">
|
|
|
<where>
|
|
<where>
|
|
@@ -1050,6 +1044,10 @@
|
|
|
,tpo.make_time AS "makeTime"
|
|
,tpo.make_time AS "makeTime"
|
|
|
,tms.staff_name as "staffName"
|
|
,tms.staff_name as "staffName"
|
|
|
,tmo.org_name as "orgName"
|
|
,tmo.org_name as "orgName"
|
|
|
|
|
+ ,tmrp.sum_amt_rec AS "sumAmtRec"
|
|
|
|
|
+ ,tmrp.sum_should_handle AS "sumShouldHandle"
|
|
|
|
|
+ ,tmrp.sum_use_payment_residue AS "sumUsePaymentResidue"
|
|
|
|
|
+ ,tmrp.sum_waive_amt AS "sumWaiveAmt"
|
|
|
FROM
|
|
FROM
|
|
|
dkic_b.t_psi_order tpo
|
|
dkic_b.t_psi_order tpo
|
|
|
left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
|
|
left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
|
|
@@ -1058,13 +1056,45 @@
|
|
|
left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
|
|
left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
|
|
|
left join dkic_b.t_mst_staff tms on tpo.staff_id = tms.staff_id
|
|
left join dkic_b.t_mst_staff tms on tpo.staff_id = tms.staff_id
|
|
|
left join dkic_b.t_mst_org tmo on tpo.org_id = tmo.org_id
|
|
left join dkic_b.t_mst_org tmo on tpo.org_id = tmo.org_id
|
|
|
|
|
+ left join dkic_b.t_mac_rec_pay tmrp on tmrp.biznis_id = tpo.order_id
|
|
|
<include refid="ConditionSalesTrackingReport"/>
|
|
<include refid="ConditionSalesTrackingReport"/>
|
|
|
- order by tpo.op_create_time desc
|
|
|
|
|
|
|
+ <if test="sort!=null and sort == 'balanceDesc'">
|
|
|
|
|
+ ORDER BY tpo.make_time desc
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="sort!=null and sort == 'balanceAsc'">
|
|
|
|
|
+ ORDER BY tpo.make_time asc
|
|
|
|
|
+ </if>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
</if>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <sql id="ConditionSalesTrackingReport">
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="orderNo != null">
|
|
|
|
|
+ tpo.order_no = #{orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="cusName != null">
|
|
|
|
|
+ tmc.cus_name = #{cusName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="cpId != null">
|
|
|
|
|
+ tpo.cp_id = #{cpId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="createtimeStart != null and createtimeEnd != null">
|
|
|
|
|
+ AND tpo.op_create_time >= #{createtimeStart}::timestamp with time zone
|
|
|
|
|
+ AND tpo.op_create_time < #{createtimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchText != null">
|
|
|
|
|
+ AND (tpo.order_no like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ OR tmc.cus_code like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ OR tmc.cus_name like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ OR tmc.cus_phone like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ OR tpo.address_full like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ OR tpo.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
<select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
@@ -1091,6 +1121,8 @@
|
|
|
T."outingQty",
|
|
T."outingQty",
|
|
|
T."priceSale",
|
|
T."priceSale",
|
|
|
T."itemQty",
|
|
T."itemQty",
|
|
|
|
|
+ T."sumQuantity",
|
|
|
|
|
+ T."sumAmount",
|
|
|
T."sumAmtRec",
|
|
T."sumAmtRec",
|
|
|
T."sumShouldHandle",
|
|
T."sumShouldHandle",
|
|
|
T."sumUsePaymentResidue",
|
|
T."sumUsePaymentResidue",
|
|
@@ -1117,6 +1149,8 @@
|
|
|
tpo.outing_qty AS "outingQty",
|
|
tpo.outing_qty AS "outingQty",
|
|
|
tpoi.price_sale AS "priceSale",
|
|
tpoi.price_sale AS "priceSale",
|
|
|
tpoi.item_qty AS "itemQty",
|
|
tpoi.item_qty AS "itemQty",
|
|
|
|
|
+ tpo.sum_quantity AS "sumQuantity",
|
|
|
|
|
+ tpo.sum_amount AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
0.00 AS "sumUsePaymentResidue",
|
|
@@ -1154,6 +1188,8 @@
|
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
|
END AS "itemQty",
|
|
END AS "itemQty",
|
|
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
0.00 AS "sumUsePaymentResidue",
|
|
@@ -1190,6 +1226,8 @@
|
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
|
END AS "itemQty",
|
|
END AS "itemQty",
|
|
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
0.00 AS "sumUsePaymentResidue",
|
|
@@ -1222,6 +1260,8 @@
|
|
|
NULL AS "outingQty",
|
|
NULL AS "outingQty",
|
|
|
NULL AS "priceSale",
|
|
NULL AS "priceSale",
|
|
|
NULL AS "itemQty",
|
|
NULL AS "itemQty",
|
|
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
tmrp.sum_amt_rec AS "sumAmtRec",
|
|
tmrp.sum_amt_rec AS "sumAmtRec",
|
|
|
tmrp.sum_should_handle AS "sumShouldHandle",
|
|
tmrp.sum_should_handle AS "sumShouldHandle",
|
|
|
tmrp.sum_use_payment_residue AS "sumUsePaymentResidue",
|
|
tmrp.sum_use_payment_residue AS "sumUsePaymentResidue",
|