﻿
-- =============================================
-- Author:		Steamware - S.E.L.
-- Create date: 2014.04.16
-- Description:	update di un record in QL (Full) e poi aggiorna a cascata
-- =============================================
CREATE PROCEDURE [dbo].[stp_QLF_UpdQState]
(
    @Original_QuoteType CHAR(1) = 'Q',
    @Original_CodQuote	BIGINT = 0,
    @Original_QuoteRev	INT = 0,
    @IdxQState			INT
)
AS

SET XACT_ABORT ON;
BEGIN TRAN

    -- aggiorno valori QuoteList!
    UPDATE QuoteList
    SET		IdxQState	= @IdxQState
    WHERE	QuoteType = @Original_QuoteType
        AND CodQuote = @Original_CodQuote
        AND QuoteRev = @Original_QuoteRev
        

    -- update dei valori calcolati!
    EXEC stp_QL_fullDataUpdate @Original_QuoteType
        ,@Original_CodQuote
        ,@Original_QuoteRev
        ,'Y'
        
COMMIT TRAN


-- seleziono intera riga!
    
SELECT	* 
FROM	v_QuoteFull_Q
WHERE	QuoteType = @Original_QuoteType
    AND CodQuote = @Original_CodQuote
    AND QuoteRev = @Original_QuoteRev


RETURN