Page 1 of 1

Sales order breakout v 6.5.13

PostPosted: Thu Jan 21, 2016 10:08 am
by tonys
Can you advise if the Debtors alternate account no field is available in the breakouts for Sales Orders.

Re: Sales order breakout v 6.5.13  Topic is solved

PostPosted: Wed Jan 27, 2016 2:14 pm
by Scott.Pearce
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

Re: Sales order breakout v 6.5.13

PostPosted: Thu Feb 04, 2016 11:26 am
by tonys
Thanks Scott,

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

Regards

Tony