(cast(contract_amount as decimal(18,2))-(select cast(case when total_reback_view.sum is null then 0 else total_reback_view.sum end as decimal(18,2)) from total_reback_view where total_reback_view.contract_unid=tb_contract.contract_unid)-cast(CASE WHEN deduct_amount IS NULL THEN 0 ELSE deduct_amount end as decimal(18,2))-cast(CASE WHEN stop_amount IS NULL THEN 0 ELSE stop_amount END as decimal(18,2))
-cast(CASE WHEN exemptions_amount IS NULL THEN 0 ELSE exemptions_amount END as decimal(18,2))-cast(CASE WHEN bad_amount IS NULL THEN 0 ELSE bad_amount END as decimal(18,2))) as contract_remain,
...
...
@@ -308,7 +326,16 @@
project_unid=#{project_unid},
</if>
<iftest="customer_unid != null and customer_unid != ''">
customer_unid=#{customer_unid}
customer_unid=#{customer_unid},
</if>
<iftest="final_user != null and final_user !=''">
final_user=#{final_user},
</if>
<iftest="relation_customer != null and relation_customer !=''">
relation_customer=#{relation_customer},
</if>
<iftest="industry != null and industry !=''">
industry=#{industry}
</if>
</set>
where contract_unid=#{contract_unid}
...
...
@@ -398,6 +425,18 @@
and
contract_type=#{contract_type}
</if>
<iftest="final_user !=null and final_user !=''">
and
final_user=#{final_user}
</if>
<iftest="relation_customer !=null and relation_customer !=''">
and
relation_customer=#{relation_customer}
</if>
<iftest="industry !=null and industry !=''">
and
industry=#{industry}
</if>
<iftest="is_archive !=null">
and
is_archive=#{is_archive}
...
...
@@ -557,6 +596,18 @@
and
contract_type=#{contract_type}
</if>
<iftest="final_user !=null and final_user !=''">
and
final_user=#{final_user}
</if>
<iftest="relation_customer !=null and relation_customer !=''">
and
relation_customer=#{relation_customer}
</if>
<iftest="industry !=null and industry !=''">
and
industry=#{industry}
</if>
<iftest="is_archive !=null">
and
is_archive=#{is_archive}
...
...
@@ -628,7 +679,7 @@
</foreach>
</if>
from (select
contract_unid, salesperson_unid, province, city, county, province_name,city_name,county_name,
contract_unid, salesperson_unid, province, city, county, province_name,city_name,county_name,final_user,relation_customer,industry,
guarantee_period,to_char(sign_date, 'yyyy-MM-dd') as sign_date, product_line_type, contract_state,
contract_type, cast(contract_amount as decimal(18,2)), cast(deduct_amount as decimal(18,2)), contract_amount_note,
cast(stop_amount as decimal(18,2)), reback_note, cast(exemptions_amount as decimal(18,2)), contract_remain_note,
...
...
@@ -748,6 +799,18 @@
and
contract_type=#{contract_type}
</if>
<iftest="final_user !=null and final_user !=''">
and
final_user=#{final_user}
</if>
<iftest="relation_customer !=null and relation_customer !=''">