Order Shipping – Freight Reminder


This code follows on from post <a href=”http://www.jordanfey.co.uk/?p=183“>Getting decimal fields from a different IDO and adding them together</a> – you may wish to view this first

The Requirement

Our despatch department occasionally mis-ship and have to ship an item back, but as standard the form does not show the freight, and has no warning that the user may wish to credit this. As a result the customer often ends up with 2 credit notes, 1 for the lines we have shipped back and 1 for the freight which has been done separately.  The objective for this code is to notify the despatch user that there is an issue that they may need to consider.

It uses a message box with a yes no response to allow the user to choose whether they wish to action it or not.  I could of actually just added the values of the field together however this will not always be the case in similar code so for the point of consistency I have compared it

Syteline 8 Order Shipping

Order Shipping Screen With Freight

Syteline 8 Order Shipping Message

Error message to alert users they may wish to amend freight

 

The Code

Function PBTI_CrReturnCheck() As Integer

Dim s As IWSIDOCollection = ThisForm.PrimaryIDOCollection
Dim countreturn As Integer = 0
Dim responce As wsMsgBoxResult = Nothing

For n As Integer = 0 To ThisForm.PrimaryIDOCollection.GetNumEntries – 1
If ThisForm.PrimaryIDOCollection.CurrentItem(“UbCrReturn”).Value = “1” Then
countreturn = countreturn + 1
End If
Next

If countreturn > 0 And ThisForm.Components(“PBTI_EDIT_Freight”).Value <> “0” Then
responce = Application.ShowMessage(“Freight Has Been Charged!” _
& vbCrLf & vbCrLf _
& “A total of ” & ThisForm.Components(“PBTI_EDIT_Freight”).Value & ” has been charged against this order.” _
& “If you are shipping the complete order back, you will probably need to reverse this freight as well ” _
& vbCrLf & vbCrLf _
& “To do this click Actions –> Edit Freight Charges” _
& vbCrLf & vbCrLf _
& “Would you Like To Continue processing ? (No will allow you to change the freight)” _
, MsgBoxStyle.YesNo)
If responce = wsMsgBoxResult.wsNo Then
Return -1
Else
Return 0
End If
Else
Return 0
End If

End Function

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.