akaunting 3.0 (the last dance)

This commit is contained in:
Burak Civan
2022-06-01 10:15:55 +03:00
parent cead09f6d4
commit d9c0764572
3812 changed files with 126831 additions and 102949 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace App\Http\Resources\Banking;
use Illuminate\Http\Resources\Json\JsonResource;
class Account extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'company_id' => $this->company_id,
'type' => $this->type,
'name' => $this->name,
'number' => $this->number,
'currency_code' => $this->currency_code,
'opening_balance' => $this->opening_balance,
'opening_balance_formatted' => money($this->opening_balance, $this->currency_code, true)->format(),
'current_balance' => $this->balance,
'current_balance_formatted' => money($this->balance, $this->currency_code, true)->format(),
'bank_name' => $this->bank_name,
'bank_phone' => $this->bank_phone,
'bank_address' => $this->bank_address,
'enabled' => $this->enabled,
'created_from' => $this->created_from,
'created_by' => $this->created_by,
'created_at' => $this->created_at ? $this->created_at->toIso8601String() : '',
'updated_at' => $this->updated_at ? $this->updated_at->toIso8601String() : '',
];
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Resources\Banking;
use App\Http\Resources\Banking\Account;
use Illuminate\Http\Resources\Json\JsonResource;
class Reconciliation extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'company_id' => $this->company_id,
'account_id' => $this->account_id,
'started_at' => $this->started_at->toIso8601String(),
'ended_at' => $this->ended_at->toIso8601String(),
'closing_balance' => $this->closing_balance,
'closing_balance_formatted' => money($this->closing_balance, setting('default.currency'), true)->format(),
'reconciled' => $this->reconciled,
'created_from' => $this->created_from,
'created_by' => $this->created_by,
'created_at' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
'account' => new Account($this->account),
];
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Http\Resources\Banking;
use App\Http\Resources\Banking\Account;
use App\Http\Resources\Common\Contact;
use App\Http\Resources\Setting\Category;
use App\Http\Resources\Setting\Currency;
use Illuminate\Http\Resources\Json\JsonResource;
class Transaction extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'company_id' => $this->company_id,
'type' => $this->type,
'account_id' => $this->account_id,
'paid_at' => $this->paid_at->toIso8601String(),
'amount' => $this->amount,
'amount_formatted' => money($this->amount, $this->currency_code, true)->format(),
'currency_code' => $this->currency_code,
'currency_rate' => $this->currency_rate,
'document_id' => $this->document_id,
'contact_id' => $this->contact_id,
'description' => $this->description,
'category_id' => $this->category_id,
'payment_method' => $this->payment_method,
'reference' => $this->reference,
'parent_id' => $this->parent_id,
'split_id' => $this->split_id,
'attachment' => $this->attachment,
'created_from' => $this->created_from,
'created_by' => $this->created_by,
'created_at' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
'account' => new Account($this->account),
'category' => new Category($this->category),
'currency' => new Currency($this->currency),
'contact' => new Contact($this->contact),
];
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Resources\Banking;
use Illuminate\Http\Resources\Json\JsonResource;
class Transfer extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
$expense_transaction = $this->expense_transaction;
$income_transaction = $this->income_transaction;
return [
'id' => $this->id,
'company_id' => $this->company_id,
'from_account' => $expense_transaction->account->name,
'from_account_id' => $expense_transaction->account->id,
'to_account' => $income_transaction->account->name,
'to_account_id' => $income_transaction->account->id,
'amount' => $expense_transaction->amount,
'amount_formatted' => money($expense_transaction->amount, $expense_transaction->currency_code, true)->format(),
'currency_code' => $expense_transaction->currency_code,
'paid_at' => $expense_transaction->paid_at ? $expense_transaction->paid_at->toIso8601String() : '',
'created_from' => $this->created_from,
'created_by' => $this->created_by,
'created_at' => $this->created_at ? $this->created_at->toIso8601String() : '',
'updated_at' => $this->updated_at ? $this->updated_at->toIso8601String() : '',
];
}
}