You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.5 KiB
93 lines
3.5 KiB
<?php
|
|
|
|
namespace Database\Seeders\Accounting;
|
|
|
|
use App\Domains\Accounting\Enums\Ledger\AccountBalance;
|
|
use App\Domains\Accounting\Enums\Ledger\AccountClassification;
|
|
use App\Domains\Accounting\Models\ChartOfAccount;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
/**
|
|
* Seeder to populate initial baseline Chart of Accounts for campus payment operations.
|
|
*/
|
|
class ChartOfAccountSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds for baseline accounts.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Create parent Revenue header account (COA 41000 - Pendapatan Operasional)
|
|
$revenueParent = ChartOfAccount::updateOrCreate(
|
|
['code' => '41000'],
|
|
[
|
|
'name' => 'Pendapatan Operasional',
|
|
'classification' => AccountClassification::REVENUE,
|
|
'normal_balance' => AccountBalance::CREDIT,
|
|
'parent_id' => null,
|
|
]
|
|
);
|
|
|
|
// Define child sub-account definitions array matching campus operational ledger
|
|
$accounts = [
|
|
[
|
|
// Asset account for Bank BNI VA Receipts
|
|
'code' => '1102',
|
|
'name' => 'Bank BNI Penerimaan VA',
|
|
'classification' => AccountClassification::ASSET,
|
|
'normal_balance' => AccountBalance::DEBIT,
|
|
'parent_id' => null,
|
|
],
|
|
[
|
|
// Asset account for Student Receivables
|
|
'code' => '1105',
|
|
'name' => 'Piutang Mahasiswa',
|
|
'classification' => AccountClassification::ASSET,
|
|
'normal_balance' => AccountBalance::DEBIT,
|
|
'parent_id' => null,
|
|
],
|
|
[
|
|
// Sub-COA 41101: New Student Registration Fee (Pendapatan Pendaftaran Maba)
|
|
'code' => '41101',
|
|
'name' => 'Pendapatan Pendaftaran Maba-Reguler',
|
|
'classification' => AccountClassification::REVENUE,
|
|
'normal_balance' => AccountBalance::CREDIT,
|
|
'parent_id' => $revenueParent->id,
|
|
],
|
|
[
|
|
// Sub-COA 41200: Re-registration Fee (Pendapatan Kemahasiswaan / Daftar Ulang)
|
|
'code' => '41200',
|
|
'name' => 'Pendapatan Kemahasiswaan / Daftar Ulang',
|
|
'classification' => AccountClassification::REVENUE,
|
|
'normal_balance' => AccountBalance::CREDIT,
|
|
'parent_id' => $revenueParent->id,
|
|
],
|
|
[
|
|
// Sub-COA 41301: Regular Tuition Fee (Pendapatan UKT-Reguler)
|
|
'code' => '41301',
|
|
'name' => 'Pendapatan UKT-Reguler',
|
|
'classification' => AccountClassification::REVENUE,
|
|
'normal_balance' => AccountBalance::CREDIT,
|
|
'parent_id' => $revenueParent->id,
|
|
],
|
|
[
|
|
// Sub-COA 4201: Contra Revenue for Discounts (Diskon & Potongan Tagihan)
|
|
'code' => '4201',
|
|
'name' => 'Diskon PMDK & Potongan Tagihan',
|
|
'classification' => AccountClassification::REVENUE,
|
|
'normal_balance' => AccountBalance::DEBIT, // Debit offsets credit revenue
|
|
'parent_id' => null,
|
|
],
|
|
];
|
|
|
|
// Loop and upsert each account entry into database
|
|
foreach ($accounts as $account) {
|
|
ChartOfAccount::updateOrCreate(
|
|
['code' => $account['code']],
|
|
$account
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|