271 lines
13 KiB
HTML
271 lines
13 KiB
HTML
{% load i18n static custom_filters num2words_tags %}
|
|
<!DOCTYPE html>
|
|
<html lang="ar">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Invoice</title>
|
|
<!-- CSS -->
|
|
<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">
|
|
<!-- Google Fonts - Roboto -->
|
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
|
<!-- Custom CSS -->
|
|
<style>
|
|
body {
|
|
font-family: 'Roboto', sans-serif;
|
|
margin: 0;
|
|
padding: 10mm;
|
|
background-color: #f8f9fa;
|
|
}
|
|
.invoice-container {
|
|
width: 210mm;
|
|
min-height: 297mm;
|
|
padding: 10mm;
|
|
margin: auto;
|
|
background: white;
|
|
border-radius: 5px;
|
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
position: relative;
|
|
}
|
|
.invoice-header {
|
|
text-align: center;
|
|
border-bottom: 2px solid #dee2e6;
|
|
padding-bottom: 10px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.qr-code {
|
|
text-align: center;
|
|
margin-top: 10px;
|
|
}
|
|
.qr-code img {
|
|
width: 3cm;
|
|
height: 3cm;
|
|
border-radius: 0.3333333333rem;
|
|
}
|
|
.invoice-details, .invoice-table {
|
|
font-size: 12px;
|
|
}
|
|
.invoice-table th {
|
|
background-color: #f8f9fa;
|
|
font-weight: 600;
|
|
}
|
|
.invoice-total {
|
|
text-align: right;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
margin-top: 10px;
|
|
}
|
|
.footer-note {
|
|
position: absolute;
|
|
bottom: 10mm;
|
|
left: 10mm;
|
|
right: 10mm;
|
|
font-size: 10px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
.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-danger w-100" onclick="window.history.back()">الرجوع / Back</button>
|
|
</div>
|
|
<div class="col-2">
|
|
<button class="btn btn-sm btn-primary w-100" id="download-pdf">تحميل / Download</button>
|
|
</div>
|
|
<div class="col-8"></div>
|
|
</div>
|
|
|
|
<div class="invoice-container" id="invoice-content">
|
|
<div class="invoice-header">
|
|
<h5 class="fs-5"><span>Quotation</span> / <span>عرض سعر</span></h5>
|
|
</div>
|
|
<div class="invoice-details p-1">
|
|
<table class="table table-sm table-responsive border-gray-50">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td></td>
|
|
<td>
|
|
<div class="qr-code">
|
|
<img class="rounded-soft" src="{{ dealer.logo.url|default:'' }}" alt="Dealer Logo"/>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>{{ dealer.name }}</strong></td>
|
|
<td></td>
|
|
<td class="text-end"><strong>{{ dealer.arabic_name }}</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>Address</strong></td>
|
|
<td>{{ dealer.address }}</td>
|
|
<td class="text-end"> <strong>العنوان</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>Phone</strong></td>
|
|
<td>{{ dealer.phone_number }}</td>
|
|
<td class="text-end"><strong>جوال</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td><strong>VAT Number</strong></td>
|
|
<td>{{ 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</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>VAT ID</strong></td>
|
|
<td class="text-center">{{ estimate.customer.vrn|default:"-" }}</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">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">Including VAT</span> / <span class="fs-10">شامل الضريبة</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in data.cars %}
|
|
<tr>
|
|
<td class="ps-1 fs-10 align-content-center" colspan="3">{{ item.make }} - {{ item.model }} - {{ item.trim }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ item.year }}</td>
|
|
<td class="ps-1 fs-10 align-content-center">{{ item.vin }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ item.quantity|floatformat:-1 }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ item.unit_price|floatformat:2 }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ item.total_vat|floatformat:2 }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
<tr>
|
|
<td class="ps-1 fs-10 align-content-center" colspan="5"></td>
|
|
<td class="text-center fs-10 align-content-center">{{ data.quantity|floatformat:-1 }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ data.total_price|floatformat:2 }}</td>
|
|
<td class="text-center fs-10 align-content-center">{{ data.total_vat|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.additionals %}
|
|
<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"><span class="fs-10">Including VAT</span> / <span class="fs-10">شامل الضريبة</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in data.additionals %}
|
|
<tr>
|
|
<td class="ps-1 text-start fs-10 align-content-center">{{ item.name }}</td>
|
|
<td class="ps-1 text-center fs-10 align-content-center">{{ item.price|floatformat:2 }}</td>
|
|
<td class="ps-1 text-center fs-10 align-content-center">{{ item.price_|floatformat:2 }}</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">VAT</strong></td>
|
|
<td class="text-center"><span class="fs-9">{{ data.total_vat_amount|floatformat:2 }} <span class="currency">{{ CURRENCY }}</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">Total</strong></td>
|
|
<td class="text-center"><span class="fs-9">{{ data.grand_total|floatformat:2 }} <span class="currency">{{ CURRENCY }}</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="currency">{{ CURRENCY }}</span></span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<br><br>
|
|
<br><br>
|
|
<br><br>
|
|
<div class="footer-note">
|
|
<div class="logo-img text-center">
|
|
<img src="{% static 'images/logos/logo-d-pdf.png' %}" alt="Logo"/>
|
|
<p class="fs-11 fw-bold"><span>Haikal</span> | <span>هيكل</span></p>
|
|
</div>
|
|
<p class="fs-11"><span class="fw-thin">Powered by </span><a class="text-decoration-none" href="https://tenhal.sa" style="color: #112e40;"><span>TENHAL</span> | <span>تنحل</span></a></p>
|
|
</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('invoice-content')).set({
|
|
margin: 0,
|
|
filename: "{{ invoice.invoice_number }}_{{ invoice.customer.customer_name }}_{{ invoice.date_in_review|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> |