From af601e0b0350c9e3c702ea9f420ab818746a2457 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 4 Sep 2019 23:26:08 +1000 Subject: [PATCH] WOrking on invoice template layouts - css --- app/Utils/Number.php | 2 +- app/Utils/Traits/MakesInvoiceValues.php | 15 +- resources/views/pdf/design1.blade.php | 254 +++++++++--------------- resources/views/pdf/design2.blade.php | 217 ++++++++++++++++++++ 4 files changed, 319 insertions(+), 169 deletions(-) create mode 100644 resources/views/pdf/design2.blade.php diff --git a/app/Utils/Number.php b/app/Utils/Number.php index b822e06a589a..3645a2c93cd8 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -74,9 +74,9 @@ class Number if ($country->decimal_separator) $decimal = $country->decimal_separator; - $value = number_format($value, $precision, $decimal, $thousand); $symbol = $currency->symbol; + if ($settings->show_currency_code == "TRUE") { return "{$value} {$code}"; } elseif ($swapSymbol) { diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 99731f61af87..75b6c82bad0f 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -163,7 +163,6 @@ trait MakesInvoiceValues $data['$due_date'] = $this->due_date; $data['$invoice_number'] = $this->invoice_number; $data['$po_number'] = $this->po_number; - $data['$discount'] = $this->calc()->getTotalDiscount(); $data['$line_taxes'] = $this->makeLineTaxes(); // $data['$tax'] = ; // $data['$item'] = ; @@ -172,12 +171,13 @@ trait MakesInvoiceValues // $data['$quantity'] = ; // $data['$line_total'] = ; // $data['$paid_to_date'] = ; - $data['$subtotal'] = $subtotal = $this->calc()->getSubTotal(); Number::formatMoney($subtotal, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); + $data['$discount'] = Number::formatMoney($this->calc()->getTotalDiscount(), $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); + $data['$subtotal'] = Number::formatMoney($this->calc()->getSubTotal(), $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); $data['$balance_due'] = Number::formatMoney($this->balance, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); $data['$partial_due'] = Number::formatMoney($this->partial, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); - $data['$total'] = $total = $this->calc()->getTotal(); Number::formatMoney($total, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); - $data['$balance'] = $balance = $this->calc()->getBalance(); Number::formatMoney($balance, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); - $data['$taxes'] = $taxes = $this->calc()->getTotalTaxes(); Number::formatMoney($taxes, $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); + $data['$total'] = Number::formatMoney($this->calc()->getTotal(), $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); + $data['$balance'] = Number::formatMoney($this->calc()->getBalance(), $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); + $data['$taxes'] = Number::formatMoney($this->calc()->getTotalTaxes(), $this->client->currency(), $this->client->country, $this->client->getMergedSettings()); $data['$terms'] = $this->terms; // $data['$your_invoice'] = ; // $data['$quote'] = ; @@ -204,7 +204,7 @@ trait MakesInvoiceValues $data['$city_state_postal'] = $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, FALSE); $data['$postal_city_state'] = $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, TRUE); $data['$country'] = $this->client->country->name; - $data['$email'] = isset($this->client->primary_contact()->first()->email) ?: 'no primary contact set'; + $data['$email'] = isset($this->client->primary_contact()->first()->email) ?: 'no contact email on record'; $data['$contact_name'] = $this->client->present()->primary_contact_name(); $data['$company_name'] = $this->company->present()->name(); $data['$company_address'] = $this->company->present()->address(); @@ -245,7 +245,6 @@ trait MakesInvoiceValues $data['$amount'] = ; $data['$amount_paid'] =; */ - return $data; } @@ -259,7 +258,7 @@ trait MakesInvoiceValues public function table(array $columns) :?string { - $data = ''; + $data = '
'; $data .= ''; diff --git a/resources/views/pdf/design1.blade.php b/resources/views/pdf/design1.blade.php index 79152e112ac4..3c4c5b0b0d7a 100644 --- a/resources/views/pdf/design1.blade.php +++ b/resources/views/pdf/design1.blade.php @@ -3,158 +3,91 @@ $invoice_number - + + -
-
- - - - - - - -
- - - - - - -
- - - $invoice_number_label: $invoice_number
- $invoice_date_label: $invoice_date
- $invoice_due_date_label: $due_date - -
-
- - - - - +
+ +
- -
- $client_name
- $address1
- $address2
- $city_state_postal
- $country
- $vat_number
+
+
-
- $company_name
- $company_address
- $phone
- $email
-
-
+
+ $invoice_number_label: $invoice_number
+ $invoice_date_label: $invoice_date
+ $invoice_due_date_label: $due_date +
+ + +
+
+ Client:
+ $client_name
+ $address1
+ $address2
+ $city_state_postal
+ $country
+ $vat_number
+
+ +
+ $company_name
+ $company_address
+ $phone
+ $email
+
+ +
+ {{-- column variables: @@ -174,36 +107,37 @@ --}} {!! $invoice->table(['product_key', 'notes', 'cost','quantity', 'discount', 'tax_name1', 'line_total']) !!} -
- - - - - - - - - +
+
+
$subtotal_label:$subtotal
$taxes_label:$taxes
+ + + + + + + + - {{-- line_taxes html is populated server side, with a class of line_items, you can customise your CSS here to override the defaults--}} - - $line_taxes + {{-- line_taxes html is populated server side, with a class of line_items, you can customise your CSS here to override the defaults--}} + + $line_taxes - - - - - - - - + + + + + + + + - - - - - -
$subtotal_label:$subtotal
$taxes_label:$taxes
$discount_label:$discount
$total_label:$total
$discount_label:$discount
$total_label:$total
$balance_label:$balance
+ + $balance_label: + $balance + + +
diff --git a/resources/views/pdf/design2.blade.php b/resources/views/pdf/design2.blade.php new file mode 100644 index 000000000000..a78e9fe87a4c --- /dev/null +++ b/resources/views/pdf/design2.blade.php @@ -0,0 +1,217 @@ + + + + + $invoice_number + + + + + + +
+
+ + + + + + + + +
+ + + + + + +
+ + + $invoice_number_label: $invoice_number
+ $invoice_date_label: $invoice_date
+ $invoice_due_date_label: $due_date + +
+
+ + + + + + + +
+ $client_name
+ $address1
+ $address2
+ $city_state_postal
+ $country
+ $vat_number
+ +
+ $company_name
+ $company_address
+ $phone
+ $email
+
+
+ {{-- + column variables: + + date + discount + product_key + notes + cost + quantity + tax_name1 + tax_name2 + line_total + custom_label1 ( will show as the following parameter as its value -> custom_invoice_value1 ) + custom_label2 ( will show as the following parameter as its value -> custom_invoice_value2 ) + custom_label3 ( will show as the following parameter as its value -> custom_invoice_value3 ) + custom_label4 ( will show as the following parameter as its value -> custom_invoice_value4 ) + --}} + {!! $invoice->table(['product_key', 'notes', 'cost','quantity', 'discount', 'tax_name1', 'line_total']) !!} + +
+
+
+ + + + + + + + + + + {{-- line_taxes html is populated server side, with a class of line_items, you can customise your CSS here to override the defaults--}} + + $line_taxes + + + + + + + + + + + + + + +
$subtotal_label:$subtotal
$taxes_label:$taxes
$discount_label:$discount
$total_label:$total
$balance_label:$balance
+
+
+
+
+
+ + \ No newline at end of file