361 lines
12 KiB
HTML
361 lines
12 KiB
HTML
{% load static custom_filters num2words_tags %}
|
|
<!DOCTYPE html>
|
|
<html lang="en" dir="ltr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Invoice</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;
|
|
position: relative;
|
|
}
|
|
|
|
/* 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;
|
|
}
|
|
.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: 80%;
|
|
border-collapse: collapse;
|
|
margin: 20px auto; /* Centering the table */
|
|
}
|
|
.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;2px solid #333;
|
|
}
|
|
|
|
/* Responsive and layout helpers */
|
|
.table-container {
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
margin-bottom: 20px;
|
|
}
|
|
.table-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 5px;
|
|
}
|
|
.table-header span {
|
|
font-size: 9px;
|
|
font-weight: lighter;
|
|
}
|
|
|
|
/* Footer Styles */
|
|
.document-footer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
text-align: center;
|
|
font-size: 10px;
|
|
color: #888;
|
|
padding-top: 15px;
|
|
margin: 0 auto; /* This change centers the footer container */
|
|
}
|
|
|
|
|
|
.footer-flex {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
width: 100%;
|
|
}
|
|
.footer-logo {
|
|
text-align: center;
|
|
}
|
|
.footer-logo img {
|
|
height: 20px;
|
|
width: 20px;
|
|
}
|
|
.footer-logo p {
|
|
font-size: 9px;
|
|
font-weight: bold;
|
|
}
|
|
.footer-powered p {
|
|
font-size: 11px;
|
|
}
|
|
.footer-powered span {
|
|
font-weight: lighter;
|
|
}
|
|
.footer-powered a {
|
|
color: #112e40;
|
|
text-decoration: none;
|
|
font-size: 9px;
|
|
}
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="document-header">
|
|
<div>
|
|
<h1>{{ dealer_info.name }}</h1>
|
|
<address>
|
|
Address : {{ dealer_info.address }}<br>
|
|
Email : {{ dealer_info.user.email }}<br>
|
|
Phone : {{ dealer_info.phone_number }}<br>
|
|
Commercial Registration No. : {{dealer_info.crn }}<br>
|
|
VAT No. : {{ dealer_info.vrn }}
|
|
</address>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="dealer-logo ">
|
|
{% if dealer_info.logo %}
|
|
<img class="rounded-soft"
|
|
style="max-width:100px;
|
|
max-height:100px"
|
|
src="{{dealer_info.logo.url|default:'' }}"
|
|
alt="Dealer Logo" />
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<h1>Invoice</h1>
|
|
<h2 style="font-size: 18px;">{{ invoice.invoice_number }}</h2>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="document-details">
|
|
<div class="section">
|
|
<h2>To: {{ customer_obj.full_name }}</h2>
|
|
<p><span class="label">Customer : {{ customer_obj.full_name }}</span></p>
|
|
<p><span class="label">Email : {{ customer_obj.email |default:"N/A"}}</span></p>
|
|
<p><span class="label">Phone : {{ customer_obj.phone_number|default:"N/A" }}</span></p>
|
|
<p><span class="label">Address : {{ customer_obj.address|default:"N/A" }}</span></p>
|
|
</div>
|
|
<div class="section text-right">
|
|
<h2>Details:</h2>
|
|
<p><span class="label">Quotation Number : </span> {{ invoice.invoice_number }}</p>
|
|
<p><span class="label">Issue Date : </span> {{ invoice.date_approved|date:"Y/m/d" }}</p>
|
|
<p><span class="label">Payment Method : </span> {{ invoiceget_terms_display }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-container">
|
|
<div class="table-header">
|
|
<span>Car Details</span>
|
|
</div>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-center">
|
|
<span>Make</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Model</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Series</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Trim</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Year</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>VIN</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center">{{ data.car.id_car_make.name }}</td>
|
|
<td class="text-center">{{ data.car.id_car_model.name }}</td>
|
|
<td class="text-center">{{ data.car.id_car_serie.name }}</td>
|
|
<td class="text-center">{{ data.car.id_car_trim.name }}</td>
|
|
<td class="text-center">{{ data.car.year }}</td>
|
|
<td class="text-center">{{ data.car.vin }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="table-container">
|
|
<div class="table-header">
|
|
<span>Financial Details</span>
|
|
</div>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-center">
|
|
<span>Quantity</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Unit Price</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Discount</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>VAT</span>
|
|
</th>
|
|
<th class="text-center">
|
|
<span>Total</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td class="text-center">1</td>
|
|
<td class="text-center">{{ data.car.marked_price|currency_format}}</td>
|
|
<td class="text-center">{{ data.discount_amount|currency_format }}</td>
|
|
<td class="text-center">{{ data.vat_amount|currency_format}}</td>
|
|
<td class="text-center">{{ data.final_price|currency_format }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% if data.additional_services %}
|
|
<div class="table-container">
|
|
<div class="table-header">
|
|
<span>Additional Services</span>
|
|
</div>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-center">Type</th>
|
|
<th class="text-center">Value</th>
|
|
<th class="text-center">Service VAT</th>
|
|
<th class="text-center">Total</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for service in data.additional_services.services %}
|
|
<tr>
|
|
<td class="text-center">{{ service.0.name }}</td>
|
|
<td class="text-center">{{ service.0.price|currency_format }}</td>
|
|
<td class="text-center">{{ service.1|currency_format}}</td>
|
|
<td class="text-center">{{ service.0.price_|currency_format}}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td class="text-center"></td>
|
|
<td class="text-center">{{ data.total_services_amount|currency_format}}</td>
|
|
<td class="text-center">{{ data.total_services_vat|currency_format}}</td>
|
|
<td class="text-center">{{ data.total_services_amount_|currency_format }}</td>
|
|
</tr>
|
|
</tfoot>
|
|
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="document-details" style="margin-top: 30px; ">
|
|
<div class="section text-right">
|
|
<p><span class="label">Total VAT : </span> {{ data.total_vat|currency_format}}</p>
|
|
<p><span class="label">Grand Total : </span> {{ data.grand_total|currency_format}}</p>
|
|
<p><span class="label">In words : </span> {{ data.grand_total|num_to_words }}</p>
|
|
</div>
|
|
</div>
|
|
<hr style="border-bottom:1px solid #ccc; ">
|
|
|
|
<div class="document-footer">
|
|
<div class="footer-logo">
|
|
<img src="{% static 'images/logos/logo-d-pdf.png' %}" alt="Logo" />
|
|
<p>
|
|
<span>Haikal</span> | <span>هيكل</span>
|
|
</p>
|
|
</div>
|
|
<div class="footer-powered">
|
|
<p>
|
|
<span>Powered by </span>
|
|
<a href="https://tenhal.sa"><span>TENHAL</span> | <span>تنحل</span></a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |