


CREATE VIEW [dbo].[ApiWmsLinesVeryficationView] as
select 
ISNULL((select count(distinct ErpId) from dbo.[ApiWmsDocLines] where DocumentId = dbo.ApiWmsDocuments.Id),0) WmsLinie
,
ISNULL((select count(*) from dbo.ApiWmsBaseLinesView p where p.ObjectId = dbo.ApiWmsDocuments.ErpId ),0) DocLinie
,* from dbo.ApiWmsDocuments   where Additionally=0 and  dbo.ApiWmsDocuments.ErpId <>0
GO


