Function SVC_Dates(Service, Param1, Param2, Param3, Param4, Param5, Param6, Param7)

/******************************************************************************************************** 

    This program is proprietary and is not to be used by or disclosed to others, nor is it to
    be copied without written permission.

    Name        :   SVC Dates

    Description :   Used to convert dates to the appointment decimal format

    Tags		:	[SRP]

    Parameters  :

    History (Date, Initials, Notes)
        01/18/10    fjt     Initial development
        05/31/10	fjt		Added additional ICONV service

********************************************************************************************************/

$insert SRP_APP_INSERTS
$insert SERVICE_INSERT

Begin Case
	Case Service _eqc "ADD"		; GoSub Add
	Case Service _eqc "ICONV"	; GoSub Iconv
	Case Service _eqc "DEC"		; GoSub Decimal
End Case

Return Ans


!----- SERVICES -----------------------------------------------------------------------------------------


Add:
	// Vars
	Date	 = Param1
	Time	 = Param2
	Duration = Param3
	
	// Convert to decimal
	Val = Oconv(Date, "D") :" ": Oconv(Time, "MT")
	Val = Iconv(Val, "DT")
	
	// Add the duration
	Val += Duration
	
	// Revert back to individual iconv values
	Val = Oconv(Val, "DT")
	Ans<1> = Iconv(Val[1,11], "D")
	Ans<2> = Iconv(Field(Val, " ", 4), "MT") + 0
return


Iconv:
	Val = Param1
	Val = Oconv(Val, "DT")
	Ans<1> = Iconv(Val[1,11], "D")
	Ans<2> = Iconv(Field(Val, " ", 4), "MT") + 0
return


Decimal:
	// Vars
	Date	 = Param1
	Time	 = Param2
	Duration = Param3
	
	// Convert to decimal
	Val = Oconv(Date, "D") :" ": Oconv(Time, "MT")
	Ans = Iconv(Val, "DT")
return
