production/Modele/Detailencaissementgarant.php
2025-12-01 16:12:12 +00:00

37 lines
1.6 KiB
PHP
Executable File

<?php
require_once 'Framework/Modele.php';
class Detailencaissementgarant extends Modele {
public function getDetailsEncaissement($idEncaissement) {
$sql = 'CALL sp_get_detail_encaissement_garant_id(?);';
$detailencaissement = $this->executerRequete($sql, array($idEncaissement));
return $detailencaissement->fetchAll(PDO::FETCH_ASSOC);
}
public function supprimer($id) {
$sql = 'DELETE FROM detailencaissement WHERE (id=?)';
$this->executerRequete($sql, array($id));
}
public function getDetailEncaissementsId($idQuittance) {
$sql = 'SELECT B.dateEncaissement, C.libelle AS modepaiement, B.referencePaiement, A.*
FROM detailencaissement A
JOIN encaissement B ON (B.codeSociete=A.codeSociete) AND (B.id=A.idEncaissement)
LEFT JOIN modepaiement C ON (C.codeModePaiement=B.codeModePaiement)
WHERE (A.idQuittance=?) ORDER BY A.numeroEncaissement DESC';
$detailencaissements = $this->executerRequete($sql, array($idQuittance));
return $detailencaissements;
}
public function getTotalEncaissement($idQuittance) {
$sql = 'SELECT IFNULL(SUM(primeNette),"0") AS primeNette, IFNULL(SUM(commission),"0") AS commission,
IFNULL(SUM(primeHt),"0") AS primeHt, IFNULL(SUM(taxe),"0") AS taxe,
IFNULL(SUM(fraisCarte),"0") AS fraisCarte, IFNULL(SUM(primeTtc),"0") AS primeTtc
FROM detailencaissement A WHERE (A.idQuittance=?)';
$totalencaissement = $this->executerRequete($sql, array($idQuittance));
return $totalencaissement->fetch(PDO::FETCH_ASSOC);
}
}