Navigating from CR_BatchPayLine to CR_BatchTranLine  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Navigating from CR_BatchPayLine to CR_BatchTranLine

Postby neil.interactit » Wed Aug 01, 2018 1:13 pm

Hi guys,

I'm stuck on this. From the "Creditor Cheque/EFT Payment" form, in need to access the "Creditor Purchase" LINE ITEM associated with a specific payment LINE ITEM.

In the database, it looks like there's a line by line association between CR_BatchPayLines and CR_Trans, but only an overall batch association between CR_Trans and CR_BatchTranLines, making it impossible to traverse from a payment CR_BatchPayLinesID back to it's originating purchase ReceiptLineID.

Please refer to the attached spreadsheet for an illustration.

Alternatively, in code, I am working with a
Code: Select all
foreach (clsPayLineInvoice paymentLine in creditor.InvoicePaymentLines)
loop, but haven't been able to spot how to navigate from the clsPayLineInvoice to the associated purchase line item.

Can you tell me what I'm missing, or advise?

Cheers,
Neil.
Attachments
CR_BatchPayLines-CR_BatchTranLines.xlsx
(13.69 KiB) Downloaded 82 times
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: Navigating from CR_BatchPayLine to CR_BatchTranLine  Topic is solved

Postby Scott.Pearce » Wed Aug 01, 2018 1:48 pm

You are correct, there is *not* a very solid linkage between the 2 lines you are interested in, and the business logic objects are a bit old and decrepit.

Here's the best I reckon you can do:

Starting with the clsPayLineInvoices line, I would use it's CRTransID property to do a read from CR_Trans - I would read in InvRemitNo, DiscountedAmount, and SourceID from the CR_Trans table.

Using the SourceID, I would instantiate a JiwaCRBatchTX.CreditorBatchTrans object and read the batch using the SourceID. Now I have the batch.

I would now iterate through the lines on the JiwaCRBatchTX.CreditorBatchTrans object, looking for a match on CRBatchTranLine.RemitNo = InvRemitNo and CRBatchTranLine.HomeTransAmount = DiscountedAmount. When a match is found you have your payment line.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Navigating from CR_BatchPayLine to CR_BatchTranLine

Postby neil.interactit » Wed Aug 01, 2018 2:45 pm

Thanks Scott.

Yep, that pretty much what I've been doing - I was doing this in SQL, but same idea. The client recently put through a batch of 50 line items all "July Rent" often with common rent amounts and my query failed to distinguish. They seem to be OK with making invoice number unique, so I might add a plugin to enforce this.

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 17 guests

cron