37241-vm/db/migrations/007_add_expense_accounts.php
2026-01-03 08:40:36 +00:00

39 lines
1.5 KiB
PHP

<?php
require_once __DIR__ . '/../../db/config.php';
try {
$pdo = db();
$accounts = [
// Expense Accounts
['5000', 'Operating Expenses', 'EXPENSE', null],
['5100', 'Salaries & Wages Expense', 'EXPENSE', '5000'],
['5110', 'Employer SSNIT Expense', 'EXPENSE', '5000'],
['5200', 'Utilities Expense', 'EXPENSE', '5000'],
['5300', 'Teaching Materials Expense', 'EXPENSE', '5000'],
['5400', 'Maintenance & Repairs Expense', 'EXPENSE', '5000'],
['5500', 'Transport Expense', 'EXPENSE', '5000'],
['5600', 'Feeding Expense', 'EXPENSE', '5000'],
['5700', 'Administrative Expenses', 'EXPENSE', '5000'],
['5800', 'Professional Fees Expense', 'EXPENSE', '5000'],
// Liability Accounts
['2100-AP', 'Accounts Payable', 'LIABILITY', null],
['2200-SALARIES', 'Salaries Payable', 'LIABILITY', null],
['2210-SSNIT', 'SSNIT Payable', 'LIABILITY', null],
['2220-TAX', 'Income Tax (PAYE) Payable', 'LIABILITY', null]
];
$stmt = $pdo->prepare("INSERT IGNORE INTO accounts (account_code, account_name, account_type, parent_account_code) VALUES (?, ?, ?, ?)");
foreach ($accounts as $account) {
$stmt->execute($account);
echo "Inserted account: {$account[0]} - {$account[1]}" . PHP_EOL;
}
echo "Migration 007 completed successfully." . PHP_EOL;
} catch (PDOException $e) {
die("Migration 007 failed: " . $e->getMessage());
}