|
@@ -106,69 +106,52 @@
|
|
|
<select id="getAmonutIn" parameterType="Map"
|
|
|
resultType="java.lang.String">
|
|
|
SELECT
|
|
|
- sum(amount_ing_receivable) as amount
|
|
|
+ sum(ei.amount_money) as amount
|
|
|
FROM
|
|
|
- stock_sale_receipt_report s
|
|
|
- LEFT JOIN warehouse_in_out_info wioi ON wioi.id = s.warehouse_record_id and wioi.delete_flag = 0
|
|
|
- LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id and wbi.delete_flag = 0
|
|
|
+ expense_info ei
|
|
|
+ LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = ei.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = ei.warehouse_name
|
|
|
+ LEFT JOIN contract_management_info cmi ON cmi.comp_id = ei.comp_id and cmi.delete_flag = 0 and cmi.contract_no = ei.contract_no
|
|
|
WHERE
|
|
|
- s.delete_flag = 0
|
|
|
- AND s.comp_id = #{compId}
|
|
|
- and s.delivery_date > #{seachMoth}
|
|
|
+ ei.delete_flag = 0
|
|
|
+ AND ei.comp_id = #{compId}
|
|
|
+ and ei.expenses_type = '1'
|
|
|
+ and ei.update_date > #{seachMoth}
|
|
|
<if test="jointVentureParties != null">
|
|
|
- AND wbi.joint_venture_parties = #{jointVentureParties}
|
|
|
+ AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="getAmonutOut" parameterType="Map"
|
|
|
resultType="java.lang.String">
|
|
|
SELECT
|
|
|
- IFNULL( sum( s.amount_ing_payable ), 0 ) + IFNULL((
|
|
|
+ IFNULL( sum( ei.amount_money ), 0 ) + IFNULL((
|
|
|
SELECT
|
|
|
sum( p.amount_ing_payable )
|
|
|
FROM
|
|
|
payment_management p
|
|
|
+ LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = p.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = p.warehouse_name
|
|
|
WHERE
|
|
|
p.delete_flag = 0
|
|
|
AND p.comp_id = #{compId}
|
|
|
AND p.create_date > #{seachMoth}
|
|
|
+ <if test="jointVentureParties != null">
|
|
|
+ AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
|
|
|
+ </if>
|
|
|
),
|
|
|
0
|
|
|
- ) + IFNULL((
|
|
|
- SELECT
|
|
|
- sum( amount )
|
|
|
- FROM
|
|
|
- inventory_cost_info i
|
|
|
- WHERE
|
|
|
- i.delete_flag = 0
|
|
|
- AND i.comp_id = #{compId}
|
|
|
- AND i.create_date > #{seachMoth}
|
|
|
- ),
|
|
|
- 0
|
|
|
- )
|
|
|
- + IFNULL((
|
|
|
- SELECT
|
|
|
- sum( sale_cost )
|
|
|
- FROM
|
|
|
- stock_sale_receipt_report s
|
|
|
- WHERE
|
|
|
- s.delete_flag = 0
|
|
|
- AND s.comp_id = #{compId}
|
|
|
- AND s.delivery_date > #{seachMoth}
|
|
|
- ),
|
|
|
- 0
|
|
|
- ) as aa
|
|
|
+ ) as aa
|
|
|
FROM
|
|
|
- stock_purchase_receipt_report s
|
|
|
- LEFT JOIN warehouse_in_out_info wioi ON wioi.id = s.warehouse_record_id and wioi.delete_flag = 0
|
|
|
- LEFT JOIN warehouse_base_info wbi ON wbi.id = wioi.base_id and wbi.delete_flag = 0
|
|
|
+ expense_info ei
|
|
|
+ LEFT JOIN warehouse_base_info wbi ON wbi.comp_id = ei.comp_id and wbi.delete_flag = 0 and wbi.warehouse_name = ei.warehouse_name
|
|
|
+ LEFT JOIN contract_management_info cmi ON cmi.comp_id = ei.comp_id and cmi.delete_flag = 0 and cmi.contract_no = ei.contract_no
|
|
|
WHERE
|
|
|
- s.delete_flag = 0
|
|
|
- AND s.comp_id = #{compId}
|
|
|
+ ei.delete_flag = 0
|
|
|
+ AND ei.comp_id = #{compId}
|
|
|
+ and ei.expenses_type = '2'
|
|
|
+ and ei.update_date > #{seachMoth}
|
|
|
<if test="jointVentureParties != null">
|
|
|
- AND wbi.joint_venture_parties = #{jointVentureParties}
|
|
|
+ AND (wbi.joint_venture_parties = #{jointVentureParties} or cmi.joint_venture_parties = #{jointVentureParties})
|
|
|
</if>
|
|
|
- AND s.warehousing_date > #{seachMoth}
|
|
|
</select>
|
|
|
|
|
|
|