Compare commits
9 Commits
543b896db2
...
2a8e2bd276
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a8e2bd276 | |||
| b61791cbc9 | |||
| 52200b2639 | |||
| dcbb52bee3 | |||
| 38add18a17 | |||
| 081aa01b70 | |||
| d7789704cf | |||
| f5856d6fb7 | |||
| 83a00f6d05 |
@ -2264,4 +2264,12 @@ class CarDealershipRegistrationForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = UserRegistration
|
||||
fields = ("name","arabic_name", "email","phone_number", "crn", "vrn", "address")
|
||||
fields = ("name","arabic_name", "email","phone_number", "crn", "vrn", "address")
|
||||
|
||||
class CarDetailsEstimateCreate(forms.Form):
|
||||
customer = forms.ModelChoiceField(
|
||||
queryset=Customer.objects.all(),
|
||||
required=True,
|
||||
label="Customer",
|
||||
widget=forms.Select(attrs={"class": "form-control"}),
|
||||
)
|
||||
@ -902,6 +902,20 @@ class Car(Base):
|
||||
)
|
||||
self.save()
|
||||
|
||||
def get_active_estimates(self):
|
||||
try:
|
||||
qs = self.item_model.itemtransactionmodel_set.exclude(ce_model__status="canceled")
|
||||
|
||||
data = []
|
||||
for item in qs:
|
||||
x = ExtraInfo.objects.filter(object_id=item.ce_model.pk,content_type=ContentType.objects.get_for_model(EstimateModel)).first()
|
||||
if x:
|
||||
data.append(x)
|
||||
return data
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting active estimates for car {self.vin} error: {e}")
|
||||
return []
|
||||
|
||||
@property
|
||||
def logo(self):
|
||||
return self.id_car_make.logo.url if self.id_car_make.logo else None
|
||||
@ -1523,7 +1537,7 @@ class Staff(models.Model):
|
||||
# max_length=255, unique=True, editable=False, null=True, blank=True,allow_unicode=True
|
||||
# )
|
||||
slug = RandomCharField(length=8, unique=True)
|
||||
|
||||
|
||||
objects = StaffUserManager()
|
||||
|
||||
@property
|
||||
@ -2479,12 +2493,14 @@ class Opportunity(models.Model):
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
if self.customer:
|
||||
return (
|
||||
f"Opportunity for {self.customer.first_name} {self.customer.last_name}"
|
||||
)
|
||||
return f"Opportunity for {self.organization.name}"
|
||||
|
||||
try:
|
||||
if self.customer:
|
||||
return (
|
||||
f"Opportunity for {self.customer.first_name} {self.customer.last_name}"
|
||||
)
|
||||
return f"Opportunity for {self.organization.name}"
|
||||
except Exception:
|
||||
return f"Opportunity for car :{self.car}"
|
||||
|
||||
class Notes(models.Model):
|
||||
dealer = models.ForeignKey(Dealer, on_delete=models.CASCADE, related_name="notes")
|
||||
|
||||
@ -625,6 +625,7 @@ class BillModelUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateVie
|
||||
f"Bill {self.object.bill_number} successfully updated.",
|
||||
extra_tags="is-success",
|
||||
)
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
def get(self, request, dealer_slug, entity_slug, bill_pk, *args, **kwargs):
|
||||
@ -693,7 +694,6 @@ class BillModelUpdateView(LoginRequiredMixin, PermissionRequiredMixin, UpdateVie
|
||||
message=f"Items for Invoice {bill_model.bill_number} saved.",
|
||||
level=messages.SUCCESS,
|
||||
)
|
||||
|
||||
# if valid get saved formset from DB
|
||||
return HttpResponseRedirect(
|
||||
redirect_to=reverse(
|
||||
|
||||
@ -991,14 +991,22 @@ def create_dealer_settings(sender, instance, created, **kwargs):
|
||||
# # save_journal(instance,ledger,vendor)
|
||||
|
||||
|
||||
@receiver(post_save, sender=BillModel)
|
||||
def save_po(sender, instance, created, **kwargs):
|
||||
try:
|
||||
if instance.is_paid() and instance.itemtransactionmodel_set.first().po_model:
|
||||
instance.itemtransactionmodel_set.first().po_model.save()
|
||||
except Exception as e:
|
||||
pass
|
||||
@receiver(post_save, sender=PurchaseOrderModel)
|
||||
def create_po_item_upload(sender, instance, created, **kwargs):
|
||||
if instance.po_status == "fulfilled":
|
||||
if instance.po_status == "fulfilled" or instance.po_status == 'approved':
|
||||
for item in instance.get_itemtxs_data()[0]:
|
||||
dealer = models.Dealer.objects.get(entity=instance.entity)
|
||||
models.PoItemsUploaded.objects.get_or_create(
|
||||
dealer=dealer, po=instance, item=item, status="fulfilled"
|
||||
)
|
||||
if item.bill_model.is_paid():
|
||||
models.PoItemsUploaded.objects.get_or_create(
|
||||
dealer=dealer, po=instance, item=item, status=instance.po_status
|
||||
)
|
||||
|
||||
|
||||
# @receiver(post_save, sender=models.Staff)
|
||||
|
||||
@ -2815,3 +2815,36 @@ def generate_car_image_simple(car):
|
||||
error_msg = f"Image processing failed: {e}"
|
||||
logger.error(error_msg)
|
||||
return {"success": False, "error": error_msg}
|
||||
|
||||
|
||||
|
||||
|
||||
def create_estimate_(dealer,car,customer):
|
||||
entity = dealer.entity
|
||||
title = f"Estimate for {car.vin}-{car.id_car_make.name}-{car.id_car_model.name}-{car.year} for customer {customer.first_name} {customer.last_name}"
|
||||
estimate = entity.create_estimate(
|
||||
estimate_title=title,
|
||||
customer_model=customer.customer_model,
|
||||
contract_terms="fixed",
|
||||
)
|
||||
|
||||
estimate_itemtxs = {
|
||||
car.item_model.item_number: {
|
||||
"unit_cost": round(float(car.marked_price)),
|
||||
"unit_revenue": round(float(car.marked_price)),
|
||||
"quantity": 1,
|
||||
"total_amount": round(float(car.final_price_plus_vat)),
|
||||
}
|
||||
}
|
||||
|
||||
try:
|
||||
estimate.migrate_itemtxs(
|
||||
itemtxs=estimate_itemtxs,
|
||||
commit=True,
|
||||
operation=EstimateModel.ITEMIZE_APPEND,
|
||||
)
|
||||
except Exception as e:
|
||||
estimate.delete()
|
||||
raise e
|
||||
|
||||
return estimate
|
||||
@ -12,6 +12,8 @@ import tempfile
|
||||
import numpy as np
|
||||
from time import sleep
|
||||
|
||||
from weasyprint import HTML
|
||||
|
||||
# from rich import print
|
||||
from random import randint
|
||||
from decimal import Decimal
|
||||
@ -204,6 +206,7 @@ from .services import (
|
||||
)
|
||||
from .utils import (
|
||||
CarFinanceCalculator,
|
||||
create_estimate_,
|
||||
get_car_finance_data,
|
||||
get_finance_data,
|
||||
get_item_transactions,
|
||||
@ -1737,6 +1740,15 @@ class CarDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
|
||||
context_object_name = "car"
|
||||
permission_required = ["inventory.view_car"]
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
form = forms.CarDetailsEstimateCreate()
|
||||
form.fields["customer"].queryset = form.fields["customer"].queryset.filter(dealer=self.request.dealer)
|
||||
context["estimate_form"] = form
|
||||
context["active_estimates"] = self.object.get_active_estimates()
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def CarFinanceUpdateView(request,dealer_slug,slug):
|
||||
car = get_object_or_404(models.Car, slug=slug)
|
||||
@ -5108,7 +5120,29 @@ class EstimatePrintView(EstimateDetailView):
|
||||
uses a dedicated, stripped-down print template.
|
||||
"""
|
||||
template_name = "sales/estimates/estimate_preview.html"
|
||||
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
|
||||
self.object = self.get_object()
|
||||
context = self.get_context_data(object=self.object)
|
||||
|
||||
|
||||
# lang = request.GET.get('lang', 'ar')
|
||||
|
||||
|
||||
template_path = "sales/estimates/estimate_preview.html"
|
||||
|
||||
|
||||
html_string = render_to_string(template_path, context)
|
||||
|
||||
|
||||
pdf_file = HTML(string=html_string).write_pdf()
|
||||
|
||||
|
||||
response = HttpResponse(pdf_file, content_type='application/pdf')
|
||||
response['Content-Disposition'] = f'attachment; filename="estimate_{self.object.estimate_number}.pdf"'
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@login_required
|
||||
@ -7239,6 +7273,7 @@ class OpportunityCreateView(
|
||||
instance = form.save(commit=False)
|
||||
instance.dealer = dealer
|
||||
instance.staff = instance.lead.staff
|
||||
instance.customer = instance.lead.customer
|
||||
instance.save()
|
||||
instance.lead.convert_to_customer()
|
||||
instance.lead.save()
|
||||
@ -10971,7 +11006,45 @@ class PurchaseOrderDetailView(LoginRequiredMixin, PermissionRequiredMixin, Detai
|
||||
if i["po_item_status"] != "cancelled"
|
||||
)
|
||||
return context
|
||||
def get(self, request, *args, **kwargs):
|
||||
self.object = self.get_object()
|
||||
context = self.get_context_data(object=self.object)
|
||||
po_items_qs, item_data = self.object.get_itemtxs_data(
|
||||
queryset=self.object.itemtransactionmodel_set.all().select_related(
|
||||
"item_model", "bill_model"
|
||||
)
|
||||
)
|
||||
|
||||
if self.object.po_status == 'fulfilled':
|
||||
context['po_items_list']=po_items_qs
|
||||
context['vendor']=po_items_qs.first().bill_model.vendor
|
||||
context['dealer']=request.dealer
|
||||
|
||||
# Check if PDF format is requested
|
||||
if request.GET.get('format') == 'pdf':
|
||||
# Use a separate, print-friendly template for the PDF
|
||||
if request.GET.get('lang')=='en':
|
||||
html_string = render_to_string(
|
||||
"purchase_orders/po_detail_en_pdf.html",
|
||||
context
|
||||
)
|
||||
else:
|
||||
html_string=render_to_string(
|
||||
"purchase_orders/po_detail_ar_pdf.html",
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Use WeasyPrint to generate the PDF
|
||||
pdf = HTML(string=html_string).write_pdf()
|
||||
|
||||
response = HttpResponse(pdf, content_type="application/pdf")
|
||||
response["Content-Disposition"] = f'attachment; filename="PO_{self.object.po_number}.pdf"'
|
||||
return response
|
||||
|
||||
# If not a PDF request, return the standard HTML response
|
||||
return self.render_to_response(context)
|
||||
|
||||
class PurchaseOrderListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
|
||||
model = PurchaseOrderModel
|
||||
@ -11142,6 +11215,7 @@ def upload_cars(request, dealer_slug, pk=None):
|
||||
|
||||
if request.method == "POST":
|
||||
csv_file = request.FILES.get("csv_file")
|
||||
marked_price = request.POST.get("marked_price")
|
||||
# Log initial attempt to process data from item or POST
|
||||
logger.debug(
|
||||
f"User {user_username} starting car data processing for upload. "
|
||||
@ -11260,14 +11334,9 @@ def upload_cars(request, dealer_slug, pk=None):
|
||||
vendor=vendor,
|
||||
receiving_date=receiving_date,
|
||||
cost_price=po_item.item.unit_cost,
|
||||
marked_price=marked_price or 0,
|
||||
)
|
||||
# if po_item: #TODO:update
|
||||
# models.CarFinance.objects.create(
|
||||
# car=car,
|
||||
# cost_price=po_item.item.unit_cost,
|
||||
# marked_price=0,
|
||||
# selling_price=0,
|
||||
# )
|
||||
|
||||
car.add_colors(exterior=exterior, interior=interior)
|
||||
cars_created += 1
|
||||
logger.debug(
|
||||
@ -12001,3 +12070,70 @@ def payment_result(request):
|
||||
if s == "success":
|
||||
return render(request, 'plans/payment_success.html')
|
||||
return render(request, 'plans/payment_failed.html')
|
||||
|
||||
|
||||
@require_POST
|
||||
def create_estimate_for_car(request,dealer_slug,slug):
|
||||
car = get_object_or_404(models.Car, slug=slug)
|
||||
dealer = get_object_or_404(models.Dealer, slug=dealer_slug)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = forms.CarDetailsEstimateCreate(request.POST)
|
||||
if form.is_valid():
|
||||
customer = form.cleaned_data['customer']
|
||||
estimate = create_estimate_(dealer, car, customer)
|
||||
|
||||
if request.is_staff:
|
||||
models.ExtraInfo.objects.create(
|
||||
dealer=dealer,
|
||||
content_object=estimate,
|
||||
related_object=request.staff,
|
||||
created_by=request.user,
|
||||
data={"vat_rate": dealer.vat_rate, "discount": 0},
|
||||
)
|
||||
else:
|
||||
models.ExtraInfo.objects.create(
|
||||
dealer=dealer,
|
||||
content_object=estimate,
|
||||
related_object=request.user,
|
||||
created_by=request.user,
|
||||
data={"vat_rate": dealer.vat_rate, "discount": 0},
|
||||
)
|
||||
|
||||
messages.success(request, "Estimate created successfully.")
|
||||
return redirect("estimate_detail", dealer_slug=dealer.slug, pk=estimate.pk)
|
||||
else:
|
||||
messages.error(request, "Please correct the errors below.")
|
||||
return redirect("car_detail", dealer_slug=dealer.slug, slug=car.slug)
|
||||
@require_POST
|
||||
def estimate_create_from_opportunity(request,dealer_slug,slug):
|
||||
opportunity = get_object_or_404(models.Opportunity, slug=slug)
|
||||
dealer = get_object_or_404(models.Dealer, slug=dealer_slug)
|
||||
car = opportunity.car
|
||||
customer = opportunity.customer
|
||||
# TODO: set safe guard, so it doesnt recreate it
|
||||
if not all([dealer,car,customer]):
|
||||
messages.error(request, "Please correct the errors below.")
|
||||
return redirect("opportunity_detail", dealer_slug=dealer.slug, slug=opportunity.slug)
|
||||
|
||||
estimate = create_estimate_(dealer, car, customer)
|
||||
|
||||
if request.is_staff:
|
||||
models.ExtraInfo.objects.create(
|
||||
dealer=dealer,
|
||||
content_object=estimate,
|
||||
related_object=request.staff,
|
||||
created_by=request.user,
|
||||
data={"vat_rate": dealer.vat_rate, "discount": 0},
|
||||
)
|
||||
else:
|
||||
models.ExtraInfo.objects.create(
|
||||
dealer=dealer,
|
||||
content_object=estimate,
|
||||
related_object=request.user,
|
||||
created_by=request.user,
|
||||
data={"vat_rate": dealer.vat_rate, "discount": 0},
|
||||
)
|
||||
|
||||
messages.success(request, "Estimate created successfully.")
|
||||
return redirect("estimate_detail", dealer_slug=dealer.slug, pk=estimate.pk)
|
||||
@ -73,7 +73,7 @@ body {
|
||||
{% endif %}
|
||||
|
||||
<div class="flex-grow-1">
|
||||
<h5 class="mb-1 text-dark fw-normal">
|
||||
<h5 class="mb-1 fw-normal">
|
||||
{{ notification.message|safe }}
|
||||
</h5>
|
||||
<p class="text-muted fs-6 mb-0 mt-2">
|
||||
@ -100,7 +100,7 @@ body {
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 d-none d-lg-block">
|
||||
<div class="card border-0 rounded-4 p-4 sticky-top mt-3 bg-gray-200">
|
||||
<div class="card border-0 rounded-4 p-4 sticky-top position-static mt-3 bg-gray-200 w-100">
|
||||
<h4 class="fw-bold mb-3">{% trans "Status" %}</h4>
|
||||
<ul class="list-unstyled mb-0">
|
||||
<li class="d-flex align-items-center mb-2">
|
||||
|
||||
@ -30,7 +30,9 @@
|
||||
{% else %}
|
||||
{% if perms.django_ledger.add_estimatemodel %}
|
||||
<a class="dropdown-item"
|
||||
href="{% url 'estimate_create_from_opportunity' request.dealer.slug opportunity.slug %}">{{ _("Create Quotation") }}</a>
|
||||
type="button"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#estimateModal">{% trans "Create Estimate" %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
@ -854,6 +856,33 @@
|
||||
{% include "components/note_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
<!-- schedule Modal -->
|
||||
{% include "components/schedule_modal.html" with content_type="opportunity" slug=opportunity.slug %}
|
||||
|
||||
<div class="modal fade"
|
||||
id="estimateModal"
|
||||
tabindex="-1"
|
||||
aria-labelledby="estimateModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="estimateModalLabel">{% trans 'Create Estimate' %}</h5>
|
||||
<button type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div id="estimateModalBody" class="main-modal-body" style="padding: 20px;">
|
||||
<form action="{% url 'estimate_create_from_opportunity' request.dealer.slug opportunity.slug %}" method="post">
|
||||
{% csrf_token %}
|
||||
<p>{% trans 'Are you sure you want to create an estimate from this opportunity?' %}</p>
|
||||
<button type="submit" class="btn btn-primary">{% trans 'Create Estimate' %}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans 'Cancel' %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
|
||||
@ -170,6 +170,14 @@
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<div class="mb-3">
|
||||
<label for="marked_price" class="form-label">{% trans "Marked Price" %}</label>
|
||||
<input type="number"
|
||||
class="form-control"
|
||||
id="marked_price"
|
||||
name="marked_price"
|
||||
>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="csv_file" class="form-label">{% trans "CSV File" %}</label>
|
||||
<input type="file"
|
||||
|
||||
@ -9,10 +9,9 @@
|
||||
<main class="py-5">
|
||||
<div class="container">
|
||||
{% if groups or request.GET.q %}
|
||||
<div class="card border-0 rounded-4 animate__animated animate__fadeInUp">
|
||||
<div class="card-header border-bottom d-flex flex-column flex-md-row justify-content-between align-items-md-center p-4">
|
||||
<div class=" d-flex flex-column flex-md-row justify-content-between align-items-md-center p-4">
|
||||
<h5 class="card-title mb-2 mb-md-0 me-md-4 fw-bold">
|
||||
<i class="fa-solid fa-user-group fs-3 me-1 text-primary "></i>{% trans "Groups" %}
|
||||
<i class="fa-solid fa-user-group fs-3 me-1 "></i>{% trans "Groups" %}
|
||||
</h5>
|
||||
<div class="d-flex gap-2">
|
||||
<a href="{% url 'group_create' request.dealer.slug %}"
|
||||
@ -26,16 +25,18 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card border-0 rounded-4 animate__animated animate__fadeInUp">
|
||||
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive scrollbar mx-n1 px-1 mt-3">
|
||||
<table class="table align-items-center table-hover mb-0">
|
||||
<thead>
|
||||
<tr class="bg-light">
|
||||
<th scope="col" class="text-secondary text-uppercase fw-bold ps-4">{% trans 'name'|capfirst %}</th>
|
||||
<th scope="col" class="text-secondary text-uppercase fw-bold">{% trans 'total Users'|capfirst %}</th>
|
||||
<th scope="col" class="text-secondary text-uppercase fw-bold">{% trans 'total permission'|capfirst %}</th>
|
||||
<tr class="">
|
||||
<th scope="col" class=" text-uppercase fw-bold ps-4">{% trans 'name'|capfirst %}</th>
|
||||
<th scope="col" class="text-uppercase fw-bold">{% trans 'total Users'|capfirst %}</th>
|
||||
<th scope="col" class="text-uppercase fw-bold">{% trans 'total permission'|capfirst %}</th>
|
||||
<th scope="col"
|
||||
class="text-secondary text-uppercase fw-bold text-end pe-4">
|
||||
class="text-uppercase fw-bold text-end pe-4">
|
||||
{% trans 'actions'|capfirst %}
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n static custom_filters %}
|
||||
{% load crispy_forms_filters %}
|
||||
{% load tenhal_tag %}
|
||||
{% block title %}{{ _("Car Details") }}{% endblock %}
|
||||
{% block customCSS %}
|
||||
@ -74,6 +75,24 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- Main row -->
|
||||
{% if car.ready %}
|
||||
<div class="d-flex align-items-center gap-2 mb-2">
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-phoenix-success"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#estimateModal">
|
||||
{% trans 'Create Estimate' %}
|
||||
</button>
|
||||
{% if active_estimates %}
|
||||
<button type="button" class="btn btn-phoenix-warning btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#activeEstimatesModal">
|
||||
{% trans "Active Estimates" %}
|
||||
<span class="ms-2 badge rounded-pill text-bg-light">{{ active_estimates|length }}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if perms.inventory.view_car %}
|
||||
<div class="row-fluid {% if car.status == 'sold' %}disabled{% endif %}">
|
||||
<div class="row g-3 justify-content-between">
|
||||
@ -509,6 +528,32 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Main Modal -->
|
||||
<div class="modal fade"
|
||||
id="estimateModal"
|
||||
tabindex="-1"
|
||||
aria-labelledby="estimateModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="estimateModalLabel">{% trans 'Create Estimate' %}</h5>
|
||||
<button type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div id="estimateModalBody" class="main-modal-body" style="padding: 20px;">
|
||||
<form action="{% url 'create_estimate_for_car' request.dealer.slug car.slug %}" method="post">
|
||||
{% csrf_token %}
|
||||
{{estimate_form|crispy}}
|
||||
<button type="submit" class="btn btn-primary">{% trans 'Create Estimate' %}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans 'Cancel' %}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade"
|
||||
id="mainModal"
|
||||
tabindex="-1"
|
||||
@ -590,6 +635,32 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!--active estimate modal-->
|
||||
|
||||
<div class="modal fade" id="activeEstimatesModal" tabindex="-1" aria-labelledby="activeEstimatesModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-top">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="activeEstimatesModalLabel">Active Estimates ({{ active_estimates|length }})</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="d-flex flex-column gap-3">
|
||||
{% for e in active_estimates %}
|
||||
<div class="d-flex align-items-center gap-2 border-bottom pb-2">
|
||||
<span class="badge rounded-pill bg-primary text-light me-1">{{ e.content_object.estimate_number }}</span class="text-nowrap"><span>{% trans " created by: " %}</span>
|
||||
<div class="text-muted">{{ e.related_object }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-phoenix-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
|
||||
@ -8,8 +8,7 @@
|
||||
type="checkbox"
|
||||
hx-post="{% url 'update_schedule' request.dealer.slug task.pk %}"
|
||||
hx-trigger="change"
|
||||
hx-swap="none"
|
||||
hx-on:click="$(this).closest('tr').toggleClass('completed-task')"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#task-{{ task.pk }}" />
|
||||
</div>
|
||||
</td>
|
||||
@ -26,4 +25,4 @@
|
||||
<span class="badge badge-phoenix fs-10 badge-phoenix-warning"><i class="fa-solid fa-xmark"></i></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
@ -34,8 +34,8 @@
|
||||
</script>
|
||||
{% if not create_po %}
|
||||
{% if style == 'po-detail' %}
|
||||
<div class="card shadow-sm border-0 mb-2">
|
||||
<div class="card-header bg-light ">
|
||||
<div class="card mb-2">
|
||||
<div class="card-header">
|
||||
<div class="d-flex align-items-center mb-2 ">
|
||||
<span class="me-3 text-primary">{% icon 'uil:bill' 36 %}</span>
|
||||
<h2 class="h3 mb-0 text-primary me-4">{{ po_model.po_number }}</h2>
|
||||
@ -94,7 +94,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer bg-light" hx-boost="false">
|
||||
<div class="card-footer" hx-boost="false">
|
||||
{% if perms.django_ledger.change_purchaseordermodel %}
|
||||
<div class="d-flex flex-wrap gap-2 justify-content-between">
|
||||
<a href="{% url 'purchase_order_update' dealer_slug=request.dealer.slug entity_slug=entity_slug po_pk=po_model.pk %}"
|
||||
|
||||
52
templates/purchase_orders/includes/po_table_for_print.html
Normal file
52
templates/purchase_orders/includes/po_table_for_print.html
Normal file
@ -0,0 +1,52 @@
|
||||
{% load django_ledger %}
|
||||
{% load i18n %}
|
||||
{%load tenhal_tag %}
|
||||
<div class="table-container">
|
||||
<table class="table is-fullwidth is-narrow is-striped is-bordered django-ledger-table-bottom-margin-75">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "PO Number" %}</th>
|
||||
<th>{% trans "Description" %}</th>
|
||||
<th>{% trans "Status Date" %}</th>
|
||||
<th>{% trans "PO Status" %}</th>
|
||||
<th>{% trans "PO Amount" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for po in po_list %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if po.po_number %}{{ po.po_number }}{% endif %}
|
||||
</td>
|
||||
<td>{{ po.po_title }}</td>
|
||||
<td>{{ po.get_status_action_date }}</td>
|
||||
<td>{{ po.get_po_status_display }}</td>
|
||||
<td>
|
||||
<span class="currency">{{ CURRENCY }}</span>{{ po.po_amount | currency_format }}
|
||||
</td>
|
||||
<td class="has-text-centered">
|
||||
<div class="dropdown is-right is-hoverable" id="bill-action-{{ po.uuid }}">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button is-small is-rounded is-outlined is-dark"
|
||||
aria-haspopup="true"
|
||||
aria-controls="dropdown-menu">
|
||||
<span>{% trans "Actions" %}</span>
|
||||
<span class="icon is-small">{% icon 'bi:arrow-down' 24 %}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="dropdown-menu-{{ po.uuid }}" role="menu">
|
||||
<div class="dropdown-content">
|
||||
<a href="{% url 'purchase_order_detail' po_pk=po.uuid %}"
|
||||
class="dropdown-item has-text-success">{% trans "Details" %}</a>
|
||||
<a href="{% url 'po-delete' entity_slug=entity_slug po_pk=po.uuid %}"
|
||||
class="dropdown-item has-text-weight-bold has-text-danger">{% trans ' Delete' %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -8,6 +8,7 @@
|
||||
{% trans "Purchase Order Detail" %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="row g-1">
|
||||
<div class="col-lg-12 mb-3">
|
||||
@ -15,6 +16,14 @@
|
||||
<div class="card-body">
|
||||
{% include 'purchase_orders/includes/card_po.html' with dealer_slug=request.dealer.slug po_model=po_model entity_slug=entity_slug style='po-detail' %}
|
||||
</div>
|
||||
{% if po_model.po_status == 'fulfilled' %}
|
||||
<div class="ms-2">
|
||||
<a class="btn btn-phoenix-primary my-2 mx-2"
|
||||
href="{{ request.path }}?format=pdf&lang=en"><i class="fa-solid fa-arrow-down me-1"></i>{% trans 'Download PO ENG' %}</a>
|
||||
<a class="btn btn-phoenix-primary my-2"
|
||||
href="{{ request.path }}?format=pdf&lang=ar"><i class="fa-solid fa-arrow-down me-1"></i>{% trans 'Download PO ARB' %}</a>
|
||||
</diV>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
|
||||
182
templates/purchase_orders/po_detail_ar_pdf.html
Normal file
182
templates/purchase_orders/po_detail_ar_pdf.html
Normal file
@ -0,0 +1,182 @@
|
||||
{% load tenhal_tag %}
|
||||
{% load custom_filters %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ po_model.po_number }}</title>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Noto Sans Arabic';
|
||||
src: url('https://fonts.gstatic.com/s/notosansarabic/v35/or3qQxoQpw-Gv0yqj6V1p-B3.ttf') format('truetype');
|
||||
}
|
||||
|
||||
/* General Body and Font Styles */
|
||||
body {
|
||||
font-family: 'Noto Sans Arabic', sans-serif;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
direction: rtl; /* This is the key for RTL support */
|
||||
}
|
||||
|
||||
/* Page Layout and Margins for PDF */
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 20mm;
|
||||
@top-left {
|
||||
content: "صفحة " counter(page) " من " counter(pages);
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
}
|
||||
}
|
||||
|
||||
/* Header Styles */
|
||||
.document-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid #333;
|
||||
padding-bottom: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.document-header .logo {
|
||||
max-width: 150px;
|
||||
height: auto;
|
||||
}
|
||||
.document-header h1 {
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
color: #0056b3; /* A professional blue */
|
||||
}
|
||||
.document-header address {
|
||||
text-align: left; /* Aligned to the left for RTL layout */
|
||||
font-style: normal;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/* Document Details Section */
|
||||
.document-details {
|
||||
display: flex;
|
||||
flex-direction: row-reverse; /* Reverses the order of the sections */
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.document-details .section {
|
||||
width: 48%;
|
||||
}
|
||||
.document-details h2 {
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 10px;
|
||||
color: #555;
|
||||
}
|
||||
.document-details p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.document-details .label {
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.table th, .table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: right; /* Aligned to the right for RTL layout */
|
||||
}
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
.table tfoot td {
|
||||
border-top: 2px solid #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text-right {
|
||||
text-align: left; /* This is now for left alignment in an RTL context */
|
||||
}
|
||||
|
||||
/* Footer Styles */
|
||||
.document-footer {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #888;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 15px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.footer-flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-header">
|
||||
<div>
|
||||
<h1>أمر شراء</h1>
|
||||
<h2 style="font-size: 18px;">{{ po_model.po_number }}</h2>
|
||||
</div>
|
||||
<div>
|
||||
<h1>{{ dealer.name }}</h1>
|
||||
<address>
|
||||
العنوان: {{ dealer.address }}<br>
|
||||
البريد الإلكتروني: {{ dealer.user.email }}<br>
|
||||
الهاتف: {{ dealer.phone_number }}<br>
|
||||
رقم السجل التجاري: {{ dealer.crn }} | رقم ضريبة القيمة المضافة: {{ dealer.vrn }}
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details">
|
||||
<div class="section">
|
||||
<h2>التفاصيل:</h2>
|
||||
<p><span class="label">رقم أمر الشراء:</span> {{ po_model.po_number }}</p>
|
||||
<p><span class="label">تاريخ الإصدار:</span> {{ po_model.date_fulfilled|date:"Y/m/d" }}</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2>يُرسل إلى:</h2>
|
||||
<p><span class="label">المورد:</span> {{ vendor.vendor_name }}</p>
|
||||
<p><span class="label">البريد الإلكتروني:</span> {{ vendor.email }}</p>
|
||||
<p><span class="label">الهاتف:</span> {{ vendor.phone }}</p>
|
||||
<p><span class="label">العنوان:</span> {{ vendor.address_1 }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
{% include 'purchase_orders/tags/po_item_table_print_ar.html' with po_items_list=po_items_list %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details" style="margin-top: 30px;">
|
||||
<div class="section" style="width: 100%;">
|
||||
<h2>ملاحظات:</h2>
|
||||
<p>{{ po_model.notes|default:"لا توجد ملاحظات إضافية." }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details" style="margin-top: 10px; border-top: 1px solid #ddd; padding-top: 10px;">
|
||||
<div class="section text-right" style="width: 100%;">
|
||||
<p class="h4"><span class="label">المبلغ الإجمالي:</span> {{ po_total_amount|floatformat:'2g' }}<span class="icon-saudi_riyal"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-footer footer-flex">
|
||||
<p>© <strong>هيكل</strong> {% now "Y" %} جميع الحقوق محفوظة.</p>
|
||||
<p><strong>تنحل</strong>مدعوم من</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
174
templates/purchase_orders/po_detail_en_pdf.html
Normal file
174
templates/purchase_orders/po_detail_en_pdf.html
Normal file
@ -0,0 +1,174 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load django_ledger %}
|
||||
{% load tenhal_tag %}
|
||||
{% load custom_filters %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ po_model.po_number }}</title>
|
||||
<style>
|
||||
/* General Body and Font Styles */
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Page Layout and Margins for PDF */
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 20mm;
|
||||
@top-right {
|
||||
content: "Page " counter(page) " of " counter(pages);
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
}
|
||||
}
|
||||
|
||||
/* Header Styles */
|
||||
.document-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid #333;
|
||||
padding-bottom: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.document-header .logo {
|
||||
max-width: 150px;
|
||||
height: auto;
|
||||
}
|
||||
.document-header h1 {
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
color: #0056b3; /* A professional blue */
|
||||
}
|
||||
.document-header address {
|
||||
text-align: right;
|
||||
font-style: normal;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/* Document Details Section */
|
||||
.document-details {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.document-details .section {
|
||||
width: 48%;
|
||||
}
|
||||
.document-details h2 {
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 10px;
|
||||
color: #555;
|
||||
}
|
||||
.document-details p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.document-details .label {
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.table th, .table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
.table tfoot td {
|
||||
border-top: 2px solid #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Footer Styles */
|
||||
.document-footer {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #888;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 15px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.footer-flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-header">
|
||||
<div>
|
||||
<h1>{{ dealer.name }}</h1>
|
||||
<address>
|
||||
Address: {{ dealer.address}}<br>
|
||||
Email: {{ dealer.user.email }}<br>
|
||||
Phone: {{dealer.phone_number }}<br>
|
||||
CRN: {{dealer.crn}} | VRN: {{dealer.vrn}}
|
||||
</address>
|
||||
</div>
|
||||
<div>
|
||||
<h1>PURCHASE ORDER</h1>
|
||||
<h2 style="font-size: 18px;">{{ po_model.po_number }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details">
|
||||
<div class="section">
|
||||
<h2>BILL TO:</h2>
|
||||
<p><span class="label">Vendor: {{vendor.vendor_name}}</span> </p>
|
||||
<p><span class="label">Email: {{vendor.email}}</span> </p>
|
||||
<p><span class="label">Phone: {{vendor.phone}}</span> </p>
|
||||
<p><span class="label">Address: {{vendor.address_1}}</span> </p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2>DETAILS:</h2>
|
||||
<p><span class="label">PO Number:</span> {{ po_model.po_number }}</p>
|
||||
<p><span class="label">Issue Date:</span> {{ po_model.date_fulfilled|date:"F j, Y" }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
{% include 'purchase_orders/tags/po_item_table_print_en.html' with po_items_list=po_items_list %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details" style="margin-top: 30px;">
|
||||
|
||||
<div class="section text-right">
|
||||
<p class="h4"><span class="label">Total Amount:</span> {{ po_total_amount|floatformat:'2g' }}<span class="icon-saudi_riyal"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-footer footer-flex">
|
||||
<p>© {% now "Y" %} All rights reserved <strong>Haikal</strong> </p>
|
||||
<p>Powered By <strong>Tenhal</strong></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -85,7 +85,7 @@
|
||||
<a href="{% url 'purchase_order_detail' request.dealer.slug request.dealer.entity.slug po.pk %}"
|
||||
class="dropdown-item text-success-dark">{% trans 'Purchase Order Detail' %}</a>
|
||||
{% endif %}
|
||||
{% if po.po_status == 'fulfilled' %}
|
||||
{% if po.po_status == 'fulfilled' or po.po_status == 'approved' %}
|
||||
{% if perms.inventory.add_car %}
|
||||
<a href="{% url 'view_items_inventory' dealer_slug=request.dealer.slug entity_slug=entity_slug po_pk=po.pk %}"
|
||||
class="dropdown-item text-success-dark">{% trans 'Inventory Items' %}</a>
|
||||
|
||||
39
templates/purchase_orders/tags/po_item_table_print_ar.html
Normal file
39
templates/purchase_orders/tags/po_item_table_print_ar.html
Normal file
@ -0,0 +1,39 @@
|
||||
{% load tenhal_tag %}
|
||||
{% load custom_filters%}
|
||||
<div class="table-container" dir="rtl">
|
||||
<table class="table is-fullwidth is-striped is-narrow is-bordered">
|
||||
<thead>
|
||||
<tr class="has-text-centered bg-body-highlight">
|
||||
<th>البند</th>
|
||||
<th>سعر الوحدة</th>
|
||||
<th>كمية أمر الشراء</th>
|
||||
<th>المبلغ</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in po_items_list %}
|
||||
<tr>
|
||||
<td>{{ item.item_model }}</td>
|
||||
<td class="has-text-centered">{{ item.po_unit_cost }}</td>
|
||||
<td class="has-text-centered">{{ item.po_quantity }}</td>
|
||||
<td class="has-text-centered">
|
||||
<span class="icon-saudi_riyal"></span>{{ item.po_total_amount | currency_format }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
<td class="has-text-left">إجمالي مبلغ أمر الشراء</td>
|
||||
<td class="has-text-weight-bold has-text-centered">
|
||||
<span class="icon-saudi_riyal"></span>{{ po_model.po_amount | currency_format }}
|
||||
</td>
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
39
templates/purchase_orders/tags/po_item_table_print_en.html
Normal file
39
templates/purchase_orders/tags/po_item_table_print_en.html
Normal file
@ -0,0 +1,39 @@
|
||||
{%load tenhal_tag %}
|
||||
{% load custom_filters %}
|
||||
<div class="table-container">
|
||||
<table class="table is-fullwidth is-striped is-narrow is-bordered">
|
||||
<thead>
|
||||
<tr class="has-text-centered bg-body-highlight">
|
||||
<th>Item</th>
|
||||
<th>Unit Cost</th>
|
||||
<th>PO Qty</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in po_items_list %}
|
||||
<tr>
|
||||
<td>{{ item.item_model }}</td>
|
||||
<td class="has-text-centered">{{ item.po_unit_cost }}</td>
|
||||
<td class="has-text-centered">{{ item.po_quantity }}</td>
|
||||
<td class="has-text-centered">
|
||||
<span class="icon-saudi_riyal"></span>{{ item.po_total_amount | currency_format }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
<td class="has-text-right">Total PO Amount</td>
|
||||
<td class="has-text-weight-bold has-text-centered">
|
||||
<span class="icon-saudi_riyal"></span>{{ po_model.po_amount | currency_format }}
|
||||
</td>
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@ -1,362 +1,264 @@
|
||||
{% load i18n static custom_filters num2words_tags %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% trans "Quotation" %}</title>
|
||||
<link href="{% static 'css/theme.min.css' %}"
|
||||
type="text/css"
|
||||
rel="stylesheet"
|
||||
id="style-default">
|
||||
<link href="{% static 'css/user.min.css' %}"
|
||||
type="text/css"
|
||||
rel="stylesheet"
|
||||
id="user-style-default">
|
||||
<link href="{% static 'css/custom.css' %}" type="text/css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
|
||||
rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% trans "Quotation" %}</title>
|
||||
<style>
|
||||
/* General Body and Font Styles */
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.invoice-container {
|
||||
width: 210mm;
|
||||
min-height: 297mm;
|
||||
padding: 10mm;
|
||||
margin: 10mm auto;
|
||||
background: white;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* Page Layout and Margins for PDF */
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 20mm;
|
||||
@top-left {
|
||||
content: "صفحة " counter(page) " من " counter(pages);
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
}
|
||||
}
|
||||
|
||||
.invoice-content {
|
||||
flex-grow: 1;
|
||||
}
|
||||
/* Header Styles */
|
||||
.document-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid #333;
|
||||
padding-bottom: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.document-header .logo {
|
||||
max-width: 150px;
|
||||
height: auto;
|
||||
}
|
||||
.document-header h1 {
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
color: #0056b3; /* A professional blue */
|
||||
}
|
||||
.document-header address {
|
||||
text-align: right;
|
||||
font-style: normal;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.invoice-header {
|
||||
text-align: center;
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
/* Document Details Section */
|
||||
.document-details {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.document-details .section {
|
||||
width: 48%;
|
||||
}
|
||||
.document-details h2 {
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 10px;
|
||||
color: #555;
|
||||
}
|
||||
.document-details p {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.document-details .label {
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.qr-code {
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
/* Table Styles */
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.table th, .table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: right;
|
||||
}
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
.table tfoot td {
|
||||
border-top: 2px solid #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
.text-right {
|
||||
text-align: left;
|
||||
}
|
||||
.text-left {
|
||||
text-align: right;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.qr-code img {
|
||||
width: 3cm;
|
||||
height: 3cm;
|
||||
border-radius: 0.3333333333rem;
|
||||
}
|
||||
|
||||
.invoice-details, .invoice-table {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.invoice-table th {
|
||||
background-color: #f8f9fa;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.invoice-total {
|
||||
text-align: right;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.footer-note {
|
||||
margin-top: auto;
|
||||
padding-top: 10mm;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-top: 2px solid #dee2e6;
|
||||
}
|
||||
|
||||
.logo-img img {
|
||||
width: 10mm;
|
||||
height: 10mm;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row p-2">
|
||||
<div class="col-2">
|
||||
<button class="btn btn-sm btn-phoenix-danger w-100"
|
||||
onclick="window.history.back()">الرجوع / Back</button>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-sm btn-phoenix-primary w-100" id="download-pdf">تحميل / Download</button>
|
||||
</div>
|
||||
<div class="col-8"></div>
|
||||
/* Footer Styles */
|
||||
.document-footer {
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
color: #888;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 15px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.footer-flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document-header">
|
||||
<div>
|
||||
<h1>{{ request.dealer.name }}</h1>
|
||||
<address>
|
||||
العنوان: {{ request.dealer.address }}<br>
|
||||
البريد الإلكتروني: {{ request.dealer.user.email }}<br>
|
||||
الهاتف: {{ request.dealer.phone_number }}<br>
|
||||
رقم السجل التجاري: {{ request.dealer.crn }} | الرقم الضريبي: {{ request.dealer.vrn }}
|
||||
</address>
|
||||
</div>
|
||||
<div class="invoice-container" id="estimate-content">
|
||||
<div class="invoice-content">
|
||||
<div class="invoice-header">
|
||||
<h5 class="fs-5">
|
||||
<span>Quotation</span> / <span>عرض سعر</span>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="invoice-details p-1">
|
||||
<div class="d-flex justify-content-end align-items-end">
|
||||
<div class="dealer-logo ">
|
||||
{% if request.dealer.logo %}
|
||||
<img class="rounded-soft"
|
||||
style="max-width:200px;
|
||||
max-height:200px"
|
||||
src="{{ request.dealer.logo.url|default:'' }}"
|
||||
alt="Dealer Logo" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-responsive border-gray-50">
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Dealership Name</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ request.dealer.name }}</td>
|
||||
<td class="text-end">
|
||||
<strong>اسم الوكالة</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Dealership Address</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ request.dealer.address }}</td>
|
||||
<td class="text-end">
|
||||
<strong>العنوان</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Phone</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ request.dealer.phone_number }}</td>
|
||||
<td class="text-end">
|
||||
<strong>جوال</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>VAT Number</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ request.dealer.vrn }}</td>
|
||||
<td class="text-end">
|
||||
<strong>الرقم الضريبي</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered border-gray-50 ">
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Quotation Number</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ estimate.estimate_number }}</td>
|
||||
<td class="text-end p-1">
|
||||
<strong>رقم عرض السعر</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Date</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ estimate.date_approved| date:"Y/m/d" }}</td>
|
||||
<td class="text-end p-1">
|
||||
<strong>التاريخ</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Customer Name</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ estimate.customer.customer_name }}</td>
|
||||
<td class="text-end p-1">
|
||||
<strong>العميل</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Email</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ estimate.customer.email |default:"N/A" }}</td>
|
||||
<td class="text-end p-1">
|
||||
<strong>البريد الإلكتروني</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="ps-1">
|
||||
<strong>Terms</strong>
|
||||
</td>
|
||||
<td class="text-center">{{ estimate.get_terms_display }}</td>
|
||||
<td class="text-end p-1">
|
||||
<strong>طريقة الدفع</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="fs-9 fw-thin">Car Details</span>
|
||||
<span class="fs-9 fw-thin">تفاصيل السيارة</span>
|
||||
</div>
|
||||
<div class="invoice-table p-1">
|
||||
<table class="table table-sm table-bordered m-1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Make</span> / <span class="fs-10">الصانع</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Model</span> / <span class="fs-10">الموديل</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Series</span> / <span class="fs-10">السلسلة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Trim</span> / <span class="fs-10">الفئة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Year</span> / <span class="fs-10">السنة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">VIN</span> / <span class="fs-10">رقم الهيكل</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Quantity</span> / <span class="fs-10">الكمية</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Unit Price</span> / <span class="fs-10">سعر الوحدة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Discount</span> / <span class="fs-10">الخصم</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">VAT</span> / <span class="fs-10">الضريبة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">Total</span> / <span class="fs-10">الإجمالي</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_make.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_model.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_serie.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_trim.name }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.car.year }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.vin }}</td>
|
||||
<td class="text-center fs-10 align-content-center">1</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.car.marked_price |floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.discount_amount |floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.vat_amount|floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.final_price|floatformat:2 }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="fs-9 fw-thin">Additional Services</span>
|
||||
<span class="fs-9 fw-thin">الخدمات الإضافية</span>
|
||||
</div>
|
||||
{% if data.additional_services %}
|
||||
<div class="invoice-table p-1">
|
||||
<table class="table table-sm table-bordered m-1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center fs-10 align-content-center">Type / النوع</th>
|
||||
<th class="text-center fs-10 align-content-center">Price / القيمة</th>
|
||||
<th class="text-center fs-10 align-content-center">VAT / ضريبة الخدمة</th>
|
||||
<th class="text-center fs-10 align-content-center">
|
||||
<span class="fs-10">Total</span> / <span class="fs-10">الإجمالي</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for service in data.additional_services.services %}
|
||||
<tr>
|
||||
<td class="ps-1 text-start fs-10 align-content-center">{{ service.0.name }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.0.price|floatformat }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.1|floatformat }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.0.price_|floatformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="invoice-total d-flex justify-content-end">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-responsive">
|
||||
<tr>
|
||||
<td class="text-start ps-1">
|
||||
<strong class="fs-9">Total VAT</strong>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="fs-9">{{ data.total_vat|floatformat }} <span class="icon-saudi_riyal"></span></span>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<strong class="fs-9">إجمالي ضريبة القيمة المضافة</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-start ps-1">
|
||||
<strong class="fs-9">Grand Total</strong>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="fs-9">{{ data.grand_total|floatformat }} <span class="icon-saudi_riyal"></span></span>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<strong class="fs-9">الإجمالي</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-end" colspan="3">
|
||||
<span class="fs-9 fw-bold">كتابةً: </span><span class="fs-9">{{ data.grand_total|num_to_words }} <span class="icon-saudi_riyal"></span></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h1>عرض سعر</h1>
|
||||
<h2 style="font-size: 18px;">{{ estimate.estimate_number }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-details">
|
||||
<div class="section">
|
||||
<h2>{{ estimate.customer.customer_name }}: إلى</h2>
|
||||
<p><span class="label">العميل: {{ estimate.customer.customer_name }}</span></p>
|
||||
<p><span class="label">البريد الإلكتروني: {{ estimate.customer.email |default:"N/A"}}</span></p>
|
||||
<p><span class="label">الهاتف: {{ estimate.customer.phone_number|default:"N/A" }}</span></p>
|
||||
<p><span class="label">العنوان: {{ estimate.customer.address_1|default:"N/A" }}</span></p>
|
||||
</div>
|
||||
<div class="section text-left">
|
||||
<h2>التفاصيل:</h2>
|
||||
<p><span class="label">رقم عرض السعر:</span> {{ estimate.estimate_number }}</p>
|
||||
<p><span class="label">تاريخ الإصدار:</span> {{ estimate.date_approved|date:"Y/m/d" }}</p>
|
||||
<p><span class="label">طريقة الدفع:</span> {{ estimate.get_terms_display }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="fs-9 fw-thin">تفاصيل السيارة</span>
|
||||
</div>
|
||||
<div class="footer-note">
|
||||
<div class="logo-img text-center">
|
||||
<img src="{% static 'images/logos/logo-d-pdf.png' %}" alt="Logo" />
|
||||
<p class="fs-9 fw-bold">
|
||||
<span>Haikal</span> | <span>هيكل</span>
|
||||
</p>
|
||||
<table class="table table-sm table-bordered m-1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الصانع</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الموديل</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">السلسلة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الفئة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">السنة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">رقم الهيكل</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الكمية</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">سعر الوحدة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الخصم</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الضريبة</span>
|
||||
</th>
|
||||
<th class="text-wrap text-center align-content-center">
|
||||
<span class="fs-10">الإجمالي</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_make.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_model.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_serie.name }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.id_car_trim.name }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.car.year }}</td>
|
||||
<td class="ps-1 fs-10 align-content-center">{{ data.car.vin }}</td>
|
||||
<td class="text-center fs-10 align-content-center">1</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.car.marked_price|floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.discount_amount|floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.vat_amount|floatformat:2 }}</td>
|
||||
<td class="text-center fs-10 align-content-center">{{ data.final_price|floatformat:2 }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if data.additional_services %}
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="fs-9 fw-thin">الخدمات الإضافية</span>
|
||||
</div>
|
||||
<p class="fs-11">
|
||||
<span class="fw-thin">Powered by </span>
|
||||
<a class="text-decoration-none fs-9"
|
||||
href="https://tenhal.sa"
|
||||
style="color: #112e40"><span>TENHAL</span> | <span>تنحل</span></a>
|
||||
</p>
|
||||
<table class="table table-sm table-bordered m-1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center fs-10 align-content-center">النوع</th>
|
||||
<th class="text-center fs-10 align-content-center">القيمة</th>
|
||||
<th class="text-center fs-10 align-content-center">ضريبة الخدمة</th>
|
||||
<th class="text-center fs-10 align-content-center">الإجمالي</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for service in data.additional_services.services %}
|
||||
<tr>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.0.name }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.0.price|floatformat:2 }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.1|floatformat:2 }}</td>
|
||||
<td class="ps-1 text-center fs-10 align-content-center">{{ service.0.price_|floatformat:2 }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{% static 'vendors/bootstrap/bootstrap.min.js' %}"></script>
|
||||
<script src="{% static 'js/html2pdf.bundle.min.js' %}"></script>
|
||||
<script>
|
||||
document.getElementById('download-pdf').addEventListener('click', function () {
|
||||
html2pdf().from(document.getElementById('estimate-content')).set({
|
||||
margin: 0,
|
||||
filename: "{{ estimate.estimate_number }}_{{ estimate.customer.customer_name }}_{{estimate.date_approved|date:'Y-m-d' }}.pdf",
|
||||
image: { type: 'jpeg', quality: 0.98 },
|
||||
html2canvas: { scale: 3 },
|
||||
jsPDF: { unit: 'mm', format: 'a3', orientation: 'portrait' }
|
||||
}).save();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endif %}
|
||||
|
||||
<div class="document-details" style="margin-top: 30px;">
|
||||
<div class="section text-left">
|
||||
<p><span class="label">إجمالي ضريبة القيمة المضافة:</span> {{ data.total_vat|floatformat:'2g' }}</p>
|
||||
<p><span class="label">الإجمالي الكلي:</span> {{ data.grand_total|floatformat:'2g' }}</p>
|
||||
<p><span class="label">كتابةً:</span> {{ data.grand_total|num_to_words }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-footer footer-flex">
|
||||
<p>© {% now "Y" %} جميع الحقوق محفوظة <strong>هيكل</strong></p>
|
||||
<p>بواسطة <strong>تنحل</strong></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -9,7 +9,7 @@
|
||||
{% if users or request.GET.q %}
|
||||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||
<h1 class="h3 mb-0 text-muted d-flex align-items-center">
|
||||
<i class="fa-solid fa-user-tie text-primary me-3 fs-2"></i>
|
||||
<i class="fa-solid fa-user-tie me-3 fs-2"></i>
|
||||
{% trans "Staffs" %}
|
||||
</h1>
|
||||
{% if request.user.userplan %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user