Исправление запроса для просмотра отчёта по заготовкам + fix шаблона для ввода/просмотра отчёта

This commit is contained in:
2024-11-20 19:36:21 +03:00
parent 59c60d115b
commit f83a05b6c8
2 changed files with 7 additions and 6 deletions

View File

@@ -1,7 +1,8 @@
SELECT w.material AS Наименование, SELECT w.name AS Наименование,
w.material AS Материал,
sum(sum) AS Сумма, sum(sum) AS Сумма,
sum(reports.count) AS Количество sum(reports.count) AS Количество
from reports from reports
JOIN workpiece w ON reports.item_id = w.work_id JOIN workpiece w ON reports.item_id = w.work_id
WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year') WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year')
GROUP BY material; GROUP BY w.material, w.name;

View File

@@ -12,11 +12,11 @@
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<form action="" method="post"> <form action="" method="post">
{% for item in items %} <select name="category" required>
<select name="category" required> {% for item in items %}
<option value="{{ item['id'] }}">{{ item['name'] }}</option> <option value="{{ item['id'] }}">{{ item['name'] }}</option>
</select> {% endfor %}
{% endfor %} </select>
<select name="month" required> <select name="month" required>
<option value="1">Январь</option> <option value="1">Январь</option>
<option value="2">Февраль</option> <option value="2">Февраль</option>