From a656c2e0bbba3a53386fb6ec88a901a73934810e Mon Sep 17 00:00:00 2001 From: denisdulici Date: Thu, 11 Oct 2018 12:29:48 +0300 Subject: [PATCH] improved invoice and fixed bill print/pdf layouts #540 --- public/css/invoice.css | 100 +++++++ resources/views/expenses/bills/bill.blade.php | 245 +++++++++--------- .../views/incomes/invoices/invoice.blade.php | 123 ++------- resources/views/partials/bill/head.blade.php | 38 +-- .../views/partials/invoice/head.blade.php | 2 + 5 files changed, 241 insertions(+), 267 deletions(-) create mode 100644 public/css/invoice.css diff --git a/public/css/invoice.css b/public/css/invoice.css new file mode 100644 index 000000000..ba31b028d --- /dev/null +++ b/public/css/invoice.css @@ -0,0 +1,100 @@ +body { + margin: 0 10px; + padding: 0; + font-family: Arial, sans-serif; + color: #000; +} + +table { + width: 100%; +} + +th, td { + text-align: left; + padding: 8px; +} + +.row { + font-size: 0; /* prevent whitespace from stuffing up inline-block column layouts */ +} + +.col-58 { + display: inline-block; + width: 58%; + vertical-align: top; +} + +.col-42 { + display: inline-block; + width: 42%; + vertical-align: top; +} + +.text { + font-size: 16px; +} + +.text-right { + text-align: right; +} + +.text-center { + text-align: center; +} + +.text-success { + color: #28a745; +} + +.header { + padding-bottom: 9px; + margin: 10px 0 20px 0; + border-bottom: 1px solid #eee; +} + +.company { + padding-left: 10px; +} + +.logo { + max-width: 430px; + max-height: 120px; +} + +.lines { + margin: 30px 0; + border-collapse: collapse; + table-layout: fixed; + border: 1px solid #ccc; +} + +.lines thead tr { + background-color: #eee; +} + +.lines tbody td { + border-bottom: 1px solid #ccc; +} + +.lines .item { + width: 40%; +} + +.lines .quantity { + width: 20%; + text-align: center; +} + +.lines .price { + width: 20%; + text-align: right; +} + +.lines .total { + width: 20%; + text-align: right; +} + +.notes { + font-size: 14px; +} \ No newline at end of file diff --git a/resources/views/expenses/bills/bill.blade.php b/resources/views/expenses/bills/bill.blade.php index e109a1539..6e6e53c84 100644 --- a/resources/views/expenses/bills/bill.blade.php +++ b/resources/views/expenses/bills/bill.blade.php @@ -3,138 +3,131 @@ @section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number) @section('content') -
-
-
- @if ($logo) - - @endif -
-
-
- {{ setting('general.company_name') }}
- {!! nl2br(setting('general.company_address')) !!}
- @if (setting('general.company_tax_number')) - {{ trans('general.tax_number') }}: {{ setting('general.company_tax_number') }}
- @endif -
- @if (setting('general.company_phone')) - {{ setting('general.company_phone') }}
- @endif - {{ setting('general.company_email') }} -
-
+
+
+ @if ($logo) + + @endif +
+
+
+ {{ setting('general.company_name') }}
+ {!! nl2br(setting('general.company_address')) !!}
+ @if (setting('general.company_tax_number')) + {{ trans('general.tax_number') }}: {{ setting('general.company_tax_number') }}
+ @endif +
+ @if (setting('general.company_phone')) + {{ setting('general.company_phone') }}
+ @endif + {{ setting('general.company_email') }}
+
+
-
-
- {{ trans('bills.bill_from') }} -
- {{ $bill->vendor_name }}
- {!! nl2br($bill->vendor_address) !!}
- @if ($bill->vendor_tax_number) - {{ trans('general.tax_number') }}: {{ $bill->vendor_tax_number }}
- @endif -
- @if ($bill->vendor_phone) - {{ $bill->vendor_phone }}
- @endif - {{ $bill->vendor_email }} -
-
-
-
- - - - - - - @if ($bill->order_number) - - - - - @endif - - - - - - - - - -
{{ trans('bills.bill_number') }}:{{ $bill->bill_number }}
{{ trans('bills.order_number') }}:{{ $bill->order_number }}
{{ trans('bills.bill_date') }}:{{ Date::parse($bill->billed_at)->format($date_format) }}
{{ trans('bills.payment_due') }}:{{ Date::parse($bill->due_at)->format($date_format) }}
-
-
+
+
+
+ {{ trans('bills.bill_from') }}

