Compile function Delete_INVOICE_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given INVOICE record from the MSSQL database.
	
	History
	-------
	09/21/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys = "INV_NO":@VM:SQL_Format(Field(Key, "*", 1), "STR")

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

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

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

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

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

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

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

Return Ans
