This is a double breakout.
It sets some simple START time and END time defaults to be the same (current date/time) on a new labour line - this is often what we use as a default.
It is especially aware of support packs and treats these as a special case - If support packs are detected for a debtor this will TICK support pack to be enabled/used by default. If support packs are NOT detected for this debtor, it will UNTICK support pack use - this can often save timely mistakes regarding use of support packs and for most purposes pick the required option for most debtors - i.e. If the debtor is a support pack debtor - auto-enforce the use of support packs, if the debtor is NOT a support pack clent, then auto-enforce the use of regular labour lines. If support packs are detected, it pops up a warning about the support pack being used and regarding remaining hours on the applicable support packs.
SPECIAL WARNING/CAUTION NOTES:-
This breakout is aware of Credit notes - as credit notes also use this - hence the check for ElapsedTime being greater than 0.
Another caveat is with SPOVERFLOW (a special rate for Support Pack clients that need more labour on the line that are currently available on their remaining support pack hours) in the case below, my SPOVERFLOW item is called SPOVERFLOW - ensure this Inventory code/item exists (all in upper case) if you are pasting the code below.
from Jiwa :-
JIWA - Service Manager - Maintenance
Record Menu - Utilities - Manage Breakouts
Left-Click "Task Labour Added Before" Breakout
add this one line at the top :-
- Code: Select all
'
' Task Labour Added Before
'
Dim SPString
StaffID = JobObject.Tasks(TaskKey).AssignedToStaffID
If (ElapsedTime > 0 And LabourTypeID <> SPOVERFLOWID) Then
EndTime = StartTime
ElapsedTime = 0
BillingTime = 0
If ((JobObject.RemainingNormalSupportPackHours = 0) And (JobObject.RemainingSpecialSupportPackHours = 0)) Then
ProcessSupportPack = False
Else
ProcessSupportPack = True
SPString = ""
If (JobObject.RemainingNormalSupportPackHours > 0) Then
SPString = SPString + VBCrLf + "NOTE:- NORMAL Support Pack Hours exist for this client"
If ((JobObject.RemainingSpecialSupportPackHours > 0) And (JobObject.Tasks(TaskKey).SpecialSupportPackName = "")) Then
SPString = SPString + VBCrLf + "SPECIAL Support Packs ALSO Exist for this Client" + VBCrLf + "and have NOT been Selected from the MAIN Tab"
End If
Else
If (JobObject.Tasks(TaskKey).SpecialSupportPackName = "") Then
SPString = SPString + VBCrLf + "A Special Support Pack MUST Be Selected on MAIN Tab !!!"
End If
End If
If (JobObject.Tasks(TaskKey).SpecialSupportPackName <> "") Then
SPString = SPString + VBCrLf + "Special Support Pack Selected : " + JobObject.Tasks(TaskKey).SpecialSupportPackName
End If
MsgBox "Normal Hours Left = " + CStr(JobObject.RemainingNormalSupportPackHours) + VBCrLF + "Special Hours Left = " + CStr(JobObject.RemainingSpecialSupportPackHours) + SPString
End If
End If
End Sub
Left-Click "Form Loaded" Breakout
add this one line at the top :-
- Code: Select all
'
' Form Loaded
'
SPOVERFLOWID = ReadSPOverFlowID(JobObject.Database, "SPOVERFLOW")
End Sub
Dim SPOVERFLOWID
Public Function ReadSPOverFlowID(Database, PartNo)
Dim SQL
Dim rHwnd
ReadSPOverFlowID = ""
With Database
rHwnd = .StatementOpen(.ConnectionRead1, , , 1)
SQL = "SELECT InventoryID FROM IN_Main WHERE PartNo = " & .FormatChar(PartNo)
If .ExecuteSelect(CInt(rHwnd), SQL, True) = True Then
If .FetchRow(CInt(rHwnd)) = True Then
ReadSPOverFlowID = .GetData(CInt(rHwnd), 1)
Else
MsgBox "Error Reading POverFlowID - PartNo " & PartNo & " not found."
End If
Else
MsgBox "Error Reading POverFlowID " & .ErrorMessage
End If
.StatementClose CInt(rHwnd)
End With
End Function
dont forget to leave the "End Sub" line at the end.
Click OK, Click Close, Close Service Manager and ReOpen Service Manager.
/Roy Adams