
/****** Object:  StoredProcedure [dbo].[API_MarkDocVeryfication]    Script Date: 07.09.2021 14:11:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[API_MarkDocVeryfication]
@DocId int
AS
BEGIN
	SET NOCOUNT ON;


-- ustawiamy żeby już nie pobierało czasem statusu pobrane
update [dbo].[ApiDownloadObjects] set Status =3 where  objectId = @DocId;





-- dokument
 update dbo.ApiDocuments set State = 5
 where ErpId = @DocId;


    -- linie
 update dbo.ApiLines   set [Status] =1 from 
	dbo.ApiDocuments d where  d.DocId =  documentId and  d.Id =  IdDocId and d.ErpId = @DocId;

select * from dbo.ApiSerialNumbers 
update dbo.ApiSerialNumbers set State=2  where DocumentId = @DocId;





/*
-- cechy
 update dbo.ApiFeatures   set [Status] =1 from 
	dbo.ApiDocuments d where   d.DocId = ParentId and ParentType=0 and d.ErpId = @DocId;
*/



           
 END







GO


