Mutualisation E/S et petites simplifications
This commit is contained in:
parent
55e649ce0d
commit
262d1935ca
10 changed files with 126 additions and 193 deletions
|
|
@ -30,28 +30,21 @@
|
|||
</div>
|
||||
|
||||
{{* types d'entrées et sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
{{:include file="./_get_config.html" keep="config, directions"}}
|
||||
|
||||
{{#foreach from=$config.input_nature key=key}}
|
||||
{{:assign var="types.input.%s."|args:$type value=$key}}
|
||||
{{/foreach}}
|
||||
{{#foreach from=$directions key="direction"}}
|
||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||
{{#foreach from=$nature key="key"}}
|
||||
{{:assign var="types.%s.%s."|args:$direction:$type value=$key}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#foreach from=$types.input key=key}}
|
||||
{{:assign var=elem from="types.input.%s"|args:$key}}
|
||||
{{:assign elem=$elem|quote_sql|implode:","}}
|
||||
{{:assign elem="("|cat:$elem|cat:")"}}
|
||||
{{:assign var="input_types.%s"|args:$key value=$elem}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{:assign var="types.output.%s."|args:$type value=$key}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#foreach from=$types.output key=key}}
|
||||
{{:assign var=elem from="types.output.%s"|args:$key}}
|
||||
{{:assign elem=$elem|quote_sql|implode:","}}
|
||||
{{:assign elem="("|cat:$elem|cat:")"}}
|
||||
{{:assign var="output_types.%s"|args:$key value=$elem}}
|
||||
{{:assign var="iotypes" from="types.%s"|args:$direction}}
|
||||
{{#foreach from=$iotypes key="key"}}
|
||||
{{:assign var=elem from="iotypes.%s"|args:$key}}
|
||||
{{:assign elem=$elem|quote_sql|implode:","}}
|
||||
{{:assign elem="("|cat:$elem|cat:")"}}
|
||||
{{:assign var="%s_types.%s"|args:$direction:$key value=$elem}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
|
|
@ -70,23 +63,23 @@
|
|||
WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ;
|
||||
(SELECT
|
||||
SUM($$.amount)
|
||||
FROM module_data_equipment AS mvt
|
||||
FROM @TABLE AS mvt
|
||||
WHERE
|
||||
$$.type = 'movement'
|
||||
AND
|
||||
$$.operation IN %s
|
||||
AND
|
||||
$$.equipment = module_data_equipment.key
|
||||
$$.equipment = @TABLE.key
|
||||
) -
|
||||
(SELECT
|
||||
COALESCE(SUM($$.amount), 0)
|
||||
FROM module_data_equipment AS mvt
|
||||
FROM @TABLE AS mvt
|
||||
WHERE
|
||||
$$.type = 'movement'
|
||||
AND
|
||||
$$.operation IN %s
|
||||
AND
|
||||
$$.equipment = module_data_equipment.key
|
||||
$$.equipment = @TABLE.key
|
||||
) AS 'Quantité'
|
||||
"|args:$input_types.temporaire:$output_types.retour
|
||||
type="equipment"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue