Loading...
Loading...
Use when designing, implementing, or reviewing an embedded accounting engine inside a SaaS, ERP, POS, inventory, payroll, school, clinic, NGO, marketplace, or mobile-money-heavy system. Covers one append-only general ledger, one LedgerPostingService write path, mapping-layer account resolution, IFRS/IFRS for SMEs defaults, subledger tagging, idempotent posting, reversing journals, period locks, audit trails, report projections, and accounting integrity tests.
npx skill4agent add peterbamuhigire/skills-web-dev accounting-engineaccounting-finance-controllergl_entriesjournal_linesjournal_entriesLedgerPostingService::post(JournalEntry $entry)JournalEntrySales / Stock / Payroll / Assets / Payments / Grants
-> business event
-> account resolver and posting-rule mapper
-> JournalEntry value object
-> LedgerPostingService::post()
-> append-only journal_entries + journal_lines
-> reports, subledgers, tax schedules, dashboardschart_of_accountsaccount_mappingsjournal_entriesjournal_linesaccounting_periodsposting_rule_versionsaccounting_integrity_runsaccounting_audit_logtenant_idfranchise_id<?php
declare(strict_types=1);
final readonly class JournalEntry
{
public function __construct(
public int $tenantId,
public string $idempotencyKey,
public DateTimeImmutable $entryDate,
public string $sourceType,
public string $sourceId,
public string $description,
/** @var list<JournalLine> */
public array $lines,
public ?int $reversesJournalId = null,
) {}
}
final readonly class JournalLine
{
public function __construct(
public int $accountId,
public string $currency,
public string $debitMinor,
public string $creditMinor,
public array $dimensions = [],
) {}
}
interface LedgerPostingService
{
public function post(JournalEntry $entry): PostedJournal;
}journal_entry_idRecord SaleReceive PaymentBuy StockRun PayrollRecord Asset PurchaseReceive GrantClose Monthchart-of-accounts-templatesinventory-costingpayroll-postings-ugandafixed-assets-and-depreciationmulticurrency-and-fxmulti-tenant-saas-architectureapi-design-firstadvanced-testing-strategyreferences/posting-engine-contract.mdreferences/integrity-invariants.md