
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE procedure [dbo].[p_pr_products_documents]
	@product_code ais_code_short,
	@branch_id int,
	@act_code ais_code_short = '%'
	
as

	set nocount on;
	
	select d.*, pa.*, prd_l1, prd_l2, prd_l3
	from pr_products_documents d
		inner join pr_products on prdd_product_code = prd_product_code
		inner join pol_acts pa on prdd_act_code = pa.pact_act_code
	where	prdd_product_code = @product_code 
	and		prdd_branch_id = @branch_id
	and		( @act_code = '%' or prdd_act_code = @act_code)
	order by prdd_product_code asc, prdd_act_code asc, prdd_document_order asc  
	
	




GO
