SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_acc_mpay_bordereaux_get_invoices]
	@bordereau_id		int
as

	set nocount on;

	/*
	DGE 06/05/2017
	Renvoie les quittances DB d'un bordereau de mensualisation. 
	On se sert pour l'encaissement.
	*/
	
	select	a.*		
	from	acc_accounts a
			inner join	acc_mpay_bordereaux_details bd	on	bd.mpaybd_invoice_id = a.a_account_id
	where	bd.mpaybd_bordereau_id = @bordereau_id



	select	i.*		
	from	acc_invoices i
			inner join	acc_mpay_bordereaux_details bd	on	bd.mpaybd_invoice_id = i.inv_invoice_id
	where	bd.mpaybd_bordereau_id = @bordereau_id

GO
