Eloquent Double Entry Accounting with a focus on IFRS Compliant Reporting

News

May 13th, 2020

laravel-money.jpg

Eloquent IFRS is a package by Edward Mungai that provides “double-entry accounting with a focus on International Financial Reporting Standards (IFRS) compliant reporting.”

According to the documentation’s introduction, this package can help you generate compliant reports:

The Eloquent IFRS package gives any Laravel application or Lumen API the ability to generate a comprehensive set of financial reports by providing an embedded double-entry bookkeeping system.

The Accounting objects are created with a consistent and fluent interface, allowing seamless integration with the Business objects of the parent application.

Here’s a high-level example from the readme, which demonstrates some of the models:

1use IFRS\Models\Account;
2use IFRS\models\LineItem;
3 
4$bankAccount = new Account([
5 'name' => "Sales Account",
6 'account_type' => Account::BANK,
7])->save();
8 
9// Intermediate save does not record the transaction in the Ledger
10$cashSale = new CashSale([
11 'account_id' => $bankAccount->id,
12 'date' => Carbon::now(),
13 'narration' => "Example Cash Sale",
14])->save();
15 
16// This posts the Transaction to the Ledger
17$cashSaleLineItem = new LineItem([
18 'vat_id' => $outputVat->id,
19 'account_id' => $revenueAccount->id,
20 'vat_account_id' => $salesVatAccount->id,
21 'description' => "Example Cash Sale Line Item",
22 'quantity' => 1,
23 'amount' => 100,
24])->save();
25 
26$cashSale->addLineItem($cashSaleLineItem);
27$cashSale->post();

Here’s an example of an income report (profit and loss):

1use IFRS\Reports\IncomeStatement;
2 
3$incomeStatement = new IncomeStatement(
4 "2020-01-01", // Report start date
5 "2020-12-31", // Report end date
6)->getSections();// Fetch balances from the ledger and store them internally
7 
8/**
9* this function is only for demonstration and
10* debugging use and should never be called in production
11*/
12dd($incomeStatement->toString());
13 
14Example Company
15Income Statement
16For the Period: Jan 01 2020 to Dec 31 2020
17 
18Operating Revenues
19 Operating Revenue 200 (100 cash sales + 100 credit sales)
20 
21Operating Expenses
22 Operating Expense 100 (cash purchase)
23 ---------------
24Operations Gross Profit 100
25 
26Non Operating Revenues
27 Non Operating Revenue 0
28 ---------------
29Total Revenue 100
30 
31Non Operating Expenses
32 Direct Expense 0
33 Overhead Expense 0
34 Other Expense 0
35 ---------------
36Total Expenses 0
37 ---------------
38Net Profit 100
39 ===============

All of the above examples come from the project readme, and is only a sample of what the package provides. The details of the package (and IFRS reporting) are quite intricate, and you should consult the full documentation.

I find this package unique because it’s created by a “finance guy turned developer.” It’s fantastic to see professionals in other industries turn to Laravel to develop ideas.

You can learn more about this package, get full installation instructions, and view the source code on GitHub at ekmungai/eloquent-ifrs.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.