From 576c0632d50f67003e35cc66eb6b79effb29574c Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Wed, 4 Dec 2024 11:39:07 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=82=D0=B8=D0=BF=D0=BE=D0=B2=20=D0=BA=D0=BD?= =?UTF-8?q?=D0=BE=D0=BF=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Report/templates/OK.html | 2 +- App/Report/templates/report_basic.html | 2 +- App/Report/templates/report_menu.html | 2 +- App/Requests/templates/sellers_ship.html | 2 +- App/Requests/templates/zagotovki.html | 2 +- App/Requests/templates/zapros_menu.html | 2 +- App/Waybill/templates/order_finish.html | 2 +- App/templates/error.html | 2 +- App/templates/output.html | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) 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/templates/sellers_ship.html b/App/Requests/templates/sellers_ship.html index 998a5bd..0ef90df 100644 --- a/App/Requests/templates/sellers_ship.html +++ b/App/Requests/templates/sellers_ship.html @@ -40,7 +40,7 @@
- +
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/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 @@

Сожалеем

{{ error_message }}

- +
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 From 0b6af28ff3703f38841e274274aa93536c38fd96 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Wed, 4 Dec 2024 11:39:36 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=BA=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=BD=D0=B0=D0=BA=D0=BB=D0=B0=D0=B4=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B8=20=D0=B8=D1=82=D0=BE=D0=B3=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D1=81=D1=83=D0=BC=D0=BC=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Waybill/templates/waybill.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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') }} ₽
+
From 8caa72d2fdd7f6c00f7fa88f776453aa9baa2bed Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Wed, 4 Dec 2024 12:14:14 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B2=D0=BE=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BA=20MVC=20+=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20(=D0=B2=20=D0=BE=D1=81=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BD=D0=BE=D0=BC=20=D0=BF=D1=80=D0=B8=D0=BB=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B8=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=B0=D1=85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Requests/__init__.py | 14 +++++--------- App/Requests/requests_model.py | 11 ++++++----- App/Requests/templates/sellers_ship.html | 8 +++++--- App/app.py | 6 +++--- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/App/Requests/__init__.py b/App/Requests/__init__.py index c3d0b8b..74fc5be 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,11 +19,9 @@ 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: header = f'Заготовки на складе из материала \"{material["material"]}\"' return render_template('output.html', items=zagotovki.result, header=header) @@ -34,11 +32,9 @@ 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: header = f'Поставки от поставщика \"{seller["seller"]}\"' return render_template('output.html', items=zagotovki.result, header=header, link=url_for('requests_bp.requests')) 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/templates/sellers_ship.html b/App/Requests/templates/sellers_ship.html index 0ef90df..844a8f6 100644 --- a/App/Requests/templates/sellers_ship.html +++ b/App/Requests/templates/sellers_ship.html @@ -33,9 +33,11 @@
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') From 08029a9883665f5b14049daefefba07cdc48cf30 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Wed, 4 Dec 2024 13:00:52 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Requests/__init__.py | 2 ++ App/Requests/sql/ship_seller.sql | 15 ++++++++------- App/Requests/sql/sklad_material.sql | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/App/Requests/__init__.py b/App/Requests/__init__.py index 74fc5be..f40799e 100644 --- a/App/Requests/__init__.py +++ b/App/Requests/__init__.py @@ -23,6 +23,7 @@ def sklad_zapros(): else: 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: @@ -36,6 +37,7 @@ def sellers_ship(): else: 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/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