From 873c3730970c5ba36b8e7559d6f8109efff8fe7f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 28 Aug 2023 20:24:48 +1000 Subject: [PATCH] Updates for invoice status resolution --- app/Export/CSV/InvoiceExport.php | 5 +++-- app/Mail/Engine/PaymentEmailEngine.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Export/CSV/InvoiceExport.php b/app/Export/CSV/InvoiceExport.php index dfaeff357c..246abe243f 100644 --- a/app/Export/CSV/InvoiceExport.php +++ b/app/Export/CSV/InvoiceExport.php @@ -126,6 +126,7 @@ class InvoiceExport extends BaseExport private function decorateAdvancedFields(Invoice $invoice, array $entity) :array { + nlog($entity); if (in_array('invoice.country_id', $this->input['report_keys'])) { $entity['invoice.country_id'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : ''; } @@ -135,11 +136,11 @@ class InvoiceExport extends BaseExport } if (in_array('invoice.client_id', $this->input['report_keys'])) { - $entity['invoice.clientstatus_id'] = $invoice->client->present()->name(); + $entity['invoice.client_id'] = $invoice->client->present()->name(); } if (in_array('invoice.status', $this->input['report_keys'])) { - $entity['invoice.status_id'] = $invoice->stringStatus($invoice->status_id); + $entity['invoice.status'] = $invoice->stringStatus($invoice->status_id); } return $entity; diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index d60fa8939f..68f17926ea 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -159,6 +159,7 @@ class PaymentEmailEngine extends BaseEmailEngine $data['$entity'] = ['value' => '', 'label' => ctrans('texts.payment')]; $data['$payment.amount'] = ['value' => Number::formatMoney($this->payment->amount, $this->client) ?: ' ', 'label' => ctrans('texts.amount')]; $data['$payment.refunded'] = ['value' => Number::formatMoney($this->payment->refunded, $this->client) ?: ' ', 'label' => ctrans('texts.refund')]; + $data['$payment.unapplied'] = ['value' => Number::formatMoney(($this->payment->amount - $this->payment->refunded - $this->payment->applied), $this->client) ?: ' ', 'label' => ctrans('texts.refund')]; $data['$amount'] = &$data['$payment.amount']; $data['$payment.date'] = ['value' => $this->translateDate($this->payment->date, $this->client->date_format(), $this->client->locale()), 'label' => ctrans('texts.payment_date')]; $data['$transaction_reference'] = ['value' => $this->payment->transaction_reference, 'label' => ctrans('texts.transaction_reference')];