DROP PROCEDURE OP_SALESPOINTSETTINGinsProc
GO
CREATE PROCEDURE OP_SALESPOINTSETTINGInsProc
(
    @SALESPOINT            UD_PTOVTA,
    @TERMINALNAME          varchar(25),
    @ENDDATEACT            UD_FECHA,
    @SERIALNUMBER          char(16),
    @STKTICKFAC            bit,
    @STKTICKBOL            bit,
    @CURYID                UD_CURYID,
    @STKLOADSALE           bit,
    @STKPRINTERFAC         bit,
    @STKPRINTEDBOL         bit,
    @TYPEDISPFAC           UD_TYPE_DISP_SALIDA,
    @DISPFAC               UD_DISP_SALIDA,
    @TYPEDISPBOL           UD_TYPE_DISP_SALIDA,
    @DISPBOL               UD_DISP_SALIDA,
    @TYPEDISPNC            UD_TYPE_DISP_SALIDA,
    @DISPNC                UD_DISP_SALIDA,
    @TYPEDISPND            UD_TYPE_DISP_SALIDA,
    @DISPND                UD_DISP_SALIDA,
    @TYPEDISORDER          UD_TYPE_DISP_SALIDA,
    @DISPORDER             UD_DISP_SALIDA,
    @TYPEDISPTICKFAC       UD_TYPE_DISP_SALIDA,
    @DISPTICKFAC           UD_DISP_SALIDA,
    @NBRTICKFAC            UD_CORRELATIVOS,
    @TYPEDISPTICKBOL       UD_TYPE_DISP_SALIDA,
    @DISPTICKBOL           UD_DISP_SALIDA,
    @NBRTICKBOL            UD_CORRELATIVOS,
    @DISPDISPLAY           UD_DISP_SALIDA,
    @STKJUMPAUTOMAT        bit,
    @QTYJUMPAUTOMAT        tinyint,
    @STKHOTKEYS            bit,
    @STKDELETEDOC          bit,
    @BUSINESSTYPE          char(1),
    @SITEID                UD_IDSITE,
    @STKTOFORCEZ	   BIT,
    @PRINTERTYPEID	   CHAR(2)
)
AS
BEGIN
    BEGIN TRAN

    INSERT INTO OP_SALESPOINTSETTING(SALESPOINT,TERMINALNAME,ENDDATEACT,SERIALNUMBER,STKTICKFAC,STKTICKBOL,CURYID,
				     STKLOADSALE,NBRLOADSALE,STKPRINTERFAC,STKPRINTEDBOL,TYPEDISPFAC,DISPFAC,TYPEDISPBOL,
				     DISPBOL,TYPEDISPNC,DISPNC,TYPEDISPND,DISPND,TYPEDISORDER,DISPORDER,TYPEDISPTICKFAC,
				     DISPTICKFAC,NBRTICKFAC,TYPEDISPTICKBOL,DISPTICKBOL,NBRTICKBOL,DISPDISPLAY,STKSALESPOINTFAC,
 				     STKZETAOK,STKTURNOK,STKJUMPAUTOMAT,QTYJUMPAUTOMAT,STKHOTKEYS,STKDELETEDOC,BUSINESSTYPE,
				     SITEID,BATNBRSALES,STKTOFORCEZ,PRINTERTYPEID)
			      VALUES(@SALESPOINT,@TERMINALNAME,@ENDDATEACT,@SERIALNUMBER,@STKTICKFAC,@STKTICKBOL,@CURYID,
				     @STKLOADSALE,0,@STKPRINTERFAC,@STKPRINTEDBOL,@TYPEDISPFAC,@DISPFAC,@TYPEDISPBOL,
				     @DISPBOL,@TYPEDISPNC,@DISPNC,@TYPEDISPND,@DISPND,@TYPEDISORDER,@DISPORDER,@TYPEDISPTICKFAC,
				     @DISPTICKFAC,@NBRTICKFAC,@TYPEDISPTICKBOL,@DISPTICKBOL,@NBRTICKBOL,@DISPDISPLAY,0,
 				     0,0,@STKJUMPAUTOMAT,@QTYJUMPAUTOMAT,@STKHOTKEYS,@STKDELETEDOC,@BUSINESSTYPE,
				     @SITEID,0,@STKTOFORCEZ,@PRINTERTYPEID)


    IF (@@error!=0)
    BEGIN
        RAISERROR  20001 'Error actualizando en OP_SALESPOINTSETTING '
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

    RETURN(0)
END


SELECT * FROM OP_SALESPOINTSETTING