SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_acc_account_solde_by_actor_id]
	@actor_id int 									-- id de l'acteur
	
AS

	/*
	Solde de l'acteur (cie, tax, int)
	*/

	select	a.a_currency_code, vir_solde = sum(a.a_amount)
	from	acc_accounts a
	where	a.a_actor_id = @actor_id
	and		a_type_code not in ('P', 'CSD')				-- payements "hors solde", commission sharing deduced
	group by a_currency_code


GO
