ekmungai / eloquent-ifrs

Eloquent Double Entry Accounting with a focus on IFRS Compliant Reporting
MIT License
335 stars 68 forks source link

Recording other taxes and levies which are not VAT. #107

Closed kchizi closed 2 years ago

kchizi commented 2 years ago

Some transactions attract levies and other taxes other than VAT. One transaction can have multiple levies for example catering levy. I have tried recording transactions without VAT but seems like it is a constraint. The approach I took was to record the VAT and levy as separate line items but it seems that has also failed.

$journalEntry = JournalEntry::create([ 'account_id' => $clientAccount, 'date' => Carbon::now(), 'narration' => "Sale against invoice ".$transaction->invoice_no." ", 'credited' => false, // main account shouold be debited 'entity_id' => $business->entity_id, 'main_account_amount' => $transaction->final_total ]);

$journalEntry->addLineItem( LineItem::create([ 'account_id' => $subtax->tax_account_id, 'description' => $subtax->name." @ ".$subtax->amount, 'amount' => $taxamount*$quantity, 'entity_id' => $entity_id, // 'quantity' => $quantity, 'credited' => true ]) );

Kindly advice on how to go about this.

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (*****.ifrs_line_items, CONSTRAINT ifrs_line_items_vat_id_foreign FOREIGN KEY (vat_id) REFERENCES ifrs_vats (id)) (SQL: insert into ifrs_line_items (account_id, amount, entity_id, quantity, credited, updated_at, created_at) values (463, 250, 64, 1, 1, 2021-12-31 01:58:42, 2021-12-31 01:58:42))

kchizi commented 2 years ago

Just did a PR to fix this issue in the migration file removing vat_id in line items. Kindly merge

ekmungai commented 2 years ago

Hi @kchizi,

Actually the current master branch already has changes to address this issue by allowing for multiple taxes (VAT, Excise etc) per line item, so please stand by until its ready for release. Cheers, Edward

chrisbaswell commented 2 years ago

Any idea when you plan to make a new release with these changes?

ekmungai commented 2 years ago

@kchizi

I've been on a small break to deal with some personal issues, but I should back at work starting April so probably a month or so after that.

Cheers, Edward

kchizi commented 2 years ago

Pushed a fix for this and did a pr by the way

ekmungai commented 2 years ago

Hi @chrisbaswell and @kchizi,

I'm happy to announce that version 5 of the package is now available.

Cheers, Edward