prestation/Controleur/ControleurAjaxfacturerpolice.php
2025-12-01 18:54:33 +00:00

213 lines
7.2 KiB
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Beneficiaire.php';
require_once 'Modele/Echeancier_temp.php';
require_once 'Modele/Typeecheancier.php';
require_once 'Modele/Avenant.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurAjaxfacturerpolice extends Controleur {
private $beneficiaire;
// private $quittance;
// private $emission;
private $echeancier;
private $typeecheancier;
private $avenant;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->beneficiaire = new Beneficiaire();
$this->echeancier = new Echeancier_temp();
$this->typeecheancier = new Typeecheancier();
$this->avenant = new Avenant();
/*
$this->quittance = new Quittance();
$this->emission = new Emission();
*/
}
public function index()
{
$idAvenant = $this->requete->getParametreFormulaire("idAvenant", "numerique");
$_SESSION['idAvenant'] = $idAvenant;
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$beneficiaires = $this->beneficiaire->afficherfacturationpolice($debut, $fin, $idAvenant);
//var_dump($beneficiaires);
//die();
if(count($beneficiaires)=="0"){
$this->beneficiaire->initfacturationpolice();
$beneficiaires = $this->beneficiaire->afficherfacturationpolice($debut, $fin, $idAvenant);
}
$total_a_facturer = $this->beneficiaire->affichertotalfacturationpolice($debut, $fin, $idAvenant);
//var_dump($beneficiaires);
//die();
$this->genererVueAjax(array('beneficiaires' => $beneficiaires, 'total_a_facturer' => $total_a_facturer));
}
public function selectionnertoutlignesafacturer()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$choix = $this->requete->getParametre("choix");
$idAvenant = $this->requete->getParametreFormulaire("idAvenant", "numerique");
$_SESSION['idAvenant'] = $idAvenant;
$this->beneficiaire->selectionnertoutlignesafacturer($choix, $debut, $fin, $idAvenant);
}
public function selectionner()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$idBeneficiairePrimeTemp = $this->requete->getParametre("idBeneficiairePrimeTemp");
$choix = $this->requete->getParametre("choix");
$idAvenant = $this->requete->getParametreFormulaire("idAvenant", "numerique");
$_SESSION['idAvenant'] = $idAvenant;
$total_a_facturer = $this->beneficiaire->selectionnerunelignesafacturer($idBeneficiairePrimeTemp, $choix, $debut, $fin, $idAvenant);
$this->genererVueAjax(array('total_a_facturer' => $total_a_facturer));
}
public function initecheancierfacturation()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$idAvenant = $_SESSION['idAvenant'];
//var_dump($idAvenant);
$idEmission_temp = $this->beneficiaire->initecheancierfacturation($debut, $fin, $idAvenant);
$_SESSION['idEmission_temp'] = $idEmission_temp;
}
public function getnbecheancier()
{
$codeTypeEcheancier = $this->requete->getParametreFormulaire("codeTypeEcheancier");
$nbEcheance_info = $this->typeecheancier->getNbEcheancier($codeTypeEcheancier);
$this->genererVueAjax(array('nbEcheance_info' => $nbEcheance_info));
}
public function majecheancier()
{
$idEmission_temp = $_SESSION['idEmission_temp'];
$codeTypeEcheancier = $this->requete->getParametreFormulaire("codeTypeEcheancier");
$nbEcheance = $this->requete->getParametreFormulaire("nbEcheance");
$tauxInteret = $this->requete->getParametreFormulaire("tauxInteret");
$this->echeancier->majEcheancier_temp($idEmission_temp, $codeTypeEcheancier, $nbEcheance, $tauxInteret);
}
public function enregistrer()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$this->echeancier->enregistrer($debut, $fin);
// $this->rediriger("Facturerpolice");
}
public function majlibelle()
{
$idEcheancier = $this->requete->getParametreFormulaire("idEcheancier");
$libelleEcheance = $this->requete->getParametreFormulaire("libelleEcheance");
$this->echeancier->majlibelle($idEcheancier, $libelleEcheance);
}
public function majdatepaiement()
{
$idEcheancier = $this->requete->getParametreFormulaire("idEcheancier");
$datePaiement = $this->requete->getParametreDate("datePaiement");
$this->echeancier->majdatepaiement($idEcheancier, $datePaiement);
}
public function majtauxecheance()
{
$idEcheancier = $this->requete->getParametreFormulaire("idEcheancier");
$tauxEcheance = $this->requete->getParametreFormulaire("tauxEcheance");
$nbEcheance = $this->requete->getParametreFormulaire("nbEcheance");
$this->echeancier->majtauxecheance($idEcheancier, $tauxEcheance, $nbEcheance);
}
public function afficherecheancierfacturation()
{
$typeecheancier = $this->typeecheancier->getListe();
$entete_echeancier = $this->echeancier->getEntete_echeancier_temp();
$echeanciers = $this->echeancier->getEcheancier_temp();
$total_echeancier = $this->echeancier->getTotalEcheancier_temp();
$this->genererVueAjax(array('typeecheancier' => $typeecheancier, 'entete_echeancier' => $entete_echeancier,
'echeanciers' => $echeanciers, 'total_echeancier' => $total_echeancier));
}
public function majaccessoiresfacturation()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$fraisCarte = $this->requete->getParametreFormulaire("fraisCarte", "numerique");
$this->beneficiaire->majaccessoiresfacturation($fraisCarte, $debut, $fin);
}
public function majprimesfacturation()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$idCollege = $this->requete->getParametreFormulaire("idCollege");
$old_primeNette = $this->requete->getParametreFormulaire("old_primeNette", "numerique");
$nv_primeNette = $this->requete->getParametreFormulaire("nv_primeNette", "numerique");
$this->beneficiaire->majprimesfacturation($idCollege, $old_primeNette, $nv_primeNette, $debut, $fin);
}
// majaccessoirefacturationprime
public function majaccessoirefacturationprime()
{
$debut = $this->requete->getParametreDate("debut");
$fin = $this->requete->getParametreDate("fin");
$accesoireTotal = $this->requete->getParametreFormulaire("accesoireTotal", "numerique");
$total_a_facturer = $this->beneficiaire->majaccessoirefacturationprime($accesoireTotal, $debut, $fin);
$this->genererVueAjax(array('total_a_facturer' => $total_a_facturer));
}
// 10/05/2021
public function affichereffetavenant()
{
$idAvenant = $this->requete->getParametreFormulaire("idAvenant");
$dateEffetAvenant = $this->avenant->getdateavenant($idAvenant, $_SESSION['idPolice_C']);
echo $dateEffetAvenant;
}
}