[Erp5-dev] Delivery getTotalPrice and getTotalQuantity

Alexandre Boeglin alex at nexedi.com
Wed Mar 23 13:06:46 CET 2005


Le Mardi 15 Mars 2005 10:38, Alexandre Boeglin a écrit :

> - in portal_skins/erp5_trade, replace Delivery_zGetTotal with the
> atached one,

Actually, it's even easier, as the variation_text and resource_uid 
parameters are handled by the buildSQLQuery too.

Regards,
Alex
-------------- next part --------------
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>from_table_list:list
where_expression
order_by_expression</params>
SELECT
	SUM(movement.quantity) AS inventory,
	SUM(movement.quantity) AS total_quantity,
	SUM(movement.total_price) AS total_price,
	SUM(movement.target_quantity) AS target_total_quantity,
	SUM(movement.target_total_price) AS target_total_price,
	AVG(movement.price) AS average_price

FROM
<dtml-in from_table_list> <dtml-var sequence-item> AS <dtml-var sequence-key><dtml-if sequence-end><dtml-else>,</dtml-if></dtml-in>

WHERE
1=1
<dtml-if where_expression> AND <dtml-var where_expression> </dtml-if>
 AND movement.is_accountable = 1
 AND catalog.portal_type <> "Container"
 AND catalog.portal_type <> "Simulation Movement"

<dtml-if order_by_expression>
ORDER BY <dtml-var order_by_expression>
</dtml-if>


More information about the Erp5-dev mailing list