Purchase Cycle

The purchase cycle is the process by which the entity acquires goods and services either as raw material for production or for the purpose of administration. This example will demonstrate A Cash Purchase and a Refund (for goods returned for instance).

Cash Purchase

A Cash Purchase requires a Bank Account.

use IFRS\Models\Account;

$bankAccount = Account::create([
    'name' => "Sales Account",
    'account_type' => Account::BANK,
]);

use IFRS\Transactions\CashPurchase;

$cashPurchase = CashPurchase::create([
    'account_id' => $bankAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Cash Purchase",
]);

For the line item of the Cash purchase, we’ll need an Expense Account, Input VAT Account and an input VAT object

use IFRS\Models\Account;

$opexAccount = Account::create([
    'name' => "Operations Expense Account",
    'account_type' => Account::OPERATING_EXPENSE,
]);

$inpuVatAccount = Account::create([
    'name' => "Input VAT Account",
    'account_type' => Account::CONTROL,
]);

use IFRS\Models\Vat;

$inputVat = Vat::create([
    'name' => "Standard Input Vat",
    'code' => "I",
    'account_id' => $inpuVatAccount->id,
    'rate' => 10,
]);

Now we can create the line item, attach it to the cash purchase and post it.

use IFRS\models\LineItem;

$cashPurchase->addLineItem(
	LineItem::create([
		'vat_id' => $inputVat->id,
		'account_id' => $opexAccount->id,
		'description' => "Example Cash Purchase Line Item",
		'amount' => 100,
	])
)->post();

To further this example, lets assume that we returned 50 (excluding ) worth of the goods we purchased. We need to effect a refund from the supplier, and we do so by making a journal entry to reverse the original transaction by that much.


use IFRS\Transactions\JournalEntry;

$journalEntry = JournalEntry::create([
    'account_id' => $opexAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example refund for goods returned",
]);

$journalEntry->addLineItem(
	LineItem::create([
		'account_id' => $bankAccount->id,
	    'description' => "Example refund for goods returned",
	    'amount' => 55,
	])
)->post();

Checking the results of the above transactions would yield the following balances.


print_r([
	$bankAccount->closingBalance(),
	$opexAccount->closingBalance(),
	$inputVat->closingBalance(),
]);

// printout
Array
(
    [0] => -55 // 100 + 10 (vat) - 55 (refund)
    [1] => 50
    [2] => 5
)

Credit Purchases

The Credit Purchase cycle follows the same process as the Credit Sales cycle only replacing the Receivable and Operating Revenue with a Payable and Expense accounts respectively.