Working on payment activities
This commit is contained in:
parent
912cb3aec5
commit
5b3155ea9e
|
|
@ -517,7 +517,7 @@ class Activity extends StaticModel
|
||||||
':recurring_invoice' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_invoice?->number ?? '', 'hashed_id' => $this->recurring_invoice->hashed_id ?? '']],
|
':recurring_invoice' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_invoice?->number ?? '', 'hashed_id' => $this->recurring_invoice->hashed_id ?? '']],
|
||||||
':recurring_expense' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_expense?->number ?? '', 'hashed_id' => $this->recurring_expense->hashed_id ?? '']],
|
':recurring_expense' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_expense?->number ?? '', 'hashed_id' => $this->recurring_expense->hashed_id ?? '']],
|
||||||
':payment_amount' => $translation = [substr($variable, 1) => [ 'label' => Number::formatMoney($this?->payment?->amount, $this?->payment?->client ?? $this->company) ?? '', 'hashed_id' => '']],
|
':payment_amount' => $translation = [substr($variable, 1) => [ 'label' => Number::formatMoney($this?->payment?->amount, $this?->payment?->client ?? $this->company) ?? '', 'hashed_id' => '']],
|
||||||
':adjustment' => $translation = [substr($variable, 1) => [ 'label' => Number::formatMoney($this?->payment?->refunded, $this?->payment?->client ?? $this->company) ?? '', 'hashed_id' => '']],
|
':adjustment' => $translation = [substr($variable, 1) => [ 'label' => $this->getPaymentAdjustment($this?->payment), 'hashed_id' => '']],
|
||||||
':ip' => $translation = [ 'ip' => $this->ip ?? ''],
|
':ip' => $translation = [ 'ip' => $this->ip ?? ''],
|
||||||
':contact' => $translation = $this->resolveContact(),
|
':contact' => $translation = $this->resolveContact(),
|
||||||
':notes' => $translation = [ 'notes' => $this->notes ?? ''],
|
':notes' => $translation = [ 'notes' => $this->notes ?? ''],
|
||||||
|
|
@ -528,6 +528,18 @@ class Activity extends StaticModel
|
||||||
return $translation;
|
return $translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getPaymentAdjustment(?\App\Models\Payment $payment): string
|
||||||
|
{
|
||||||
|
if(!$payment)
|
||||||
|
return '';
|
||||||
|
|
||||||
|
preg_match('/:\s*(\d+)\s*-/', $this->notes, $matches);
|
||||||
|
$amount = $matches[1] ?? null;
|
||||||
|
|
||||||
|
return Number::formatMoney($amount ?? $payment->refunded, $payment?->client ?? $this->company);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function resolveContact(): array
|
private function resolveContact(): array
|
||||||
{
|
{
|
||||||
$contact = $this->contact ? $this->contact : $this->vendor_contact;
|
$contact = $this->contact ? $this->contact : $this->vendor_contact;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue