COMPILE FUNCTION obj_WO_Verify(Method,Parms)
/*
	Methods for the Work Order Verify (WO_VERIFY) table
    
	12/15/2004 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    Create(WoNo,Step,PSNo,OrgWO)			;* Create new WO Step entry 	
   
	
*/


DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey, Get_Property
DECLARE SUBROUTINE  Set_Status, Msg, obj_Tables, Send_Dyn, ErrMsg

$INSERT WO_VERIFY_EQU


ErrTitle = 'Error in Stored Procedure "obj_WO_Verify"'
ErrorMsg = ''

IF NOT(ASSIGNED(Method))	THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms))		THEN Parms = ''

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

Result = ''

BEGIN CASE
	CASE Method = 'Create'			; GOSUB Create
	
	CASE 1
		ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.'

END CASE

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

RETURN Result


* * * * * * *
Create:
* * * * * * *

RDSNo		= Parms[1,@RM]
WOVStatus	= Parms[COL2()+1,@RM]
WOVNotes	= Parms[COL2()+1,@RM]

IF NOT(ASSIGNED(RDSNo))			THEN ErrorMsg = 'Unassigned parameter "RDSNo" passed to routine. (':Method:')'
IF NOT(ASSIGNED(WOVStatus))		THEN ErrorMsg = 'Unassigned parameter "WOVStatus" passed to routine. (':Method:')'
IF NOT(ASSIGNED(WOVNotes))		THEN WOVNotes = ''

IF ErrorMsg NE '' OR RDSNo = '' OR WOVStatus = '' THEN RETURN

WOVerKey = NextKey('WO_VERIFY')

WOVerRec = ''
WOVerRec<WO_VERIFY_ENTRY_ID$>	= @USER4
WOVerRec<WO_VERIFY_ENTRY_DATE$> = Date()
WOVerRec<WO_VERIFY_RDS_ID$>		= RDSNo
WOVerRec<WO_VERIFY_STATUS$>		= WOVStatus

OtParms = 'WO_VERIFY':@RM:WOVerKey:@RM:@RM:WOVerRec
obj_Tables('WriteRec',OtParms)

Result = WOVerKey

RETURN


