Merge branch 'Requests' of ParkSuMin/Cursovaya into main
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<h1 class="mt-5">Успешно!</h1>
|
||||
<p class="lead">Отчет успешно добавлен в базу данных!</p>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="row 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>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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((),
|
||||
|
||||
@@ -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
|
||||
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
|
||||
@@ -1,4 +1,4 @@
|
||||
SELECT weight AS 'Вес', price AS 'Цена',
|
||||
count AS 'Количество', last_update AS 'Дата последнего обновления'
|
||||
FROM workpiece
|
||||
WHERE material = '${material}'
|
||||
WHERE material = '$material'
|
||||
@@ -33,14 +33,16 @@
|
||||
<form action="" method="post" style="display: inline-block;">
|
||||
<label>Выберите поставщика</label>
|
||||
<select class="form-select" name="seller">
|
||||
{% for seller in sellers %}
|
||||
<option value="{{ seller['name'] }}">{{ seller['name'] }}</option>
|
||||
{% endfor %}
|
||||
<option value="Alpha Supplies">Alpha Supplies</option>
|
||||
<option value="Beta Materials">Beta Materials</option>
|
||||
<option value="Gamma Parts">Gamma Parts</option>
|
||||
<option value="Delta Components">Delta Components</option>
|
||||
<option value="Epsilon Goods">Epsilon Goods</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
<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>
|
||||
</main>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<button type="submit" class="btn btn-primary">Отправить</button>
|
||||
</form>
|
||||
<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>
|
||||
</main>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="row 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>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<h1 class="mt-5">Накладная оформлена</h1>
|
||||
<p class="lead">Номер вашей накладной: {{ order_id }}</p>
|
||||
<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>
|
||||
</main>
|
||||
|
||||
@@ -9,7 +9,18 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</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="row">
|
||||
<!-- Секция заготовок -->
|
||||
@@ -31,6 +42,9 @@
|
||||
{% for item in waybill %}
|
||||
{{ card.render_item(item, show_form = False, show_amount = True) }}
|
||||
{% endfor %}
|
||||
<div class="mt-3">
|
||||
<h5>Итого: {{ session.get('total', '0') }} ₽</h5>
|
||||
</div>
|
||||
<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('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="container">
|
||||
<h1 class="mt-5">Сожалеем</h1>
|
||||
<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>
|
||||
</main>
|
||||
</body>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user