30 lines
1.3 KiB
PHP
30 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Finance;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class FinancialSummaryResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'schoolYear' => $this->resource['schoolYear'] ?? null,
|
|
'dateFrom' => $this->resource['dateFrom'] ?? null,
|
|
'dateTo' => $this->resource['dateTo'] ?? null,
|
|
'totalCharges' => (float) ($this->resource['totalCharges'] ?? 0),
|
|
'totalExtraCharges' => (float) ($this->resource['totalExtraCharges'] ?? 0),
|
|
'totalDiscounts' => (float) ($this->resource['totalDiscounts'] ?? 0),
|
|
'totalRefunds' => (float) ($this->resource['totalRefunds'] ?? 0),
|
|
'totalExpenses' => (float) ($this->resource['totalExpenses'] ?? 0),
|
|
'totalReimbursements' => (float) ($this->resource['totalReimbursements'] ?? 0),
|
|
'donationToSchool' => (float) ($this->resource['donationToSchool'] ?? 0),
|
|
'totalPaid' => (float) ($this->resource['totalPaid'] ?? 0),
|
|
'amountCollected' => (float) ($this->resource['amountCollected'] ?? 0),
|
|
'totalUnpaid' => (float) ($this->resource['totalUnpaid'] ?? 0),
|
|
'netAmount' => (float) ($this->resource['netAmount'] ?? 0),
|
|
];
|
|
}
|
|
}
|