Bot ended
This commit is contained in:
18
.drone.yml
18
.drone.yml
@@ -31,15 +31,15 @@ steps:
|
||||
- sleep 5 # Ждём, чтобы бот запустился
|
||||
- python test_bot.py # Проверка работы бота
|
||||
|
||||
services:
|
||||
# Шаг 3: Сервис базы данных MySQL
|
||||
- name: mysql
|
||||
image: mysql:8
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: R0sebud
|
||||
MYSQL_USER: user
|
||||
MYSQL_PASSWORD: password
|
||||
MYSQL_DATABASE: w1510415_wp832
|
||||
# services:
|
||||
# # Шаг 3: Сервис базы данных MySQL
|
||||
# - name: mysql
|
||||
# image: mysql:8
|
||||
# environment:
|
||||
# MYSQL_ROOT_PASSWORD: R0sebud
|
||||
# MYSQL_USER: user
|
||||
# MYSQL_PASSWORD: password
|
||||
# MYSQL_DATABASE: w1510415_wp832
|
||||
|
||||
trigger:
|
||||
event:
|
||||
|
||||
@@ -28,14 +28,14 @@ def generate_pdf_report(hotel_name, reservations, start_date, end_date):
|
||||
pdf.ln(10)
|
||||
|
||||
# Ширины колонок
|
||||
page_width = pdf.w - 20
|
||||
page_width = pdf.w - 10
|
||||
col_widths = [page_width * 0.2, page_width * 0.2, page_width * 0.15, page_width * 0.25, page_width * 0.1, page_width * 0.1]
|
||||
|
||||
# Заголовки таблицы
|
||||
pdf.set_font("OpenSans", size=10)
|
||||
headers = ["Дата заезда", "Дата выезда", "Номер", "Тип комнаты", "Цена", "Скидка"]
|
||||
for width, header in zip(col_widths, headers):
|
||||
pdf.cell(width, 10, header, border=1, align="C")
|
||||
pdf.cell(width, 15, header, border=1, align="C")
|
||||
pdf.ln()
|
||||
|
||||
total_price = 0
|
||||
@@ -47,19 +47,19 @@ def generate_pdf_report(hotel_name, reservations, start_date, end_date):
|
||||
total_price += price
|
||||
total_discount += discount
|
||||
|
||||
pdf.cell(col_widths[0], 10, res.check_in.strftime('%d.%m.%Y'), border=1)
|
||||
pdf.cell(col_widths[1], 10, res.check_out.strftime('%d.%m.%Y'), border=1)
|
||||
pdf.cell(col_widths[0], 10, res.check_in.strftime('%d.%m.%Y %H:%M'), border=1)
|
||||
pdf.cell(col_widths[1], 10, res.check_out.strftime('%d.%m.%Y %H:%M'), border=1)
|
||||
pdf.cell(col_widths[2], 10, res.room_number, border=1)
|
||||
pdf.cell(col_widths[3], 10, res.room_type, border=1)
|
||||
pdf.cell(col_widths[4], 10, f"{price:.2f} ₽", border=1, align="R")
|
||||
pdf.cell(col_widths[5], 10, f"{discount:.2f} ₽", border=1, align="R")
|
||||
pdf.cell(col_widths[4], 10, f"{price:.2f} р.", border=1, align="R")
|
||||
pdf.cell(col_widths[5], 10, f"{discount:.2f} р.", border=1, align="R")
|
||||
pdf.ln()
|
||||
|
||||
pdf.ln(5)
|
||||
pdf.set_font("OpenSans", size=12)
|
||||
pdf.set_font("OpenSans", size=18)
|
||||
pdf.cell(0, 10, "Итоги:", ln=True)
|
||||
pdf.cell(0, 10, f"Общая сумма цен: {total_price:.2f} ₽", ln=True)
|
||||
pdf.cell(0, 10, f"Общая сумма скидок: {total_discount:.2f} ₽", ln=True)
|
||||
pdf.cell(0, 10, f"Общая сумма цен: {total_price:.2f} руб.", ln=True)
|
||||
pdf.cell(0, 10, f"Общая сумма скидок: {total_discount:.2f} руб. ", ln=True)
|
||||
|
||||
file_path = os.path.join("reports", f"{hotel_name}_report.pdf")
|
||||
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user