Document archived check – Doc-Trak


The requirement
We use Lake Companies Doc-Trak to archived documents processed through our system, but for new customer orders and rmas our auditors need to be able to find the original email / PDF we recieved. We use the drag and drop utility to store these but users are only human and sometimes forget.

As such I have written the following code that fires when ever the Rma status is changed or they try to send an Rma verification to the customer that checks there is an attached doc-trac record and if not, generates an error message to the user, reverts the Chang if appropriate and does not process the Rma verification if appropriate. Because this is a new mandatory requirement I have also set it to only fire if the Rma date is greater than the date the change has been implemented, this means that people processing historic rmas without access to the original customer document, do not get stopped from processing as they need to.

The code

Function PBTI_DocTrakTest() As Integer

‘Application.ShowMessage(ThisForm.GetCurrentComponentName)
Dim responsedoctrakrecords As LoadCollectionResponseData

responsedoctrakrecords = Me.IDOClient.LoadCollection( _
“TABLE!lc_dt_map”, _
“filename”, _
“description = ‘RMA Related Document – Drag and Drop’ and value_1 = ‘” & ThisForm.PrimaryIDOCollection.CurrentItem(“RmaNum”).Value & “‘”, _
“description Desc”, 0)
Dim d As New Date(2013, 10, 23)
If (ThisForm.CurrentIDOCollection.CurrentItem(“rmauf_rms_rx_via”).Value = “Email” And _
ThisForm.CurrentIDOCollection.CurrentItem(“RmaDate”).GetValue(Of Date)() > d And _
responsedoctrakrecords.Items.Count = 0 And _
ThisForm.PrimaryIDOCollection.CurrentItem(“rmauf_rma_overstat”).Value <> “Raised”) _
Or _
(ThisForm.CurrentIDOCollection.CurrentItem(“rmauf_rms_rx_via”).Value = “Email” And _
ThisForm.CurrentIDOCollection.CurrentItem(“RmaDate”).GetValue(Of Date)() > d And _
responsedoctrakrecords.Items.Count = 0 _
And ThisForm.GetCurrentComponentName = “PBTI_But_RMAVerificationNew”) _
Then
Application.ShowMessage(“You have not added the customers request document to Doc-Trak, Please add this before trying to do the RMA Verification”, MsgBoxStyle.Critical)

If ThisForm.PrimaryIDOCollection.CurrentItem(“rmauf_rma_overstat”).Modified Then
ThisForm.Components(“PBTI_COMBO_OverallStatus”).Value = ThisForm.Components(“PBTI_EDIT_OverallStatusOriginalValue”).Value
End If
Return -1
Else
Return 0
End If

End Function

Code thoughts

I am not particularly proud of this code, it is not eligant but it is functional and fit for purpose.

I am fairly sure that somewhere within the mongoose framework there is a way to find the value of a property pre modification as long as the modification has not been saved, but as yet I have not found it.

The interesting thing within this code is the Ido collection loaded is actually a sql table, not an Ido. Lake company use custom load methods which I am not that familiar with yet so have opted to do a lookup directly instead.

Leave a comment

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