diff --git a/App/Report/templates/OK.html b/App/Report/templates/OK.html index 5361c46..e2f8785 100644 --- a/App/Report/templates/OK.html +++ b/App/Report/templates/OK.html @@ -12,7 +12,7 @@

Успешно!

Отчет успешно добавлен в базу данных!

- +
diff --git a/App/Report/templates/report_basic.html b/App/Report/templates/report_basic.html index bea0f07..03e0f3a 100644 --- a/App/Report/templates/report_basic.html +++ b/App/Report/templates/report_basic.html @@ -63,7 +63,7 @@
- +
diff --git a/App/Report/templates/report_menu.html b/App/Report/templates/report_menu.html index 8b4e859..d55d621 100644 --- a/App/Report/templates/report_menu.html +++ b/App/Report/templates/report_menu.html @@ -35,7 +35,7 @@
- +
diff --git a/App/Requests/__init__.py b/App/Requests/__init__.py index c3d0b8b..f40799e 100644 --- a/App/Requests/__init__.py +++ b/App/Requests/__init__.py @@ -4,7 +4,7 @@ from checker import check_auth from .requests_model import sklad, materials_per_seller, sellers_names, materials_names import json -with open(path.join(path.dirname(__file__), 'zapros_menu.json')) as f: +with open(path.join(path.dirname(__file__), 'zapros_menu.json'), encoding='utf-8') as f: requests_list = json.load(f) requests_bp = Blueprint('requests_bp', __name__, template_folder='templates') @@ -19,12 +19,11 @@ def requests(): @check_auth def sklad_zapros(): if request.method == 'GET': - materials = materials_names() - return render_template('zagotovki.html', materials=materials.result) + return render_template('zagotovki.html') else: - material = dict(request.form) - zagotovki = sklad(material) + zagotovki = sklad(request) if zagotovki.status: + material = dict(request.form) header = f'Заготовки на складе из материала \"{material["material"]}\"' return render_template('output.html', items=zagotovki.result, header=header) else: @@ -34,12 +33,11 @@ def sklad_zapros(): @check_auth def sellers_ship(): if request.method == 'GET': - sellers = sellers_names() - return render_template('sellers_ship.html', sellers=sellers.result) + return render_template('sellers_ship.html') else: - seller = dict(request.form) - zagotovki = materials_per_seller(seller) + zagotovki = materials_per_seller(request) if zagotovki.status: + seller = dict(request.form) header = f'Поставки от поставщика \"{seller["seller"]}\"' return render_template('output.html', items=zagotovki.result, header=header, link=url_for('requests_bp.requests')) else: diff --git a/App/Requests/requests_model.py b/App/Requests/requests_model.py index f19df13..3841ef7 100644 --- a/App/Requests/requests_model.py +++ b/App/Requests/requests_model.py @@ -29,9 +29,9 @@ def materials_names() -> InfoRespronse: status=False) return InfoRespronse(result, error_message='', status=True) -def sklad(input_data) -> InfoRespronse: - _sql = sql_provider.get('sklad_material.sql', input_data) - print("sql = ", _sql) +def sklad(request) -> InfoRespronse: + material = dict(request.form) + _sql = sql_provider.get('sklad_material.sql', material) result = select_list(current_app.config['db_config'], _sql) if result is None: return InfoRespronse((), @@ -40,8 +40,9 @@ def sklad(input_data) -> InfoRespronse: return InfoRespronse(result, error_message='', status=True) -def materials_per_seller(input_data) -> InfoRespronse: - _sql = sql_provider.get('ship_seller.sql', input_data) +def materials_per_seller(request) -> InfoRespronse: + seller = dict(request.form) + _sql = sql_provider.get('ship_seller.sql', seller) result = select_list(current_app.config['db_config'], _sql) if result is None: return InfoRespronse((), diff --git a/App/Requests/sql/ship_seller.sql b/App/Requests/sql/ship_seller.sql index 582b34f..e0c182c 100644 --- a/App/Requests/sql/ship_seller.sql +++ b/App/Requests/sql/ship_seller.sql @@ -1,8 +1,9 @@ -SELECT w.date_of_delivery AS 'Дата поставки', - SUM(w.sum) AS 'Общая сумма', - SUM(wl.cnt) as 'Количество' +SELECT w.waybill_date AS 'Дата поставки', + SUM(w.total) AS 'Общая сумма', + SUM(wl.amount) as 'Количество' FROM waybill w -JOIN (SELECT waybill_id, SUM(count) AS cnt FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id) -JOIN sellers USING(sel_id) -WHERE sellers.name = '${seller}' -GROUP BY date_of_delivery \ No newline at end of file +JOIN (SELECT waybill_id, SUM(amount) AS amount FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id) +JOIN (SELECT user_id, sel_id FROM external_users) eu USING(user_id) +JOIN (SELECT sel_id, name FROM sellers) s USING(sel_id) +WHERE s.name = '$seller' +GROUP BY waybill_date \ No newline at end of file diff --git a/App/Requests/sql/sklad_material.sql b/App/Requests/sql/sklad_material.sql index e377fb5..2a154a5 100644 --- a/App/Requests/sql/sklad_material.sql +++ b/App/Requests/sql/sklad_material.sql @@ -1,4 +1,4 @@ SELECT weight AS 'Вес', price AS 'Цена', count AS 'Количество', last_update AS 'Дата последнего обновления' FROM workpiece -WHERE material = '${material}' \ No newline at end of file +WHERE material = '$material' \ No newline at end of file diff --git a/App/Requests/templates/sellers_ship.html b/App/Requests/templates/sellers_ship.html index 998a5bd..844a8f6 100644 --- a/App/Requests/templates/sellers_ship.html +++ b/App/Requests/templates/sellers_ship.html @@ -33,14 +33,16 @@
- +
diff --git a/App/Requests/templates/zagotovki.html b/App/Requests/templates/zagotovki.html index 3d8f662..c36de7d 100644 --- a/App/Requests/templates/zagotovki.html +++ b/App/Requests/templates/zagotovki.html @@ -43,7 +43,7 @@
- +
diff --git a/App/Requests/templates/zapros_menu.html b/App/Requests/templates/zapros_menu.html index 0aa606c..ae6a429 100644 --- a/App/Requests/templates/zapros_menu.html +++ b/App/Requests/templates/zapros_menu.html @@ -35,7 +35,7 @@
- +
diff --git a/App/Waybill/templates/order_finish.html b/App/Waybill/templates/order_finish.html index dd7b64f..1f53a11 100644 --- a/App/Waybill/templates/order_finish.html +++ b/App/Waybill/templates/order_finish.html @@ -12,7 +12,7 @@

Накладная оформлена

Номер вашей накладной: {{ order_id }}

- На главную страницу + На главную страницу
diff --git a/App/Waybill/templates/waybill.html b/App/Waybill/templates/waybill.html index 9b0603a..cf8af10 100644 --- a/App/Waybill/templates/waybill.html +++ b/App/Waybill/templates/waybill.html @@ -9,7 +9,18 @@ - + +
+
+
+
+

Оформление накладной

+
+ +
+
@@ -31,6 +42,9 @@ {% for item in waybill %} {{ card.render_item(item, show_form = False, show_amount = True) }} {% endfor %} +
+
Итого: {{ session.get('total', '0') }} ₽
+
diff --git a/App/app.py b/App/app.py index fe5e3d3..7f96e0e 100644 --- a/App/app.py +++ b/App/app.py @@ -9,9 +9,9 @@ app = Flask(__name__) app.secret_key = 'suplex' app.config.update( - db_config=json.load(open(os.path.join(os.path.dirname(__file__), 'data/config.json'))), - db_access=json.load(open(os.path.join(os.path.dirname(__file__), 'data/db_access.json'))), - cache_config=json.load(open(os.path.join(os.path.dirname(__file__), 'data/redis_config.json'))) + db_config=json.load(open(os.path.join(os.path.dirname(__file__), 'data/config.json'), encoding='utf-8')), + db_access=json.load(open(os.path.join(os.path.dirname(__file__), 'data/db_access.json'), encoding='utf-8')), + cache_config=json.load(open(os.path.join(os.path.dirname(__file__), 'data/redis_config.json'), encoding='utf-8')) ) app.register_blueprint(requests_bp, url_prefix='/requests') diff --git a/App/templates/error.html b/App/templates/error.html index 2813469..2860a4a 100644 --- a/App/templates/error.html +++ b/App/templates/error.html @@ -11,7 +11,7 @@ diff --git a/App/templates/output.html b/App/templates/output.html index 224e921..49e047c 100644 --- a/App/templates/output.html +++ b/App/templates/output.html @@ -55,7 +55,7 @@
{% endif %} \ No newline at end of file