Compile function Delete_WM_OUT_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given WM_OUT record from the MSSQL database.
	
	History
	-------
	05/10/2012    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys  = "WO_NO"       :@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "PROC_STEP_NO":@VM:SQL_Format(Field(Key, "*", 2), "INT"):@FM
Keys := "OUT_CASS_NO" :@VM:SQL_Format(Field(Key, "*", 3), "INT")

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

!! Delete records from MV tables first !!

// WM_OUT_THICK_MIN_ALL
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_THICK_MIN_ALL", Keys)
end

// WM_OUT_MET_TEST
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_MET_TEST", Keys)
end

// WM_OUT_SLOT
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_SLOT", Keys)
end

// WM_OUT_NCR_KEYS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_NCR_KEYS", Keys)
end

// WM_OUT_INV_WH
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_INV_WH", Keys)
end

// WM_OUT_HOLD_HISTORY
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT_HOLD_HISTORY", Keys)
end

// WM_OUT
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WM_OUT", Keys)
end

Return Ans
