Multiple transaction create in accounts module using a laravel package

Viewed 143

I am creating a double entry accounts website in laravel, transaction sale, purchase and cash or bank etc. And i have build the api for an payment website using laravel accounting package eloquent-ifrs , When I create api for add transaction, these trancation is multiple types.

I have all trasaction created expect 'contra entry' transaction because in this transaction main account type not valid for double entry for line item post ledgers.example:-

$contraEntry = ContraEntry::create([
    'entity_id' => $entity,
    'account_id' => $bankAccount->id,
]);

$zeroVat  = DB::table('ifrs_vats')->where('entity_id', $entity)->whereNull('account_id')->first();

$assetAccount = Account::where('account_type', 'BANK')->first();

$contraEntryLineItem = LineItem::create([
    'vat_id' =>  $zeroVat->id,
    'account_id' => $assetAccount->id,
    'vat_account_id' =>  $zeroVat->account_id

In this example of code contraEntry transaction created after that lineItem not created. Because A Transaction Main Account cannot be one of the Line Item Accounts.

I have sent parameter account_id for create first ContraEntry::create([]) and required account_type = "BANK" and account_type= "BANK" required in LineItem::create([]) but exist account id can't be send showing this error.

If any one have already worked on this Eloquent IFRS laravel package or working on this "Eloquent IFRS" accounting package.Help me out I really appreciate.

0 Answers
Related