mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 09:24:07 +00:00
supplier bill payment refund module
This commit is contained in:
@@ -18,6 +18,7 @@ class BillGroupResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
$billGroupPayment = (App()->make(CalculatesBillGroupPaymentAmount::class))->execute($this->resource);
|
||||
$bill_refund_amount = $billGroupPayment['bill_refund_amount'];
|
||||
$floating_amount = $billGroupPayment['floating_amount'];
|
||||
$paid_amount = $billGroupPayment['paid_amount'];
|
||||
$outstanding_amount = $billGroupPayment['outstanding_amount'];
|
||||
@@ -37,6 +38,7 @@ class BillGroupResource extends JsonResource
|
||||
'currency_rate' => (float) $this->currency_rate,
|
||||
'status' => $this->status,
|
||||
'groups' => GroupResource::collection($this->groups),
|
||||
'bill_refund_amount' => $bill_refund_amount,
|
||||
'floating_amount' => $floating_amount,
|
||||
'paid_amount' => $paid_amount,
|
||||
'outstanding_amount' => $outstanding_amount,
|
||||
@@ -58,6 +60,23 @@ class BillGroupResource extends JsonResource
|
||||
'updated_at' => Carbon::parse($transaction->updated_at)->format('d-m-Y h:i:s A'),
|
||||
];
|
||||
}),
|
||||
'bill_refunds' => $this->billRefunds->map(function ($transaction) {
|
||||
return [
|
||||
'id' => $transaction->id,
|
||||
'type' => (int) $transaction->type,
|
||||
'bill_no' => $transaction->bill_no,
|
||||
'payment_method' => (float) $transaction->payment_method,
|
||||
'amount' => (double) $transaction->amount,
|
||||
'original_amount' => (double) $transaction->original_amount,
|
||||
'currency' => new CurrencyResource($transaction->currency),
|
||||
'original_currency' => new CurrencyResource($transaction->original_currency),
|
||||
'service_charge' => (double) $transaction->service_charge,
|
||||
'tax' => (double) $transaction->tax,
|
||||
'status' => (int) $transaction->status,
|
||||
'statusText' => ApprovalStatus::APPROVAL_STATUS_ID[(int) $transaction->status],
|
||||
'updated_at' => Carbon::parse($transaction->updated_at)->format('d-m-Y h:i:s A'),
|
||||
];
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user