Skip to content

Instantly share code, notes, and snippets.

@itzikbenh
Last active December 21, 2018 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itzikbenh/3b598c70036f3ec2d131c2b1f1edd62a to your computer and use it in GitHub Desktop.
Save itzikbenh/3b598c70036f3ec2d131c2b1f1edd62a to your computer and use it in GitHub Desktop.
DOMPDF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Industrial.</title>
<link href="css/invoice.css?v=1.0" rel="stylesheet">
<style>
</style>
</head>
<body>
<div class="invoice-pdf">
<div class="invoice-header">
<div class="company-name bold">Industrial</div>
<div class="company-phone">(212) 532-1075</div>
<div class="company-email">email@email.com</div>
</div>
<div class="invoice-body">
<h1>INVOICE</h1>
<div class="bill-to-table-container">
<div class="bill-to display-inline">
<div class="bold">BILL TO</div>
<div class="client-name">{{$invoice->client_name}}</div>
<div class="client-location">
{{$invoice->billing_address}}
</div>
</div>
<table class="table-nonfluid">
<tr>
<th>INVOICE #</th>
<td>{{$invoice->number}}</td>
</tr>
<tr>
<th>DATE</th>
<td>{{$invoice->date}}</td>
</tr>
</table>
</div>
<hr>
<div class="ref-po-container">
<div class="po-container display-inline">
@if ($invoice->po_number)
<div class="bold">P.O. NUMBER</div>
<div>{{$invoice->po_number}}</div>
@endif
</div>
<div class="ref-container display-inline">
@if ($invoice->reference_number)
<div class="bold">REFERENCE NUMBER</div>
<div>{{$invoice->reference_number}}</div>
@endif
</div>
</div>
@if (isset($invoice->data_rows) && count($invoice->data_rows['service_date']) > 0)
<table class="data-rows" border="0" cellspacing="0" cellpadding="2">
<thead>
<tr>
<th style="width: 15%;">DATE</th>
<th style="width: 45%;">DESCRIPTION</th>
<th style="width: 10%;">QTY</th>
<th style="width: 15%;">PRICE EACH</th>
<th style="width: 20%;">AMOUNT</th>
</tr>
</thead>
<tbody>
@for ($i=0; $i < count($invoice->data_rows['service_date']); $i++)
<tr>
<td>{{$invoice->data_rows['service_date'][$i]}}</td>
<td>{!! nl2br($invoice->data_rows['description'][$i]) !!}</td>
<td>{{$invoice->data_rows['quantity'][$i]}}</td>
<td>
@if ($invoice->data_rows['rate'][$i])
{{number_format($invoice->data_rows['rate'][$i], 2)}}
@endif
</td>
@if ($invoice->data_rows['is_taxed'][$i] === 'Yes' && (isset($invoice->invoice_tax) && $invoice->invoice_tax > 0))
<td>{{number_format($invoice->data_rows['amount'][$i], 2)}}T</td>
@else
<td>{{number_format($invoice->data_rows['amount'][$i], 2)}}</td>
@endif
</tr>
@endfor
</tbody>
</table>
@endif
</div>{{-- /invoice body --}}
<hr class="dashed">
<div class="invoice-footer">
<div class="message display-inline">
{!! nl2br($invoice->message) !!}
</div>
<table class="table-nonfluid">
@if (isset($invoice->invoice_tax) && $invoice->invoice_tax > 0)
<tr>
<th>SUBTOTAL</th>
<td>{{number_format($invoice->subtotal, 2)}}</td>
</tr>
<tr>
<th>TAX ({{$invoice->tax_rate}}%)</th>
<td>{{number_format($invoice->invoice_tax, 2)}}</td>
</tr>
@endif
@if ($invoice->discount)
<tr>
<th>DISCOUNT</th>
<td>{{number_format($invoice->discount, 2)}}</td>
</tr>
@endif
<tr>
<th>TOTAL</th>
<td>{{number_format($invoice->total, 2)}}</td>
</tr>
<tr>
<th>BALANCE DUE</th>
<td class="balance_due bold">${{number_format($invoice->balance_due, 2)}}</td>
</tr>
</table>
</div>
</div>
</body>
</html>
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
@hxgdzyuyi
Copy link

nl2br is unsafe from xss attacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment