DROP PROCEDURE ReporteDepositos
GO
CREATE PROCEDURE ReporteDepositos
(  @FECHA	CHAR(15),
   @SITEID	UD_IDSITE
)
AS
BEGIN
   DECLARE  @DATFECHA SMALLDATETIME
   DECLARE  @CADENA	VARCHAR(8000)

   SET @DATFECHA=CAST(RTRIM(LTRIM(@FECHA)) AS SMALLDATETIME)


   SET @CADENA= "SELECT D.SITEID,D.BATNBRDEPOSITSITE,D.DATEPROCE,D.SEQUENCE,D.CUSTIDSS,C.CUSTNAME," + 
		"D.DEPOSITPASSWORD,D.DATEDEPOSIT,D.CURYID,D.CURYRATE,D.TOTALPEN,D.TOTALUSD FROM OP_DEPOSITSITEDET AS D JOIN CUSTOMER AS C " +
		"ON D.CUSTIDSS=C.CUSTIDSS " +
		"WHERE DATEPROCE='" + RTRIM(LTRIM(CAST(@DATFECHA AS CHAR(100)))) + "' AND SITEID='" + @SITEID + "'"


   EXEC (@CADENA)
END 

