add controllers, servoices
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialDiscountResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'discount_amount' => (float) ($this->resource['discount_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialExpenseSummaryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'category' => $this->resource['category'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialInvoiceResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? 0),
|
||||
'invoice_number' => $this->resource['invoice_number'] ?? null,
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'parent_name' => $this->resource['parent_name'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
'balance' => (float) ($this->resource['balance'] ?? 0),
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'issue_date' => $this->resource['issue_date'] ?? null,
|
||||
'due_date' => $this->resource['due_date'] ?? null,
|
||||
'created_at' => $this->resource['created_at'] ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialPaymentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'paid_amount' => (float) ($this->resource['paid_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialRefundResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'invoice_id' => (int) ($this->resource['invoice_id'] ?? 0),
|
||||
'school_year' => $this->resource['school_year'] ?? null,
|
||||
'total_refunded' => (float) ($this->resource['total_refunded'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialReimbursementSummaryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'total_amount' => (float) ($this->resource['total_amount'] ?? 0),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialReportResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'selectedYear' => $this->resource['selectedYear'] ?? null,
|
||||
'dateFrom' => $this->resource['dateFrom'] ?? null,
|
||||
'dateTo' => $this->resource['dateTo'] ?? null,
|
||||
'schoolYears' => $this->resource['schoolYears'] ?? [],
|
||||
'invoices' => FinancialInvoiceResource::collection($this->resource['invoices'] ?? []),
|
||||
'payments' => FinancialPaymentResource::collection($this->resource['payments'] ?? []),
|
||||
'paymentBreakdown' => $this->resource['paymentBreakdown'] ?? [],
|
||||
'paymentTotals' => $this->resource['paymentTotals'] ?? [],
|
||||
'refunds' => FinancialRefundResource::collection($this->resource['refunds'] ?? []),
|
||||
'expenses' => FinancialExpenseSummaryResource::collection($this->resource['expenses'] ?? []),
|
||||
'reimbursements' => FinancialReimbursementSummaryResource::collection($this->resource['reimbursements'] ?? []),
|
||||
'discounts' => FinancialDiscountResource::collection($this->resource['discounts'] ?? []),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Finance;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class FinancialUnpaidParentResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
||||
'parent_name' => $this->resource['parent_name'] ?? null,
|
||||
'email' => $this->resource['email'] ?? null,
|
||||
'total_invoice' => (float) ($this->resource['total_invoice'] ?? 0),
|
||||
'total_balance' => (float) ($this->resource['total_balance'] ?? 0),
|
||||
'total_discount' => (float) ($this->resource['total_discount'] ?? 0),
|
||||
'remaining_installments' => (int) ($this->resource['remaining_installments'] ?? 0),
|
||||
'installment_amount' => (float) ($this->resource['installment_amount'] ?? 0),
|
||||
'type' => $this->resource['type'] ?? null,
|
||||
'total_paid' => (float) ($this->resource['total_paid'] ?? 0),
|
||||
'payment_count' => (int) ($this->resource['payment_count'] ?? 0),
|
||||
'has_installment' => (int) ($this->resource['has_installment'] ?? 0),
|
||||
'next_installment' => $this->resource['next_installment'] ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user