Sales order breakout v 6.5.13  Topic is solved

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

Sales order breakout v 6.5.13

Postby tonys » Thu Jan 21, 2016 10:08 am

Can you advise if the Debtors alternate account no field is available in the breakouts for Sales Orders.
tonys
Occasional Contributor
Occasional Contributor
 
Posts: 26
Joined: Tue Mar 04, 2008 10:25 am

Re: Sales order breakout v 6.5.13  Topic is solved

Postby Scott.Pearce » Wed Jan 27, 2016 2:14 pm

Not natively, but you could use this to resolve it (taken from viewtopic.php?f=14&t=23):

Code: Select all
Function GetAltAccountNo(DatabaseObject, DebtorID, AltAccountNo, rtnErrorModule, rtnErrorString)

   GetAltAccountNo= True

    With DatabaseObject
        rHwnd = .StatementOpen(.ConnectionJiwaRead1, , , 1)
       
        If GetAltAccountNo= True Then
            SQL = "SELECT TOP 1 AltAccountNo " _
                & "FROM DB_Main " _
                & "WHERE " _
                & "DebtorID = " & .FormatChar(DebtorID)
           
            If .ExecuteSelect(CInt(rHwnd), SQL, True) = True Then
                If .FetchRow(CInt(rHwnd)) = True Then
                  AltAccountNo= .GetData(CInt(rHwnd), 1)
                Else
                  rtnErrorModule = "GetAltAccountNo"
                  rtnErrorString = "Inventory item with DebtorID of '" & DebtorID & "' not found."
                  GetInventoryWeight = False           
                End If
            Else
              rtnErrorModule = "Database.ExecuteSelect"
              rtnErrorString = .ErrorMessage
              GetAltAccountNo= False
            End If
            .StatementClose CInt(rHwnd)
        End If
   End With
End Function


The above function can be placed in the "Sales Order Entry Form Loaded" breakout, after the End Sub. The call can be made from any other sales order breakout, and would look something like this:

Code: Select all
If GetAltAccountNo(SalesOrderObject.Database, SalesOrderObject.DebtorID, altAccountNo, errorModule, errorMessage) = False Then
   MsgBox errorModule& vbCrLf & errorMessage
Else
   MsgBox altAccountNo
End If
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: Sales order breakout v 6.5.13

Postby tonys » Thu Feb 04, 2016 11:26 am

Thanks Scott,

I may need a little help as it want the invoice email breakout to pick up this field.

Regards

Tony
tonys
Occasional Contributor
Occasional Contributor
 
Posts: 26
Joined: Tue Mar 04, 2008 10:25 am


Return to Technical / Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron