<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>resource_uid
variation_text
source_uid
destination_uid
start_date
stop_date
target_start_date
target_stop_date</params>
SELECT
	catalog.*
FROM
	catalog, movement
WHERE
	catalog.uid = movement.uid
AND	movement.is_accountable = 1
AND	catalog.portal_type <> "Simulation Movement"
<dtml-if resource_uid>AND	movement.resource_uid = <dtml-sqlvar resource_uid type="int">
</dtml-if><dtml-if variation_text>AND	movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if source_uid>AND	movement.source_uid = <dtml-sqlvar source_uid type="int">
</dtml-if><dtml-if destination_uid>AND	movement.destination_uid = <dtml-sqlvar destination_uid type="int">
</dtml-if><dtml-if start_date>AND	movement.start_date = <dtml-sqlvar start_date type="string">
</dtml-if><dtml-if stop_date>AND	movement.stop_date = <dtml-sqlvar stop_date type="string">
</dtml-if><dtml-if target_start_date>AND	movement.start_date = <dtml-sqlvar target_start_date type="string">
</dtml-if><dtml-if target_stop_date>AND	movement.stop_date = <dtml-sqlvar target_stop_date type="string">
</dtml-if>