Merge branch 'CI/CD' of ParkSuMin/Cursovaya into main

This commit is contained in:
2024-12-12 18:41:09 +00:00
committed by Gogs
11 changed files with 60 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
SELECT
s.name AS Поставщик,
reports.sum AS 'Сумма в рублях',
reports.sum AS 'Сумма (в ₽)',
reports.count AS 'Количество поставок'
FROM reports
JOIN sellers s ON reports.item_id = s.sel_id

View File

@@ -1,6 +1,6 @@
SELECT w.name AS Наименование,
reports.sum AS 'Сумма в рублях',
reports.count AS 'Количество поставленных заготовок'
reports.sum AS 'Сумма (в ₽)',
reports.count AS 'Количество поставленных заготовок (в шт.)'
from reports
JOIN workpiece w ON reports.item_id = w.work_id
WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year')

View File

@@ -1,7 +1,7 @@
SELECT DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
SUM(w.total) AS 'Общая сумма (в рублях)',
SUM(wl.amount) as 'Общее количество заготовок'
SUM(w.total) AS 'Общая сумма (в )',
SUM(wl.amount) as 'Общее количество заготовок (в шт.)'
FROM waybill w
JOIN (SELECT waybill_id, SUM(amount) AS amount FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id)

View File

@@ -2,7 +2,7 @@ SELECT
DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
s.name AS 'Поставщик',
wl.amount AS 'Количество'
wl.amount AS 'Количество (в шт.)'
FROM waybill w
JOIN (SELECT waybill_id, work_id, amount FROM waybill_lines) wl USING(waybill_id)

View File

@@ -74,12 +74,12 @@ def button_click(request):
session["total"] = str(int(session["total"]) + price)
session.modified = True
else:
print("NEW WORKPIECE")
# print("NEW WORKPIECE")
pr_id = product["work_id"]
price = product["price"]
session["waybill"][str(pr_id)] = "1"
session["total"] = str(int(session["total"]) + price)
print(session["waybill"])
# print(session["waybill"])
session.modified = True
elif request.form.get("product_display_minus"):
@@ -121,7 +121,7 @@ def transaction_order_model(user_id: int, current_date: date) -> InfoRespronse:
),
)
cursor.execute(_sql)
result = tuple([order_id])
result = tuple([order_id])
if result is None:
return InfoRespronse((), error_message="Заказ не был создан", status=False)
clear()

View File

@@ -39,22 +39,34 @@
<div class="col-md-4">
<h4>Накладная</h4>
{% if waybill %}
{% 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 class="row">
<div class="col-8">
<div class="row row-cols-1 g-3">
{% for item in waybill %}
<div class="col">
{{ card.render_item(item, show_form = False, show_amount = True) }}
</div>
{% endfor %}
</div>
</div>
<div class="col-4 d-flex flex-column">
<h5 class="mb-3">Итого: {{ session.get('total', '0') }} ₽</h5>
<div class="d-flex flex-column gap-2">
<a href="{{url_for('waybill_bp.save_order')}}"><button class="btn btn-primary">Оформить накладную</button></a>
<a href="{{url_for('waybill_bp.clear_waybill')}}"><button class="btn btn-danger">Очистить накладную</button></a>
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
</div>
</div>
</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('waybill_bp.clear_waybill')}}"><button class="btn btn-danger">Очистить накладную</button></a>
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
</div>
{% else %}
<span>Ваша накладная пуста</span>
<div class="d-grid gap-2 mt-3">
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
</div>
<div class="row">
<div class="col-8">
<span>Ваша накладная пуста</span>
</div>
<div class="col-4">
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
</div>
</div>
{% endif %}
</div>
</div>

View File

@@ -2,7 +2,7 @@ import json
import os
from Auth import auth_bp
from flask import Flask, render_template, session
from flask import Flask, redirect, render_template, session
from Report import report_bp
from Requests import requests_bp
from Waybill import waybill_bp
@@ -45,7 +45,7 @@ def index():
@app.route("/logout")
def logout():
session.clear()
return render_template("main_menu.html", ses=session)
return redirect("/")
if __name__ == "__main__":

View File

@@ -17,7 +17,7 @@ def fetch_from_cache(cache_name: str, cache_config: dict):
@wraps(f)
def wrapper(*args, **kwargs):
cached_value = cache_conn.get_value(cache_name)
print("cached_value=", cached_value)
# print("cached_value=", cached_value)
if cached_value:
return cached_value
response = f(*args, **kwargs)

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
# Use the official Python image as a base
FROM python:3.9.20-alpine3.19
# Set the working directory inside the container
WORKDIR /app
# Copy the contents of the 'App' folder to the working directory
COPY App/ /app
# Copy the requirements file to the working directory
COPY requirements.txt /app
# Install the dependencies from the requirements file
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5001
# Command to run the application
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "app:app"]

4
build.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
docker build -t tsettaro/kursovaya-ris:latest .
docker push tsettaro/kursovaya-ris:latest

Binary file not shown.