+ {{ $bill->vendor_name }}
+ {!! nl2br($bill->vendor_address) !!}
+ @if ($bill->vendor_tax_number) + {{ trans('general.tax_number') }}: {{ $bill->vendor_tax_number }}
+ @endif +
+ @if ($bill->vendor_phone) + {{ $bill->vendor_phone }}
+ @endif + {{ $bill->vendor_email }}
- -
-
- - + +
+
+
+ - - - - + + - @foreach($bill->items as $item) - - - - - - - @endforeach - -
{{ trans_choice('general.items', 1) }}{{ trans('bills.quantity') }}{{ trans('bills.price') }}{{ trans('bills.total') }}{{ trans('bills.bill_number') }}:{{ $bill->bill_number }}
- {{ $item->name }} - @if ($item->sku) -
{{ trans('items.sku') }}: {{ $item->sku }} - @endif -
{{ $item->quantity }}@money($item->price, $bill->currency_code, true)@money($item->total, $bill->currency_code, true)
-
+ @if ($bill->order_number) + + {{ trans('bills.order_number') }}: + {{ $bill->order_number }} + + @endif + + {{ trans('bills.bill_date') }}: + {{ Date::parse($bill->billed_at)->format($date_format) }} + + + {{ trans('bills.payment_due') }}: + {{ Date::parse($bill->due_at)->format($date_format) }} + + +
+
+
-
-
- @if ($bill->notes) -

{{ trans_choice('general.notes', 2) }}:

- -

- {{ $bill->notes }} -

+ + + + + + + + + + + @foreach($bill->items as $item) + + + + + + + @endforeach + +
{{ trans_choice('general.items', 1) }}{{ trans('bills.quantity') }}{{ trans('bills.price') }}{{ trans('bills.total') }}
+ {{ $item->name }} + @if ($item->sku) +
{{ trans('items.sku') }}: {{ $item->sku }} @endif - -
-
- - - @foreach($bill->totals as $total) - @if ($total->code != 'total') - - - - - @else - @if ($bill->paid) - - - - - @endif - - - - - @endif - @endforeach - -
{{ trans($total->title) }}:@money($total->amount, $bill->currency_code, true)
{{ trans('invoices.paid') }}:- @money($bill->paid, $bill->currency_code, true)
{{ trans($total->name) }}:@money($total->amount - $bill->paid, $bill->currency_code, true)
-
-
- - +
{{ $item->quantity }}@money($item->price, $bill->currency_code, true)@money($item->total, $bill->currency_code, true)
+ +
+
+ @if ($bill->notes) + + + +
{{ trans_choice('general.notes', 2) }}
{{ $bill->notes }}
+ @endif +
+
+ + + @foreach ($bill->totals as $total) + @if ($total->code != 'total') + + + + + @else + @if ($bill->paid) + + + + + @endif + + + + + @endif + @endforeach + +
{{ trans($total->title) }}:@money($total->amount, $bill->currency_code, true)
{{ trans('invoices.paid') }}:- @money($bill->paid, $bill->currency_code, true)
{{ trans($total->name) }}:@money($total->amount - $bill->paid, $bill->currency_code, true)
+
+
@endsection diff --git a/resources/views/incomes/invoices/invoice.blade.php b/resources/views/incomes/invoices/invoice.blade.php index b30135e96..132a635b0 100644 --- a/resources/views/incomes/invoices/invoice.blade.php +++ b/resources/views/incomes/invoices/invoice.blade.php @@ -2,100 +2,15 @@ @section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number) -@push('css') - -@endpush - @section('content') -
+
@if ($logo) - + @endif
-
+
{{ setting('general.company_name') }}
{!! nl2br(setting('general.company_address')) !!}
@if (setting('general.company_tax_number')) @@ -154,7 +69,7 @@
- +
@@ -165,17 +80,17 @@ @foreach($invoice->items as $item) - - - - - - + + + + + + @endforeach
{{ trans_choice('general.items', 1) }}
- {{ $item->name }} - @if ($item->sku) -
{{ trans('items.sku') }}: {{ $item->sku }} - @endif -
{{ $item->quantity }}@money($item->price, $invoice->currency_code, true)@money($item->total, $invoice->currency_code, true)
+ {{ $item->name }} + @if ($item->sku) +
{{ trans('items.sku') }}: {{ $item->sku }} + @endif +
{{ $item->quantity }}@money($item->price, $invoice->currency_code, true)@money($item->total, $invoice->currency_code, true)
@@ -183,10 +98,10 @@
@if ($invoice->notes) - - - -
{{ trans_choice('general.notes', 2) }}
{{ $invoice->notes }}
+ + + +
{{ trans_choice('general.notes', 2) }}
{{ $invoice->notes }}
@endif
diff --git a/resources/views/partials/bill/head.blade.php b/resources/views/partials/bill/head.blade.php index e248275c9..e1173cc8c 100644 --- a/resources/views/partials/bill/head.blade.php +++ b/resources/views/partials/bill/head.blade.php @@ -9,48 +9,12 @@ @yield('title') - @setting('general.company_name') - - - - - - - - - - - - - - + @stack('css') @stack('stylesheet') - - - - - - - - - - - - - - - @stack('js') @stack('scripts') diff --git a/resources/views/partials/invoice/head.blade.php b/resources/views/partials/invoice/head.blade.php index 295d75c2a..e1173cc8c 100644 --- a/resources/views/partials/invoice/head.blade.php +++ b/resources/views/partials/invoice/head.blade.php @@ -9,6 +9,8 @@ @yield('title') - @setting('general.company_name') + + @stack('css') @stack('stylesheet')