From 6046113cb1c24c78cc4d2b30e418a45eab1e8f6f Mon Sep 17 00:00:00 2001 From: radhu587 Date: Thu, 7 May 2020 16:42:04 +0530 Subject: [PATCH] Refactor Invoice and Payment templates --- .../app/pdf/estimate/estimate1.blade.php | 65 +-- .../app/pdf/estimate/estimate2.blade.php | 63 ++- .../app/pdf/estimate/estimate3.blade.php | 48 +- .../partials/billing-address.blade.php | 4 +- .../partials/company-address.blade.php | 4 +- .../partials/shipping-address.blade.php | 4 +- .../views/app/pdf/invoice/invoice1.blade.php | 184 ++++--- .../views/app/pdf/invoice/invoice2.blade.php | 344 ++++++------- .../views/app/pdf/invoice/invoice3.blade.php | 407 +++++++-------- .../partials/billing-address.blade.php | 8 +- .../partials/shipping-address.blade.php | 8 +- .../app/pdf/invoice/partials/table.blade.php | 68 ++- .../partials/billing-address.blade.php | 8 +- .../partials/company-address.blade.php | 2 +- .../partials/shipping-address.blade.php | 8 +- .../views/app/pdf/payment/payment.blade.php | 482 ++++++------------ 16 files changed, 758 insertions(+), 949 deletions(-) diff --git a/resources/views/app/pdf/estimate/estimate1.blade.php b/resources/views/app/pdf/estimate/estimate1.blade.php index 13348e10..ea16355d 100644 --- a/resources/views/app/pdf/estimate/estimate1.blade.php +++ b/resources/views/app/pdf/estimate/estimate1.blade.php @@ -6,6 +6,7 @@ @@ -328,18 +364,18 @@
@include('app.pdf.invoice.partials.company-address')
-
+
- + - + - +
Invoice NumberInvoice Number  {{$invoice->invoice_number}}
Invoice Date Invoice Date  {{$invoice->formattedInvoiceDate}}
Due dateDue date  {{$invoice->formattedDueDate}}
@@ -347,11 +383,11 @@
-
+
@include('app.pdf.invoice.partials.billing-address')
- -
user->billingaddress) style="float:left;" @endif> + +
user->billingaddress) style="float:left;" @endif> @include('app.pdf.invoice.partials.shipping-address')
@@ -361,4 +397,4 @@ @include('app.pdf.invoice.partials.notes') - \ No newline at end of file + diff --git a/resources/views/app/pdf/invoice/invoice2.blade.php b/resources/views/app/pdf/invoice/invoice2.blade.php index 5467ae26..a1d72527 100644 --- a/resources/views/app/pdf/invoice/invoice2.blade.php +++ b/resources/views/app/pdf/invoice/invoice2.blade.php @@ -5,6 +5,7 @@ Invoice -
+
@if($logo) - -
+ @else - + @if($invoice->user->company)

{{$invoice->user->company->name}}

@endif @endif
+

Invoice

{{$invoice->invoice_number}}

{{$invoice->formattedInvoiceDate}}

@@ -399,18 +393,18 @@

-
-
-
+
+
+
@include('app.pdf.invoice.partials.company-address')
-
+
@include('app.pdf.invoice.partials.shipping-address')
@if($invoice->user->shippingaddress) -
+
@else -
+
@endif @include('app.pdf.invoice.partials.billing-address')
@@ -421,4 +415,4 @@
- \ No newline at end of file + diff --git a/resources/views/app/pdf/invoice/invoice3.blade.php b/resources/views/app/pdf/invoice/invoice3.blade.php index 1e602bf0..e544345f 100644 --- a/resources/views/app/pdf/invoice/invoice3.blade.php +++ b/resources/views/app/pdf/invoice/invoice3.blade.php @@ -6,6 +6,8 @@ -
+
- -
+ @if($logo) @else

{{$invoice->user->company->name}}

@endif
+ @include('app.pdf.invoice.partials.company-address')
-
+
-
-
-
-
+
+
+
+
@include('app.pdf.invoice.partials.billing-address')
@if($invoice->user->billingaddress) -
+
@else -
+
@endif @include('app.pdf.invoice.partials.shipping-address')
-
+
- + - + - +
Invoice NumberInvoice Number  {{$invoice->invoice_number}}
Invoice Date Invoice Date  {{$invoice->formattedInvoiceDate}}
Due dateDue date  {{$invoice->formattedDueDate}}
@@ -458,4 +413,4 @@
- \ No newline at end of file + diff --git a/resources/views/app/pdf/invoice/partials/billing-address.blade.php b/resources/views/app/pdf/invoice/partials/billing-address.blade.php index d5292672..d35b17b8 100644 --- a/resources/views/app/pdf/invoice/partials/billing-address.blade.php +++ b/resources/views/app/pdf/invoice/partials/billing-address.blade.php @@ -1,11 +1,11 @@ @if($invoice->user->billingaddress) -

Bill To,

+

Bill To,

@if($invoice->user->billingaddress->name) -

+

{{$invoice->user->billingaddress->name}}

@endif -

+

@if($invoice->user->billingaddress->address_street_1) {!! nl2br(htmlspecialchars($invoice->user->billingaddress->address_street_1)) !!}
@endif @@ -25,7 +25,7 @@ {{$invoice->user->billingaddress->country->name}}
@endif @if($invoice->user->billingaddress->phone) -

+

Phone :{{$invoice->user->billingaddress->phone}}

@endif diff --git a/resources/views/app/pdf/invoice/partials/shipping-address.blade.php b/resources/views/app/pdf/invoice/partials/shipping-address.blade.php index 3cd2abb6..a2452457 100644 --- a/resources/views/app/pdf/invoice/partials/shipping-address.blade.php +++ b/resources/views/app/pdf/invoice/partials/shipping-address.blade.php @@ -1,11 +1,11 @@ @if($invoice->user->shippingaddress) -

Ship To,

+

Ship To,

@if($invoice->user->shippingaddress->name) -

+

{{$invoice->user->shippingaddress->name}}

@endif -

+

@if($invoice->user->shippingaddress->address_street_1) {!! nl2br(htmlspecialchars($invoice->user->shippingaddress->address_street_1)) !!}
@endif @@ -31,7 +31,7 @@ @endif @if($invoice->user->shippingaddress->phone) -

+

Phone :{{$invoice->user->shippingaddress->phone}}

@endif diff --git a/resources/views/app/pdf/invoice/partials/table.blade.php b/resources/views/app/pdf/invoice/partials/table.blade.php index a2a74ebe..40b4abb4 100644 --- a/resources/views/app/pdf/invoice/partials/table.blade.php +++ b/resources/views/app/pdf/invoice/partials/table.blade.php @@ -1,13 +1,13 @@ - +
- - - - + + + + @if($invoice->discount_per_item === 'YES') - + @endif - + @php $index = 1 @@ -15,32 +15,29 @@ @foreach ($invoice->items as $item) @if($invoice->discount_per_item === 'YES') - @endif @@ -64,20 +60,21 @@
-
#ItemsQuantityPrice#ItemsQuantityPriceDiscountDiscountAmountAmount
{{$index}} {{ $item->name }}
- {!! nl2br(htmlspecialchars($item->description)) !!} + {!! nl2br(htmlspecialchars($item->description)) !!}
{{$item->quantity}} {!! format_money_pdf($item->price, $invoice->user->currency) !!} + @if($item->discount_type === 'fixed') {!! format_money_pdf($item->discount_val, $invoice->user->currency) !!} @endif @@ -50,8 +47,7 @@ {!! format_money_pdf($item->total, $invoice->user->currency) !!}
+
- - + + @if ($invoice->tax_per_item === 'YES') @for ($i = 0; $i < count($labels); $i++) - - @@ -85,10 +82,10 @@ @else @foreach ($invoice->taxes as $tax) - - @@ -97,7 +94,7 @@ @if ($invoice->discount_per_item === 'NO') - - @endif - - + + - diff --git a/resources/views/app/pdf/payment/partials/billing-address.blade.php b/resources/views/app/pdf/payment/partials/billing-address.blade.php index 01b29348..7dc0a23b 100644 --- a/resources/views/app/pdf/payment/partials/billing-address.blade.php +++ b/resources/views/app/pdf/payment/partials/billing-address.blade.php @@ -1,11 +1,11 @@ @if($payment->user->billingaddress) -

