Double Entry Accounting

Acme sells computers and tablets. Initially, the Acme account sheet contains the following accounts with the associated numbers and balances:

Account #

Account

Balance

Assets

100

checking

 $                50,000.00

101

equipment

 $                10,000.00

102

inventory

 $                50,000.00

103

receivables

 $                               -  

Liabilities

200

credit card

 $               (10,000.00)

Expenses

300

utilities

 $                               -  

301

payroll

 $                               -  

302

depreciation

 $                               -  

Revenue

400

laptop sales

 $                               -  

401

tablet sales

 $                               -  

Equity

500

investments

 $            (100,000.00)

TOTAL

 $                               -  

Acme actually sells three things: laptops, tablets, and shares of stock. The account sheet shows that $100K of shares were sold to investors. Half of this money was put into Acme's checking account, the other half was used to buy inventory (i.e., laptop and tablet components). In addition, Acme bought $10K worth of equipment (furniture, machines, vehicles, etc.), which it paid for with its credit card.

The most basic accounting formula is:

equity = assets – liabilities

Equity is the value of the company. So this formula says that the value of a company, what you could get if you sold it today, is the sum of its assets less its debts. Investments and the credit card debt have been entered as negative numbers. These will need to be paid out if we sell the company.

In a monthly ledger we would record the above transactions as follows:

$100K from investments to checking
$50K from checking to inventory
$10K from credit card to equipment

A transaction has three parts:

amount from source account to receiving account

The amount is withdrawn from the source account and deposited into the receiving account.

Let's sell some products and pay some salaries:

Acme Account Sheet

Account #

Account

Balance

Assets

100

checking

 $                40,000.00

101

equipment

 $                   9,000.00

102

inventory

 $                10,000.00

103

receivables

 $                   5,000.00

Liabilities

200

credit card

 $               (10,000.00)

Expenses

300

utilities

 $                               -  

301

payroll

 $                10,000.00

302

depreciation

 $                   1,000.00

Revenue

400

laptop sales

 $                20,000.00

401

tablet sales

 $                15,000.00

Equity

500

investments

 $            (100,000.00)

TOTAL

 $                               -  

Now the account sheet shows the result of executing the following transactions:

$20K from inventory to laptop sales
$15K from inventory to tablet sales
$5K from inventory to receivables
$1K from equipment to depreciation
$10K from checking to payroll

Acme sold $20K worth of laptops and $20K worth of tablets. However, the tablet customer only paid $15K up front and owes $5K.

Acme also paid $10K in salaries from the checking account.

Profit-Loss Statement

Every quarter Acme issues a profit-loss statement, which is the blue part of the account sheet. The quarterly profit is:

profit = revenue – expenses = $35K - $11K = $26K

Now let's move $30K of revenue into the checking account and pay off $5K as dividends to our investors:

Acme Account Sheet

Account #

Account

Balance

Assets

100

checking

 $                70,000.00

101

equipment

 $                   9,000.00

102

inventory

 $                10,000.00

103

receivables

 $                   5,000.00

Liabilities

200

credit card

 $               (10,000.00)

Expenses

300

utilities

 $                               -  

301

payroll

 $                10,000.00

302

depreciation

 $                   1,000.00

Revenue

400

laptop sales

 $                               -  

401

tablet sales

 $                               -  

Equity

500

investments

 $               (95,000.00)

TOTAL

 $                               -  

Balance Sheet

Acme also issues an annual balance sheet, which computes:

(assets + liabilities) – (equity + revenue - expenses) = $94K - $10K + $95K - $11K = $0.

Terminology

A good model of accounting would probably require consultation with an actual CPA. There are lots of inaccuracies in my explanation.

Actual accounting terminology is confusing. Depending on the type of account, withdrawing may be called a credit or debit. Similarly a deposit might be called a credit or debit.

Assets are different from expenses in that assets can be sold and their cost (less the depreciation) can be recovered. Money spent on payroll or utility bills can never be recovered.

Project

Research double entry accounting on your own. Create and implement a domain model. Create a test suite to verify that your implementation is correct.

References

A lot of this stuff can be found on Internet sites purporting to explain these concepts for dummies, but apparently these are pretty smart dummies. Here's one such site:

https://www.business-case-analysis.com/double-entry-system.html

Fowler's analysis patterns book has a reusable model for accounting:

Fowler; Analysis Patterns: Reusable Object Models; Addison-Wesley; 1997.

My notes are based on information obtained from the following site:

https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html