Accounting Module
The Accounting module provides comprehensive financial management capabilities for your business. Built on double-entry bookkeeping principles, it ensures accurate financial records and regulatory compliance.
Features Overview
📊 Core Accounting
- Chart of Accounts: Flexible account structure with categories and subcategories
- Double-Entry Bookkeeping: Automatic debit/credit balancing
- Multi-Currency Support: Handle transactions in multiple currencies
- Fiscal Year Management: Configure custom fiscal periods
💰 Transaction Management
- Journal Entries: Manual and automated journal entry creation
- Transaction Tracking: Complete audit trail for all financial activities
- Batch Processing: Handle multiple transactions efficiently
- Recurring Entries: Automate repetitive transactions
📈 Financial Reporting
- Balance Sheet: Real-time financial position statements
- Income Statement: Profit and loss reporting
- Cash Flow Statement: Track cash movements
- Trial Balance: Verify account balances
- Custom Reports: Build tailored financial reports
🔧 Integration Features
- ERP Integration: Seamlessly connects with Sales, Purchasing, and Inventory
- API Access: Programmatic access to accounting data
- Export/Import: Data exchange with external accounting systems
- Audit Trail: Complete transaction history and modifications
Installation
Add the accounting module to your Obelaw ERP:
bash
composer require obelaw/erp-accounting
php artisan twist:migrateQuick Setup
1. Configure Chart of Accounts
php
use Obelaw\ERP\Addons\Accounting\Models\Account;
// Create account categories
Account::create([
'code' => '1000',
'name' => 'Assets',
'type' => 'asset',
'parent_id' => null,
]);
Account::create([
'code' => '1100',
'name' => 'Current Assets',
'type' => 'asset',
'parent_id' => 1, // Assets account ID
]);2. Create Journal Entries
php
use Obelaw\ERP\Addons\Accounting\Models\JournalEntry;
use Obelaw\ERP\Addons\Accounting\Models\JournalLine;
// Create a sales transaction
$entry = JournalEntry::create([
'reference' => 'SALE-001',
'description' => 'Product sale to customer',
'date' => now(),
'total_debit' => 1000.00,
'total_credit' => 1000.00,
]);
// Add journal lines
JournalLine::create([
'journal_entry_id' => $entry->id,
'account_id' => $cashAccount->id,
'debit' => 1000.00,
'credit' => 0,
]);
JournalLine::create([
'journal_entry_id' => $entry->id,
'account_id' => $salesAccount->id,
'debit' => 0,
'credit' => 1000.00,
]);Integration with Other Modules
Sales Integration
Automatically create accounting entries from sales transactions:
php
// In your sales order
use Obelaw\ERP\Addons\Accounting\Services\AccountingService;
class SalesOrder extends Model
{
public function postToAccounting()
{
AccountingService::createSalesEntry([
'amount' => $this->total,
'customer_id' => $this->customer_id,
'reference' => $this->number,
'date' => $this->date,
]);
}
}Purchasing Integration
Handle vendor transactions automatically:
php
// Purchase order accounting
AccountingService::createPurchaseEntry([
'amount' => $this->total,
'vendor_id' => $this->vendor_id,
'reference' => $this->number,
'date' => $this->date,
]);Admin Interface
The accounting module integrates seamlessly with Filament Admin:
php
use Obelaw\ERP\Addons\Accounting\Filament\Clusters\AccountingCluster;
// Add to your admin panel
class CustomAccountingResource extends Resource
{
protected static ?string $cluster = AccountingCluster::class;
// Your resource configuration
}Available Resources
- Accounts Management: Create and organize your chart of accounts
- Journal Entries: Record and view all financial transactions
- Reports Dashboard: Access built-in financial reports
- Settings: Configure accounting preferences and defaults
Reports and Analytics
Financial Statements
Generate comprehensive financial reports:
php
use Obelaw\ERP\Addons\Accounting\Services\ReportService;
// Balance Sheet
$balanceSheet = ReportService::balanceSheet([
'date' => '2024-12-31',
'format' => 'detailed'
]);
// Income Statement
$incomeStatement = ReportService::incomeStatement([
'start_date' => '2024-01-01',
'end_date' => '2024-12-31',
'comparison' => 'previous_year'
]);
// Cash Flow
$cashFlow = ReportService::cashFlow([
'period' => 'monthly',
'year' => 2024
]);Custom Analytics
Build custom financial analytics:
php
// Account balances over time
$accountBalances = Account::withBalances()
->whereBetween('date', [$startDate, $endDate])
->get();
// Revenue trends
$revenueTrends = JournalLine::whereHas('account', function($q) {
$q->where('type', 'revenue');
})
->selectRaw('MONTH(created_at) as month, SUM(credit) as revenue')
->groupBy('month')
->get();Configuration
Account Types
Configure supported account types:
php
// config/accounting.php
return [
'account_types' => [
'asset' => 'Assets',
'liability' => 'Liabilities',
'equity' => 'Equity',
'revenue' => 'Revenue',
'expense' => 'Expenses',
],
'currencies' => [
'default' => 'USD',
'supported' => ['USD', 'EUR', 'GBP'],
],
'fiscal_year' => [
'start_month' => 1, // January
],
];Best Practices
1. Account Structure
- Use a logical numbering system (e.g., 1000s for assets, 2000s for liabilities)
- Create parent accounts for better organization
- Keep account names descriptive but concise
2. Transaction Recording
- Always include meaningful descriptions
- Use consistent reference numbering
- Verify debits equal credits before posting
- Maintain proper supporting documentation
3. Reporting
- Run trial balance regularly to verify account integrity
- Generate financial statements monthly
- Review and reconcile accounts periodically
- Backup accounting data frequently
Next Steps
- Sales Module Integration - Connect sales to accounting
- Purchasing Module - Manage vendor transactions
- Reporting Dashboard - View financial analytics