DROP PROCEDURE OP_MostrarDetalleVentas
GO 
CREATE PROCEDURE OP_MostrarDetalleVentas 
(@SITEID	UD_IDSITE,
 @NBRDOCUMENT  UD_CORRELATIVOS,
 @NDECIMAL TINYINT) 
as
BEGIN

	DECLARE @DOCTYPEIDTICKET UD_DOCTYPEID
	SET @DOCTYPEIDTICKET =(SELECT DOCTYPEIDTICKET FROM OP_SETUP)

        Select sequence as Lin ,InvtidSku ,DESCRINVENTORY, 
                      SLSPRICESALE ,
                      PORCENTTAXIGV ,  
                      QTY,
                     TOTALPEN,                                                       
                     TOTALUSD,                                
                      ROUND((TOTALPEN/((PORCENTTAXIGV/100)+1)),@NDECIMAL) AS SUBTOTALPEN,
                      ROUND((TOTALUSD/((PORCENTTAXIGV/100)+1)),@NDECIMAL) AS SUBTOTALUSD,
                      TAXPEN,TAXUSD,PORCENTTAXIGV,NBRTURN,NBRSIDE
                      from OP_SALESDET where DOCTYPEID=@DOCTYPEIDTICKET AND SITEID=@SITEID AND NBRDOCUMENT=@NBRDOCUMENT  order by sequence 
END
