rp_utils::getnextnscheduledservicesbycontract

Returns the next N scheduled services for the contact number specified. This can include work orders as well.

o.getnextnscheduledservicesbycontract( tcContract , tnServices , tddate, tcWO_Type , tcLevel, tcCancelWO_Type, tcCursor)

Return Value

The number of services found


Parameters

tcContract
The contract number which holds the charge for which the next N scheduled services are
required.

tnServices
The number of scheduled services required

tddate
The date from which to retrieve services

tcWO_Type
The work order type of workorders which denote booked services

tcLevel
The level at which the above work order types must be at

tcCancelWO_Type
The work order type which represents cancelled work orders for scheduled
services. Leave blank if you don't cancel jobs with work orders

tcCursor
The name of the internal cursor to store the results

Remarks

This function is handy for getting a list of dates for which services have been booked for an
on-call contract. If a valid work order type and level are specified then this list of dates
includes services booked via work orders. If not then it only includes reqular scheduled services.
It assumes that there is only one charge assigned to the contract contract.

The structure of the list returned is as follows;

ChargeID c(10) - Charge ID of scheduled Charge
RouteID c(10) - Route ID of scheduled Charge
Work_Order c(10) - Work Order number if a work Order(empty if not)
route_num c(5) - Route number assigned
cycle c(3) - Cycle of route
date Date - Date of service


Example

o.GetNextNScheduledServicesbyContract("OC234234",12,{01/07/2003},"S","2","CAN","scheduled")

The above would;
1.	Retrieve the next 12 dates for the run assigned to the charge in contract "OC234234"
	as of the 01/07/2003
2.	Also inlcuded in this list would be the dates of any work orders of type "EDP" and level 2
	which contain the charge held in the contract "OC234234"
3.	Removed from this list would be any scheduled services which have been cancelled by creating
	a work order of type "CAN" on the same date and having the same contract number assigned
4.	Place this list in the internal cursor "Scheduled"
5.	Place the list in the collection o.oRows


To access the results you can either user the createresultxml function or access the data
directly.  For instance if you wanted to cancel any services for tomorrow you could
use something like the following

ldCancelDate = Date() + 1

For each orow in o.Rows
	ldDate = orow.date
	lcworkorder = orow.Work_Order
	
	If ldDate = ldCancelDate
		DO case
		Case not Empty(lcworkorder)
			this.cancelworkorderservice(lcworkorder, "Cancelled by IVR", "Do not perform service")
		Otherwise
			this.cancelscheduledservice("OC234234" , lddate, "S", "1", "Cancelled by IVR", "Do not perform service")
		EndCase
	EndIf
EndFor


See also:

Class rp_utils


Last Updated: 23/11/2005