{% for charge in job.job_charges %}
{% if charge.item.name == 'BREAK' & 'NOTE' & 'WARRANTY' %}
<tr class="break">
<html><head> <title>{{ which | upcase }}</title> <meta http-
equiv="Content-Type" content="text/html; charset=UTF-8" /> <style
type="text/css"> @page {margin: 72px 5px;}
body { margin: 25px 50px 20px 50px; color: #000000; font: 12px
Helvetica, sans-serif; }
table { width: 100%; font-size: 12px; border-collapse: collapse; }
table td { vertical-align: top; margin: 0; padding: 0; }
table#details { margin-top: 40px; }
table#customer_address { margin-right: 20px; }
table#vitals { text-align: right; } table#vitals td { padding: .
3em; border: 1px solid #06b; } table#vitals .label { background-
color: #D5E6F4; color: #333; }
table#company_address { margin-left: 20px; }
h1 { font-size: 18px; margin: 0; padding: 0; }
table#charges { margin-top: 20px; } table#charges th, table#charges
td { padding: 5px 2px 2px 2px; border-bottom: 1px solid #06b; }
table#charges th { text-align: left; background-color: #80B3DD; font-
weight: bold; } table#charges th.currency, table#charges td.currency
{ width: 10%; text-align: right; } table#charges tr.break td { border-
bottom: 3px solid #06b; background-color: #D5E6F4; } table#charges
tr.break td { border-bottom: 3px solid #06b; }
table#totals { text-align: right; } table#totals td { padding: 0
5px; } table#totals td.currency { width: 10%; }
.currency { text-align: right; }
#terms, #notes { margin-top: 10px; } .setting { padding-top: 10px }
</style>
</head><body>
<table id="template_header"> <tr> <td> <h1>{{ which |
upcase }} # {{ job.job_number }}</h1>
<strong>{{ job.scheduled_on | date: "%m/%d/%Y" }}</strong> </td>
<td align="right"> {% if account.logo != null %}
{{ account.logo }} {% endif %} </td> </tr> </table>
<table id="details"> <tr> <td width="33%"> <table
id="customer_address"> <tr> <td>
{{ customer.name | h }} </td> </tr> <tr>
<td> {{ customer.service_address | h }}
</td> </tr> <tr> <td>
{{ customer.service_city | h }} {{ customer.service_state
| h }} {{ customer.service_zip_code | h }} </
td> </tr> {% if customer.service_country != blank
%} <tr> <td>
{{ customer.service_country | h }} </td> </tr>
{% endif %} {% if customer.email_address != blank %}
<tr> <td> {{ customer.email_address }}
</td> </tr> {% endif %} {% if
customer.phone_number != blank %} <tr> <td>
{{ customer.phone_number }} </td> </tr>
{% endif %} {% if customer.alt_phone_number != blank %}
<tr> <td>
{{ customer.alt_phone_number }} </td> </tr>
{% endif %} {% if customer.primary_contact != null and
customer.primary_contact.name != customer.name %} <tr>
<td> Primary Contact:
{{ customer.primary_contact.name | h }}
{{ customer.primary_contact.phone1 | h }} </td> </
tr> {% endif %} </table> </td> <td
width="33%"> <table id="vitals"> <tr> <td
class="label" nowrap="nowrap"> <strong>{{ which |
capitalize }}</strong> </td> <td>
{{ job.job_number }} </td> </tr> <tr>
<td class="label"> <strong>Date</strong>
</td> <td> {{ job.scheduled_on | date: "%m/
%d/%Y" }} </td> </tr> </table> </td>
<td width="33%"> <table id="company_address"
align="right"> <tr> <td nowrap="nowrap">
{{ account.company_name | h }} </td> </tr>
<tr> <td nowrap="nowrap">
{{ account_details.billing_address | h }} </td> </
tr> <tr> <td nowrap="nowrap">
{{ account_details.billing_city | h }}
{{ account_details.billing_state | h }}
{{ account_details.billing_zip_code | h }} </td> </
tr> <tr> <td nowrap="nowrap">
{{ account_details.billing_country | h }} </td> </
tr> <tr> <td nowrap="nowrap">
{{ account_details.billing_phone_number | h }} </td>
</tr> </table> </td> </tr> </table>
<table id="charges" cellpadding="0" cellspacing="0"> <tr>
<th>Item</th> <th class="currency" nowrap="nowrap">Unit Cost</
th> <th class="currency">Quantity</th> <th nowrap="nowrap"
class="currency last">Line Total</th> </tr> {% for charge in
job.job_charges %} {% if charge.item.name == 'BREAK' %} <tr
class="break">
<td> <br/> {% if charge.details != blank %}
{{ charge.details | h | newline_to_br }} {% else %}
{{ charge.description | h | newline_to_br }} {% endif %} </
td> <td></td> <td></td> <td></td> </tr>
{% else %}
<tr> <td> {% if charge.item != blank %}
{{ charge.item.name | h }}<br/> {% endif %} {% if
charge.details != blank %} {{ charge.details | h |
newline_to_br }} {% else %} {{ charge.description | h |
newline_to_br }} {% endif %} </td>
<td class="currency"> {{ charge.price_per_unit |
currency }} </td> <td class="currency">
{{ charge.quantity }} </td> <td class="currency">
{{ charge.total | currency }} </td> </tr> {% endif %} {%
endfor %} </table>
<table id="totals"> <tr> <td> Subtotal </td>
<td class="currency"> {{ job.subtotal | currency }} </
td> </tr> <tr> <td> Tax </td> <td
class="currency"> {{ job.tax | currency }} </td> </tr>
<tr> <td> Total </td> <td class="currency">
{{ job.total | currency }} </td> </tr> {% if
job.synced? %} <tr> <td> Total payments </td>
<td class="currency"> {{ job.total |
minus:job.balance_remaining | currency }} </td> </tr> <tr>
<td nowrap="nowrap"> Balance remaining </td> <td
class="currency"> {{ job.balance_remaining | currency }} </
td> </tr> {% endif %} </table>
<div id="terms"> <strong>Terms</strong> <div class="setting">
{% if which == 'invoice' %} {{ job.invoice_terms | h }}
{% else %} {{ job.estimate_terms | h }} {% endif %} </
div> </div>
<div id="notes"> <strong>Notes</strong> <div class="setting">
{% if which == 'invoice' %} {{ job.invoice_notes | h }}
{% else %} {{ job.estimate_notes | h }} {% endif %} </
div> </div>
</body></html>