Purchase Order Line - TaxID - Version 149  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Purchase Order Line - TaxID - Version 149

Postby neil.interactit » Tue Feb 16, 2016 11:24 am

Hi,

I have a client upgrading (from 115) to 149. A plugin is failing as property TaxID no longer exists. I have looked through the associated Line class, but cannot work out your intention for deriving this information now. Can you point me in the right direction?

Code: Select all
    Private Sub CreateCreditorPurchase(purchaseOrder As PurchaseOrder)
        Dim poLines As IEnumerable(Of Line) = From poLine As Line In purchaseOrder.Lines Where poLine.UserDefinedString1.Length >= 8 And poLine.UserDefinedString2 = "Yes" And poLine.UserDefinedString3 = ""
        If poLines.Count() = 0 Then Throw New System.Exception("There are no purchase order lines to process.")

        Dim closePurchaseOrder = GetCustomField("ClosePurchaseOrder").ToString() = "True"
        Dim creditorInvoiceNumber = GetCustomField("CreditorInvoiceNumber").ToString()
        Dim creditorInvoiceDate = IIf(GetCustomField("CreditorInvoiceDate") Is Nothing, System.DateTime.Today, GetCustomField("CreditorInvoiceDate"))
        Dim total As Decimal = poLines.Sum(Function(x) x.LineTotal)

        Dim purchasesUi = JiwaApplication.Manager.Instance.FormFactory.CreateForm(Of JiwaCRBatchTXUI.CreditorPurchases)()

        purchasesUi.InitialReadMode = JiwaApplication.IJiwaNavigable.ReadModes.None
        purchasesUi.Start()
        purchasesUi.CRBatchTransObject.CreateNew()
        purchasesUi.CRBatchTransObject.Description = String.Format("PO{0}/{1}/{2}/{3}/{4}", purchaseOrder.OrderNo, purchaseOrder.Reference.Trim, GetCustomField("AuthorisedBy"), purchaseOrder.Staff.DisplayName.Trim, total)
        purchasesUi.CRBatchTransObject.BatchType = CreditorBatchTrans.CreditorBatchTypes.Creditor_Purchase

        Dim item = New CRBatchTranLine()
        item.Creditor.ReadRecord(purchaseOrder.Creditor.CreditorID)
        item.HomeTransAmount = total
        item.RemitNo = creditorInvoiceNumber
        purchasesUi.CRBatchTransObject.TransLines.Add(item)
        ' NOTE: If we try to set ReceiptDate BEFORE adding it to the collection it doesn't stick
        item.ReceiptDate = creditorInvoiceDate
        Dim dispersalNum = 1
        For Each poLine As Line In poLines
            Dim dispersal = New CRBatchDispersal()
            If dispersalNum = 1 Then
                ' The adding of a line to the batch automatically also adds a dispersal for the line - all lines must have at least one disperals, so we adjust that with:
                dispersal = item.Dispersals(1)
            Else
                ' And now if we choose to, we can add another dispersal
                item.Dispersals.Add(dispersal)
            End If
            ' NOTE: If we try to set the dispersed amount BEFORE adding it to the collection, then we have issues (this is bug)
            dispersal.OtherLedger.ReadRecordFromAccountNo(poLine.UserDefinedString1.Substring(0, 8))
            dispersal.TaxRate.Read(poLine.TaxID)
            dispersal.HomeDispersedAmount = poLine.LineTotal - poLine.TaxAmount
            dispersal.Remark = String.Format("{0} - {1} (x{2:N0})", poLine.PartNo, poLine.Description, poLine.Quantity)
            dispersalNum += 1
        Next

        purchasesUi.CRBatchTransObject.Save()
        For Each poLine As Line In poLines
            poLine.UserDefinedString3 = purchasesUi.CRBatchTransObject.BatchNumber
        Next

        If closePurchaseOrder Then purchaseOrder.OrderStatus = Workflow.Status.Closed
        purchaseOrder.Save()
    End Sub

(TaxID is about 14 lines up from the bottom)

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

Re: Purchase Order Line - TaxID - Version 149  Topic is solved

Postby Scott.Pearce » Fri Feb 19, 2016 3:37 pm

The purchase order line class now uses an entity for it's tax rate. It used to use a string, representing the TaxID. So, the line:

Code: Select all
dispersal.TaxRate.Read(poLine.TaxID)


needs to change to:

Code: Select all
dispersal.TaxRate.Read(poLine.TaxRate.RecID)


I was asked to look at this as a matter of priority. In future, if it truly is urgent you should lodge a case as they can be escalated to high-priority for a fast turn-around and you’ll get a response within a few hours. We try our best to tend to outstanding questions on these forums, but as it is a pure cost centre it often has to take a back seat to other work we are engaged in – so we can’t give a SLA like response times.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Purchase Order Line - TaxID - Version 149

Postby neil.interactit » Mon Feb 22, 2016 8:31 am

Thanks Scott.

Yeah, client is upgrading to 149 tomorrow, so from my tech perspective pretty urgent. I'll push the lodging a case approach up the chain at my end for future. Thanks again.

Cheers,
Neil.
neil.interactit
Kohai
Kohai
 
Posts: 232
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 6 guests