<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Invoice</title>
	<link rel="stylesheet" href="public/css/style-invoice.css" type="text/css">
</head>
<body>
	<div class="inv-template inv-template-2 inv-template-4">
		<div class="company pl-30 pr-30">
			<table>
				<tbody>
					<tr>
						<td class="info">
							<div class="logo"><img src="{{ info.url~info.logo }}" alt="logo"></div>
							<div class="name">{{ info.legal_name }}</div>
							<div class="text">{% if info.mail %}{{ info.mail }},{% endif %} {{ info.phone }}</div>
							<div class="text">{{ info.address|join(', ') }}</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="strip"><p>Invoice</p></div>
		<div class="pl-30 pr-30">
			<table class="meta">
				<tbody>
					<tr>
						<td class="bill-to v-align-middle">
							<div class="heading">Bill To</div>
							<div class="title">{{ result.name }}</div>
							<div class="text">{{ result.email }}</div>
							<div class="text">{{ result.mobile }}</div>
						</td>
						<td class="info v-align-middle">
							<table class="text-right">
								<tbody>
									<tr>
										<td class="text"># :</td>
										<td class="text w-min-130">{{ info.invoice_prefix~"%05d"|format(result.id) }}</td>
									</tr>
									<tr>
										<td class="text">Invoice Date :</td>
										<td class="text w-min-130">{{ result.invoicedate|date(info.date_format) }}</td>
									</tr>
									<tr>
										<td class="text">Due Date :</td>
										<td class="text w-min-130">{{ result.duedate|date(info.date_format) }}</td>
									</tr>
									<tr>
										<td class="text">Payment Method :</td>
										<td class="text w-min-130">{{ result.method }}</td>
									</tr>
									<tr>
										<td class="text">Status :</td>
										<td class="text w-min-130">{{ result.status }}</td>
									</tr>
								</tbody>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="pl-30 pr-30">
			<div class="item">
				<table cellspacing="0">
					<thead>
						<tr>
							<th>Items & Description</th>
							<th>Qty</th>
							<th>Unit Cost</th>
							<th>Discount</th>
							<th>Tax</th>
							<th>Price</th>
						</tr>
					</thead>
					<tbody>
						{% for value in result.items %}
							<tr class="item-list">
								<td class="title"><p>{{ value.name }}</p><span>{{ value.descr }}</span></td>
								<td class="qty">{{ value.quantity }}</td>
								<td class="cost">{{ info.currency_abbr~value.cost }}</td>
								<td>{% if value.discountvalue %}{{ info.currency_abbr~value.discountvalue }}{% else %}0{% endif %}</td>
								<td class="tax">
									{% for tax in value.tax %}
										<div><span>{{ info.currency_abbr~tax.tax_price }}</span><span> ({{ tax.name|raw }})</span></div>
									{% endfor %}
								</td>
								<td class="price">{{ info.currency_abbr~value.price }}</td>
							</tr>
						{% endfor %}
					</tbody>
				</table>
			</div>
		</div>
		<div class="payment-total">
			<table>
				<tbody>
					<tr>
						<td class="v-align-middle pr-30 pl-30">
							<div class="customer-note">
								<p>{{ result.note }}</p>
							</div>
						</td>
						<td class="v-align-top pr-30">
							<div class="total">
								<table cellspacing="0">
									<tbody>
										<tr>
											<td>Sub Total</td>
											<td>{{ info.currency_abbr~result.subtotal }}</td>
										</tr>
										{% if result.discount_value > '0' %}
											<tr>
												<td>Discount</td>
												<td>{{ info.currency_abbr~result.discount_value }}</td>
											</tr>
										{% endif %}
										<tr>
											<td>Tax</td>
											<td>{{ info.currency_abbr~result.tax }}</td>
										</tr>
										<tr>
											<td>Paid</td>
											<td>{{ info.currency_abbr~result.paid }}</td>
										</tr>
										<tr>
											<td>Due</td>
											<td>{{ info.currency_abbr~result.due }}</td>
										</tr>
										<tr class="main">
											<td>Total</td>
											<td>{{ info.currency_abbr~result.amount }}</td>
										</tr>
									</tbody>
								</table>
							</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		{% if result.tc %}
			<div class="pl-30 pr-30">
				<div class="tc">
					<span>Terms & Conditions</span>
					<p>{{ result.tc }}</p>
				</div>
			</div>
		{% endif %}
	</div>
</body>
</html>