Correction indentation
This commit is contained in:
parent
0e669a7c21
commit
3a9424de78
28 changed files with 1479 additions and 1502 deletions
|
|
@ -1,134 +1,134 @@
|
|||
{{*
|
||||
Calcul des entrées/sorties de matériels à une date donnée
|
||||
paramètres :
|
||||
- liste de catégories
|
||||
- date
|
||||
Calcul des entrées/sorties de matériels à une date donnée
|
||||
paramètres :
|
||||
- liste de catégories
|
||||
- date
|
||||
*}}
|
||||
|
||||
{{* liste des catégories *}}
|
||||
{{if $categories === null}}
|
||||
{{#load type="category"}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/load}}
|
||||
{{#load type="category"}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{* date *}}
|
||||
{{if $date === null}}
|
||||
{{* :assign date=$now|date:"Y-m-d" *}}
|
||||
{{:assign date="31/12/9999"|parse_date}}
|
||||
{{* si on veut aussi lister les mouvements du futur :-) *}}
|
||||
{{* :assign date=$now|date:"Y-m-d" *}}
|
||||
{{:assign date="31/12/9999"|parse_date}}
|
||||
{{* si on veut aussi lister les mouvements du futur :-) *}}
|
||||
{{/if}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.date') as 'date',
|
||||
eqpmt.key as 'eqpmt_key',
|
||||
json_extract(eqpmt.document, '$.designation') as 'designation',
|
||||
cat.key as 'cat_key',
|
||||
json_extract(cat.document, '$.name') as 'category',
|
||||
mvt.key as 'mvt_key',
|
||||
json_extract(mvt.document, '$.direction') as 'direction',
|
||||
CASE json_extract(mvt.document, '$.direction')
|
||||
WHEN 'input' THEN json_extract(mvt.document, '$.input_nature')
|
||||
WHEN 'output' THEN json_extract(mvt.document, '$.output_nature')
|
||||
END
|
||||
AS 'operation',
|
||||
json_extract(mvt.document, '$.amount') AS 'nombre'
|
||||
FROM module_data_equipment as eqpmt
|
||||
INNER JOIN module_data_equipment as cat
|
||||
ON json_extract(eqpmt.document, '$.category') = cat.key
|
||||
INNER JOIN module_data_equipment as mvt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE json_extract(eqpmt.document, '$.type') = "equipment"
|
||||
AND !categories
|
||||
AND json_extract(mvt.document, '$.date') <= :date
|
||||
ORDER BY
|
||||
json_extract(cat.document, '$.name'),
|
||||
json_extract(eqpmt.document, '$.designation'),
|
||||
json_extract(mvt.document, '$.date');
|
||||
!categories='cat_key'|sql_where:'IN':$categories
|
||||
:date=$date
|
||||
json_extract(mvt.document, '$.date') as 'date',
|
||||
eqpmt.key as 'eqpmt_key',
|
||||
json_extract(eqpmt.document, '$.designation') as 'designation',
|
||||
cat.key as 'cat_key',
|
||||
json_extract(cat.document, '$.name') as 'category',
|
||||
mvt.key as 'mvt_key',
|
||||
json_extract(mvt.document, '$.direction') as 'direction',
|
||||
CASE json_extract(mvt.document, '$.direction')
|
||||
WHEN 'input' THEN json_extract(mvt.document, '$.input_nature')
|
||||
WHEN 'output' THEN json_extract(mvt.document, '$.output_nature')
|
||||
END
|
||||
AS 'operation',
|
||||
json_extract(mvt.document, '$.amount') AS 'nombre'
|
||||
FROM module_data_equipment as eqpmt
|
||||
INNER JOIN module_data_equipment as cat
|
||||
ON json_extract(eqpmt.document, '$.category') = cat.key
|
||||
INNER JOIN module_data_equipment as mvt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE json_extract(eqpmt.document, '$.type') = "equipment"
|
||||
AND !categories
|
||||
AND json_extract(mvt.document, '$.date') <= :date
|
||||
ORDER BY
|
||||
json_extract(cat.document, '$.name'),
|
||||
json_extract(eqpmt.document, '$.designation'),
|
||||
json_extract(mvt.document, '$.date');
|
||||
!categories='cat_key'|sql_where:'IN':$categories
|
||||
:date=$date
|
||||
}}
|
||||
|
||||
{{:assign
|
||||
var="equipments.%s.name"|args:$cat_key
|
||||
value=$category}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.designation"|args:$cat_key:$eqpmt_key
|
||||
value=$designation}}
|
||||
{{:assign
|
||||
var="equipments.%s.name"|args:$cat_key
|
||||
value=$category}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.designation"|args:$cat_key:$eqpmt_key
|
||||
value=$designation}}
|
||||
|
||||
{{* matériel propriété de l'asso en stock *}}
|
||||
{{:assign
|
||||
var="stock"
|
||||
from="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $stock === null}}
|
||||
{{:assign stock=0}}
|
||||
{{/if}}
|
||||
{{* matériel propriété de l'asso en stock *}}
|
||||
{{:assign
|
||||
var="stock"
|
||||
from="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $stock === null}}
|
||||
{{:assign stock=0}}
|
||||
{{/if}}
|
||||
|
||||
{{* matériel propriété de l'asso à l'extérieur *}}
|
||||
{{:assign
|
||||
var="exterieur"
|
||||
from="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $exterieur === null}}
|
||||
{{:assign exterieur=0}}
|
||||
{{/if}}
|
||||
{{* matériel propriété de l'asso à l'extérieur *}}
|
||||
{{:assign
|
||||
var="exterieur"
|
||||
from="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $exterieur === null}}
|
||||
{{:assign exterieur=0}}
|
||||
{{/if}}
|
||||
|
||||
{{* matériel non propriété de l'asso *}}
|
||||
{{:assign
|
||||
var="nonproprio"
|
||||
from="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $nonproprio === null}}
|
||||
{{:assign nonproprio=0}}
|
||||
{{/if}}
|
||||
{{* matériel non propriété de l'asso *}}
|
||||
{{:assign
|
||||
var="nonproprio"
|
||||
from="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key}}
|
||||
{{if $nonproprio === null}}
|
||||
{{:assign nonproprio=0}}
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{if $direction === 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key
|
||||
from=stock}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key
|
||||
from=exterieur}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign nonproprio="%d+%d"|math:$nonproprio:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key
|
||||
from=nonproprio}}
|
||||
{{/if}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $direction === 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key
|
||||
from=stock}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key
|
||||
from=exterieur}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key
|
||||
from=nonproprio}}
|
||||
{{/if}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{if $direction === 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key
|
||||
from=stock}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key
|
||||
from=exterieur}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign nonproprio="%d+%d"|math:$nonproprio:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key
|
||||
from=nonproprio}}
|
||||
{{/if}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $direction === 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.stock"|args:$cat_key:$eqpmt_key
|
||||
from=stock}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.exterieur"|args:$cat_key:$eqpmt_key
|
||||
from=exterieur}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$nombre}}
|
||||
{{:assign
|
||||
var="equipments.%s.eqpmt.%s.nonproprio"|args:$cat_key:$eqpmt_key
|
||||
from=nonproprio}}
|
||||
{{/if}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue