if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paInsLogTmsAju]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[paInsLogTmsAju]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paInsLogTmsAjuProd]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[paInsLogTmsAjuProd]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE paInsLogTmsAju @pmNumero INT,@pmIdCia CHAR(2),@pmFecha SMALLDATETIME,@pmNumDocAjs INT,@pmNumDocAjf INT
,@pmEstadoProc INT,@pmTimeSys SMALLDATETIME,@pmIdUsuario VARCHAR(11),@pmNombre VARCHAR(50)
 AS 
 INSERT INTO LogTmsAju (Numero,IdCia,Fecha,NumDocAjs,NumDocAjf,EstadoProc,TimeSys,IdUsuario,Nombre)
 VALUES (@pmNumero,@pmIdCia,@pmFecha,@pmNumDocAjs,@pmNumDocAjf,@pmEstadoProc,@pmTimeSys,@pmIdUsuario,@pmNombre)

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE paInsLogTmsAjuProd @pmNumero INT,@pmIdCia CHAR(2),@pmItem INT,@pmIdProducto VARCHAR(16),@pmDescripProd VARCHAR(150),@pmTipFac VARCHAR(3),@pmFactura INT,@pmIdCiaFac CHAR(2)
,@pmNumGuia INT,@pmIdCiaGuia CHAR(2),@pmCdTanque VARCHAR(4),@pmCantFact DECIMAL(14,4),@pmCantGuia DECIMAL(14,4),@pmgalsbruto DECIMAL(14,4),@pmgalsneto DECIMAL(14,4),@pmTemperatura DECIMAL(14,4)
,@pmDensidad DECIMAL(14,4),@pmReferencia VARCHAR(50),@pmObservacion VARCHAR(250),@pmNitCliente VARCHAR(16),@pmCdAgencia VARCHAR(16)
 AS 
 INSERT INTO LogTmsAjuProd (Numero,IdCia,Item,IdProducto,DescripProd,TipFac,Factura,IdCiaFac,NumGuia,IdCiaGuia,CdTanque,CantFact,CantGuia,galsbruto,galsneto,Temperatura,Densidad,Referencia,Observacion,NitCliente,CdAgencia)
 VALUES (@pmNumero,@pmIdCia,@pmItem,@pmIdProducto,@pmDescripProd,@pmTipFac,@pmFactura,@pmIdCiaFac,@pmNumGuia,@pmIdCiaGuia,@pmCdTanque,@pmCantFact,@pmCantGuia,@pmgalsbruto,@pmgalsneto
,@pmTemperatura,@pmDensidad,@pmReferencia,@pmObservacion,@pmNitCliente,@pmCdAgencia)

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

