Posting S/O payments to cashbook  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Posting S/O payments to cashbook

Postby pricerc » Wed Sep 30, 2020 8:53 am

If I'm capturing C/C payments for a sales order, and I want to keep the sales order open (i.e. not process the order), but also want the payment to make it to the cashbook immediately, can I just use SalesOrder.ProcessPayments()? And what are the caveats, if any?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Posting S/O payments to cashbook  Topic is solved

Postby Scott.Pearce » Wed Sep 30, 2020 11:43 am

can I just use SalesOrder.ProcessPayments()?

Absolutely. That's exactly what it's for - process payments but not the sales order.

caveats

You will probably want to have some control over the changing of a sales order that has had payments processed against it? Otherwise, nothing else comes to mind.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Posting S/O payments to cashbook

Postby pricerc » Wed Sep 30, 2020 4:50 pm

Ok,

related question. How do I calculate the outstanding balance on an part-paid, unprocessed order that has items on backorder that need to be paid for in advance ?

I actually have two very different customers for whom these apply, but for quite different reasons.

I have a part-payment recorded and posted (perhaps a deposit or a laybuy) on said unprocessed order. The payment can be cash or credit card.

If I'm on snapshot #1, I figure (with help from the POS plugin) that the amount outstanding can probably be calculated as:

Code: Select all
( Lines.Sum(l => l.LineValueIncTax) ) - ( Payments.Where(p => p.AuthorisationStatus == Authorised || p.AuthorisationStatus == NoAuthorisationNeeded ).Sum(p => p.AmountPaid) )


But what if I'm on a later snapshot?

Does this same logic still work and/or is there another method that I'm missing?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Posting S/O payments to cashbook

Postby Mike.Sheen » Wed Sep 30, 2020 5:08 pm

The figure on the bottom right of the payments tab - "Balance" - is the total amount owing, minus already made payments, and includes backordered amounts

SalesOrder_BO_With_Payment.png


That is calculated as:

Code: Select all
FreightAmount = SalesOrder.SalesOrderHistorys((SalesOrder.SelectedHistoryNo)).CartageCharge1.IncGSTAmount + SalesOrder.SalesOrderHistorys((SalesOrder.SelectedHistoryNo)).CartageCharge2.IncGSTAmount + SalesOrder.SalesOrderHistorys((SalesOrder.SelectedHistoryNo)).CartageCharge3.IncGSTAmount

Balance = SalesOrder.SalesOrderLines.OrderedIncGSTTotal + FreightAmount) - SalesOrder.SalesOrderPayments.TotalPayments


I believe that this is what you want - but your way is virtually the same - it's just we've already got a property doing that summing for you.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Posting S/O payments to cashbook

Postby pricerc » Wed Sep 30, 2020 6:09 pm

will
Code: Select all
SalesOrder.SalesOrderPayments.TotalPayments
cope with (i.e. ignore), e.g. declined CC payments?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Posting S/O payments to cashbook

Postby Mike.Sheen » Wed Sep 30, 2020 6:16 pm

pricerc wrote:will
Code: Select all
SalesOrder.SalesOrderPayments.TotalPayments
cope with (i.e. ignore), e.g. declined CC payments?


Nope.

So, now after reading your linq more closely I see you omit those - our TotalPayments does not and is obviously flawed.

Would you like a job fixing bugs?

Your calculation works, and would work with all snapshots - whilst payments do have a snapshot property to associate them with one, all payments for all snapshots would be included in your query, and SalesOrderLines.OrderedIncGSTTotal is always going to be the same, across all snapshots - so those combined will give you the outstanding balance (you may need to add freight charges as well like in my example).
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Posting S/O payments to cashbook

Postby pricerc » Fri Feb 05, 2021 10:57 am

I like to avoid necro'ing threads, but this is related.

If I've got a payment posted to cashbook from an unprocessed sales order, the cashbook transaction is unallocated - fair enough, because there's no invoice.

If I process the sales order later, is there a (convenient) way to create an allocation for the pre-payment?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron