Well, I guess we need to start by reading in the job to which we want to add labour:
- Code: Select all
Dim myJobNo as string = "0000000001"
Dim _Job As JiwaFinancials.Jiwa.JiwaServiceManager.Job = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaFinancials.Jiwa.JiwaServiceManager.Job)(nothing)
'Read based on JobNo
_Job.Find(JiwaApplication.IJiwaNavigable.ReadModes.Actual, "JobNo", myJobNo, "" )
Now we select the task on the job to which we want to add labour:
- Code: Select all
_Job.SelectedTaskNo = 2
Now we construct the new labour line and add it to the job:
- Code: Select all
Dim myPartNo as string = "11802"
Dim myStartDate as date = "2015-08-01"
Dim myStartTime as date = "13:00"
Dim newLabourLine As New JiwaFinancials.Jiwa.JiwaServiceManager.LabourLine
newLabourLine.Inventory.ReadRecordFromPartNo(myPartNo)
'Set your values
newLabourLine.StartTime = startDate.ToShortDateString + " " + startTime.ToString("HH:mm")
newLabourLine.BillingTime = 2
_Job.Tasks(_Job.SelectedTaskNo).LabourLines.Add(newLabourLine)
Finally, we save:
- Code: Select all
_Job.Save
Always re-read after saving to make sure you have the latest data in the business logic:
- Code: Select all
_Job.Read(_Job.RecID)
This is all off the top of my head, so let me know if anything doesn't work for you.