Fix issues on invoice template

This commit is contained in:
radhu587
2020-05-08 18:49:02 +05:30
parent a739a938fc
commit 325f90bba5
9 changed files with 235 additions and 204 deletions

View File

@ -5,7 +5,7 @@
<th class="item-table-heading text-right pr-20">Quantity</th>
<th class="item-table-heading pr-20 text-right">Price</th>
@if($invoice->discount_per_item === 'YES')
<th class="item-table-heading pl-10">Discount</th>
<th class="item-table-heading text-right pl-10">Discount</th>
@endif
<th class="item-table-heading text-right">Amount</th>
</tr>
@ -22,22 +22,28 @@
</td>
<td
class="item-cell text-left pl-0"
style="vertical-align: top;"
>
<span>{{ $item->name }}</span><br>
<span class="item-description">{!! nl2br(htmlspecialchars($item->description)) !!}</span>
</td>
<td
class="item-cell pr-20 text-right"
style="vertical-align: top;"
>
{{$item->quantity}}
</td>
<td
class="item-cell text-right pr-20"
style="vertical-align: top;"
>
{!! format_money_pdf($item->price, $invoice->user->currency) !!}
</td>
@if($invoice->discount_per_item === 'YES')
<td class="item-cell text-right pl-10">
<td
class="item-cell text-right pl-10"
style="vertical-align: top;"
>
@if($item->discount_type === 'fixed')
{!! format_money_pdf($item->discount_val, $invoice->user->currency) !!}
@endif
@ -48,6 +54,7 @@
@endif
<td
class="item-cell text-right"
style="vertical-align: top;"
>
{!! format_money_pdf($item->total, $invoice->user->currency) !!}
</td>
@ -60,70 +67,72 @@
<hr class="item-cell-table-hr">
<table width="100%" cellspacing="0px" border="0" class="total-display-table @if(count($invoice->items) > 12) page-break @endif">
<tr>
<td class="border-0 total-table-attribute-label">Subtotal</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($invoice->sub_total, $invoice->user->currency) !!}
</td>
</tr>
@if ($invoice->tax_per_item === 'YES')
@for ($i = 0; $i < count($labels); $i++)
<tr>
<td class="border-0 total-table-attribute-label">
{{$labels[$i]}}
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($taxes[$i], $invoice->user->currency) !!}
</td>
</tr>
@endfor
@else
@foreach ($invoice->taxes as $tax)
<tr>
<td class="border-0 total-table-attribute-label">
{{$tax->name.' ('.$tax->percent.'%)'}}
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($tax->amount, $invoice->user->currency) !!}
</td>
</tr>
@endforeach
@endif
@if ($invoice->discount_per_item === 'NO')
<div class="total-display-container">
<table width="100%" cellspacing="0px" border="0" class="total-display-table @if(count($invoice->items) > 12) page-break @endif">
<tr>
<td class="border-0 total-table-attribute-label">
@if($invoice->discount_type === 'fixed')
Discount
@endif
@if($invoice->discount_type === 'percentage')
Discount ({{$invoice->discount}}%)
@endif
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value" >
@if($invoice->discount_type === 'fixed')
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
@endif
@if($invoice->discount_type === 'percentage')
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
@endif
<td class="border-0 total-table-attribute-label">Subtotal</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($invoice->sub_total, $invoice->user->currency) !!}
</td>
</tr>
@endif
<tr>
<td class="py-3"></td>
<td class="py-3"></td>
</tr>
<tr>
<td class="border-0 total-border-left total-table-attribute-label">
Total
</td>
<td
class="border-0 total-border-right item-cell py-8 total-table-attribute-value text-primary"
>
{!! format_money_pdf($invoice->total, $invoice->user->currency)!!}
</td>
</tr>
</table>
@if ($invoice->tax_per_item === 'YES')
@for ($i = 0; $i < count($labels); $i++)
<tr>
<td class="border-0 total-table-attribute-label">
{{$labels[$i]}}
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($taxes[$i], $invoice->user->currency) !!}
</td>
</tr>
@endfor
@else
@foreach ($invoice->taxes as $tax)
<tr>
<td class="border-0 total-table-attribute-label">
{{$tax->name.' ('.$tax->percent.'%)'}}
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value">
{!! format_money_pdf($tax->amount, $invoice->user->currency) !!}
</td>
</tr>
@endforeach
@endif
@if ($invoice->discount_per_item === 'NO')
<tr>
<td class="border-0 total-table-attribute-label">
@if($invoice->discount_type === 'fixed')
Discount
@endif
@if($invoice->discount_type === 'percentage')
Discount ({{$invoice->discount}}%)
@endif
</td>
<td class="border-0 item-cell py-2 total-table-attribute-value" >
@if($invoice->discount_type === 'fixed')
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
@endif
@if($invoice->discount_type === 'percentage')
{!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!}
@endif
</td>
</tr>
@endif
<tr>
<td class="py-3"></td>
<td class="py-3"></td>
</tr>
<tr>
<td class="border-0 total-border-left total-table-attribute-label">
Total
</td>
<td
class="border-0 total-border-right item-cell py-8 total-table-attribute-value text-primary"
>
{!! format_money_pdf($invoice->total, $invoice->user->currency)!!}
</td>
</tr>
</table>
</div>