<html>
<head>
	<style type="text/css" media="screen">
		@font-face {
		  font-family: 'Open Sans';
		  font-style: normal;
		  font-weight: 400;
		  src: url(http://themes.googleusercontent.com/static/fonts/opensans/v8/cJZKeOuBrn4kERxqtaUH3aCWcynf_cDxXwCLxiixG1c.ttf) format('truetype');
		}
		@page {
			margin: 0;
			padding: 0;
		}

		body {
			font-family: times ,sans-serif;
			font-size: 14px;
			color: #444;
			background-color: #fff;
		}

		*{
			font-family: times ,sans-serif;
		}

		a{
			text-decoration: none;
		}

		#header {
			top: 0;
		}

		#header .left {
			text-align: left;
			width: 43%;
			display: inline-block;
			vertical-align: top;
		}

		#header .right {
			text-align: right;
			width: 50%;
			display: inline-block;
			vertical-align: top;
		}

		#header .logo{
			height: 80px;
		}

		#header .title{
			font-size: 32px;
			margin: 0;
		}

		#header .address{
			font-size: 12px;
			margin: 0;
		}

		#header .label-nid{
			color:#555;
			margin-top: 2px;
		}

		#data .contact {
			text-align: left;
			width: 70%;
			display: inline-block;
			vertical-align: top;
		}

		#data .date {
			text-align: right;
			width: 23%;
			display: inline-block;
			vertical-align: top;
		}

		#data .label{
			font-size: 18px;
		}

		#content {
			margin: 6% 0 0 7%;
		}

		#summary {
			margin: 30px 0 30px 0;
			border-collapse: collapse;
			width: 93%;
		}

		#summary th {
			background-color: #323232;
			color: #FFF;
			border: 1px solid #FFF;
			padding: 10px;
		}

		#summary td {
			padding: 15px 10px;
			border-bottom: 1px solid #ddd;
		}

		#summary .col-1{
			width: 50%;
		}

		#summary .col-1 p{
			margin: 0;
			font-size: 13px;
			color: #000;
		}

		#summary .col-2 {
			width: 8%;
			text-align: center;
			vertical-align: top;
		}

		#summary .col-3 {
			width: 8%;
			text-align: center;
			vertical-align: top;
		}

		#summary .col-4 {
			width: 15%;
			text-align: right;
			vertical-align: top;
		}

		#summary .bt{
			border: none;
		}

		#summary .sum-price.sep td{
			padding-top: 30px;
		}

		#summary .sum-price td{
			padding: 8px 10px;
		}

		#summary .sum-price.discount td{
			font-size: 13px;
			padding: 0px 10px;
		}

		#summary .sum-price .col-4 {
			border: none;
		}
	</style>
</head>
<body>
	<div id="content">
		<div id="header">
			<div class="left">
				<img src="{{ company.logo.path|base64img }}" class="logo" alt="" height="100px">

				{# 
				<h3 class="company-name">{{ company.name }}</h3>
				<h3 class="slogan">{{ company.slogan }}</h3> 
				#}

				<h3 class="company-nid">{{ company.company_name_nid }}: {{ company.company_nid }}</h3>
				<p class="address">{{ company.address|nl2br }}</p>
				<p>
					<span class="email">{{ labels.email }}: <a href="mailto:{{ company.email }}">{{ company.email }}</a></span><br>
					<span class="phone">{{ labels.tel }}: {{ company.phone }}</span>
				</p>
			</div>
			<div class="right">
				<h1 class="title" style="font-family: 'Tahoma'">
					{% if document.taxdocument.doc_type %}
						{{ document.taxdocument.doc_type }}
					{% else %}
						{{ labels.estimate }}
					{% endif %}
				</h1>

				<h2 class="label-nid">{{ document.label_nid }}</h2>

				{% if document.taxdocument.doc_nid %}
				<h3 class="doc-nid">{{ document.taxdocument.doc_name }}:<br> {{ document.taxdocument.doc_nid }}</h3>
				{% endif %}

				{% if document.taxdocument.init_number %}
				<p><strong>{{ labels.range }}:</strong><br> {{ document.taxdocument.init_number|strpad(8) }} {{ labels.to }} {{ document.taxdocument.end_number|strpad(8) }}</p>
				{% endif %}

				{% if document.taxdocument.start_date %}
				<p><strong>{{ labels.date_limit }}:</strong><br> {{ document.taxdocument.start_date|date("M d, Y") }} {{ labels.to }} {{ document.taxdocument.end_date|date("M d, Y") }}</p>
				{% endif %}
			</div>
		</div>

		<div id="data">
			<div class="contact">
				<p>
					<strong>{{ labels.for }}:</strong><br>
					<span class="label">{{ document.contact.company }}</span><br>
					<em>{{ document.contact.name }}</em>
				</p>
			</div>
			<div class="date">
				<p>
					<strong>{{ labels.date }}:</strong><br>
					<span class="label">{{ document.date|date("M d, Y") }}</span><br>
					<em>{{ labels.by }}: {{ document.owner.first_name }} {{ document.owner.last_name }}</em>
				</p>
			</div>
		</div>

		<table id="summary">
			<tr>
				<th>{{ labels.products }}</th>
				<th>{{ labels.discount }}</th>
				<th>{{ labels.tax }}</th>
				<th>{{ labels.quantity }}</th>
				<th>{{ labels.price }}</th>
				<th>{{ labels.total }}</th>
			</tr>

			{% for item in document.products %}
			<tr>
				<td class="col-1">
					<strong>{{ item.name }}</strong>
					{% if item.pivot.description %}<br><p>{{ item.pivot.description|nl2br }}</p>{% endif %}
				</td>
				<td class="col-2">{{ item.pivot.discount }}%</td>
				<td class="col-2">{{ item.pivot.tax }}%</td>
				<td class="col-2">{{ item.pivot.quantity }}</td>
				<td class="col-4">{{ item.pivot.price|number_format(2, '.', ',') }}</td>
				<td class="col-4">{{ item.pivot.total|number_format(2, '.', ',') }}</td>
			</tr>
			{% endfor %}

			<tr class="sum-price">
				<td colspan="5" class="col-4 bt"></td>
				<td class="col-4"></td>
			</tr>

			<tr class="sum-price">
				<td colspan="6" class="col-4"><strong>{{ labels.total }}:</strong>&nbsp;&nbsp;&nbsp; {{ currency['symbol_native'] }} {{ document.total|number_format(2, '.', ',') }}</td>
			</tr>
		</table>
		{% if document.taxdocument.doc_nid %}
			{% if settings.invoice_note %}
				<br>
				<strong>{{ labels.note }}:</strong><br>
				{{ settings.invoice_note|raw }}
			{% endif %}
		{% else %}
			{% if settings.estimate_note %}
				<br>
				<strong>{{ labels.note }}:</strong><br>
				{{ settings.estimate_note|raw }}
			{% endif %}
		{% endif %}
	</div>
</body>
</html>