1317 lines
52 KiB
PHP
1317 lines
52 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Utilisateur
|
|
* Date: 2019-04-23
|
|
* Time: 10:21
|
|
*/
|
|
class TachesProjets_model extends CI_Model
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->load->database();
|
|
$this->load->helper('date');
|
|
$this->load->model('Projets_model');
|
|
|
|
}
|
|
public function mod_getRecords_paiements($facture)
|
|
{
|
|
|
|
// list la bb client
|
|
$this->db->select('*');
|
|
$this->db->from('pai_paiements');
|
|
$this->db->join('pai_genres', 'pai_genres.gen_id=pai_paiements.pai_gen_id', 'left');
|
|
$this->db->join('usa_usagers', 'pai_paiements.pai_user = usa_usagers.usa_id ', 'left');
|
|
|
|
|
|
//$this->db->where('det_con_active', 1);
|
|
|
|
|
|
$this->db->where('pai_no_facture', $facture );
|
|
|
|
$this->db->order_by("pai_date");
|
|
|
|
$query = $this->db->get();
|
|
|
|
return $query->result_array();
|
|
}
|
|
public function mod_getRecords_listetache($proj_num)
|
|
{
|
|
|
|
|
|
// list la bb client
|
|
$this->db->select('*');
|
|
$this->db->from('pai_paiements');
|
|
$this->db->join('pai_genres', 'pai_genres.gen_id=pai_paiements.pai_gen_id', 'left');
|
|
$this->db->join('usa_usagers', 'pai_paiements.pai_user = usa_usagers.usa_id ', 'left');
|
|
|
|
|
|
//$this->db->where('det_con_active', 1);
|
|
|
|
|
|
$this->db->where('pai_no_facture', $proj_num );
|
|
|
|
$this->db->order_by("pai_date");
|
|
|
|
$query = $this->db->get();
|
|
|
|
return $query->result_array();
|
|
}
|
|
|
|
public function mod_listtaches($proj_det_id,$excel,$Type_projet) {
|
|
|
|
|
|
//projets
|
|
//
|
|
$Type_projet='projets';
|
|
$client_list= $this->TachesProjets_model->mod_listtache($Type_projet,$proj_det_id);
|
|
$header=array(
|
|
'',
|
|
'Echeance',
|
|
'Type',
|
|
'Statut',
|
|
'Produit','Responsable' );
|
|
// prépare les donnés du tableau
|
|
$nbitem=0;
|
|
$mem_excel['excel']=array();
|
|
|
|
foreach($client_list as $row)
|
|
{ $nbitem++;
|
|
// faire le link pour edit
|
|
|
|
$mem_link_edit= '<a id="pk_1" data-facture="" data-id="'.'" class="btn btn-primary btn-circle glyphicon glyphicon-pencil"> </a>';
|
|
|
|
|
|
$mem_bt='';
|
|
$mem_color='btn-warning';
|
|
if ($row['tach_active']==0){
|
|
$mem_color='btn-success';
|
|
}else{
|
|
if ($row['tach_echeance_date']< date("Y-m-d")){
|
|
$mem_color='btn-danger';
|
|
}
|
|
}
|
|
if($row['tach_section']=='projetsclient' || $row['tach_section']=='projetsfournisseur'){
|
|
$goto='projets';}
|
|
$mem_titre=$row['gen_nom_fr'].' 
Demande :
'.$row['tach_note_demande'].'
Suivie :
'.$row['tach_note_suivie'];
|
|
|
|
$mem_bt =$mem_bt.'<a data-toggle="modal" data-section="'.$row['tach_section'].'" data-id="'.$row['tach_id'].'" data-section_id="'.$row['tach_section_id'].'" class="btn '.$mem_color.' btn-circle glyphicon glyphicon-bell popup" title="'.$mem_titre.'"></a>';
|
|
$data_row = array();
|
|
|
|
$data_row[] = array('data'=> $mem_bt, 'align' => 'left', 'width' => '1%');
|
|
$data_row[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statut_'.$row['typeid'] );
|
|
$data_row[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statut_'.$row['statutid']);
|
|
$data_row[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
|
|
// $data_row[] = array('data'=>$row['tach_section'], 'align' => 'left', 'width' => '13%');
|
|
$tabular_data[] = $data_row;
|
|
|
|
if($excel==2){
|
|
$data_row_excel = array();
|
|
|
|
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=> 'Projets');
|
|
$data_row_excel[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statut_'.$row['typeid'] );
|
|
$data_row_excel[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statut_'.$row['statutid']);
|
|
$data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
$mem_excel['excel'][]=$data_row_excel;
|
|
|
|
// $data_row[] = array('data'=>$row['usa_prenom'].''.$row['usa_nom'], 'align' => 'left');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = array(
|
|
'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="table table-striped table-bordered table-hover">',
|
|
|
|
'thead_open' => '<thead >',
|
|
'thead_close' => '</thead>',
|
|
|
|
'heading_row_start' => '<tr>',
|
|
'heading_row_end' => '</tr>',
|
|
'heading_cell_start' => '<th style="background-color: #003333">',
|
|
'heading_cell_end' => '</th>',
|
|
|
|
'tbody_open' => '<tbody>',
|
|
'tbody_close' => '</tbody>',
|
|
|
|
'row_start' => '<tr>',
|
|
'row_end' => '</tr>',
|
|
'cell_start' => '<td>',
|
|
'cell_end' => '</td>',
|
|
|
|
'row_alt_start' => '<tr>',
|
|
'row_alt_end' => '</tr>',
|
|
'cell_alt_start' => '<td>',
|
|
'cell_alt_end' => '</td>',
|
|
|
|
'table_close' => '</table>'
|
|
);
|
|
|
|
$this->table->set_template($template);
|
|
|
|
$this->table->set_heading($header);
|
|
|
|
if(!isset($tabular_data))
|
|
$tabular_data=array();
|
|
$nbitemtot=0;
|
|
if ($nbitem==0) {
|
|
$tableau_sortie_projets=''; }else{$tableau_sortie_projets= 'Projets</br>'.$this->table->generate($tabular_data);
|
|
$nbitemtot=$nbitemtot+$nbitem;
|
|
};
|
|
//projetsclient
|
|
//
|
|
$tabular_data=null;
|
|
$Type_projet='projetsclient';
|
|
$client_list= $this->TachesProjets_model->mod_listtache($Type_projet,$proj_det_id);
|
|
$header=array(
|
|
'',
|
|
'Echeance',
|
|
'Type',
|
|
'Statut',
|
|
'Produit','Responsable' );
|
|
// prépare les donnés du tableau
|
|
$nbitem=0;
|
|
|
|
|
|
foreach($client_list as $row)
|
|
{ $nbitem++;
|
|
// faire le link pour edit
|
|
|
|
$mem_link_edit= '<a id="pk_1" data-facture="" data-id="'.'" class="btn btn-primary btn-circle glyphicon glyphicon-pencil"> </a>';
|
|
|
|
|
|
$mem_bt='';
|
|
$mem_color='btn-warning';
|
|
if ($row['tach_active']==0){
|
|
$mem_color='btn-success';
|
|
}else{
|
|
if ($row['tach_echeance_date']< date("Y-m-d")){
|
|
$mem_color='btn-danger';
|
|
}
|
|
}
|
|
if($row['tach_section']=='projetsclient' || $row['tach_section']=='projetsfournisseur'){
|
|
$goto='projets';}
|
|
$mem_titre=$row['gen_nom_fr'].' 
Demande :
'.$row['tach_note_demande'].'
Suivie :
'.$row['tach_note_suivie'];
|
|
|
|
$mem_bt =$mem_bt.'<a data-toggle="modal" data-section="'.$row['tach_section'].'" data-id="'.$row['tach_id'].'" data-section_id="'.$row['tach_section_id'].'" class="btn '.$mem_color.' btn-circle glyphicon glyphicon-bell popup" title="'.$mem_titre.'"></a>';
|
|
$data_row = array();
|
|
|
|
$data_row[] = array('data'=> $mem_bt, 'align' => 'left', 'width' => '1%');
|
|
$data_row[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['typeid'] );
|
|
$data_row[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['statutid']);
|
|
$data_row[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
|
|
// $data_row[] = array('data'=>$row['tach_section'], 'align' => 'left', 'width' => '13%');
|
|
$tabular_data[] = $data_row;
|
|
|
|
if($excel==2){
|
|
$data_row_excel = array();
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=>'Clients');
|
|
$data_row_excel[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[]= array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['typeid'] );
|
|
$data_row_excel[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['statutid']);
|
|
$data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
$mem_excel['excel'][]=$data_row_excel;
|
|
|
|
//$data_row_excel[] = array('data'=>$row['pai_date'], 'align' => 'left', 'width' => '13%','color'=>'b3b3ff');
|
|
// $data_row[] = array('data'=>$row['usa_prenom'].''.$row['usa_nom'], 'align' => 'left');
|
|
|
|
//$data_row_excel[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left','color'=>'b3b3ff');
|
|
|
|
// $data_row_excel[] = array('data'=>$row['pai_note'], 'align' => 'left','color'=>'b3b3ff');
|
|
// $data_row_excel[] = array('data'=>number_format($row['pai_montant'],2,'.',''), 'align' => 'left','format'=>'argent','color'=>'b3b3ff');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = array(
|
|
'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="table table-striped table-bordered table-hover">',
|
|
|
|
'thead_open' => '<thead >',
|
|
'thead_close' => '</thead>',
|
|
|
|
'heading_row_start' => '<tr>',
|
|
'heading_row_end' => '</tr>',
|
|
'heading_cell_start' => '<th style="background-color: #003333">',
|
|
'heading_cell_end' => '</th>',
|
|
|
|
'tbody_open' => '<tbody>',
|
|
'tbody_close' => '</tbody>',
|
|
|
|
'row_start' => '<tr>',
|
|
'row_end' => '</tr>',
|
|
'cell_start' => '<td>',
|
|
'cell_end' => '</td>',
|
|
|
|
'row_alt_start' => '<tr>',
|
|
'row_alt_end' => '</tr>',
|
|
'cell_alt_start' => '<td>',
|
|
'cell_alt_end' => '</td>',
|
|
|
|
'table_close' => '</table>'
|
|
);
|
|
|
|
$this->table->set_template($template);
|
|
|
|
$this->table->set_heading($header);
|
|
|
|
if(!isset($tabular_data))
|
|
$tabular_data=array();
|
|
|
|
if ($nbitem==0) {
|
|
$tableau_sortie_projetsclient=''; }else{$tableau_sortie_projetsclient= 'Clients</br>'.$this->table->generate($tabular_data);
|
|
$nbitemtot=$nbitemtot+$nbitem;
|
|
};
|
|
//projetsfournisseur
|
|
//
|
|
$tabular_data=null;
|
|
$Type_projet='projetsfournisseur';
|
|
$client_list= $this->TachesProjets_model->mod_listtache($Type_projet,$proj_det_id);
|
|
$header=array(
|
|
'',
|
|
'Echeance',
|
|
'Type',
|
|
'Statut',
|
|
'Produit','Responsable' );
|
|
// prépare les donnés du tableau
|
|
$nbitem=0;
|
|
|
|
|
|
foreach($client_list as $row)
|
|
{ $nbitem++;
|
|
// faire le link pour edit
|
|
|
|
$mem_link_edit= '<a id="pk_1" data-facture="" data-id="'.'" class="btn btn-primary btn-circle glyphicon glyphicon-pencil"> </a>';
|
|
|
|
|
|
$mem_bt='';
|
|
$mem_color='btn-warning';
|
|
if ($row['tach_active']==0){
|
|
$mem_color='btn-success';
|
|
}else{
|
|
if ($row['tach_echeance_date']< date("Y-m-d")){
|
|
$mem_color='btn-danger';
|
|
}
|
|
}
|
|
if($row['tach_section']=='projetsclient' || $row['tach_section']=='projetsfournisseur'){
|
|
$goto='projets';}
|
|
$mem_titre=$row['gen_nom_fr'].' 
Demande :
'.$row['tach_note_demande'].'
Suivie :
'.$row['tach_note_suivie'];
|
|
|
|
$mem_bt =$mem_bt.'<a data-toggle="modal" data-section="'.$row['tach_section'].'" data-id="'.$row['tach_id'].'" data-section_id="'.$row['tach_section_id'].'" class="btn '.$mem_color.' btn-circle glyphicon glyphicon-bell popup" title="'.$mem_titre.'"></a>';
|
|
$data_row = array();
|
|
|
|
$data_row[] = array('data'=> $mem_bt, 'align' => 'left', 'width' => '1%');
|
|
$data_row[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['typeid'] );
|
|
$data_row[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['statutid']);
|
|
$data_row[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
|
|
// $data_row[] = array('data'=>$row['tach_section'], 'align' => 'left', 'width' => '13%');
|
|
$tabular_data[] = $data_row;
|
|
|
|
if($excel==2){
|
|
|
|
|
|
$data_row_excel = array();
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=>'');
|
|
$data_row_excel[] = array('data'=> 'Fournisseurs' );
|
|
|
|
$data_row_excel[] = array('data'=>$row['tach_echeance_date'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['typeid'] );
|
|
$data_row_excel[] = array('data'=>$row['statut_fr'], 'align' => 'left', 'width' => '13%', 'class' => 'statuttach_'.$row['statutid']);
|
|
$data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left', 'width' => '13%');
|
|
$data_row_excel[] = array('data'=>$row['usa_aqui'], 'align' => 'left', 'width' => '13%');
|
|
|
|
$mem_excel['excel'][]=$data_row_excel;
|
|
//$data_row_excel[] = array('data'=>$row['pai_date'], 'align' => 'left', 'width' => '13%','color'=>'b3b3ff');
|
|
// $data_row[] = array('data'=>$row['usa_prenom'].''.$row['usa_nom'], 'align' => 'left');
|
|
|
|
//$data_row_excel[] = array('data'=>$row['gen_nom_fr'], 'align' => 'left','color'=>'b3b3ff');
|
|
|
|
//$data_row_excel[] = array('data'=>$row['pai_note'], 'align' => 'left','color'=>'b3b3ff');
|
|
//$data_row_excel[] = array('data'=>number_format($row['pai_montant'],2,'.',''), 'align' => 'left','format'=>'argent','color'=>'b3b3ff');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = array(
|
|
'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="table table-striped table-bordered table-hover">',
|
|
|
|
'thead_open' => '<thead >',
|
|
'thead_close' => '</thead>',
|
|
|
|
'heading_row_start' => '<tr>',
|
|
'heading_row_end' => '</tr>',
|
|
'heading_cell_start' => '<th style="background-color: #003333">',
|
|
'heading_cell_end' => '</th>',
|
|
|
|
'tbody_open' => '<tbody>',
|
|
'tbody_close' => '</tbody>',
|
|
|
|
'row_start' => '<tr>',
|
|
'row_end' => '</tr>',
|
|
'cell_start' => '<td>',
|
|
'cell_end' => '</td>',
|
|
|
|
'row_alt_start' => '<tr>',
|
|
'row_alt_end' => '</tr>',
|
|
'cell_alt_start' => '<td>',
|
|
'cell_alt_end' => '</td>',
|
|
|
|
'table_close' => '</table>'
|
|
);
|
|
|
|
$this->table->set_template($template);
|
|
|
|
$this->table->set_heading($header);
|
|
|
|
if(!isset($tabular_data))
|
|
$tabular_data=array();
|
|
|
|
if ($nbitem==0) {
|
|
$tableau_sortie_projetsfournisseur=''; }else{$tableau_sortie_projetsfournisseur= 'Fournisseurs</br>'.$this->table->generate($tabular_data);
|
|
$nbitemtot=$nbitemtot+$nbitem;
|
|
};
|
|
|
|
//if($nbitem==0)
|
|
// $tableau_sortie='vide';
|
|
|
|
|
|
$mem_sortie['tableau_sortie']=$tableau_sortie_projets.$tableau_sortie_projetsclient.$tableau_sortie_projetsfournisseur;
|
|
$mem_sortie['nbitemtot']=$nbitemtot;
|
|
|
|
$mem_sortie['excel']=$mem_excel['excel'];
|
|
return $mem_sortie;
|
|
|
|
|
|
}
|
|
|
|
public function mod_loadData_list($record=0,$filtre1='',$filtre2='',$filtre3='',$filtre4='',$date_debut,$date_fin,$mem_proj_num,$mem_proj_compagnie,$excel=0) {
|
|
|
|
$filtre1=($filtre1=='null'?'':$filtre1);
|
|
$filtre2=($filtre2=='null'?'':$filtre2);
|
|
$filtre3=($filtre3=='null'?'':$filtre3);
|
|
$filtre4=($filtre4=='null'?'':$filtre4);
|
|
$recordPerPage = 9999;
|
|
|
|
$config["cur_page"] = $record;
|
|
if($record != 0){
|
|
$record = ($record-1) * $recordPerPage;
|
|
}
|
|
|
|
// $recordCount2 = $this->TachesProjets_model->mod_getRecordCount();
|
|
|
|
// $recordCount = $this->TachesProjets_model->mod_getRecordCountfilter($filtre1,$filtre2,$filtre3,'');
|
|
|
|
|
|
|
|
$client_list = $this->TachesProjets_model->mod_getRecords($filtre1,$filtre2,$filtre3,$filtre4,$date_debut,$date_fin,$mem_proj_num,$mem_proj_compagnie);
|
|
|
|
$recordCount2 = count($client_list);
|
|
$recordCount=$recordCount2 ;
|
|
|
|
$config['base_url'] = base_url().'index.php/Fournisseurs/loadData_list';
|
|
$config['use_page_numbers'] = TRUE;
|
|
$config['next_link'] = 'Next';
|
|
$config['prev_link'] = 'Previous';
|
|
$config['total_rows'] = $recordCount;
|
|
$config['per_page'] = $recordPerPage;
|
|
|
|
$choice = $config["total_rows"] / $config["per_page"];
|
|
$config["uri_segment"] = 2;
|
|
$config["num_links"] = 2;
|
|
$config['full_tag_open'] = '<div ><ul class="pagination">';
|
|
$config['full_tag_close'] = '</ul></div><!--pagination-->';
|
|
|
|
$config['first_link'] = '« First';
|
|
$config['first_tag_open'] = '<li class="prev page">';
|
|
$config['first_tag_close'] = '</li>';
|
|
|
|
$config['last_link'] = 'Last »';
|
|
$config['last_tag_open'] = '<li class="next page">';
|
|
$config['last_tag_close'] = '</li>';
|
|
|
|
$config['next_link'] = 'Next →';
|
|
$config['next_tag_open'] = '<li class="next page">';
|
|
$config['next_tag_close'] = '</li>';
|
|
|
|
$config['prev_link'] = '← Previous';
|
|
$config['prev_tag_open'] = '<li class="prev page">';
|
|
$config['prev_tag_close'] = '</li>';
|
|
|
|
$config['cur_tag_open'] = '<li class="active"><a href="">';
|
|
$config['cur_tag_close'] = '</a></li>';
|
|
|
|
$config['num_tag_open'] = '<li class="page">';
|
|
$config['num_tag_close'] = '</li>';
|
|
$this->pagination->initialize($config);
|
|
$data['pagination'] = $this->pagination->create_links();
|
|
$data['recordCount']=$recordCount2;
|
|
// creation du tableau
|
|
|
|
|
|
// prepare header
|
|
|
|
// if ($model == 'projets'){ $mem_link_new='';
|
|
// }else{
|
|
$mem_link_new=anchor('fournisseurs/form/0' , ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-pencil" ');
|
|
|
|
// }
|
|
$model='';
|
|
$data['model']=$model;
|
|
$mem_excel='<a id="excel" data-id="1" class="btn btn-primary btn-circle fa fa-cloud-download"> </a><a id="excel" data-id="2" class="btn btn-success btn-circle fa fa-cloud-download"> </a>';
|
|
$header=array( $mem_excel,
|
|
'# de projet',
|
|
'nom du client ',
|
|
'étape du projet ',
|
|
'destination',
|
|
'type',
|
|
'date de départ' );
|
|
|
|
if ($excel!=0){
|
|
$mem_excel_output['header']=array('Client',
|
|
|
|
'No. de projet','étape du projet','destination','type','date de départ' );
|
|
$mem_excel_output['headerwidth']=array(45,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15);
|
|
}
|
|
$nbitem=0;
|
|
|
|
|
|
// filter
|
|
global $mem_data;
|
|
|
|
|
|
$data_row = array();
|
|
if (1==2){
|
|
$data_row[]=array('data'=>'Filtre', 'align' => 'left');
|
|
// -------------------------------------------------------------------------
|
|
// $mem_champ='filtre_fournisseurs_1';
|
|
// $mem_value=trim($filtre1);
|
|
// $this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_fournisseurs_1');
|
|
|
|
// $mem_filtre=form_input($mem_data['input'][$mem_champ]);
|
|
// $data_row[]=array('data'=>$mem_filtre, 'align' => 'left');
|
|
// -------------------------------------------------------------------------
|
|
$mem_champ='filtre_fournisseurs_1';
|
|
$mem_value=trim($filtre1);
|
|
$this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_fournisseurs_1',7);
|
|
$mem_filtre=form_input($mem_data['input'][$mem_champ]);
|
|
$data_row[]=array('data'=>$mem_filtre, 'align' => 'left');
|
|
|
|
// -------------------------------------------------------------------------
|
|
$mem_champ='filtre_fournisseurs_2';
|
|
$mem_value=trim($filtre2);
|
|
$this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_fournisseurs_2');
|
|
$mem_filtre=form_input($mem_data['input'][$mem_champ]);
|
|
$data_row[]=array('data'=>$mem_filtre, 'align' => 'left');
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
|
|
// -------------------------------------------------------------------------
|
|
$mem_champ='filtre_fournisseurs_3';
|
|
$mem_value=trim($filtre3);
|
|
$this->FxForm_model->fxinputtxt($mem_champ,$mem_value,'','','','filtre_fournisseurs_3',4);
|
|
$mem_filtre=form_input($mem_data['input'][$mem_champ]);
|
|
$data_row[]=array('data'=>$mem_filtre, 'align' => 'left');
|
|
// -------------------------------------------------------------------------
|
|
$data_row[]=array('data'=>'', 'align' => 'left');
|
|
$data_row[]=array('data'=>'', 'align' => 'left');
|
|
$data_row[]=array('data'=>'', 'align' => 'left');
|
|
|
|
// prépare les donnés du tableau
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$tabular_data[] = $data_row;
|
|
|
|
|
|
//print_r($client_list);
|
|
|
|
if ($client_list!=null){
|
|
foreach($client_list as $row)
|
|
{ $nbitem++;
|
|
// faire le link pour edit
|
|
$mem_link_edit="";
|
|
|
|
// $mem_link_edit=anchor('fournisseurs/form/'.$row['com_id'], ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-plus-sign" ');
|
|
//$mem_link_edit = '<a id="pk_1" data-id="0" data-facture="'.$row['det_fac_numero'].'" class="btn btn-primary btn-circle glyphicon glyphicon-pencil"> </a>';
|
|
$mem_link_edit = '';
|
|
$mem_link_projet = anchor('projets/form/' . $row['proj_id'], ' ', array('class'=> 'btn btn-primary btn-circle glyphicon glyphicon-edit', 'target' => 'projet' ));
|
|
|
|
|
|
// <a href="javascript:void(0);" class="btn btn-primary btn-circle"><i ></i></a> ';
|
|
$data_row = array();
|
|
$data_row[] = array('data'=> $mem_link_edit.$mem_link_projet, 'align' => 'left','width'=>5);
|
|
// $data_row[] = array('data'=>$row['com_num_client'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['proj_numero'], 'align' => 'left','width'=>5);
|
|
$data_row[] = array('data'=>$row['com_compagnie'].'</br>'.$row['proj_nom'], 'align' => 'left','width'=>75);
|
|
$data_row[] = array('data'=>$row['etape'], 'align' => 'left','width'=>3, 'class' => 'statut_' . $row['proj_etape']);
|
|
// $data_row[] = array('data'=>$row['rep_prenom']." ".$row['rep_nom'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['destination'], 'align' => 'left','width'=>30);
|
|
$data_row[] = array('data'=>$row['type'], 'align' => 'left','width'=>30);
|
|
|
|
$data_row[] = array('data'=>date("Y-m-d",strtotime($row['proj_date_debut'])), 'align' => 'left','width'=>10);
|
|
// $data_row[] = array('data'=>number_format($row['det_fac_montant'],2,'.',' '), 'align' => 'left');
|
|
|
|
//$mem_facture=' <a target="_blank" href="'. base_url().'/pdf/pdf2019/facturation/'. $row['det_fac_pdf'] .'" class="btn btn-primary btn-circle glyphicon glyphicon-list-alt"></a>';
|
|
|
|
|
|
// $data_row[] = array('data'=>$mem_facture, 'align' => 'left');
|
|
|
|
// $bal=$row['det_fac_montant']-$row['tot_montant'];
|
|
$bal=0;
|
|
|
|
// $data_row[] = array('data'=>$row['days'], 'align' => 'left');
|
|
$tabular_data[] = $data_row;
|
|
// print_r( $row);
|
|
|
|
$mem_projets=$this->mod_listtaches( $row['proj_id'],$excel,'projets');
|
|
|
|
|
|
if ($excel!=0){
|
|
$data_row_excel = array();
|
|
$data_row_excel[] = array('data'=>$row['com_compagnie'], 'align' => 'left');
|
|
|
|
$data_row_excel[] = array('data'=>$row['proj_numero'], 'align' => 'left','width'=>3);
|
|
$data_row_excel[] = array('data'=>$row['etape'], 'align' => 'left','width'=>3 );
|
|
|
|
$data_row_excel[] = array('data'=>$row['destination'], 'align' => 'left','width'=>30);
|
|
$data_row_excel[] = array('data'=>$row['type'], 'align' => 'left','width'=>30);
|
|
|
|
$data_row_excel[] = array('data'=>date("Y-m-d",strtotime($row['proj_date_debut'])), 'align' => 'left','width'=>10);
|
|
// $data_row[] = array('data'=>number_format($row['det_fac_montant'],2,'.',' '), 'align' => 'left');
|
|
|
|
$mem_excel_output['data'][]=$data_row_excel;
|
|
|
|
$mem_excel_output['data']=array_merge($mem_excel_output['data'],$mem_projets['excel']);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($mem_projets['tableau_sortie']==='vide'){
|
|
$mem_projets="";
|
|
$expend="";
|
|
}
|
|
else
|
|
{
|
|
|
|
$mem_nbitemtot=$mem_projets['nbitemtot'];
|
|
$mem_projets='<div style="display:none" id="hide_'.$row['proj_id'].'">'.$mem_projets['tableau_sortie']. '</div>';
|
|
|
|
$expend='<a id="bt_hide_'.$row['proj_id'].'" data-id="hide_'.$row['proj_id'].'" class="fa fa-fw fa-dot-circle-o"> </a> </br>'.$mem_nbitemtot ;
|
|
|
|
}
|
|
|
|
$data_row = array();
|
|
$data_row[] = array('data'=>$expend );
|
|
$data_row[] = array('data'=>$mem_projets,'colspan' => 6 );
|
|
|
|
$tabular_data[] = $data_row;
|
|
|
|
}
|
|
|
|
}
|
|
$template = array(
|
|
'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="table table-striped table-bordered table-hover">',
|
|
|
|
'thead_open' => '<thead>',
|
|
'thead_close' => '</thead>',
|
|
|
|
'heading_row_start' => '<tr>',
|
|
'heading_row_end' => '</tr>',
|
|
'heading_cell_start' => '<th>',
|
|
'heading_cell_end' => '</th>',
|
|
|
|
'tbody_open' => '<tbody>',
|
|
'tbody_close' => '</tbody>',
|
|
|
|
'row_start' => '<tr>',
|
|
'row_end' => '</tr>',
|
|
'cell_start' => '<td>',
|
|
'cell_end' => '</td>',
|
|
|
|
'row_alt_start' => '<tr>',
|
|
'row_alt_end' => '</tr>',
|
|
'cell_alt_start' => '<td>',
|
|
'cell_alt_end' => '</td>',
|
|
|
|
'table_close' => '</table>'
|
|
);
|
|
|
|
$this->table->set_template($template);
|
|
$this->table->set_heading($header);
|
|
|
|
$tableau_sortie= $this->table->generate($tabular_data);
|
|
|
|
if ($excel!=0){
|
|
//$mem_excel_output['data']=$tabular_data;
|
|
|
|
$data['fichier']="projetstaches.xls";
|
|
$mem_excel_output['fichier']="projetstaches";
|
|
// $mem_excel_output['titre']="depart du ".$debut.' @ '.$fin;
|
|
$mem_excel_output['titre']="rapport en date du ".date("Y-m-d H:i");;
|
|
$mem_parameter=array('premiere_ligne'=>0);
|
|
|
|
$this->Config_model->excel($mem_excel_output,$mem_parameter);
|
|
}
|
|
|
|
$data['list'] = $tableau_sortie;
|
|
|
|
return $data ;
|
|
}
|
|
|
|
public function mod_getRecords($filtre1 = "", $filtre2 = "", $filtre3 = "", $filtre4 = "",$date_debut,$date_fin,$mem_proj_num,$mem_proj_compagnie,$trie="",$mem_numero="")
|
|
{
|
|
|
|
|
|
// list la bb client
|
|
$this->db->select('*,type.gen_nom_fr as type,etape.gen_nom_fr as etape,destination.gen_nom_fr as destination,projdetails.det_desc,DATEDIFF( now(),tach_create_date) AS days,fournisseur.com_compagnie as fournisseur,client.com_compagnie as compagnie, CONCAT(aqui.usa_prenom," ",aqui.usa_nom) as usa_aqui,CONCAT(create.usa_prenom," ",create.usa_nom) as usa_create,CONCAT(fin.usa_prenom," ",fin.usa_nom) as usa_fin');
|
|
|
|
$this->db->from('tach_details');
|
|
|
|
$this->db->join('usa_usagers aqui', 'tach_details.tach_aqui_id = aqui.usa_id ', 'left');
|
|
$this->db->join('usa_usagers create', 'tach_details.tach_create_user_id = create.usa_id ', 'left');
|
|
$this->db->join('usa_usagers fin', 'tach_details.tach_create_user_id = fin.usa_id ', 'left');
|
|
$this->db->join('tach_genres', 'tach_details.tach_type = gen_id', 'left');
|
|
$this->db->join('proj_entete', 'tach_details.tach_section_id = proj_id and (tach_details.tach_section="Projets" or tach_details.tach_section="projetsclient" or tach_details.tach_section="projetsfournisseur" )', 'left');
|
|
$this->db->join('cli_compte client', 'tach_details.tach_section_id = client.com_id and tach_details.tach_section="Clients"', 'left');
|
|
$this->db->join('fou_compte fournisseur', 'tach_details.tach_section_id = fournisseur.com_id and tach_details.tach_section="Fournisseurs"', 'left');
|
|
$this->db->join('proj_details_details projdetails', 'tach_details.tach_details_id = projdetails.detail_id', 'left');
|
|
$this->db->join('proj_details projdetails1', 'tach_details.tach_details_id = projdetails1.proj_det_id', 'left');
|
|
$this->db->join('pro_descriptions prodescriptions', 'projdetails1.proj_prod_id = prodescriptions.des_id', 'left');
|
|
|
|
$this->db->join('cli_compte ctp', 'proj_entete.proj_client_id = ctp.com_id', 'left');
|
|
|
|
$this->db->join('proj_genres etape', 'etape.gen_id=proj_entete.proj_etape', 'left');
|
|
$this->db->join('proj_genres destination', 'destination.gen_id=proj_entete.proj_dest', 'left');
|
|
$this->db->join('proj_genres type', 'type.gen_id=proj_entete.proj_type', 'left');
|
|
if ($trie != "null"){
|
|
$this->db->order_by($trie);
|
|
}else{
|
|
|
|
}
|
|
//$this->db->order_by('tach_echeance_date');
|
|
$this->db->where("proj_date_debut>=",$date_debut);
|
|
$this->db->where("proj_date_debut<=",$date_fin);
|
|
|
|
|
|
|
|
if ($mem_proj_num!="")
|
|
$this->db->where("proj_numero='" . $mem_proj_num."'");
|
|
|
|
if ($mem_proj_compagnie!="")
|
|
$this->db->like('ctp.com_compagnie',$mem_proj_compagnie);
|
|
|
|
if ($filtre1!= 0)
|
|
$this->db->where("tach_details.tach_create_user_id",$filtre1);
|
|
|
|
|
|
if ($filtre2!= 0)
|
|
$this->db->where("proj_etape=" . $filtre2);
|
|
|
|
|
|
if ($filtre3 != 0)
|
|
$this->db->where("proj_type=" . $filtre3);
|
|
|
|
if ($filtre4 != 0)
|
|
$this->db->where("proj_dest=" . $filtre4);
|
|
|
|
|
|
$this->db->where("tach_details.tach_active",1);
|
|
if ($mem_numero==''){
|
|
|
|
$this->db->order_by('proj_date_debut');
|
|
$this->db->group_by("proj_numero");
|
|
}else{
|
|
$this->db->order_by('proj_date_debut');
|
|
$this->db->where("proj_numero=".$mem_numero);
|
|
|
|
}
|
|
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result_array();
|
|
// a faire sl affiche tableau de tache
|
|
//print_r ($result);
|
|
return $result;
|
|
}
|
|
public function mod_getRecordsold($rowno, $rowperpage, $filtre1 = "", $filtre2 = "", $filtre3 = "",$date_debut="2019-01-01",$date_fin="2025-01-01", $langue = 'fr')
|
|
{
|
|
|
|
// $this->db->select('*,DATEDIFF( now(),det_fac_envoi) AS days,proj_entete.proj_client_id as cli_id,cli_contacts.con_prenom as cli_contact_prenom,cli_contacts.con_nom as cli_contact_nom,fou_contacts.con_courriel as fou_contact_courriel,fou_contacts.con_prenom as fou_contact_prenom,fou_contacts.con_nom as fou_contact_nom,cli_compte.com_compagnie as com_compagnie_client,fou_compte.com_compagnie as com_compagnie_fou,sum(pai_paiements.pai_montant) as tot_montant');
|
|
$this->db->select('*,DATEDIFF( now(),det_fac_envoi) AS days,proj_entete.proj_client_id as cli_id,cli_contacts.con_prenom as cli_contact_prenom,cli_contacts.con_nom as cli_contact_nom,fou_contacts.con_courriel as fou_contact_courriel,fou_contacts.con_prenom as fou_contact_prenom,fou_contacts.con_nom as fou_contact_nom,cli_compte.com_compagnie as com_compagnie_client,fou_compte.com_compagnie as com_compagnie_fou');
|
|
|
|
$this->db->from('proj_details_details');
|
|
|
|
|
|
|
|
// $this->db->join('pai_paiements','pai_paiements.pai_no_facture=proj_details_details.det_fac_numero', 'left');
|
|
$this->db->join('proj_details', 'proj_details.proj_det_id=proj_details_details.proj_det_id', 'left');
|
|
$this->db->join('proj_entete', 'proj_entete.proj_id=proj_details.proj_ent_id', 'left');
|
|
$this->db->join('fou_compte', 'fou_compte.com_id=proj_details.proj_fou_id', 'left');
|
|
$this->db->join('pro_descriptions', 'pro_descriptions.des_id=proj_details.proj_prod_id', 'left');
|
|
$this->db->join('fou_genres', 'fou_genres.gen_id=pro_descriptions.des_ref_type', 'left');
|
|
$this->db->join('cli_compte', 'cli_compte.com_id=proj_entete.proj_client_id', 'left');
|
|
$this->db->join('fou_contacts', 'fou_contacts.con_id=proj_details_details.det_res_contact_id', 'left');
|
|
$this->db->join('cli_contacts', 'cli_contacts.con_id=proj_entete.proj_contact_principale', 'left');
|
|
$this->db->group_by('det_fac_lot_numero');
|
|
|
|
$this->db->where('det_fac_lock', 1);
|
|
|
|
$this->db->where("det_fac_envoi between '".$date_debut." 00:00:00' and '".$date_fin." 23:59:00'");
|
|
|
|
|
|
$this->db->order_by("proj_details_details.det_fac_numero");
|
|
|
|
|
|
|
|
if ($filtre1 != "")
|
|
$this->db->where("det_fac_numero LIKE '%$filtre1%'");
|
|
if ($filtre2 != "")
|
|
$this->db->where("cli_compte.com_compagnie LIKE '%$filtre2%'");
|
|
if ($filtre3 != "")
|
|
$this->db->where("proj_numero LIKE '%$filtre3%'");
|
|
|
|
$this->db->limit($rowperpage, $rowno);
|
|
|
|
$query = $this->db->get();
|
|
$four = $query->result_array();
|
|
// ajouter la liste des type
|
|
$sortie="";
|
|
foreach ($four as $row){
|
|
$this->db->select('sum(pai_paiements.pai_montant) as tot_montant');
|
|
$this->db->from('pai_paiements');
|
|
$this->db->where("pai_no_facture='".$row['det_fac_numero']."'");
|
|
$query = $this->db->get();
|
|
$montant = $query->result_array();
|
|
$row['tot_montant']=$montant[0]['tot_montant'];
|
|
$sortie[]=$row;
|
|
}
|
|
|
|
|
|
return $sortie;
|
|
}
|
|
public function mod_getRecords_contacts($id, $langue = 'fr')
|
|
{
|
|
// list la bb client
|
|
$this->db->select('*,fou_contacts_roles.rol_nom as role');
|
|
$this->db->from('fou_contacts');
|
|
$this->db->join('fou_contacts_roles', 'fou_contacts_roles.rol_id=fou_contacts.con_role_id', 'left');
|
|
$this->db->where('fou_contacts.ref_id', $id);
|
|
$this->db->where('fou_contacts.con_actif', 1);
|
|
$query = $this->db->get();
|
|
return $query->result_array();
|
|
}
|
|
|
|
public function mod_getRecord($id, $langue = 'fr')
|
|
{
|
|
// trouve un enregiestrement
|
|
$this->db->select('*');
|
|
$this->db->from('pai_paiements');
|
|
$this->db->join('pai_genres', 'pai_genres.gen_id=pai_paiements.pai_gen_id', 'left');
|
|
$this->db->join('usa_usagers', 'pai_paiements.pai_user = usa_usagers.usa_id ', 'left');
|
|
|
|
|
|
$this->db->where('pai_id=' . $id);
|
|
|
|
$this->db->limit(1);
|
|
|
|
$query = $this->db->get();
|
|
return $query->row();
|
|
}
|
|
|
|
public function mod_saveRecordbd($id, $data, $pref)
|
|
{
|
|
|
|
|
|
// creation de la chaine de save
|
|
$mem_data = array();
|
|
// ajoute les checkbox
|
|
if (!isset($data['com_actif']))
|
|
$data['com_actif'] = 0;
|
|
foreach ($data as $key => $value) {
|
|
|
|
|
|
if (substr($key, 0, strlen($pref)) == $pref) {
|
|
switch ($key) {
|
|
case 'com_ref_type':
|
|
$mem_value = '';
|
|
foreach ($data['com_ref_type'] as $key2 => $value2) {
|
|
$mem_value = $mem_value . $value2 . ',';
|
|
|
|
}
|
|
$mem_value = rtrim($mem_value, ",");
|
|
$mem_data['com_ref_type'] = $mem_value;
|
|
break;
|
|
|
|
default:
|
|
$mem_data[$key] = $value;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
$mem_data['com_modif'] = date("Y-m-d H:i:s");
|
|
$mem_where = "com_id =" . $id;
|
|
|
|
$str = $this->db->update('fou_compte', $mem_data, $mem_where);
|
|
$ok = true;
|
|
|
|
return $ok;
|
|
}
|
|
|
|
|
|
|
|
public function mod_createRecordbdcontact($data, $pref, $ref_id)
|
|
{
|
|
|
|
|
|
$mem_data = array();
|
|
foreach ($data as $key => $value) {
|
|
if (substr($key, 0, strlen($pref)) == $pref) {
|
|
$mem_data[$key] = $value;
|
|
}
|
|
|
|
}
|
|
$mem_data['ref_id'] = $ref_id;
|
|
$mem_data['con_creation'] = date("Y-m-d H:i:s");
|
|
$mem_data['con_actif'] = 1;
|
|
|
|
$str = $this->db->insert('fou_contacts', $mem_data);
|
|
|
|
$ok = true;
|
|
|
|
return;
|
|
}
|
|
|
|
public function mod_deleteRecordbdcontact($id)
|
|
{
|
|
|
|
$mem_data['con_actif'] = 0;
|
|
$mem_where = "con_id =" . $id;
|
|
|
|
$str = $this->db->update('fou_contacts', $mem_data, $mem_where);
|
|
|
|
|
|
$ok = true;
|
|
|
|
return;
|
|
}
|
|
public function mod_getRecordCount()
|
|
{
|
|
$this->db->select('count(*) as allcount');
|
|
$this->db->from('tach_details');
|
|
|
|
|
|
$query = $this->db->get();
|
|
$result = $query->result_array();
|
|
return $result[0]['allcount'];
|
|
}
|
|
public function mod_getRecordCountold()
|
|
{
|
|
$this->db->select('count(*) as allcount');
|
|
$this->db->from('proj_details_details');
|
|
$this->db->join('proj_details', 'proj_details.proj_det_id=proj_details_details.proj_det_id', 'left');
|
|
$this->db->join('proj_entete', 'proj_entete.proj_id=proj_details.proj_ent_id', 'left');
|
|
$this->db->join('fou_compte', 'fou_compte.com_id=proj_details.proj_fou_id', 'left');
|
|
$this->db->join('pro_descriptions', 'pro_descriptions.des_id=proj_details.proj_prod_id', 'left');
|
|
$this->db->join('fou_genres', 'fou_genres.gen_id=pro_descriptions.des_ref_type', 'left');
|
|
$this->db->join('cli_compte', 'cli_compte.com_id=proj_entete.proj_client_id', 'left');
|
|
$this->db->join('fou_contacts', 'fou_contacts.con_id=proj_details_details.det_res_contact_id', 'left');
|
|
$this->db->join('cli_contacts', 'cli_contacts.con_id=proj_entete.proj_contact_principale', 'left');
|
|
$this->db->group_by('det_fac_lot_numero');
|
|
|
|
$this->db->where('det_fac_lock', 1);
|
|
$query = $this->db->get();
|
|
$result = $query->result_array();
|
|
return $result[0]['allcount'];
|
|
}
|
|
public function mod_getRecordCountfilter($filtre1 = "", $filtre2 = "", $filtre3 = "",$filtre4 = "",$listactive='')
|
|
{
|
|
// list la bb client
|
|
$this->db->select('count(*) as allcount');
|
|
$this->db->from('tach_details');
|
|
|
|
$this->db->join('usa_usagers aqui', 'tach_details.tach_aqui_id = aqui.usa_id ', 'left');
|
|
$this->db->join('usa_usagers create', 'tach_details.tach_create_user_id = create.usa_id ', 'left');
|
|
$this->db->join('usa_usagers fin', 'tach_details.tach_create_user_id = fin.usa_id ', 'left');
|
|
$this->db->join('tach_genres', 'tach_details.tach_type = gen_id', 'left');
|
|
|
|
|
|
|
|
if ($filtre1 != "")
|
|
$this->db->where("tach_section='" . $filtre1."'");
|
|
if ($filtre2 != "")
|
|
$this->db->where("tach_details.tach_aqui_id",$filtre2);
|
|
|
|
|
|
if ($filtre3 != "")
|
|
$this->db->where("tach_type=" . $filtre3);
|
|
|
|
|
|
if ($listactive==1)
|
|
$this->db->where("tach_details.tach_active!=0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result_array();
|
|
|
|
|
|
return $result[0]['allcount'];
|
|
}
|
|
|
|
public function mod_getRecordCountfilterxxx($filtre1 = "", $filtre2 = "", $filtre3 = "",$filtre4 = "",$listactive)
|
|
{
|
|
// list la bb client
|
|
$this->db->select('count(*) as allcount');
|
|
$this->db->from('tach_details');
|
|
|
|
$this->db->join('usa_usagers aqui', 'tach_details.tach_aqui_id = aqui.usa_id ', 'left');
|
|
$this->db->join('usa_usagers create', 'tach_details.tach_create_user_id = create.usa_id ', 'left');
|
|
$this->db->join('usa_usagers fin', 'tach_details.tach_create_user_id = fin.usa_id ', 'left');
|
|
$this->db->join('tach_genres', 'tach_details.tach_type = gen_id', 'left');
|
|
|
|
|
|
|
|
if ($filtre1 != "")
|
|
$this->db->where("tach_section='" . $filtre1."'");
|
|
if ($filtre2 != "")
|
|
$this->db->where("tach_details.tach_aqui_id",$filtre2);
|
|
|
|
|
|
if ($filtre3 != "")
|
|
$this->db->where("tach_type=" . $filtre3);
|
|
|
|
|
|
if ($listactive==1)
|
|
$this->db->where("tach_details.tach_active!=0");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$query = $this->db->get();
|
|
|
|
$result = $query->result_array();
|
|
|
|
|
|
return $result[0]['allcount'];
|
|
}
|
|
public function mod_getRecordCountfilterold($filtre1 = "", $filtre2 = "", $filtre3 = "")
|
|
{
|
|
$this->db->select('count(*) as allcount');
|
|
$this->db->from('proj_details_details');
|
|
|
|
$this->db->join('proj_details', 'proj_details.proj_det_id=proj_details_details.proj_det_id', 'left');
|
|
$this->db->join('proj_entete', 'proj_entete.proj_id=proj_details.proj_ent_id', 'left');
|
|
$this->db->join('fou_compte', 'fou_compte.com_id=proj_details.proj_fou_id', 'left');
|
|
$this->db->join('pro_descriptions', 'pro_descriptions.des_id=proj_details.proj_prod_id', 'left');
|
|
$this->db->join('fou_genres', 'fou_genres.gen_id=pro_descriptions.des_ref_type', 'left');
|
|
$this->db->join('cli_compte', 'cli_compte.com_id=proj_entete.proj_client_id', 'left');
|
|
$this->db->join('fou_contacts', 'fou_contacts.con_id=proj_details_details.det_res_contact_id', 'left');
|
|
$this->db->join('cli_contacts', 'cli_contacts.con_id=proj_entete.proj_contact_principale', 'left');
|
|
$this->db->group_by('det_fac_lot_numero');
|
|
|
|
$this->db->where('det_fac_lock', 1);
|
|
$query = $this->db->get();
|
|
$result = $query->result_array();
|
|
return $result[0]['allcount'];
|
|
}
|
|
public function mod_listtache($section,$section_id,$details_id=0)
|
|
{
|
|
|
|
$this->db->select('*,statut.gen_nom_fr as statut_fr,statut.gen_id as statutid,genres.gen_id as typeid,genres.gen_nom_fr as gen_nom_fr, CONCAT(aqui.usa_prenom," ",aqui.usa_nom) as usa_aqui,CONCAT(create.usa_prenom," ",create.usa_nom) as usa_create,CONCAT(fin.usa_prenom," ",fin.usa_nom) as usa_fin');
|
|
|
|
$this->db->from('tach_details');
|
|
|
|
$this->db->join('usa_usagers aqui', 'tach_details.tach_aqui_id = aqui.usa_id ', 'left');
|
|
$this->db->join('usa_usagers create', 'tach_details.tach_create_user_id = create.usa_id ', 'left');
|
|
$this->db->join('usa_usagers fin', 'tach_details.tach_create_user_id = fin.usa_id ', 'left');
|
|
$this->db->join('tach_genres genres', 'tach_details.tach_type = genres.gen_id', 'left');
|
|
$this->db->join('tach_genres statut', 'tach_details.tach_statut = statut.gen_id', 'left');
|
|
|
|
$this->db->where( 'tach_section' ,strtolower($section) );
|
|
$this->db->where('tach_section_id',$section_id);
|
|
|
|
$this->db->join('proj_details_details projdetails', 'tach_details.tach_details_id = projdetails.detail_id', 'left');
|
|
$this->db->join('proj_details projdetails1', 'tach_details.tach_details_id = projdetails1.proj_det_id', 'left');
|
|
$this->db->join('pro_descriptions prodescriptions', 'projdetails1.proj_prod_id = prodescriptions.des_id', 'left');
|
|
$this->db->join('fou_compte fournisseur', 'projdetails1.proj_fou_id = fournisseur.com_id', 'left');
|
|
|
|
|
|
|
|
$this->db->where('tach_active',1);
|
|
if ($details_id!=0){
|
|
$this->db->where('tach_details_id',$details_id);
|
|
|
|
}
|
|
$this->db->order_by('tach_echeance_date');
|
|
$query = $this->db->get();
|
|
$result = $query->result_array();
|
|
|
|
|
|
return $result ;
|
|
|
|
|
|
|
|
|
|
}
|
|
public function mod_listcontact($record = 0)
|
|
{
|
|
|
|
|
|
// $recordCount = $this->Fournisseurs_model->getRecordCount();
|
|
|
|
$client_list = $this->mod_getRecords_contacts($record);
|
|
|
|
|
|
// creation du tableau
|
|
|
|
|
|
// prepare header
|
|
|
|
//$mem_link_new=anchor('clients/form/0' , ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-plus-sign" ');
|
|
|
|
$mem_link_new = '<button id="submit_btn" type="submit" class="btn btn-primary btn-circle glyphicon glyphicon-plus"></button> ';
|
|
|
|
|
|
$header=array('','Prénom',
|
|
'Nom',
|
|
'<i class="fa fa-fw fa-phone text-muted hidden-md hidden-sm hidden-xs"></i>Téléphone bureau',
|
|
'Ext',
|
|
'<i class="fa fa-fw fa-phone text-muted hidden-md hidden-sm hidden-xs"></i>Cellulaire',
|
|
'Courriel',
|
|
'Role');
|
|
// prépare les donnés du tableau
|
|
$nbitem = 0;
|
|
foreach ($client_list as $row) {
|
|
$nbitem++;
|
|
// faire le link pour edit
|
|
$mem_link_edit = anchor('fournisseurs/deletecontact/' . $row['con_id'] . '/' . $record, ' ', 'class="btn btn-primary btn-circle glyphicon glyphicon-trash" ');
|
|
// <a href="javascript:void(0);" class="btn btn-primary btn-circle"><i ></i></a> ';
|
|
$data_row = array();
|
|
|
|
$data_row[] = array('data'=> $mem_link_edit, 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_prenom'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_nom'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_telephone'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_ext'],'width'=>'5', 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_telephone2'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['con_courriel'], 'align' => 'left');
|
|
$data_row[] = array('data'=>$row['role'], 'align' => 'left');
|
|
|
|
$tabular_data[] = $data_row;
|
|
|
|
}
|
|
$data_row = array();
|
|
$data_row[] = array('data'=> $mem_link_new);
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_prenom','size'=>15)));
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_nom','size'=>15)));
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_telephone','size'=>15)));
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_ext','size'=>5)));
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_telephone2','size'=>15)));
|
|
$data_row[] = array('data'=> form_input(array('name' => 'con_courriel','size'=>15)));
|
|
|
|
$mem_choix = $this->Config_model->conf_getRolesContactsFournisseur();
|
|
$mem_roles = form_dropdown('con_role_id', $mem_choix);
|
|
|
|
|
|
$data_row[] = array('data' => $mem_roles, 'align' => 'left');
|
|
$tabular_data[] = $data_row;
|
|
|
|
$template = array(
|
|
'table_open' => '<table border="0" cellpadding="4" cellspacing="0" class="table table-striped table-bordered table-hover">',
|
|
|
|
'thead_open' => '<thead >',
|
|
'thead_close' => '</thead>',
|
|
|
|
'heading_row_start' => '<tr>',
|
|
'heading_row_end' => '</tr>',
|
|
'heading_cell_start' => '<th>',
|
|
'heading_cell_end' => '</th>',
|
|
|
|
'tbody_open' => '<tbody>',
|
|
'tbody_close' => '</tbody>',
|
|
|
|
'row_start' => '<tr>',
|
|
'row_end' => '</tr>',
|
|
'cell_start' => '<td>',
|
|
'cell_end' => '</td>',
|
|
|
|
'row_alt_start' => '<tr>',
|
|
'row_alt_end' => '</tr>',
|
|
'cell_alt_start' => '<td>',
|
|
'cell_alt_end' => '</td>',
|
|
|
|
'table_close' => '</table>'
|
|
);
|
|
|
|
$this->table->set_template($template);
|
|
|
|
$this->table->set_heading($header);
|
|
$tableau_sortie = $this->table->generate($tabular_data);
|
|
|
|
|
|
return $tableau_sortie;
|
|
|
|
|
|
}
|
|
|
|
public function mod_getforminfo($id)
|
|
{
|
|
global $mem_data, $validation;
|
|
|
|
$this->load->model('Config_model');
|
|
$this->load->model('FxForm_model');
|
|
// vas chercher les info de la fiche
|
|
|
|
if ($id != 0)
|
|
$info = $this->mod_getRecord($id);
|
|
|
|
|
|
// prepare info pour chaque champs utilisé
|
|
// input
|
|
$mem_data['mem_id'] = $id;
|
|
$mem_champ = 'pai_montant';
|
|
$mem_value = ($id == 0 ? '' : $info->$mem_champ);
|
|
$this->FxForm_model->fxinputtxt($mem_champ, $mem_value, 'Montant', '');
|
|
$this->FxForm_model->fxvaliderequired($mem_champ);
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
$mem_champ = 'pai_note';
|
|
$mem_value = ($id == 0 ? '' : $info->$mem_champ);
|
|
$this->FxForm_model->fxinputtxt($mem_champ, $mem_value, 'Note', '');
|
|
// $this->FxForm_model->fxvaliderequired($mem_champ);
|
|
// -------------------------------------------------------------------------
|
|
$mem_champ = 'pai_date';
|
|
|
|
$mem_data['icon'][$mem_champ] = 'icon-append fa fa-calendar';
|
|
$mem_value = ($id == 0 ? '' : $info->$mem_champ);
|
|
|
|
$this->FxForm_model->fxinputtxt($mem_champ, $mem_value, 'Date', '', '', '');
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
$mem_champ = 'pai_gen_id';
|
|
|
|
$mem_value = ($id == 0 ? '' : $info->$mem_champ);
|
|
$mem_data['select'][$mem_champ]['choix'] = $this->Config_model->conf_getGenresPaiement('fr');
|
|
// value multipli select
|
|
$mem_value = explode(',', $mem_value);
|
|
|
|
$mem_data['select'][$mem_champ]['value'] = $mem_value;
|
|
$mem_data['label'][$mem_champ] = 'Type';
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
$mem_data['validation'] = $this->FxForm_model->fxValidation($validation['rule'], $validation['message']);
|
|
|
|
|
|
return $mem_data;
|
|
}
|
|
public function mod_selectcontact($fournisseur_id,$langue='fr',$choix_vide=true)
|
|
{
|
|
|
|
|
|
$contacts=$this->Fournisseurs_model->mod_getRecords_contacts($fournisseur_id);
|
|
// list la bb client
|
|
|
|
|
|
$mem_sortie=array();
|
|
if ($choix_vide)
|
|
$mem_sortie[0]='';
|
|
foreach ($contacts as $pro ){
|
|
$mem_sortie[$pro['con_id']]=$pro['con_prenom']." ".$pro['con_nom']." (".$pro['rol_nom'].")";
|
|
|
|
}
|
|
return $mem_sortie;
|
|
|
|
|
|
}
|
|
public function mod_createRecordbd($data, $pref, $id,$no_facture)
|
|
{
|
|
|
|
|
|
// creation de la chaine de save
|
|
|
|
$mem_data = array();
|
|
|
|
|
|
|
|
foreach ($data as $key => $value) {
|
|
if (substr($key, 0, strlen($pref)) == $pref) {
|
|
$mem_data[$key] = $value;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($id == 0) {
|
|
$mem_data['pai_user'] =$this->session->id ;
|
|
$mem_data['pai_no_facture'] =$no_facture;
|
|
|
|
$str = $this->db->insert('pai_paiements', $mem_data);
|
|
} else {
|
|
$mem_where = "pai_id =" . $id;
|
|
|
|
$str = $this->db->update('pai_paiements', $mem_data, $mem_where);
|
|
|
|
}
|
|
$ok = true;
|
|
|
|
return $this->db->insert_id();
|
|
}
|
|
} |