	SELECT 
	prt.codePrestataire AS codeP,`fn_libelle_prestataire`(prt.codePrestataire) AS Prestataire,
	C.id,C.numeroPolice,C.libellePolice,prt.codeGarantie AS codeGarantie,fn_libelle_garantie(prt.codeGarantie) AS libelle, -- ga.libelle,	
	COUNT(DISTINCT prt.idBeneficiaire) AS Quantite, COALESCE(SUM(prt.montantApayer),0) AS MontantRembourse
	,ROUND((SUM(IFNULL(prt.montantApayer,0))/COUNT(*)),0) AS Coutmoyen 
	/*,ROUND(SUM(IFNULL(prt.montantApayer,0))*100/( SELECT  SUM(IFNULL(prt1.montantApayer,0))    
	FROM p_prestationactes prt1 JOIN p_facture B1 ON (B1.id=prt1.idfacture)
	INNER JOIN  police C1 ON  (B1.idPolice = C1.id)
	INNER JOIN  gc_assureur G1 ON  (C1.codeGcAssureur = G1.codeGcAssureur)
	INNER JOIN adherent a1 ON ((C1.id=a1.idPolice) AND (C1.codeSociete=a1.codeSociete) AND ( a1.id=B1.idAdherent))
	WHERE (LEFT(B1.dateSysteme,10)  BETWEEN '2022-10-01' AND '2022-10-31' )
	AND G1.id!='45' AND C1.idClient!='49' AND (B1.codeSociete="vitalis")
	AND B1.codePrestataire NOT IN ('CE0416','PR1176','CE1215','CE1232','CE1287','PR1175','CE1276')
	AND prt1.codePrestataire in ('CE0195') -- sisangue,MIENMOH,BETHANIE
	),2) AS Taux */
	FROM p_prestationactes prt JOIN p_facture B ON (B.id=prt.idfacture)
	INNER JOIN  police C ON  (B.idPolice = C.id)
	INNER JOIN  gc_assureur G ON  (C.codeGcAssureur = G.codeGcAssureur)
	INNER JOIN adherent a ON ((C.id=a.idPolice) AND (C.codeSociete=a.codeSociete) AND ( a.id=B.idAdherent))
	WHERE (LEFT(B.dateSysteme,10)  BETWEEN '2022-11-01' AND '2022-11-30' )
	AND G.id!='45' AND C.idClient!='49' AND (B.codeSociete="vitalis")
	-- AND B.valide=1 AND B.okDecompte=1
	AND prt.codePrestataire IN ('CE1258') -- sisangue,MIENMOH,BETHANIE
-- 	AND prt.codePrestataire in ('CE0195','CE1257','CE1258') -- sisangue,MIENMOH,BETHANIE
	AND B.codePrestataire NOT IN ('CE0416','PR1176','CE1215','CE1232','CE1287','PR1175','CE1276')
	GROUP BY prt.codePrestataire,C.id,C.numeroPolice,C.libellePolice,prt.codeGarantie -- ,ga.libelle
	HAVING SUM(IFNULL(B.montantApayer,0))!='0' 
	ORDER BY prt.codePrestataire,C.id,prt.codeGarantie,MontantRembourse DESC ;