COMPILE ROUTINE FIX_WO_MAT_QA(Dummy)
ROWDEF(CHARSTR)

DECLARE SUBROUTINE Send_Dyn,Send_Info, obj_WO_Log, Set_Status, RList, Btree.Extract, obj_WO_Mat_QA
DECLARE FUNCTION Get_Status, Set_Printer


$INSERT WO_MAT_QA_EQUATES
$INSERT WO_LOG_EQU
$INSERT RLIST_EQUATES

OPEN 'WO_MAT_QA' TO WOMatQAFile ELSE
	DEBUG 
	GOTO Bail
END




OPEN 'DICT.WO_MAT' TO DictVar ELSE
	DEBUG
	GOTO Bail
END


DEBUG

SelectSent = 'SELECT WO_MAT WITH REL_DTM > "4/29/2016 08:00" AND WITH QA_MET_STAGE = "" '


RLIST(SelectSent,TARGET_ACTIVELIST$,'','','')



IF Get_Status(errCode) THEN
	DEBUG
	GOTO Bail
END



Done = 0

FixCnt = 0


LOOP
	READNEXT WOMatKey ELSE Done = 1
UNTIL Done


	READ WOMatQARec FROM WOMatQAFile,WOMatKey  THEN
		QAMetStage = XLATE('WO_MAT',WOMatKey,'QA_MET_STAGE','X')
		
		*Send_Dyn(RecNo:' ':WOMatKey)
		DEBUG
		
	END ELSE
		FixCnt += 1
		
		WONo = WOMatKey[1,'*']
		CassNo = WOMatKey[COL2()+1,'*']
		
		obj_WO_Mat_QA('Create',WONo:@RM:CassNo)
		
		Send_Dyn(FixCnt:' ':WONo:' ':CassNo)
	END
REPEAT





GOTO Bail





/*
Equ WO_MAT_HOLD$                     To  34
Equ WO_MAT_HOT_LOT$                  To  35

Equ WO_MAT_REL_DTM$                  To  38
Equ WO_MAT_REL_BY$                   To  39

Equ WO_MAT_PROMISE_SHIP_DT$          To  61
Equ WO_MAT_NCR_KEYS$                 To  62
Equ WO_MAT_RX_DTM$                   To  63
Equ WO_MAT_RX_BY$                    To  64
*/



		

GOTO Bail




IF Get_Status(errCode) THEN DEBUG


* * * * * * *
Bail:
* * * * * * *

END
