|
|
@@ -584,6 +584,20 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 采购明细报表主表Count-->
|
|
|
+ <select id="getPurReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_purchase tpp
|
|
|
+ Left join dkic_b.t_mst_org tmo on tpp.org_id = tmo.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on tpp.sup_id = tmp.sup_id
|
|
|
+ Left join dkic_b.t_mst_staff tms on tpp.staff_id = tms.staff_id
|
|
|
+ Left join dkic_b.t_mst_staff tms1 on tpp.make_staff = tms1.staff_id
|
|
|
+ Left join dkic_b.t_mst_warehouse tmw on tpp.wh_id = tmw.wh_id
|
|
|
+ left join sys.t_data_kind tdk2 on tdk2.kind_code = tpp.pur_status
|
|
|
+ left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
|
|
|
+ <include refid="Condition_PurReport"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 采购明细报表明细 -->
|
|
|
<select id="getPurDetailReport" resultType="java.util.Map">
|
|
|
select
|
|
|
@@ -627,8 +641,8 @@
|
|
|
FROM dkic_b.t_psi_purchase as tpp
|
|
|
Left join dkic_b.t_mst_org as tmo on tpp.org_id = tmo.org_id
|
|
|
Left join dkic_b.t_mst_supplier as tmp on tpp.sup_id = tmp.sup_id
|
|
|
- Left join dkic_b.t_mst_staff as tms on tpp.staff_id = tms.staff_id
|
|
|
- Left join dkic_b.t_mst_staff as tms1 on tpp.make_staff = tms1.staff_id
|
|
|
+ Left join dkic_b.t_mst_staff as tms on tpp.staff_id = tms.staff_id
|
|
|
+ Left join dkic_b.t_mst_staff as tms1 on tpp.make_staff = tms1.staff_id
|
|
|
Left join dkic_b.t_mst_warehouse as tmw on tpp.wh_id = tmw.wh_id
|
|
|
left join sys.t_data_kind as tdk2 on tdk2.kind_code = tpp.pur_status
|
|
|
left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
|
|
|
@@ -647,6 +661,28 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 采购明细报表明细Count-->
|
|
|
+ <select id="getPurDetailReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_purchase as tpp
|
|
|
+ Left join dkic_b.t_mst_org as tmo on tpp.org_id = tmo.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier as tmp on tpp.sup_id = tmp.sup_id
|
|
|
+ Left join dkic_b.t_mst_staff as tms on tpp.staff_id = tms.staff_id
|
|
|
+ Left join dkic_b.t_mst_staff as tms1 on tpp.make_staff = tms1.staff_id
|
|
|
+ Left join dkic_b.t_mst_warehouse as tmw on tpp.wh_id = tmw.wh_id
|
|
|
+ left join sys.t_data_kind as tdk2 on tdk2.kind_code = tpp.pur_status
|
|
|
+ left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
|
|
|
+ left join dkic_b.t_psi_purchase_item as tppi on tppi.pur_id = tpp.pur_id
|
|
|
+ left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tppi.sku_id
|
|
|
+ left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
+ left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
|
|
|
+ left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
|
|
|
+ left join dkic_b.t_psi_order as tpo on tpo.order_id = tppi.from_id
|
|
|
+ left join dkic_b.t_psi_inbound_item as ibi on ibi.from_item_id=tppi.item_id
|
|
|
+ left join dkic_b.t_psi_inbound as ib on ibi.into_id=ib.into_id
|
|
|
+ left join sys.t_data_kind tdk1 on tdk1.kind_code = tppi.into_status
|
|
|
+ <include refid="Condition_PurDetailReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 销售明细报表主表 -->
|
|
|
<select id="getOrderReport" resultType="java.util.Map">
|
|
|
@@ -689,6 +725,20 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 销售明细报表主表Count-->
|
|
|
+ <select id="getOrderReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_order as t
|
|
|
+ left join dkic_b.t_mst_sale_channel as tmsc on t.sales_channel = tmsc.channel_id
|
|
|
+ left join dkic_b.t_mst_org as tmo on t.org_id = tmo.org_id
|
|
|
+ left join dkic_b.t_mst_staff as tms on t.staff_id = tms.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on t.make_staff = makestaff.staff_id
|
|
|
+ left join dkic_b.t_mst_customer as tmc on t.cus_id = tmc.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data as tmdd on tmc.cus_from = tmdd.data_id
|
|
|
+ left join sys.t_data_kind as tdk1 on t.order_type = tdk1.kind_code
|
|
|
+ left join sys.t_data_kind as tdk2 on t.order_status = tdk2.kind_code
|
|
|
+ <include refid="Condition_OrdReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 销售明细报表明细 -->
|
|
|
<select id="getOrderDetailReport" resultType="java.util.Map">
|
|
|
@@ -758,6 +808,27 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 销售明细报表明细Count-->
|
|
|
+ <select id="getOrderDetailReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_order as t
|
|
|
+ left join dkic_b.t_mst_sale_channel tmsc on t.sales_channel = tmsc.channel_id
|
|
|
+ left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
|
|
|
+ left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on t.make_staff = makestaff.staff_id
|
|
|
+ left join dkic_b.t_mst_customer tmc on t.cus_id = tmc.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data tmdd on tmc.cus_from = tmdd.data_id
|
|
|
+ left join sys.t_data_kind as tdk1 on t.order_type = tdk1.kind_code
|
|
|
+ left join sys.t_data_kind as tdk2 on t.order_status = tdk2.kind_code
|
|
|
+ left join dkic_b.t_psi_order_item as toi on toi.order_id = t.order_id
|
|
|
+ left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = toi.sku_id
|
|
|
+ left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
+ left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
|
|
|
+ left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
|
|
|
+ left join sys.t_data_kind as tdk3 on tdk3.kind_code = toi.out_status
|
|
|
+ left join dkic_b.t_psi_outbound as tpo on tpo.from_id=t.order_id
|
|
|
+ <include refid="Condition_OrdDetailReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 出库明细报表主表 -->
|
|
|
<select id="getOutboundReport" resultType="java.util.Map">
|
|
|
@@ -799,6 +870,20 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 出库明细报表主表Count-->
|
|
|
+ <select id="getOutboundReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_outbound as t
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
|
|
|
+ LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = t.out_type
|
|
|
+ <include refid="Condition_OutboundReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 出库明细报表明细 -->
|
|
|
<select id="getOutboundDetailReport" resultType="java.util.Map">
|
|
|
@@ -860,6 +945,27 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 出库明细报表明细Count-->
|
|
|
+ <select id="getOutboundDetailReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_outbound as t
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
|
|
|
+ left join sys.t_data_kind tdktype ON tdktype.kind_code = t.out_type
|
|
|
+ left join dkic_b.t_psi_outbound_item as tpoi on tpoi.out_id = t.out_id
|
|
|
+ left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpoi.sku_id
|
|
|
+ left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
+ left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
|
|
|
+ left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
|
|
|
+ left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
|
|
|
+ left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
|
|
|
+ <include refid="Condition_OutboundDetailReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 入库明细报表主表 -->
|
|
|
<select id="getInboundlReport" resultType="java.util.Map">
|
|
|
@@ -903,6 +1009,21 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 入库明细报表主表Count-->
|
|
|
+ <select id="getInboundlReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_inbound as t
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.into_status
|
|
|
+ left join sys.t_data_kind tdktype ON tdktype.kind_code = t.into_type
|
|
|
+ left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
|
|
|
+ <include refid="Condition_IntoboundReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 入库明细报表明细 -->
|
|
|
<select id="getInboundDetailReport" resultType="java.util.Map">
|
|
|
@@ -962,6 +1083,26 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 入库明细报表明细Count-->
|
|
|
+ <select id="getInboundDetailReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_psi_inbound as t
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
|
|
|
+ left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.into_status
|
|
|
+ LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = t.into_type
|
|
|
+ left join dkic_b.t_psi_inbound_item as tpoi on tpoi.into_id = t.into_id
|
|
|
+ left join dkic_b.t_mst_goods_sku as tmgs on tmgs.sku_id = tpoi.sku_id
|
|
|
+ left join dkic_b.t_mst_goods_brand as tmgb on tmgb.brand_id = tmgs.brand_id
|
|
|
+ left join dkic_b.t_mst_goods_category as tmgc on tmgc.cat_id = tmgs.category_id
|
|
|
+ left join dkic_b.t_mst_goods_series as series on series.series_id = tmgs.series_id
|
|
|
+ left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
|
|
|
+ <include refid="Condition_IntoboundDetailReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
<!-- 客户收款明细报表主表 -->
|
|
|
<select id="getRecPayDetailReport" resultType="java.util.Map">
|
|
|
@@ -992,15 +1133,21 @@
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <!-- 客户收款明细报表主表Count-->
|
|
|
+ <select id="getRecPayDetailReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM dkic_b.t_mac_rec_pay_item as tmrpi
|
|
|
+ left join dkic_b.t_mac_rec_pay t on tmrpi.rp_id = t.rp_id
|
|
|
+ left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
|
|
|
+ left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
|
|
|
+ left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
|
|
|
+ left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
|
|
|
+ left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
|
|
|
+ left join dkic_b.t_mst_money_account tmma on tmma.mac_id = tmrpi.mac_id
|
|
|
+ <include refid="Condition_RecPayDetailReport"/>
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
- <sql id="ConditionSalesTrackingReport">
|
|
|
- <where>
|
|
|
- <if test="cpId != null">
|
|
|
- tpo.cp_id = #{cpId}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
|
|
|
<sql id="ConditionPurTrackingReport">
|
|
|
<where>
|
|
|
@@ -1050,6 +1197,10 @@
|
|
|
,tpo.make_time AS "makeTime"
|
|
|
,tms.staff_name as "staffName"
|
|
|
,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
|
|
|
dkic_b.t_psi_order tpo
|
|
|
left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
|
|
|
@@ -1058,14 +1209,167 @@
|
|
|
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_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"/>
|
|
|
- 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">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
</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="getSalesItemReport" resultType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ t.item_id AS "itemId",
|
|
|
+ t.order_id AS "orderId",
|
|
|
+ t.item_index AS "itemIndex",
|
|
|
+ t.sku_id AS "skuId",
|
|
|
+ tmgs.sku_code as "skuCode",
|
|
|
+ tmgs.sku_model as "skuModel",
|
|
|
+ tmgs.sku_name as "skuName",
|
|
|
+ tmgb.brand_name AS "brandName",
|
|
|
+ t.item_qty AS "itemQty",
|
|
|
+ sys.f_get_name_i18n(tdk3.kind_name_i18n, #{i18n}) as "outStatusName",
|
|
|
+ t.price_std AS "priceStd",
|
|
|
+ t.amt_std AS "amtStd",
|
|
|
+ t.price_sale AS "priceSale",
|
|
|
+ t.item_amt AS "itemAmt",
|
|
|
+ t.price_discount AS "priceDiscount",
|
|
|
+ t.non_std_code AS "nonStdCode",
|
|
|
+ t.out_status AS "outStatus",
|
|
|
+ t.outing_qty AS "outingQty",
|
|
|
+ t.outing_amt AS "outingAmt",
|
|
|
+ t.out_qty AS "outQty",
|
|
|
+ t.out_amt AS "outAmt",
|
|
|
+ t.return_qty AS "returnQty",
|
|
|
+ t.return_amt AS "returnAmt",
|
|
|
+ t.remarks,
|
|
|
+ t.wh_id AS "whId",
|
|
|
+ tmw.wh_name AS "whName",
|
|
|
+ tpo.order_no AS "orderNo",
|
|
|
+ tpo.make_time AS "makeTime",
|
|
|
+ tmc.cus_id AS "cusId",
|
|
|
+ tmc.cus_code AS "cusCode",
|
|
|
+ tmc.cus_name AS "cusName",
|
|
|
+ tmc.cus_phone AS "cusPhone"
|
|
|
+ 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
|
|
|
+ left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
|
|
|
+ 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
|
|
|
+ <include refid="ConditionSaleItem"/>
|
|
|
+ order by t.item_index
|
|
|
+ <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
+ limit #{end} offset #{start}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
|
|
|
+ <sql id="ConditionSaleItem">
|
|
|
+ <where>
|
|
|
+ <if test="orderId != null and orderId != ''">
|
|
|
+ AND t.order_id = #{orderId}::uuid
|
|
|
+ </if>
|
|
|
+ <if test="itemIndex != null">
|
|
|
+ AND t.item_index = #{itemIndex}
|
|
|
+ </if>
|
|
|
+ <if test="skuId != null and skuId != ''">
|
|
|
+ AND t.sku_id = #{skuId}
|
|
|
+ </if>
|
|
|
+ <if test="itemQty != null">
|
|
|
+ AND t.item_qty = #{itemQty}
|
|
|
+ </if>
|
|
|
+ <if test="priceStd != null">
|
|
|
+ AND t.price_std = #{priceStd}
|
|
|
+ </if>
|
|
|
+ <if test="amtStd != null">
|
|
|
+ AND t.amt_std = #{amtStd}
|
|
|
+ </if>
|
|
|
+ <if test="priceSale != null">
|
|
|
+ AND t.price_sale = #{priceSale}
|
|
|
+ </if>
|
|
|
+ <if test="itemAmt != null">
|
|
|
+ AND t.item_amt = #{itemAmt}
|
|
|
+ </if>
|
|
|
+ <if test="priceDiscount != null">
|
|
|
+ AND t.price_discount = #{priceDiscount}
|
|
|
+ </if>
|
|
|
+ <if test="nonStdCode != null and nonStdCode != ''">
|
|
|
+ AND t.non_std_code = #{nonStdCode}
|
|
|
+ </if>
|
|
|
+ <if test="outStatus != null and outStatus != ''">
|
|
|
+ AND t.out_status = #{outStatus}
|
|
|
+ </if>
|
|
|
+ <if test="outingQty != null">
|
|
|
+ AND t.outing_qty = #{outingQty}
|
|
|
+ </if>
|
|
|
+ <if test="outingAmt != null">
|
|
|
+ AND t.outing_amt = #{outingAmt}
|
|
|
+ </if>
|
|
|
+ <if test="outQty != null">
|
|
|
+ AND t.out_qty = #{outQty}
|
|
|
+ </if>
|
|
|
+ <if test="outAmt != null">
|
|
|
+ AND t.out_amt = #{outAmt}
|
|
|
+ </if>
|
|
|
+ <if test="returnQty != null">
|
|
|
+ AND t.return_qty = #{returnQty}
|
|
|
+ </if>
|
|
|
+ <if test="returnAmt != null">
|
|
|
+ AND t.return_amt = #{returnAmt}
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND t.remarks = #{remarks}
|
|
|
+ </if>
|
|
|
+ <if test="flgValid != null">
|
|
|
+ AND t.flg_valid = #{flgValid}
|
|
|
+ </if>
|
|
|
+ <if test="cpId != null">
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <select id="getSalesItemReportCount" resultType="java.lang.Long">
|
|
|
+ SELECT count(1)
|
|
|
+ FROM
|
|
|
+ dkic_b.t_psi_order_item t
|
|
|
+ <include refid="ConditionSaleItem"/>
|
|
|
+ </select>
|
|
|
|
|
|
<select id="getSalesTrackingReportCount" resultType="java.lang.Long">
|
|
|
SELECT count(1)
|
|
|
@@ -1074,6 +1378,17 @@
|
|
|
<include refid="ConditionSalesTrackingReport"/>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 收发存汇总报表 -->
|
|
|
+ <select id="getIvtSumReport" resultType="java.util.Map">
|
|
|
+ select dkic_b.f_query_ivt_rds(#{cpId},#{currentPage},#{pageSize}, #{querys, typeHandler=JsonTypeHandler})
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 收发存汇总报表明细 -->
|
|
|
+ <select id="getIvtItemReport" resultType="java.util.Map">
|
|
|
+ select dkic_b.f_query_ivt_rds_item(#{cpId},#{invId} ::uuid,#{invType},#{accDateStart} ::date
|
|
|
+ ,#{accDateEnd} ::date,#{i18n} ,#{currentPage},#{pageSize})
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getSalesTrackingReportDetail" resultType="java.util.Map">
|
|
|
SELECT T
|
|
|
."id",
|
|
|
@@ -1091,6 +1406,8 @@
|
|
|
T."outingQty",
|
|
|
T."priceSale",
|
|
|
T."itemQty",
|
|
|
+ T."sumQuantity",
|
|
|
+ T."sumAmount",
|
|
|
T."sumAmtRec",
|
|
|
T."sumShouldHandle",
|
|
|
T."sumUsePaymentResidue",
|
|
|
@@ -1117,6 +1434,8 @@
|
|
|
tpo.outing_qty AS "outingQty",
|
|
|
tpoi.price_sale AS "priceSale",
|
|
|
tpoi.item_qty AS "itemQty",
|
|
|
+ tpo.sum_quantity AS "sumQuantity",
|
|
|
+ tpo.sum_amount AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
|
@@ -1154,6 +1473,8 @@
|
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
|
END AS "itemQty",
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
|
@@ -1190,6 +1511,8 @@
|
|
|
WHEN tpobi.out_status = '出库状态-出库中' THEN
|
|
|
tpobi.outing_qty ELSE tpobi.out_qty
|
|
|
END AS "itemQty",
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
0.00 AS "sumAmtRec",
|
|
|
0.00 AS "sumShouldHandle",
|
|
|
0.00 AS "sumUsePaymentResidue",
|
|
|
@@ -1222,6 +1545,8 @@
|
|
|
NULL AS "outingQty",
|
|
|
NULL AS "priceSale",
|
|
|
NULL AS "itemQty",
|
|
|
+ 0.00 AS "sumQuantity",
|
|
|
+ 0.00 AS "sumAmount",
|
|
|
tmrp.sum_amt_rec AS "sumAmtRec",
|
|
|
tmrp.sum_should_handle AS "sumShouldHandle",
|
|
|
tmrp.sum_use_payment_residue AS "sumUsePaymentResidue",
|
|
|
@@ -1240,7 +1565,7 @@
|
|
|
<!-- 采购跟踪表 列表查询 -->
|
|
|
<select id="getPurTrackingReport" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
- tpp.pur_id AS "purId"
|
|
|
+ tpp.pur_id AS "purId"
|
|
|
,tpp.pur_no AS "purNo"
|
|
|
,tpp.pur_type AS "purType"
|
|
|
,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) AS "purTypeName"
|
|
|
@@ -1336,7 +1661,8 @@
|
|
|
<result column="itemQty" property="itemQty"/>
|
|
|
<result column="remarks" property="remarks"/>
|
|
|
</resultMap>
|
|
|
-<!--采购跟踪表 明细查询-->
|
|
|
+
|
|
|
+ <!--采购跟踪表 明细查询-->
|
|
|
<select id="getPurTrackingReportDetail" resultMap="PurTrackingReportResultMapResponse">
|
|
|
SELECT T."id"
|
|
|
,T."no"
|
|
|
@@ -1406,72 +1732,72 @@
|
|
|
UNION ALL
|
|
|
SELECT
|
|
|
tpi.into_id AS "id"
|
|
|
- ,tpi.into_no AS "no"
|
|
|
- ,NULL AS "contactName"
|
|
|
- ,NULL AS "contactPhone"
|
|
|
- ,NULL AS "whId"
|
|
|
- ,NULL AS "makeTime"
|
|
|
- ,NULL AS "pickupDate"
|
|
|
- ,NULL AS "sumQuantity"
|
|
|
- ,NULL AS "sumAmount"
|
|
|
- ,NULL AS "intoQty"
|
|
|
- ,0 AS "returnQty"
|
|
|
- ,0.00 AS "sumAmtRec"
|
|
|
- ,0.00 AS "sumShouldHandle"
|
|
|
- ,0.00 AS "sumUsePaymentResidue"
|
|
|
- ,0.00 AS "sumWaiveAmt"
|
|
|
- ,tpii.item_id AS "itemId"
|
|
|
- ,'采购入库' AS "type"
|
|
|
- ,tpii.sku_id AS "skuId"
|
|
|
- ,tmgs.sku_code AS "skuCode"
|
|
|
- ,tmgs.sku_name AS "skuName"
|
|
|
- ,tmgs.sku_model AS "skuModel"
|
|
|
- ,tmgs.sku_images AS "skuImages"
|
|
|
- ,tmgb.brand_name AS "brandName"
|
|
|
- ,tmgb.short_name AS "shortName"
|
|
|
- ,tpii.price_into AS "pricePur"
|
|
|
- , CASE
|
|
|
- WHEN tpii.into_status = '入库状态-入库中' THEN tpii.intoing_qty
|
|
|
- ELSE tpii.into_qty
|
|
|
+ ,tpi.into_no AS "no"
|
|
|
+ ,NULL AS "contactName"
|
|
|
+ ,NULL AS "contactPhone"
|
|
|
+ ,NULL AS "whId"
|
|
|
+ ,NULL AS "makeTime"
|
|
|
+ ,NULL AS "pickupDate"
|
|
|
+ ,NULL AS "sumQuantity"
|
|
|
+ ,NULL AS "sumAmount"
|
|
|
+ ,NULL AS "intoQty"
|
|
|
+ ,0 AS "returnQty"
|
|
|
+ ,0.00 AS "sumAmtRec"
|
|
|
+ ,0.00 AS "sumShouldHandle"
|
|
|
+ ,0.00 AS "sumUsePaymentResidue"
|
|
|
+ ,0.00 AS "sumWaiveAmt"
|
|
|
+ ,tpii.item_id AS "itemId"
|
|
|
+ ,'采购入库' AS "type"
|
|
|
+ ,tpii.sku_id AS "skuId"
|
|
|
+ ,tmgs.sku_code AS "skuCode"
|
|
|
+ ,tmgs.sku_name AS "skuName"
|
|
|
+ ,tmgs.sku_model AS "skuModel"
|
|
|
+ ,tmgs.sku_images AS "skuImages"
|
|
|
+ ,tmgb.brand_name AS "brandName"
|
|
|
+ ,tmgb.short_name AS "shortName"
|
|
|
+ ,tpii.price_into AS "pricePur"
|
|
|
+ , CASE
|
|
|
+ WHEN tpii.into_status = '入库状态-入库中' THEN tpii.intoing_qty
|
|
|
+ ELSE tpii.into_qty
|
|
|
END AS "itemQty"
|
|
|
- -- 入库中显示入库中数量 已入库显示 已入库数量
|
|
|
- ,tpii.remarks AS "remarks"
|
|
|
+ -- 入库中显示入库中数量 已入库显示 已入库数量
|
|
|
+ ,tpii.remarks AS "remarks"
|
|
|
FROM
|
|
|
dkic_b.t_psi_inbound_item tpii
|
|
|
- LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
|
|
|
- LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
|
|
|
- LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
|
|
|
+ LEFT JOIN dkic_b.t_psi_inbound tpi ON tpi.into_id = tpii.into_id
|
|
|
+ LEFT JOIN dkic_b.t_mst_goods_sku tmgs ON tmgs.sku_id = tpii.sku_id
|
|
|
+ LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
|
|
|
WHERE
|
|
|
tpi.from_id = = #{id}::uuid
|
|
|
UNION ALL
|
|
|
SELECT
|
|
|
tmrp.rp_id AS "id"
|
|
|
- ,tmrp.rp_no AS "no"
|
|
|
- ,NULL AS "contactName"
|
|
|
- ,NULL AS "contactPhone"
|
|
|
- ,NULL AS "whId"
|
|
|
- ,NULL AS "makeTime"
|
|
|
- ,NULL AS "pickupDate"
|
|
|
- ,NULL AS "sumQuantity"
|
|
|
- ,NULL AS "sumAmount"
|
|
|
- ,NULL AS "intoQty"
|
|
|
- ,NULL AS "returnQty"
|
|
|
- ,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"
|
|
|
- ,Null AS "itemId"
|
|
|
- ,'核销信息' AS "type"
|
|
|
- ,Null AS "skuId"
|
|
|
- ,Null AS "skuCode"
|
|
|
- ,Null AS "skuName"
|
|
|
- ,Null AS "skuModel"
|
|
|
- ,Null AS "skuImages"
|
|
|
- ,Null AS "brandName"
|
|
|
- ,Null AS "shortName"
|
|
|
- ,Null AS "pricePur"
|
|
|
- ,Null AS "itemQty"
|
|
|
- ,Null AS "remarks"
|
|
|
+ ,tmrp.rp_no AS "no"
|
|
|
+ ,NULL AS "contactName"
|
|
|
+ ,NULL AS "contactPhone"
|
|
|
+ ,NULL AS "whId"
|
|
|
+ ,NULL AS "makeTime"
|
|
|
+ ,NULL AS "pickupDate"
|
|
|
+ ,NULL AS "sumQuantity"
|
|
|
+ ,NULL AS "sumAmount"
|
|
|
+ ,NULL AS "intoQty"
|
|
|
+ ,NULL AS "returnQty"
|
|
|
+ ,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"
|
|
|
+ ,Null AS "itemId"
|
|
|
+ ,'核销信息' AS "type"
|
|
|
+ ,Null AS "skuId"
|
|
|
+ ,Null AS "skuCode"
|
|
|
+ ,Null AS "skuName"
|
|
|
+ ,Null AS "skuModel"
|
|
|
+ ,Null AS "skuImages"
|
|
|
+ ,Null AS "brandName"
|
|
|
+ ,Null AS "shortName"
|
|
|
+ ,Null AS "pricePur"
|
|
|
+ ,Null AS "itemQty"
|
|
|
+ ,Null AS "remarks"
|
|
|
FROM
|
|
|
dkic_b.t_mac_rec_pay tmrp
|
|
|
|