diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 62a64ab447ee..b6e0e25b1d30 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -477,7 +477,7 @@ class CompanySettings extends BaseSettings '$contact.email', ], 'company_details' => [ - '$company.company_name', + '$company.name', '$company.id_number', '$company.vat_number', '$company.website', @@ -519,7 +519,7 @@ class CompanySettings extends BaseSettings '$product.cost', '$product.quantity', '$product.discount', - '$product.tax_name1', + '$product.tax', '$product.line_total', ], 'task_columns' =>[ @@ -528,7 +528,7 @@ class CompanySettings extends BaseSettings '$task.cost', '$task.quantity', '$task.discount', - '$task.tax_name1', + '$task.tax', '$task.line_total', ], ]; diff --git a/app/Models/Credit.php b/app/Models/Credit.php index d9203a462c2b..7cfa471cd9ed 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -79,7 +79,7 @@ class Credit extends BaseModel const STATUS_APPLIED = 4; public function getDateAttribute($value) { - if (!$value) { + if (!empty($value)) { //$value format 'Y:m:d H:i:s' to 'Y-m-d H:i' return (new Carbon($value))->format('Y-m-d'); } @@ -87,7 +87,7 @@ class Credit extends BaseModel } public function getDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { //$value format 'Y:m:d H:i:s' to 'Y-m-d H:i' return (new Carbon($value))->format('Y-m-d'); } @@ -95,7 +95,7 @@ class Credit extends BaseModel } public function getPartialDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { //$value format 'Y:m:d H:i:s' to 'Y-m-d H:i' return (new Carbon($value))->format('Y-m-d'); } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index b16eb8ccd7a5..bbd4b964909d 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -129,21 +129,21 @@ class Invoice extends BaseModel const STATUS_REVERSED = -3; public function getDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getPartialDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 54d0d8bbed37..9a062fab6fd4 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -85,21 +85,21 @@ class Quote extends BaseModel const STATUS_EXPIRED = -1; public function getDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getPartialDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 0cc36d640e2f..1f63012dbdc2 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -112,21 +112,21 @@ class RecurringInvoice extends BaseModel ]; public function getDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getPartialDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; diff --git a/app/Models/RecurringQuote.php b/app/Models/RecurringQuote.php index add31149da69..4ed6990222f8 100644 --- a/app/Models/RecurringQuote.php +++ b/app/Models/RecurringQuote.php @@ -95,21 +95,21 @@ class RecurringQuote extends BaseModel ]; public function getDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; } public function getPartialDueDateAttribute($value) { - if (!$value) { + if (!empty($value)) { return (new Carbon($value))->format('Y-m-d'); } return $value; diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 21a7fa226502..af8371f6a27a 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -185,6 +185,7 @@ trait MakesInvoiceValues $data['$balance_due'] = &$data['$invoice.balance_due']; $data['$invoice.partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; $data['$total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; + $data['$amount'] = &$data['$total']; $data['$quote.total'] = &$data['$total']; $data['$invoice.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; $data['$invoice.amount'] = &$data['$total'];