supplier bill payment refund module

This commit is contained in:
Sai0224
2024-02-24 12:15:26 +08:00
parent ec0ebe3812
commit 25de31ea2e
18 changed files with 403 additions and 18 deletions
+19
View File
@@ -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'),
];
}),
];
}
}