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

	set nocount on;

	/*
	DGE 17/01/2017

	Restaurer le statut prélèvement des quittancesà la situation antérieure (annulation d'un bordereau de mensualisation envpyée à la banque)
	
	*/
	
	update	i
	set		i.inv_monthly_payment_status_code = d.mpaybd_monthly_payment_status_code
	from	acc_invoices i 
			inner join acc_mpay_bordereaux_details d on d.mpaybd_invoice_id = i.inv_invoice_id
	where	d.mpaybd_bordereau_id = @bordereau_id
GO
