DROP PROCEDURE OP_CARD_MONTDelProc
GO
CREATE PROCEDURE OP_CARD_MONTDelProc
(
    @SITEID        UD_IDSITE,
    @CARDID        char(2),
    @DATEPOS       UD_FECHA,
    @DATEPROCE     UD_FECHA 
)
AS
BEGIN
    BEGIN TRAN

    DELETE
    FROM OP_CARD_MONT	
    WHERE SITEID=@SITEID AND CARDID=@CARDID AND DATEPOS=@DATEPOS AND DATEPROCE=@DATEPROCE

    IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'Error Eliminando en OP_CARD_MONT '
        ROLLBACK TRAN
        RETURN(1)
    
    END

    DELETE
    FROM OP_CARD_MONTSALES
    WHERE SITEID=@SITEID AND CARDID=@CARDID AND DATEPROCE=@DATEPROCE

    IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'Error Eliminando en OP_CARD_MONTSALES '
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

END

