ALTER TABLE LogMudConc ADD TarifSeguro DECIMAL(14,4) DEFAULT(0) NOT NULL,CodTarSeg VARCHAR(4)
GO
ALTER TABLE  LogTraManifInt ADD DescripUnid VARCHAR(500)
GO 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paInsLogMudConc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 DROP PROCEDURE [dbo].[paInsLogMudConc]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paInsLogTraManifInt]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 DROP PROCEDURE [dbo].[paInsLogTraManifInt]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paQryLogMudConc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 DROP PROCEDURE [dbo].[paQryLogMudConc]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paUpLogMudConc]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 DROP PROCEDURE [dbo].[paUpLogMudConc]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[paUpLogTraManifInt]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 DROP PROCEDURE [dbo].[paUpLogTraManifInt]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[paInsLogMudConc] @pmId VARCHAR(5),@pmItem INT,@pmIdConcepto VARCHAR(4),@pmDescripcion VARCHAR(500),@pmValorTotal MONEY,@pmTarifaIva DECIMAL(14,4),@pmTipoConc VARCHAR(10),@pmTipoRubro VARCHAR(20)
,@pmTipoReg INT,@pmCdCuenta VARCHAR(16),@pmNitTercero VARCHAR(16),@pmReferencia VARCHAR(50),@pmNumDocRef VARCHAR(20),@pmCodTarIva VARCHAR(4),@pmRazonSocial VARCHAR(250),@pmConcepto VARCHAR(250),@pmTarifSeguro DECIMAL(14,4),@pmCodTarSeg VARCHAR(4)
 AS 
 INSERT INTO LogMudConc (Id,Item,IdConcepto,Descripcion,ValorTotal,TarifaIva,TipoConc,TipoRubro,TipoReg,CdCuenta,NitTercero,Referencia,NumDocRef,CodTarIva,RazonSocial,Concepto,TarifSeguro,CodTarSeg)
 VALUES (@pmId,@pmItem,@pmIdConcepto,@pmDescripcion,@pmValorTotal,@pmTarifaIva,@pmTipoConc,@pmTipoRubro,@pmTipoReg,@pmCdCuenta,@pmNitTercero,@pmReferencia,@pmNumDocRef,@pmCodTarIva,@pmRazonSocial,@pmConcepto,@pmTarifSeguro,@pmCodTarSeg)
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[paUpLogMudConc] @pmId VARCHAR(5),@pmItem INT,@pmIdConcepto VARCHAR(4),@pmDescripcion VARCHAR(500),@pmValorTotal MONEY,@pmTarifaIva DECIMAL(14,4),@pmTipoConc VARCHAR(10),@pmTipoRubro VARCHAR(20)
,@pmTipoReg INT,@pmCdCuenta VARCHAR(16),@pmNitTercero VARCHAR(16),@pmReferencia VARCHAR(50),@pmNumDocRef VARCHAR(20),@pmCodTarIva VARCHAR(4),@pmRazonSocial VARCHAR(250),@pmConcepto VARCHAR(250),@pmTarifSeguro DECIMAL(14,4),@pmCodTarSeg VARCHAR(4)
 AS 
 UPDATE LogMudConc SET IdConcepto=@pmIdConcepto,Descripcion=@pmDescripcion,ValorTotal=@pmValorTotal,TarifaIva=@pmTarifaIva,TipoConc=@pmTipoConc,TipoRubro=@pmTipoRubro,TipoReg=@pmTipoReg,CdCuenta=@pmCdCuenta
,NitTercero=@pmNitTercero,Referencia=@pmReferencia,NumDocRef=@pmNumDocRef,CodTarIva=@pmCodTarIva,RazonSocial=@pmRazonSocial,Concepto=@pmConcepto,TarifSeguro=@pmTarifSeguro,CodTarSeg=@pmCodTarSeg
 WHERE Id=@pmId AND Item=@pmItem
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[paQryLogMudConc] @pmId VARCHAR(5),@pmItem INT
 AS 
 SELECT Id,Item,IdConcepto,Descripcion,ValorTotal,TarifaIva,TipoConc,TipoRubro,TipoReg,CdCuenta,NitTercero,Referencia,NumDocRef,CodTarIva
