Merge branch 'Requests'

This commit is contained in:
Anton Kamalov
2024-10-24 16:53:09 +03:00
5 changed files with 13 additions and 7 deletions

View File

@@ -48,8 +48,8 @@ def zagotovki_ship():
return zagotovki.error_message return zagotovki.error_message
else: else:
material = dict(request.form) material = dict(request.form)
print(material)
zagotovki = route(session['db_config'], material, sql_provider, 'zapros2.sql') zagotovki = route(session['db_config'], material, sql_provider, 'zapros2.sql')
print(zagotovki)
if zagotovki.status: if zagotovki.status:
header = f'Поставленные заготовки из материала \'{material["material"]}\'' header = f'Поставленные заготовки из материала \'{material["material"]}\''
return render_template('output.html', items=zagotovki.result, object=header) return render_template('output.html', items=zagotovki.result, object=header)

View File

@@ -11,5 +11,5 @@ def route(db_config, input_data, sql_provider, name) -> InfoRespronse:
print("sql = ", _sql) print("sql = ", _sql)
result = select_list(db_config, _sql) result = select_list(db_config, _sql)
if result is None: if result is None:
return InfoRespronse(result, error_message = 'Ошибка в подключении к базе данных', status=False) return InfoRespronse(result, error_message = 'Ошибка в подключении к базе данных. Свяжитесь с администратором', status=False)
return InfoRespronse(result, error_message='', status=True) return InfoRespronse(result, error_message='', status=True)

View File

@@ -3,8 +3,9 @@ SELECT sellers.name AS 'Поставщик',
SUM(wl.count) AS 'Общее количество заготовок', SUM(wl.count) AS 'Общее количество заготовок',
SUM(wl.price) AS 'Общая стоимость поставленных заготовок' SUM(wl.price) AS 'Общая стоимость поставленных заготовок'
FROM waybill w FROM waybill w
JOIN waybill_lines wl ON w.waybill_id = wl.waybill_id JOIN waybill_lines wl USING(waybill_id)
JOIN workpiece USING(work_id) JOIN workpiece USING(work_id)
JOIN sellers USING(sel_id) JOIN sellers USING(sel_id)
WHERE workpiece.material = '${material}' WHERE workpiece.material = '${material}'
AND (w.date_of_delivery BETWEEN '${date_from}' AND '${date_to}')
GROUP BY sellers.name, w.date_of_delivery; GROUP BY sellers.name, w.date_of_delivery;

View File

@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Заготовки на складе</title> <title>Материалы заготовок</title>
<link href="/static/css/main.css" type="text/css" rel="stylesheet"> <link href="/static/css/main.css" type="text/css" rel="stylesheet">
</head> </head>
<body> <body>
@@ -10,7 +10,8 @@
<a href="{{ url_for('logout') }}"><button>Выход</button></a> <a href="{{ url_for('logout') }}"><button>Выход</button></a>
</div> </div>
<!-- Input --> <!-- Input -->
<h1>Выберите материал</h1> <h1>Материалы заготовок</h1>
<p>Выберите материал<p>
<form action="" method="post"> <form action="" method="post">
<select name="material"> <select name="material">
{% for item in materials %} {% for item in materials %}

View File

@@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Заготовки на складе</title> <title>Поставки заготовок</title>
<link href="/static/css/main.css" type="text/css" rel="stylesheet"> <link href="/static/css/main.css" type="text/css" rel="stylesheet">
</head> </head>
<body> <body>
@@ -10,13 +10,17 @@
<a href="{{ url_for('logout') }}"><button>Выход</button></a> <a href="{{ url_for('logout') }}"><button>Выход</button></a>
</div> </div>
<!-- Input --> <!-- Input -->
<h1>Выберите материал</h1> <h1>Поставки заготовок</h1>
<p>Выберите материал</p>
<form action="" method="post"> <form action="" method="post">
<select name="material"> <select name="material">
{% for item in materials %} {% for item in materials %}
<option value="{{ item['material'] }}">{{ item['material'] }}</option> <option value="{{ item['material'] }}">{{ item['material'] }}</option>
{% endfor %} {% endfor %}
</select> </select>
<p>Выберите даты:</p>
<p>с <input type="date" name="date_from" required min="2000-01-01" max="2024-12-31" id="date_from"></p>
<p>по <input type="date" name="date_to" required min="2000-01-01" max="2024-12-31" id="date_to"></p>
<input type="submit" value="Отправить"> <input type="submit" value="Отправить">
</form> </form>
<div class="return"> <div class="return">