122 lines
4.6 KiB
PHP
Executable File
122 lines
4.6 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Modepaiement.php';
|
|
require_once 'Modele/Moyenpaiement.php';
|
|
require_once 'Modele/Encaissementgarant_temp.php';
|
|
require_once 'Modele/Encaissementgarant.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
|
|
|
|
|
|
class ControleurEncaissergarant extends Controleur {
|
|
private $menuvue;
|
|
private $modepaiement;
|
|
private $moyenpaiement;
|
|
private $encaissement_temp;
|
|
private $encaissement;
|
|
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuVue('Encaissergarant');
|
|
|
|
$this->encaissement_temp = new Encaissementgarant_temp();
|
|
$this->encaissement = new Encaissementgarant();
|
|
$this->modepaiement = (new Modepaiement())->getListe();
|
|
$this->moyenpaiement = new Moyenpaiement();
|
|
}
|
|
public function index() {
|
|
|
|
$user = $this->requete->getSession()->getAttribut('login');
|
|
|
|
$idEncaissementGarant_temp = $this->requete->getSession()->getAttribut('idEncaissementGarant_temp');
|
|
|
|
$idSaisie = $this->requete->getSession()->getAttribut('idSaisie');
|
|
|
|
$encaissement = $this->encaissement_temp->getEncaissementTemp($idEncaissementGarant_temp);
|
|
|
|
$garants = $this->encaissement->getgarant();
|
|
|
|
if(!is_array($encaissement)){
|
|
|
|
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
|
|
$codeGcAssureur = "";
|
|
$codeModePaiement = "";
|
|
$codeMoyenPaiement = "";
|
|
$referencePaiement = "";
|
|
$nomTireur = "";
|
|
$banquePayeur = "";
|
|
$montant = "0";
|
|
$libelleOperation = "";
|
|
$dateEncaissement = date('Y-m-d');
|
|
$dateComptable = date('Y-m-d');
|
|
|
|
$codeModePaiement = "";
|
|
$moyenpaiement = "";
|
|
|
|
$idEncaissementGarant_temp = $this->encaissement_temp->initEncaissement($codeSociete, $codeGcAssureur, $codeModePaiement, $codeMoyenPaiement,
|
|
$referencePaiement, $nomTireur, $banquePayeur, $montant, $libelleOperation, $dateEncaissement, $dateComptable, $user, $idSaisie);
|
|
|
|
|
|
$encaissement = $this->encaissement_temp->getEncaissementTemp($idEncaissementGarant_temp);
|
|
}
|
|
|
|
$codeModePaiement = $encaissement['codeModePaiement'];
|
|
$moyenpaiement = $this->moyenpaiement->getListe($codeModePaiement);
|
|
|
|
|
|
$chemin = $this->menuvue->getChemin('Encaissergarant');
|
|
|
|
$this->genererVue(array('encaissement' => $encaissement, 'garants' => $garants,
|
|
'modepaiement' => $this->modepaiement, 'moyenpaiement' => $moyenpaiement, 'chemin' => $chemin));
|
|
}
|
|
|
|
public function initencaissement() {
|
|
|
|
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
|
|
$codeGcAssureur = $this->requete->getParametre("codeGcAssureur");
|
|
|
|
$this->requete->getSession()->setAttribut('codeGcAssureur',$codeGcAssureur);
|
|
|
|
$codeModePaiement = $this->requete->getParametreFormulaire("codeModePaiement");
|
|
$codeMoyenPaiement = $this->requete->getParametreFormulaire("codeMoyenPaiement");
|
|
$referencePaiement = $this->requete->getParametre("referencePaiement");
|
|
$nomTireur = $this->requete->getParametreFormulaire("nomTireur");
|
|
$banquePayeur = $this->requete->getParametreFormulaire("banquePayeur");
|
|
|
|
$montant = str_replace(' ', '', $this->requete->getParametreFormulaire("montant"));
|
|
|
|
$libelleOperation = $this->requete->getParametre("libelleOperation");
|
|
$dateEncaissement = $this->requete->getParametreDate("dateEncaissement");
|
|
$dateComptable = $this->requete->getParametreDate("dateComptable");
|
|
|
|
$user = $this->requete->getSession()->getAttribut('login');
|
|
|
|
$idSaisie = $this->requete->getSession()->getAttribut('idSaisie');
|
|
|
|
$idEncaissementGarant_temp = $this->encaissement_temp->initEncaissement($codeSociete, $codeGcAssureur, $codeModePaiement, $codeMoyenPaiement,
|
|
$referencePaiement, $nomTireur, $banquePayeur, $montant, $libelleOperation, $dateEncaissement, $dateComptable, $user, $idSaisie);
|
|
|
|
|
|
if($this->requete->existeParametre("btn_suivant"))
|
|
{
|
|
//$this->rediriger("Encselectionquittances/".$idClient);
|
|
$this->rediriger("Encselectionfacturesgarant/");
|
|
}
|
|
else
|
|
{
|
|
$dernierNumeroEncaissement = $this->encaissement->getDenierNumeroEncaissement();
|
|
$dernierNumeroEncaissement++;
|
|
|
|
if ($this->encaissement->existeligne($dernierNumeroEncaissement)) {
|
|
$dernierNumeroEncaissement++;
|
|
}
|
|
|
|
$numeroEncaissement = $dernierNumeroEncaissement;
|
|
$idEncaissement = $this->encaissement->EnregistrerDepot($idEncaissementTemp, $numeroEncaissement);
|
|
$this->encaissement->setDenierNumeroEncaissement($numeroEncaissement);
|
|
|
|
$this->rediriger("Ficheencaissement/".$idEncaissement);
|
|
}
|
|
}
|
|
|
|
} |