<?xml version="1.0" encoding="utf-8"?>
<AisMenuItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/AisMenuItem.xsd">
	<Action>stat</Action>
	<SecondAction></SecondAction>
	<Ico></Ico>
  <Label>
    <L1>Products - branches - introducers</L1>
    <L2>Produits - entités - apporteurs</L2>
  </Label>
  <Description>
    <L1>Products - branches - introducers repartition</L1>
    <L2>Répartition produits - entités - apporteurs</L2>
  </Description>
  <Stat>
    <FileMajorVersion>1</FileMajorVersion>
    <FileMinorVersion>0</FileMinorVersion>
    <Parameters>
      <Parameter>
        <Name>date_effet</Name>
        <Type>date</Type>
        <Label>
          <L1>Start date</L1>
          <L2>Date d'effet de</L2>
        </Label>
      </Parameter>
    </Parameters>
    <SQL>
		select	
      [Code produit]      = p.prd_product_code, 
      [Libellé]           = p.prd_l1, 
			[Code entité]       = a.act_internal_reference,  
			[Entité]            = b.br_display_name,
			[Code apporteur]    = a2.act_internal_reference,
			[Apporteur]         = adri.adr_complete_name
		from	pr_products_branches pb
				inner join pr_products p				on	p.prd_product_code = pb.prdb_product_code
				inner join act_branches b				on	b.br_actor_id = pb.prdb_branch_id
				inner join act_actors a					on	a.act_actor_id = b.br_actor_id
				inner join adr_addresses adrb			on	adrb.adr_address_id = a.act_address_id
				left join pr_products_introducers pin	on	pin.prdint_product_code = pb.prdb_product_code
														and	pin.prdint_branch_id = pb.prdb_branch_id
				left join act_introducers ai			on	ai.int_actor_id = pin.prdint_introducer_id
				left join act_actors a2					on	a2.act_actor_id = ai.int_actor_id		
				left join adr_addresses adri			on	adri.adr_address_id = a2.act_address_id
    where @date_effet is null or prd_date_begin >= @date_effet
		order by prd_product_code, a.act_internal_reference, a2.act_internal_reference	
	</SQL>
</Stat>

</AisMenuItem>