-- VISUEL DES ACTE 

SELECT 
	`codeActe`,`libelle`,
	CASE WHEN`ententePrealable`='1' THEN 'OUI' ELSE 'NON' END AS ententePrealable,
	CASE WHEN`alerte`='1' THEN 'OUI' ELSE 'NON' END AS alerte,
	CASE WHEN`exclu`='1' THEN 'OUI' ELSE 'NON' END AS exclu,`lettreCle`,`coefficient`
FROM p_acte AS B
WHERE B.codeFamilleActe='FA005' ;


-- 1-- TARIF ACTE
SELECT 
	A.`codeTarifActe`,A.`codeActe`,
	B.libelle AS libelleActe,
	A.`prix`,A.`prixNuitFerier`
FROM p_detailtarifacte A
JOIN p_acte B ON (B.codeActe=A.codeActe) 
LEFT JOIN p_familleacte C ON (C.codeFamilleActe=B.codeFamilleActe) 
WHERE B.codeFamilleActe='FA005' 
-- AND (B.libelle LIKE p_libelleActe)
ORDER BY B.libelle;


-- 2--

SELECT * FROM p_detailtarifactegroupeprestataire


SELECT * FROM p_detailtarifactepolice


SELECT * FROM p_detailtarifactepolice

SELECT * FROM p_detailtarifactepoliceprestataire

--  	
SELECT 
	A.codePrestataire,`fn_libelle_prestataire`(A.codePrestataire) AS prestataire,
	A.id, 
	A.codeActe, 
	B.libelle AS libelleActe,
	A.prix,
	A.prixNuitFerier,
	A.idPolice
FROM p_detailtarifactepoliceprestataire A
JOIN p_acte B ON (B.codeActe=A.codeActe) 
JOIN prestataire P ON (P.codePrestataire=A.codePrestataire) 
WHERE  B.codeFamilleActe='FA005' 
ORDER BY A.codePrestataire,B.libelle;