diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 47b85609..68df5ee3 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -535,8 +535,8 @@ class Invoice extends BaseController $reference_number = $rec['order_number']; $invoice_serial_number = $rec['invoice_number']; $recipient_name = $rec['customer_name']; - $approval_date = $rec['updated_on']; - $approved_by = $rec['updated_by_name']; + $approval_date = $rec['status'] == 'Approved' && $rec['updated_by'] !== NULL ? $rec['updated_on_format'] : $rec['created_on_format']; + $approved_by = $rec['status'] == 'Approved' && $rec['updated_by'] !== NULL ? $rec['updated_by_name'] : $rec['created_by_name']; $recipient_email = $rec['customer_email']; $recipient_mobile = $rec['customer_mobile']; $subtotal = $rec['subtotal'];