Sub BuildTruckInpection
Dim lk, inspid, inspidpost As Long
Inspection.Trk_Trl = 1
inspid = InspectDB.CheckCurrInspect4Pre( Inspection.Trk_Trl, 1) ' see what type to build (pre/post) -new or existing-(post only)
lk = GetInspEqp(1)' 1 truck - 2 trailer - lookup the inspection model
If inspid = 0 Then 'pre-trip - new once only
BuildNewInspect(lk, "CMast", "CDet", "WMast", "WDet" ) ' copy the "correct" inspection records from the WMast to CMast (defaults to current)
Inspection.InspItem = 4
LogColor(" built new pre-trip inspection",Colors.Green)
Else 'post trip - look for first time - or copy existing and add to it...
inspidpost = InspectDB.CheckCurrInspect4Pre(Inspection.Trk_Trl,3)
If inspidpost = 0 Then
' use pre-trip data for post
BuildPostTrip(inspid, True)
' will build a clean post on next line
' InspectDB.BuildNewInspect(lk, "CMast", "CDet", "WMast", "WDet" )
Inspection.InspItem = 2
LogColor(" built new post-trip inspection",Colors.Green)
Else
BuildPostTrip(inspidpost,False)
LogColor(" built existing post-trip inspection",Colors.Green)
End If
End If
End Sub