|
|
@@ -1540,7 +1540,10 @@
|
|
|
tmc.cus_id AS "cusId",
|
|
|
tmc.cus_code AS "cusCode",
|
|
|
tmc.cus_name AS "cusName",
|
|
|
- tmc.cus_phone AS "cusPhone"
|
|
|
+ tmc.cus_phone AS "cusPhone",
|
|
|
+ tmgs.sku_spec as "skuSpec",
|
|
|
+ concat ( sys.f_remove_zero ( T.item_qty ), tmgu.unit_name ) AS "itemQtyPiece",
|
|
|
+ dkic_b.f_box_piece ( tmgus.unit_name, tmgu.unit_name, T.BOX, T.piece ) AS "boxPiece"
|
|
|
FROM dkic_b.t_psi_order_item as t
|
|
|
inner join dkic_b.t_psi_order tpo on tpo.order_id = t.order_id
|
|
|
inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
|
|
|
@@ -1548,8 +1551,10 @@
|
|
|
left join dkic_b.t_mst_customer tmc on tmc.cus_id = tpo.cus_id
|
|
|
LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
|
|
|
left join sys.t_data_kind as tdk3 on tpo.out_status = tdk3.kind_code
|
|
|
+ LEFT JOIN dkic_b.t_mst_unit AS tmgu ON tmgs.unit_id = tmgu.unit_id
|
|
|
+ LEFT JOIN dkic_b.t_mst_unit AS tmgus ON tmgs.sub_unit_id = tmgus.unit_id
|
|
|
<include refid="ConditionSaleItem"/>
|
|
|
- order by t.item_index
|
|
|
+ order by tpo.make_time,t.item_index
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
@@ -1617,12 +1622,45 @@
|
|
|
<if test="cpId != null">
|
|
|
AND t.cp_id = #{cpId}
|
|
|
</if>
|
|
|
+ <if test="makeTimeStart != null and makeTimeEnd != null">
|
|
|
+ AND tpo.make_time >= #{makeTimeStart}::timestamp with time zone
|
|
|
+ AND tpo.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
|
|
|
+ </if>
|
|
|
+ <if test="skuName != null and skuName != ''">
|
|
|
+ AND tmgs.sku_name like concat('%', my_ex.likequery(#{skuName}) , '%')
|
|
|
+ </if>
|
|
|
+ <if test="skuModel != null and skuModel != ''">
|
|
|
+ AND tmgs.sku_model like concat('%', my_ex.likequery(#{skuModel}) , '%')
|
|
|
+ </if>
|
|
|
+ <if test="brandName != null and brandName != ''">
|
|
|
+ AND tmgb.brand_name like concat('%', my_ex.likequery(#{brandName}) , '%')
|
|
|
+ </if>
|
|
|
+ <if test="whName != null and whName != ''">
|
|
|
+ AND tmw.wh_name like concat('%', my_ex.likequery(#{whName}) , '%')
|
|
|
+ </if>
|
|
|
+ <if test="nonStdCode != null and nonStdCode != ''">
|
|
|
+ AND t.non_std_code like concat('%', my_ex.likequery(#{nonStdCode}) , '%')
|
|
|
+ </if>
|
|
|
+ <if test="searchText !=null and searchText != ''">
|
|
|
+ AND (
|
|
|
+ tpo.order_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
|
|
|
+ or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
|
|
|
+ or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="isFlgGift != null and isFlgGift == true">
|
|
|
+ AND t.flg_gift
|
|
|
+ </if>
|
|
|
+ <if test="isExtCo != null and isExtCo == true">
|
|
|
+ AND t.sku_id is null
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<select id="getSalesItemReportCount" resultType="java.lang.Long">
|
|
|
SELECT count(1)
|
|
|
FROM
|
|
|
dkic_b.t_psi_order_item t
|
|
|
+ inner join dkic_b.t_psi_order tpo on tpo.order_id = t.order_id
|
|
|
<include refid="ConditionSaleItem"/>
|
|
|
</select>
|
|
|
|
|
|
@@ -3014,7 +3052,7 @@
|
|
|
OR tmc.address_full LIKE concat('%',#{searchText},'%'))
|
|
|
</if>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
- LIMIT #{pageSize} OFFSET #{currentPage}
|
|
|
+ limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
|