Files
crm-ms1/application/controllers/Paiements.php
2026-05-27 11:44:10 -04:00

90 lines
2.9 KiB
PHP

<?php
class Paiements extends CI_Controller {
function __construct()
{
parent::__construct('paiements');
$this->load->helper('url');
$this->load->library('pagination');
$this->load->model('Paiements_model');
$this->lang->load('fournisseurs');
$this->load->model('Tache_model');
$this->load->library('table');
$this->load->helper('form');
$this->load->model('FxForm_model');
$this->load->model('Config_model');
$this->load->library('session');
}
public function index()
{
$this->load->view('paiements/header' );
$this->load->view('paiements/list' );
$this->load->view('paiements/footer' );
}
public function form($mem_id,$error='',$facture="")
{
// $error['error']=array('type'=>'error','message'=>'test');
// $error['error']=$error;
// prépare tout les info pour la forme
$data=$this->Paiements_model->mod_getForminfo($mem_id);
$data['no_facture']=$facture;
$data_view= $this->load->view('paiements/form',$data,true );
echo json_encode($data_view);
}
public function loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$date_debut="2019-01-01",$date_fin="2025-01-01", $listactif = 1, $model='liste',$excel=0) {
$this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_1',$filtre1,1,0);
$this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_2',$filtre2,1,0);
$this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_3',$filtre3,1,0);
$this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','date_debut',$date_debut,1,0);
$this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','date_fin',$date_fin,1,0);
$filtre1=urldecode($filtre1);
$filtre2=urldecode($filtre2);
$filtre3=urldecode($filtre3);
$data=$this->Paiements_model->mod_loadData_list($record,$filtre1,$filtre2,$filtre3,$date_debut,$date_fin,$listactif,$model,$excel);
echo json_encode($data);
}
public function saveRecord($id=0,$no_facture="")
{
$id=$this->Paiements_model->mod_createRecordbd($_POST,'pai_',$id,$no_facture);
$error['error']=array('type'=>'success','message'=>'Paiement créée');
redirect('/paiements');
}
public function deletecontact($id,$con_id){
$this->Fournisseurs_model->mod_deleteRecordbdcontact($id);
$error=array('type'=>'success','message'=>'Contact effacé');
$this->form($con_id,$error);
}
public function saveRecordcontact($id)
{
$this->Fournisseurs_model->mod_createRecordbdcontact($_POST,'con_',$id);
$error=array('type'=>'success','message'=>'Nouvelle fiche créée');
$this->form($id,$error);
}
}