set xact_abort on;
go

begin transaction;
go

set ANSI_NULLS on;
go

/*****************************************
* STORED stp_ODETTE_updateVal
*
* effettua aggiornamento valori etichetta Odette
*
* Steamware, S.E.L.
* mod: 2011.04.28
*
****************************************/
alter PROCEDURE stp_ODETTE_updateVal
(
	@UDC NVARCHAR(50),
	@ragSocCli NVARCHAR(50),
	@indirCli NVARCHAR(50),
	@capCittCli NVARCHAR(50),
	@ragSocDest NVARCHAR(50),
	@indirDest NVARCHAR(50),
	@capCittDest NVARCHAR(50),
	@pesoNetto NVARCHAR(50),
	@pesoLordo NVARCHAR(50),
	@numColli NVARCHAR(50),
	@disPart NVARCHAR(50),
	@descPart NVARCHAR(50),
	@codPart NVARCHAR(50),
	@codImb NVARCHAR(50),
	@codMaz NVARCHAR(50),
	@codNael NVARCHAR(50),
	@codAQP NVARCHAR(50)	
)
AS

-- COMMIT TRAN


-- update valori (sovrascrivo...)
UPDATE	Odette
SET		Campo1_2 = @ragSocCli,
		Campo1_3 = @indirCli,
		Campo1_4 = @capCittCli,
		Campo2_2 = @ragSocDest,
		Campo2_3 = @indirDest,
		Campo2_4 = @capCittDest,
		Campo5_2 = @pesoNetto,
		Campo6_2 = @pesoLordo,
--		Campo7_2 = @numColli,
		Campo7_2 = 1,             -- imposto n. colli del cartellino odette fisso = 1
		Campo8_2 = @disPart,
		Campo8_3 = @disPart,
		Campo10_2 = @descPart,
		Campo11_1_2 = @codPart,
		Campo11_1_3 = @codPart,
		Campo11_2_2 = @codImb,
		Campo11_2_3 = @codImb,
		Campo12_2 = @codMaz,
		Campo12_3 = @codMaz,
		Campo14_2 = @codNael,
		Campo16_5 = ISNULL(@codAQP,'')

WHERE	CampoUDC = @UDC

RETURN
go

commit;
go





-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(540, GETDATE())
GO
SELECT TOP 5 * FROM LogUpdateDb ORDER BY Versione DESC
GO
