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

152 lines
4.4 KiB
PHP
Executable File

<?php
require_once 'Framework/Modele.php';
class Pointvente extends Modele
{
public function getPointventes()
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'SELECT A.* FROM pointvente A WHERE (A.codeSociete=?) AND (typeSysteme != "1") ORDER BY A.libelle;';
$resultat = $this->executerRequete($sql, array($codeSociete));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getListe()
{
$sql = 'SELECT codePointVente as `code`, libelle FROM pointvente WHERE (codeSociete=?) AND (typeSysteme != "1") order by libelle;';
$liste = $this->executerRequete($sql,array($_SESSION['codeSociete']));
return $liste->fetchAll(PDO::FETCH_ASSOC);
}
public function getintermediairehorspointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'CALL sp_get_intermediaires_hors_pointvente(?);';
$resultat = $this->executerRequete($sql, array($codePointVente));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getintermediairepointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'CALL sp_get_intermediaires_pointvente(?);';
$resultat = $this->executerRequete($sql, array($codePointVente));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function ajouterunintermediairepointvente($codePointVente, $codeApporteur)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_ajouter_intermediaire_pointvente(?, ?, ?)';
$this->executerRequete($sql, array($codePointVente, $codeApporteur, $user));
}
public function retirerunintermediairepointvente($codePointVente, $codeApporteur)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_retirer_intermediaire_pointvente(?, ?, ?)';
$this->executerRequete($sql, array($codePointVente, $codeApporteur, $user));
}
public function retirertousintermediairepointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_retirer_tous_intermediaire_pointvente(?, ?)';
$this->executerRequete($sql, array($codePointVente, $user));
}
public function ajoutertousintermediairepointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_ajouter_tous_intermediaire_pointvente(?, ?)';
$this->executerRequete($sql, array($codePointVente, $user));
}
// Commercial
public function getcommercialhorspointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'CALL sp_get_commerciaux_hors_pointvente(?);';
$resultat = $this->executerRequete($sql, array($codePointVente));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function getcommercialpointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$sql = 'CALL sp_get_commerciaux_pointvente(?);';
$resultat = $this->executerRequete($sql, array($codePointVente));
return $resultat->fetchAll(PDO::FETCH_ASSOC);
}
public function ajouteruncommercialpointvente($codePointVente, $codeApporteur)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_ajouter_commercial_pointvente(?, ?, ?)';
$this->executerRequete($sql, array($codePointVente, $codeApporteur, $user));
}
public function retireruncommercialpointvente($codePointVente, $codeApporteur)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_retirer_commercial_pointvente(?, ?, ?)';
$this->executerRequete($sql, array($codePointVente, $codeApporteur, $user));
}
public function retirertouscommercialpointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_retirer_tous_commercial_pointvente(?, ?)';
$this->executerRequete($sql, array($codePointVente, $user));
}
public function ajoutertouscommercialpointvente($codePointVente)
{
$codeSociete = $_SESSION['codeSociete'];
$user = $_SESSION['login'];
$sql = 'call sp_r_ajouter_tous_commercial_pointvente(?, ?)';
$this->executerRequete($sql, array($codePointVente, $user));
}
}