DROP PROCEDURE OP_MostrarDetalleVentasCSTOREProc 
GO
CREATE PROCEDURE OP_MostrarDetalleVentasCSTOREProc 
(@CORRELATIVO  INTEGER,
 @NDECIMAL TINYINT) 
as
BEGIN
      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
                      from tmp_op_salesdetCSTORE where CORRNBR=@CORRELATIVO  order by sequence 
END
GO

EXEC OP_MostrarDetalleVentasCSTOREProc 2,2
select * from tmp_op_salesdetCSTORE 

