ISAppointmentTemplateDPP.AddSlice

Description

Internal use only. This function adds a time slice to the appointment rule.

Syntax

object.AddSlice(aStart, aFinish[, aPriority = 0])

Part Attribute Type Description
object Required
The object always implements the ISAppointmentTemplateDPP interface
aStart In, Required
DateTime
The start time for the time slice
aFinish In, Required
DateTime
The finish time for the time slice
aPriority In, Optional
Default value is 0
int
The priority of the time slice

Return Value

ISAppointmentTimeSlice

Returns the added appointment rule time slice.

Example

Add a a time slice to the appointment rule and display some information about it.

'variable CurrentTemplate supports interface ISAppointmentTemplateDPP

Dim aCurrentTemplate
Dim aMessage
Dim aPOS
Dim aProvider
Dim i
Dim aAppointmentSlice
Dim aType
Dim aReason

set aCurrentTemplate = Profile.Variable("CurrentTemplate").Value

aMessage = "Appointment Template: " & vbNewLine &_
  "Date: " & aCurrentTemplate.Date & vbNewLine

if aCurrentTemplate.ProviderID > 0 then 
  set aProvider = Profile.LoadProviderById(aCurrentTemplate.ProviderID)
  aMessage = aMessage & "Provider: " & aProvider.FullName & vbNewLine                         
end if

aCurrentTemplate.AddSlice #19:00#, #21:00#, 100

if aCurrentTemplate.PosID > 0 then
  set aPOS = Profile.LoadProviderById(aCurrentTemplate.PosID)
  aMessage = aMessage & "POS: " & aPOS.Code & vbNewLine
end if

aMessage = aMessage & vbNewLine & vbNewLine &_
  "The number of the appointment time slices is " & aCurrentTemplate.SlicesCount 
for i = 0 to aCurrentTemplate.SlicesCount - 1
  set aAppointmentSlice = aCurrentTemplate.Slices(i)      
  aMessage = aMessage & vbNewLine &_
    "Def Reason Description: " & aAppointmentSlice.DefReasonDesc & vbNewLine &_
    "Def Reason ID: " & aAppointmentSlice.DefReasonID & vbNewLine &_
    "Duration: " & aAppointmentSlice.Duration & vbNewLine &_
    "Start: " & aAppointmentSlice.Start & vbNewLine &_
    "Finish: " & aAppointmentSlice.Finish & vbNewLine &_
    "Is Block Out: " & aAppointmentSlice.IsBlockOut & vbNewLine &_
    "Priority: " & aAppointmentSlice.Priority & vbNewLine &_ 
    "Def Type ID: " & aAppointmentSlice.DefTypeID & vbNewLine    
                                        
  if aAppointmentSlice.DefTypeID > 0 then                                                                     
    set aType = Profile.LoadShortCode(aAppointmentSlice.DefTypeID)
    aMessage = aMessage & "Def Type: " & aType.Description & vbNewLine
  end if

  if aAppointmentSlice.DefReasonID > 0 then                                                                     
    set aReason = Profile.LoadServiceByID(aAppointmentSlice.DefReasonID)
    aMessage = aMessage & "Def Reason Code: " & aReason.Code & vbNewLine
  end if  
next 
Profile.MsgBox(aMessage)  
Note: To run this macro go to Special > Appointments and select the same provider, POS and date as specified in the Appointment rule.

In Profile Client v8 on User Interface Appointment Rule Time Slices can be found in Maintain > Appointments > Rules > Open the appointment rule > Rule.

Version information

Added in v7.8.0