ekmungai / eloquent-ifrs

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

Get $clientReceipt->id, and $clientInvoice->id, #142

Closed AAUU-Ansari closed 12 months ago

AAUU-Ansari commented 1 year ago

'transaction_id' => $clientReceipt->id, 'cleared_id' => $clientInvoice->id,

Dear how to get $clientReceipt->id, and $clientInvoice->id, ids

AAUU-Ansari commented 1 year ago

When we assign the receipt to partially clear the specific Invoice

ekmungai commented 1 year ago

Hi Ansari, I'm afraid i do not understand your question

AAUU-Ansari commented 12 months ago

Hi @ekmungai When we take payment from a client for an invoice. then for that transaction and assignment, we need cleared_id and cleared_type. how and where we get it.

like this.

echo $clientInvoice->clearedAmount; //0: Currently the Invoice has not been cleared at all echo $clientReceipt->balance; //50: The Receipt has not been assigned to clear any transaction

$assignment = Assignment::create([ 'assignment_date'=> Carbon::now(), 'transaction_id' => $clientReceipt->id, 'cleared_id' => $clientInvoice->id, -------???????????? 'cleared_type'=> $clientInvoice->clearedType, ---------------????????? 'amount' => 50, ]);

echo $clientInvoice->clearedAmount; //50 echo $clientReceipt->balance; //0: The Receipt has been assigned fully to the Invoice

hicka commented 12 months ago

Hi, you should be able to get the client invoice id after creating a client invoice.

You should also get a client receipt id after creating a client receipt.

This below example was taken from the readme.

`$clientReceipt = ClientReceipt::create([ 'account_id' => $clientAccount->id, 'date' => Carbon::now(), 'narration' => "Example Client Payment", ]);

$clientReceiptLineItem = LineItem::create([ 'account_id' => $bankAccount->id, 'narration' => "Part payment for Client Invoice", 'quantity' => 1, 'amount' => 50, ]);

$clientReceipt->addLineItem($clientReceiptLineItem); $clientReceipt->post(); `

You can then use the $clientReceipt->id to create the assignment.

Please have a look at the readme and see if you can get it to work.

AAUU-Ansari commented 12 months ago

I know but one thing. can we get unpaid invoice ids

On Mon, 24 Jul 2023, 9:47 pm F. Ahmed, @.***> wrote:

Hi, you should be able to get the client invoice id after creating a client invoice.

You should also get a client receipt id after creating a client receipt.

This below example was taken from the readme.

`$clientReceipt = ClientReceipt::create([ 'account_id' => $clientAccount->id, 'date' => Carbon::now(), 'narration' => "Example Client Payment", ]);

$clientReceiptLineItem = LineItem::create([ 'account_id' => $bankAccount->id, 'narration' => "Part payment for Client Invoice", 'quantity' => 1, 'amount' => 50, ]);

$clientReceipt->addLineItem($clientReceiptLineItem); $clientReceipt->post(); `

You can then use the $clientReceipt->id to create the assignment.

Please have a look at the readme and see if you can get it to work.

— Reply to this email directly, view it on GitHub https://github.com/ekmungai/eloquent-ifrs/issues/142#issuecomment-1648259429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZJ3QZFN2OLKHTXW47XHOR3XR2RJLANCNFSM6AAAAAA2Q5OGFQ . You are receiving this because you authored the thread.Message ID: @.***>

hicka commented 12 months ago

I think what you're referring to is the Account Schedule.


$transactions = new AccountSchedule($clientAccount, $currency)->getTransactions();

Once you have the client account you should be able to run an account schedule report.

The outstanding Transactions of the Account can be retrieved by calling the Account Schedule

AAUU-Ansari commented 12 months ago

Thanks, @hicka