Merge branch 'Requests' of ParkSuMin/Cursovaya into main
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<h1 class="mt-5">Успешно!</h1>
|
<h1 class="mt-5">Успешно!</h1>
|
||||||
<p class="lead">Отчет успешно добавлен в базу данных!</p>
|
<p class="lead">Отчет успешно добавлен в базу данных!</p>
|
||||||
<div class="gap-2 py-5">
|
<div class="gap-2 py-5">
|
||||||
<a href="{{ url_for('index') }}"><button class="btn btn-primary">На главную страницу</button></a>
|
<a href="{{ url_for('index') }}"><button class="btn btn-secondary">На главную страницу</button></a>
|
||||||
<a href="{{ url_for('report_bp.menu') }}"><button class="btn btn-primary">В меню отчетов</button></a>
|
<a href="{{ url_for('report_bp.menu') }}"><button class="btn btn-primary">В меню отчетов</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-center mt-5">
|
<div class="d-flex justify-content-center mt-5">
|
||||||
<a href="{{ url_for('index') }}"><button class="btn btn-warning">Главное меню</button></a>
|
<a href="{{ url_for('index') }}"><button class="btn btn-secondary">Главное меню</button></a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-12 d-flex justify-content-center">
|
<div class="col-12 d-flex justify-content-center">
|
||||||
<a href="{{ url_for('index') }}"><button class="btn btn-warning">Главное меню</button></a>
|
<a href="{{ url_for('index') }}"><button class="btn btn-secondary">Главное меню</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from checker import check_auth
|
|||||||
from .requests_model import sklad, materials_per_seller, sellers_names, materials_names
|
from .requests_model import sklad, materials_per_seller, sellers_names, materials_names
|
||||||
import json
|
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_list = json.load(f)
|
||||||
|
|
||||||
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
|
requests_bp = Blueprint('requests_bp', __name__, template_folder='templates')
|
||||||
@@ -19,12 +19,11 @@ def requests():
|
|||||||
@check_auth
|
@check_auth
|
||||||
def sklad_zapros():
|
def sklad_zapros():
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
materials = materials_names()
|
return render_template('zagotovki.html')
|
||||||
return render_template('zagotovki.html', materials=materials.result)
|
|
||||||
else:
|
else:
|
||||||
material = dict(request.form)
|
zagotovki = sklad(request)
|
||||||
zagotovki = sklad(material)
|
|
||||||
if zagotovki.status:
|
if zagotovki.status:
|
||||||
|
material = dict(request.form)
|
||||||
header = f'Заготовки на складе из материала \"{material["material"]}\"'
|
header = f'Заготовки на складе из материала \"{material["material"]}\"'
|
||||||
return render_template('output.html', items=zagotovki.result, header=header)
|
return render_template('output.html', items=zagotovki.result, header=header)
|
||||||
else:
|
else:
|
||||||
@@ -34,12 +33,11 @@ def sklad_zapros():
|
|||||||
@check_auth
|
@check_auth
|
||||||
def sellers_ship():
|
def sellers_ship():
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
sellers = sellers_names()
|
return render_template('sellers_ship.html')
|
||||||
return render_template('sellers_ship.html', sellers=sellers.result)
|
|
||||||
else:
|
else:
|
||||||
seller = dict(request.form)
|
zagotovki = materials_per_seller(request)
|
||||||
zagotovki = materials_per_seller(seller)
|
|
||||||
if zagotovki.status:
|
if zagotovki.status:
|
||||||
|
seller = dict(request.form)
|
||||||
header = f'Поставки от поставщика \"{seller["seller"]}\"'
|
header = f'Поставки от поставщика \"{seller["seller"]}\"'
|
||||||
return render_template('output.html', items=zagotovki.result, header=header, link=url_for('requests_bp.requests'))
|
return render_template('output.html', items=zagotovki.result, header=header, link=url_for('requests_bp.requests'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ def materials_names() -> InfoRespronse:
|
|||||||
status=False)
|
status=False)
|
||||||
return InfoRespronse(result, error_message='', status=True)
|
return InfoRespronse(result, error_message='', status=True)
|
||||||
|
|
||||||
def sklad(input_data) -> InfoRespronse:
|
def sklad(request) -> InfoRespronse:
|
||||||
_sql = sql_provider.get('sklad_material.sql', input_data)
|
material = dict(request.form)
|
||||||
print("sql = ", _sql)
|
_sql = sql_provider.get('sklad_material.sql', material)
|
||||||
result = select_list(current_app.config['db_config'], _sql)
|
result = select_list(current_app.config['db_config'], _sql)
|
||||||
if result is None:
|
if result is None:
|
||||||
return InfoRespronse((),
|
return InfoRespronse((),
|
||||||
@@ -40,8 +40,9 @@ def sklad(input_data) -> InfoRespronse:
|
|||||||
return InfoRespronse(result, error_message='', status=True)
|
return InfoRespronse(result, error_message='', status=True)
|
||||||
|
|
||||||
|
|
||||||
def materials_per_seller(input_data) -> InfoRespronse:
|
def materials_per_seller(request) -> InfoRespronse:
|
||||||
_sql = sql_provider.get('ship_seller.sql', input_data)
|
seller = dict(request.form)
|
||||||
|
_sql = sql_provider.get('ship_seller.sql', seller)
|
||||||
result = select_list(current_app.config['db_config'], _sql)
|
result = select_list(current_app.config['db_config'], _sql)
|
||||||
if result is None:
|
if result is None:
|
||||||
return InfoRespronse((),
|
return InfoRespronse((),
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
SELECT w.date_of_delivery AS 'Дата поставки',
|
SELECT w.waybill_date AS 'Дата поставки',
|
||||||
SUM(w.sum) AS 'Общая сумма',
|
SUM(w.total) AS 'Общая сумма',
|
||||||
SUM(wl.cnt) as 'Количество'
|
SUM(wl.amount) as 'Количество'
|
||||||
FROM waybill w
|
FROM waybill w
|
||||||
JOIN (SELECT waybill_id, SUM(count) AS cnt FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id)
|
JOIN (SELECT waybill_id, SUM(amount) AS amount FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id)
|
||||||
JOIN sellers USING(sel_id)
|
JOIN (SELECT user_id, sel_id FROM external_users) eu USING(user_id)
|
||||||
WHERE sellers.name = '${seller}'
|
JOIN (SELECT sel_id, name FROM sellers) s USING(sel_id)
|
||||||
GROUP BY date_of_delivery
|
WHERE s.name = '$seller'
|
||||||
|
GROUP BY waybill_date
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
SELECT weight AS 'Вес', price AS 'Цена',
|
SELECT weight AS 'Вес', price AS 'Цена',
|
||||||
count AS 'Количество', last_update AS 'Дата последнего обновления'
|
count AS 'Количество', last_update AS 'Дата последнего обновления'
|
||||||
FROM workpiece
|
FROM workpiece
|
||||||
WHERE material = '${material}'
|
WHERE material = '$material'
|
||||||
@@ -33,14 +33,16 @@
|
|||||||
<form action="" method="post" style="display: inline-block;">
|
<form action="" method="post" style="display: inline-block;">
|
||||||
<label>Выберите поставщика</label>
|
<label>Выберите поставщика</label>
|
||||||
<select class="form-select" name="seller">
|
<select class="form-select" name="seller">
|
||||||
{% for seller in sellers %}
|
<option value="Alpha Supplies">Alpha Supplies</option>
|
||||||
<option value="{{ seller['name'] }}">{{ seller['name'] }}</option>
|
<option value="Beta Materials">Beta Materials</option>
|
||||||
{% endfor %}
|
<option value="Gamma Parts">Gamma Parts</option>
|
||||||
|
<option value="Delta Components">Delta Components</option>
|
||||||
|
<option value="Epsilon Goods">Epsilon Goods</option>
|
||||||
</select>
|
</select>
|
||||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="d-flex justify-content-center mt-5">
|
<div class="d-flex justify-content-center mt-5">
|
||||||
<a href="{{ url_for('requests_bp.requests') }}"><button class="btn btn-warning">Обратно в меню запросов</button></a>
|
<a href="{{ url_for('requests_bp.requests') }}"><button class="btn btn-secondary">Обратно в меню запросов</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="d-flex justify-content-center mt-5">
|
<div class="d-flex justify-content-center mt-5">
|
||||||
<a href="{{ url_for('requests_bp.requests') }}"><button class="btn btn-warning">Обратно в меню запросов</button></a>
|
<a href="{{ url_for('requests_bp.requests') }}"><button class="btn btn-secondary">Обратно в меню запросов</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-12 d-flex justify-content-center">
|
<div class="col-12 d-flex justify-content-center">
|
||||||
<a href="{{ url_for('index') }}"><button class="btn btn-warning">Главное меню</button></a>
|
<a href="{{ url_for('index') }}"><button class="btn btn-secondary">Главное меню</button></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<h1 class="mt-5">Накладная оформлена</h1>
|
<h1 class="mt-5">Накладная оформлена</h1>
|
||||||
<p class="lead">Номер вашей накладной: {{ order_id }}</p>
|
<p class="lead">Номер вашей накладной: {{ order_id }}</p>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<a href="{{ url_for('index') }}" class="btn btn-primary me-2">На главную страницу</a>
|
<a href="{{ url_for('index') }}" class="btn btn-secondary me-2">На главную страницу</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -9,7 +9,18 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="p-3 m-0 border-0 bd-example m-0 border-0">
|
||||||
|
<header>
|
||||||
|
<div class="row flex-nowrap justify-content-between pb-5">
|
||||||
|
<div class="col-1 pt-1"></div>
|
||||||
|
<div class="col-10 text-center">
|
||||||
|
<h1 class="display-5 fw-bold">Оформление накладной</h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-1 d-flex justify-content-end align-items-center">
|
||||||
|
<a href="{{ url_for('logout') }}"><button class="btn btn-danger">Выход</button></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Секция заготовок -->
|
<!-- Секция заготовок -->
|
||||||
@@ -31,6 +42,9 @@
|
|||||||
{% for item in waybill %}
|
{% for item in waybill %}
|
||||||
{{ card.render_item(item, show_form = False, show_amount = True) }}
|
{{ card.render_item(item, show_form = False, show_amount = True) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<div class="mt-3">
|
||||||
|
<h5>Итого: {{ session.get('total', '0') }} ₽</h5>
|
||||||
|
</div>
|
||||||
<div class="d-grid gap-2 mt-3">
|
<div class="d-grid gap-2 mt-3">
|
||||||
<a href="{{url_for('waybill_bp.save_order')}}"><button class="btn btn-primary">Оформить накладную</button></a>
|
<a href="{{url_for('waybill_bp.save_order')}}"><button class="btn btn-primary">Оформить накладную</button></a>
|
||||||
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ app = Flask(__name__)
|
|||||||
app.secret_key = 'suplex'
|
app.secret_key = 'suplex'
|
||||||
|
|
||||||
app.config.update(
|
app.config.update(
|
||||||
db_config=json.load(open(os.path.join(os.path.dirname(__file__), 'data/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'))),
|
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')))
|
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')
|
app.register_blueprint(requests_bp, url_prefix='/requests')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="mt-5">Сожалеем</h1>
|
<h1 class="mt-5">Сожалеем</h1>
|
||||||
<p class="lead"> {{ error_message }}</p>
|
<p class="lead"> {{ error_message }}</p>
|
||||||
<a href="{{ url_for('index') }}"><button class="btn btn-primary">На главную страницу</button></a>
|
<a href="{{ url_for('index') }}"><button class="btn btn-secondary">На главную страницу</button></a>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="d-flex justify-content-center gap-2">
|
<div class="d-flex justify-content-center gap-2">
|
||||||
<a href="{{ link }}"><button class="btn btn-primary">Вернуться в меню выбора</button></a>
|
<a href="{{ link }}"><button class="btn btn-secondary">Вернуться в меню выбора</button></a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user