Received From:

+

Received From:

@if($payment->user->billingaddress->name) -

+

{{$payment->user->billingaddress->name}}

@endif -

+

@if($payment->user->billingaddress->address_street_1) {!! nl2br(htmlspecialchars($payment->user->billingaddress->address_street_1)) !!}
@endif @@ -25,7 +25,7 @@ {{$payment->user->billingaddress->country->name}}
@endif @if($payment->user->billingaddress->phone) -

+

Phone :{{$payment->user->billingaddress->phone}}

@endif diff --git a/resources/views/app/pdf/payment/partials/company-address.blade.php b/resources/views/app/pdf/payment/partials/company-address.blade.php index 5f82d059..ef2b850a 100644 --- a/resources/views/app/pdf/payment/partials/company-address.blade.php +++ b/resources/views/app/pdf/payment/partials/company-address.blade.php @@ -3,7 +3,7 @@ @endif @if($company_address) -

+

@if($company_address->addresses[0]['address_street_1']) {!! nl2br(htmlspecialchars($company_address->addresses[0]['address_street_1'])) !!}
@endif diff --git a/resources/views/app/pdf/payment/partials/shipping-address.blade.php b/resources/views/app/pdf/payment/partials/shipping-address.blade.php index 95203320..8e8bca7f 100644 --- a/resources/views/app/pdf/payment/partials/shipping-address.blade.php +++ b/resources/views/app/pdf/payment/partials/shipping-address.blade.php @@ -1,11 +1,11 @@ @if($payment->user->shippingaddress) -

Ship To,

+

Ship To,

@if($payment->user->shippingaddress->name) -

+

{{$payment->user->shippingaddress->name}}

@endif -

+

@if($payment->user->shippingaddress->address_street_1) {!! nl2br(htmlspecialchars($payment->user->shippingaddress->address_street_1)) !!}
@endif @@ -31,7 +31,7 @@ @endif @if($payment->user->phone) -

+

Phone :{{$payment->user->shippingaddress->phone}}

@endif diff --git a/resources/views/app/pdf/payment/payment.blade.php b/resources/views/app/pdf/payment/payment.blade.php index b3140e70..5413fc8a 100644 --- a/resources/views/app/pdf/payment/payment.blade.php +++ b/resources/views/app/pdf/payment/payment.blade.php @@ -5,6 +5,7 @@ -
+
Subtotal{!! format_money_pdf($invoice->sub_total, $invoice->user->currency) !!}Subtotal + {!! format_money_pdf($invoice->sub_total, $invoice->user->currency) !!} +
+ {{$labels[$i]}} + {!! format_money_pdf($taxes[$i], $invoice->user->currency) !!}
+ {{$tax->name.' ('.$tax->percent.'%)'}} + {!! format_money_pdf($tax->amount, $invoice->user->currency) !!}
+ @if($invoice->discount_type === 'fixed') Discount @endif @@ -105,7 +102,7 @@ Discount ({{$invoice->discount}}%) @endif + @if($invoice->discount_type === 'fixed') {!! format_money_pdf($invoice->discount_val, $invoice->user->currency) !!} @endif @@ -116,18 +113,15 @@
- + + Total {!! format_money_pdf($invoice->total, $invoice->user->currency)!!}
@if($logo) - -
+ @else @if($payment->user->company) - +

{{$payment->user->company->name}}

@endif @endif
+ @include('app.pdf.payment.partials.company-address')
+
-

+ +

PAYMENT RECEIPT

-
-
-
-
+ +
+
+
+
@include('app.pdf.payment.partials.billing-address')
-
+
-
+
- + - + - + @if ($payment->invoice && $payment->invoice->invoice_number) - + @endif @@ -495,8 +319,8 @@
-
-

Amount Received

+
+

Amount Received

{!! format_money_pdf($payment->amount, $payment->user->currency) !!}
Payment DatePayment Date  {{$payment->formattedPaymentDate}}
Payment NumberPayment Number  {{$payment->payment_number}}
Payment ModePayment Mode  {{$payment->paymentMethod ? $payment->paymentMethod->name : '-'}}
InvoiceInvoice  {{$payment->invoice->invoice_number}}