Files
crm-ms1/application/views/paiements/paiements_filtre.php
2026-05-27 11:44:10 -04:00

167 lines
4.7 KiB
PHP

mem_select=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_fournisseur','mem_select_3',0,0);?>;
// START AND FINISH DATE
$('#date_debut').datepicker({
dateFormat: 'yy-mm-dd',
prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',
onSelect: function (selectedDate) {
$('#date_fin').datepicker('option', 'minDate', selectedDate);
createpagination_fournisseurs(0);
}
});
$('#date_fin').datepicker({
dateFormat: 'yy-mm-dd',
prevText: '<i class="fa fa-chevron-left"></i>',
nextText: '<i class="fa fa-chevron-right"></i>',
onSelect: function (selectedDate) {
$('#date_debut').datepicker('option', 'maxDate', selectedDate);
createpagination_fournisseurs(0);
}
});
<?php
if ($model_de_fournisseur=="liste"){
?>
createpagination_fournisseurs(0);
<?php
}
?>
$('#pagination_fournisseurs').on('click','a',function(e){
e.preventDefault();
var pageNum = $(this).attr('data-ci-pagination-page');
createpagination_fournisseurs(pageNum);
});
$("body").on("keyup", "input.filtre_fournisseurs_1", function(e){
if(e.which == 13) {
createpagination_fournisseurs(0,1)
}
});
$("body").on("keyup", "input.filtre_fournisseurs_2", function(e){
if(e.which == 13) {
createpagination_fournisseurs(0,2)
}
});
$("body").on("change", ".filtre_fournisseurs_3", function(){
createpagination_fournisseurs(0,3)
});
(function($){
$.fn.focusTextToEnd = function(){
this.focus();
var $thisVal = this.val();
this.val('').val($thisVal);
return this;
}
}(jQuery));
function createpagination_fournisseurs(pageNum,nofiltre=1,excel=0){
mem_debut=$('#date_debut').val();
mem_fin=$('#date_fin').val();
if (typeof $('input.filtre_fournisseurs_1').val()!=='undefined'){
mem_filtre_fournisseurs_1=$('input.filtre_fournisseurs_1').val().trim();}
else
mem_filtre_fournisseurs_1=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_1','null',0,0);?>;
if(mem_filtre_fournisseurs_1=="")
mem_filtre_fournisseurs_1="null";
if (typeof $('input.filtre_fournisseurs_2').val()!=='undefined'){
mem_filtre_fournisseurs_2=$('input.filtre_fournisseurs_2').val().trim();}
else
mem_filtre_fournisseurs_2=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_2','null',0,0);?>;
if(mem_filtre_fournisseurs_2=="")
mem_filtre_fournisseurs_2="null";
if (typeof $('input.filtre_fournisseurs_3').val()!=='undefined'){
mem_filtre_fournisseurs_3=$('input.filtre_fournisseurs_3').val().trim();}
else
mem_filtre_fournisseurs_3=<?php echo $this->Config_model->conf_getFiltreData($this->session->id,'list_paiement','mem_select_3','null',0,0);?>;
if(mem_filtre_fournisseurs_3=="")
mem_filtre_fournisseurs_3="null";
$.ajax({
url: '<?=base_url()?>index.php/Paiements/loadData_list/'+pageNum+'/'+mem_filtre_fournisseurs_1+'/'+mem_filtre_fournisseurs_2+'/'+mem_filtre_fournisseurs_3+'/'+mem_debut+'/'+mem_fin+'/1/<?php echo($model_de_fournisseur);?>/'+excel,
type: 'get',
dataType: 'json',
success: function(responseData){
$('#pagination_fournisseurs').empty();
$('#pagination_fournisseurs').html(responseData.pagination);
$('#fournisseurs_List').empty();
$('#fournisseurs_List').html(responseData.list);
$('#Fournisseurs_actif').empty();
$('#Fournisseurs_actif').html(responseData.recordCount);
$('input.filtre_fournisseurs_'+nofiltre).focusTextToEnd();
if(excel!=0)
{
location.replace('/data/paiement.xls' );
}
}
});
}
mem_excel=0;
$("body").on("click", ".emp a", function(){
memid=$(this).attr("id") ;
if (event.target.id=='excel'){
var x = $(this).attr("data-id");
createpagination_fournisseurs(0,3,x);
}else{
if (memid.substring(0, 2)=='bt'){
var x = document.getElementById($(this).attr("data-id"));
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}else{
if (typeof memid != 'undefined' || mem_excel==1) {
$.ajax({
url: '<?=base_url()?>index.php/Paiements/form/'+$(this).attr("data-id")+'/null/'+$(this).attr("data-facture"),
type: 'get',
dataType: 'json',
success: function(responseData){
mem_excel==0
$('#modal_info').html(responseData);
}
});
$('#myModal').modal('show');
}};
}
});