2025-01-17 11:03:00 +01:00
|
|
|
{% extends 'part/base/select.sql' %}
|
|
|
|
|
|
|
|
{% block total_missing %}
|
2025-01-20 19:39:12 +01:00
|
|
|
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block total_quantity %}
|
2025-01-20 19:39:12 +01:00
|
|
|
SUM("inventory"."quantity" * IFNULL("minifigures"."quantity", 1)) AS "total_quantity",
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block total_sets %}
|
2025-01-20 19:39:12 +01:00
|
|
|
COUNT(DISTINCT "sets"."u_id") AS "total_sets",
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block total_minifigures %}
|
2025-01-20 19:39:12 +01:00
|
|
|
SUM(IFNULL("minifigures"."quantity", 0)) AS "total_minifigures"
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block join %}
|
2025-01-20 19:39:12 +01:00
|
|
|
LEFT JOIN "missing"
|
|
|
|
ON "inventory"."set_num" IS NOT DISTINCT FROM "missing"."set_num"
|
|
|
|
AND "inventory"."id" IS NOT DISTINCT FROM "missing"."id"
|
|
|
|
AND "inventory"."part_num" IS NOT DISTINCT FROM "missing"."part_num"
|
|
|
|
AND "inventory"."color_id" IS NOT DISTINCT FROM "missing"."color_id"
|
|
|
|
AND "inventory"."element_id" IS NOT DISTINCT FROM "missing"."element_id"
|
|
|
|
AND "inventory"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
|
|
|
|
|
|
|
|
LEFT JOIN "minifigures"
|
|
|
|
ON "inventory"."set_num" IS NOT DISTINCT FROM "minifigures"."fig_num"
|
|
|
|
AND "inventory"."u_id" IS NOT DISTINCT FROM "minifigures"."u_id"
|
2025-01-17 11:03:00 +01:00
|
|
|
|
|
|
|
LEFT JOIN sets
|
2025-01-20 19:39:12 +01:00
|
|
|
ON "inventory"."u_id" IS NOT DISTINCT FROM "sets"."u_id"
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block group %}
|
|
|
|
GROUP BY
|
2025-01-20 19:39:12 +01:00
|
|
|
"inventory"."part_num",
|
|
|
|
"inventory"."name",
|
|
|
|
"inventory"."color_id",
|
|
|
|
"inventory"."is_spare",
|
|
|
|
"inventory"."element_id"
|
2025-01-17 11:03:00 +01:00
|
|
|
{% endblock %}
|