,TarifSeguro,CodTarSeg,RazonSocial,Concepto
 FROM LogMudConc
 WHERE Id=@pmId AND Item=@pmItem
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[paInsLogTraManifInt] @pmId VARCHAR(5),@pmItem INT,@pmCdMercancia VARCHAR(16),@pmDescripMcias VARCHAR(500),@pmCantidad DECIMAL(14,4),@pmPesoNeto DECIMAL(14,4),@pmPesoBruto DECIMAL(14,4),@pmVolumen DECIMAL(14,4),@pmValorMcia MONEY,@pmIdMoneda VARCHAR(5)
,@pmIdUnd VARCHAR(4),@pmIdEmp VARCHAR(4),@pmIdNat VARCHAR(4),@pmUndMed VARCHAR(10),@pmUndVol VARCHAR(10),@pmTipOrd VARCHAR(3),@pmNumOrden INT,@pmIdCiaOrd CHAR(2),@pmBultos VARCHAR(150),@pmObservacion VARCHAR(1000),@pmUnidad VARCHAR(50),@pmEmpaque VARCHAR(50),@pmNaturaleza VARCHAR(50),@pmDescripUnid VARCHAR(500)
 AS 
 INSERT INTO LogTraManifInt (Id,Item,CdMercancia,DescripMcias,Cantidad,PesoNeto,PesoBruto,Volumen,ValorMcia,IdMoneda,IdUnd,IdEmp,IdNat,UndMed,UndVol,TipOrd,NumOrden,IdCiaOrd,Bultos,Observacion,Unidad,Empaque,Naturaleza,DescripUnid)
 VALUES (@pmId,@pmItem,@pmCdMercancia,@pmDescripMcias,@pmCantidad,@pmPesoNeto,@pmPesoBruto,@pmVolumen,@pmValorMcia,@pmIdMoneda,@pmIdUnd,@pmIdEmp,@pmIdNat,@pmUndMed,@pmUndVol,@pmTipOrd,@pmNumOrden,@pmIdCiaOrd,@pmBultos,@pmObservacion,@pmUnidad,@pmEmpaque,@pmNaturaleza,@pmDescripUnid)
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[paUpLogTraManifInt] @pmId VARCHAR(5),@pmItem INT,@pmCdMercancia VARCHAR(16),@pmDescripMcias VARCHAR(500),@pmCantidad DECIMAL(14,4),@pmPesoNeto DECIMAL(14,4),@pmPesoBruto DECIMAL(14,4),@pmVolumen DECIMAL(14,4),@pmValorMcia MONEY,@pmIdMoneda VARCHAR(5),@pmIdUnd VARCHAR(4)
,@pmIdEmp VARCHAR(4),@pmIdNat VARCHAR(4),@pmUndMed VARCHAR(10),@pmUndVol VARCHAR(10),@pmTipOrd VARCHAR(3),@pmNumOrden INT,@pmIdCiaOrd CHAR(2),@pmBultos VARCHAR(150),@pmObservacion VARCHAR(1000),@pmUnidad VARCHAR(50),@pmEmpaque VARCHAR(50),@pmNaturaleza VARCHAR(50),@pmDescripUnid VARCHAR(500)
 AS 
 UPDATE LogTraManifInt SET CdMercancia=@pmCdMercancia,DescripMcias=@pmDescripMcias,Cantidad=@pmCantidad,PesoNeto=@pmPesoNeto,PesoBruto=@pmPesoBruto,Volumen=@pmVolumen,ValorMcia=@pmValorMcia,IdMoneda=@pmIdMoneda,IdUnd=@pmIdUnd,IdEmp=@pmIdEmp,IdNat=@pmIdNat,UndMed=@pmUndMed
,UndVol=@pmUndVol,TipOrd=@pmTipOrd,NumOrden=@pmNumOrden,IdCiaOrd=@pmIdCiaOrd,Bultos=@pmBultos,Observacion=@pmObservacion,Unidad=@pmUnidad,Empaque=@pmEmpaque,Naturaleza=@pmNaturaleza,DescripUnid=@pmDescripUnid
 WHERE Id=@pmId AND Item=@pmItem
GO
