feat: oleg gone away

This commit is contained in:
2024-09-11 23:11:34 +03:00
parent a0d71550f3
commit 689eacf227
3 changed files with 35 additions and 10 deletions

View File

@@ -18,6 +18,7 @@ from models import DealBillRequest, Deal, DealProduct, DealService as DealServic
from schemas.billing import *
from services.base import BaseService
from services.deal import DealService
from utils.list_utils import to_locale_number
env = Environment(loader=FileSystemLoader(Path("templates") / Path("documents")))
@@ -148,16 +149,16 @@ class BillingService(BaseService):
services.append(
CreateBillingRequestValue(
name=f'[{product.product.name}] - {service.service.name}',
price=service.price,
amount=product.quantity
price=to_locale_number(service.price),
amount=to_locale_number(product.quantity)
)
)
for service in deal.services:
services.append(
CreateBillingRequestValue(
name=f'{service.service.name}',
price=service.price,
amount=service.quantity
price=to_locale_number(service.price),
amount=to_locale_number(service.quantity)
)
)
@@ -180,6 +181,7 @@ class BillingService(BaseService):
deal_price = sum((service.price * service.amount for service in services))
deal_price_words = get_string_by_number(deal_price)[0:-10]
deal_price = to_locale_number(deal_price)
template = env.get_template("bill-of-payment.html")
now = datetime.datetime.now()
@@ -194,7 +196,6 @@ class BillingService(BaseService):
async def create_billing_document_pdf(self, deal_id) -> BytesIO:
doc = await self._create_billing_document_html(deal_id)
pdf_file = BytesIO()
HTML(string=doc).write_pdf(pdf_file)