|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/mcg/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
$pagemenu = basename($_SERVER["PHP_SELF"]) ;
$TOTALREG = 0;
// ini_set('display_errors','on');
// error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Enregistrer le titre de la page --><title> LogMCPRO | Client</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<!-- DataTables -->
<link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.css">
<!-- overlayScrollbars -->
<link rel="stylesheet" href="../dist/css/adminlte.min.css">
</head>
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Menu extensible -->
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a></li>
</ul>
<!-- liens TOP MENU DROITE -->
<ul class="navbar-nav ml-auto">
<!-- Placer ici l'élément à positionner à droite du TOP MENU -->
</ul>
</nav> <!-- fin du TOP MENU -->
<?php include('menu.php'); ?>
<!-- Ne pas toucher au dessus / fin de la BARRE DE NAVIGATION-->
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark"></h1>
</div><!-- /.col -->
<div class="col-sm-6">
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- PAGE PRINCIPALE -->
<div class="content">
<div class="container-fluid">
<div class="row">
<!-- DEFINITION DES COLONNES -->
<div class="col-lg-3">
<!-- WIDGET AVEC LE NOM DU CLIENT -->
<div class="info-box mb-3 bg-info">
<div class="info-box-content">
<span class="info-box-text"><b> <h1><div id='TOTALREG'><?php echo number_format( $TOTALREG, 2, ',', ' ').'<sup style="font-size: 20px">€ </sup>';?></div></h1></b></span>
</div>
</div>
<!-- BARRE DE NAVIGATION DU CLIENT -->
<?php include('menu_recouvrement.php'); ?>
</div>
<!-- PASSAGE A LA COLONNE DE DROITE-->
<div class="col-lg-9">
<div class="row">
<div class="col-lg-12">
<!-- CARD DE DROITE-->
<div class="card">
<div class="card-header"><h5 class="m-0"><i class="nav-icon far fas fa-chart-line"></i> <?php echo strtoupper ("Encours en Retard -20") ; ?> </h5></div>
<div class="card-body">
<div class="box-body">
<form action="" method="POST">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<TH align="center" >Client</TH>
<TH align="center" >Créer </TH>
<TH align="center" >Encours</TH>
<TH align="center" >Suivi </TH>
<TH align="center" >Action de suivi </TH>
<TH align="center" >Salarié administratif </TH>
<TH align="center" >Voir Suivi </TH>
<TH align="center" >relance 1 </TH>
<TH align="center" >relance 2 </TH>
</tr><tbody>
<?php
$Client=array();
$order=' ASC ';
$query = dbi_query("SELECT f.client_id, client_nom, reglement_delai , f.num_fact,
f.fact_id, total,total-sum(if(p.montant is null, 0, p.montant))-sum(if(a.montant is null, 0, a.montant)) AS paye,
if(a.montant is null, 0, a.montant) avoir,
f.date_fact, f.relance
FROM ".TABLE_FACT." f
LEFT JOIN ".TABLE_PAIEMENT." p ON f.fact_id=p.fact_id AND f.client_id=p.client_id
LEFT JOIN ".TABLE_AVOIR." a ON f.fact_id = a.fact_id
LEFT JOIN ".TABLE_CLIENT." c ON c.client_id = f.client_id
GROUP BY date_fact, f.fact_id, total
HAVING paye > 0.001
ORDER BY client_nom $order , f.date_fact ASC ") ;
// $today = date('Ymd', strtotime('-20 day'));
$today = date('Ymd');
$todayform = date('Y-m-d');
// echo
// echo "$today <br/>" ;
// exit() ;
while($f = dbi_fetch_row($query))
{
// echo "<pre>" ;
// print_r($f) ;
// echo "</pre>" ;
// 'Y-m-d'
// echo "==oooooooo>".int2date($f['date_fact'],'Y-m-d')."<br/>" ;
// $a = int2date($f['date_fact'],'Y-m-d') ;
// $tabloTest = explode('-', $a);
// $dateTest = $tabloTest[0].''.$tabloTest[1].''.$tabloTest[2];
// $b = strtotime(date("Y-m-d", strtotime($a)) . " +5 day");
// echo "=kk=>".$b."<br/>" ; .
$a = int2date($f['date_fact'],'Y-m-d') ;
$date_fact_plus_reglement_delai = date("Y-m-d", strtotime("$a +".$f['reglement_delai']." days"));
// echo "==>".$date_fact_plus_reglement_delai."<br/>" ;
// echo "==>".$todayform."<br/>" ;
$date1 = new DateTime($date_fact_plus_reglement_delai);
$date2 = new DateTime($todayform);
$diff = $date2->diff($date1)->format("%a");
// echo $diff."<br/>";
// exit() ;
$tabloTest = explode('-', $date_fact_plus_reglement_delai);
$date_fact_plus_reglement_delai = $tabloTest[0].''.$tabloTest[1].''.$tabloTest[2];
// echo "===>>> ".$date_fact_plus_reglement_delai."<br/>" ;
// $date_fact_plus_reglement_delai = $f['date_fact'] + $f['reglement_delai'] ;
// echo "===> $today <br/>" ;
// echo "==> ".$date_fact_plus_reglement_delai."<br/>" ;
if($date_fact_plus_reglement_delai <= $today )
{
$Client[$f['client_id']][]=$f;
}
}
// echo "<pre>" ;
// print_r($Client) ;
// echo "</pre>" ;
// exit() ;
?>
<?
$R=dbi_query("SELECT reglement_delai regday ,client_id id, client_nom civ FROM ".TABLE_CLIENT." ORDER BY civ");
while($cl = dbi_fetch_row($R))
{
$client_id=$cl['id'];
$a=$client_id ;
$nb=count($Client[$client_id]);
$soldaa = 0 ;
// $sommeavoir = 0 ;
for($i=0 ; $i<$nb ;$i++ )
{
// echo "=$i==>".$Client[$client_id][$i]['total']."<br/>" ;
// if(!empty($Client[$client_id][$i]['fact_id']))
// {
// list($avoir) = dbi_fetch_row(dbi_query("select montant from avoir where fact_id = ".$Client[$client_id][$i]['fact_id'])) ;
// }
// $sommeavoir = $sommeavoir + $avoir ;
$soldaa=$Client[$client_id][$i]['paye'] + $soldaa ;
// $avoir = 0 ;
}
// list($solde) = $Client[$client_id][] ;
// $soldaa = $soldaa - $sommeavoir ;
if($soldaa != 0)
{
$suiva = dbi_query("SELECT * FROM `client_suivi` WHERE client_id = $a and client_suivi_clos = '0' ") ;
$recouvrement = "" ;
$litige = "" ;
$Compta = "" ;
while($ss = dbi_fetch_row($suiva))
{
if($ss['suivi_id']== 10)
{
$recouvrement = "<i class='fa fa-fw fa-check' ></i>" ;
}
if($ss['suivi_id']== 21)
{
$litige = "<i class='fa fa-fw fa-check' ></i>" ;
}
if($ss['suivi_id']== 25)
{
$Compta = "<i class='fa fa-fw fa-check' ></i>" ;
}
}
$suiv = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and suivi_parent_id != 0 and client_suivi.client_suivi_clos = '0' and ( suivi.suivi_id = 21 or suivi.suivi_id = 25 or suivi.suivi_id = 10 ) ORDER BY suivi_date DESC") ;
list($suivdate) = dbi_fetch_row (dbi_query("SELECT UNIX_TIMESTAMP(suivi_date) FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and suivi_parent_id != 0 and client_suivi.client_suivi_clos = '0' and ( suivi.suivi_id = 21 or suivi.suivi_id = 25 or suivi.suivi_id = 10 ) ORDER BY suivi_date DESC")) ;
$suivRoucv = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.client_suivi_clos = '0' and suivi.suivi_id = 10 ORDER BY suivi_date DESC") ;
$suivlitge = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.client_suivi_clos = '0' and ( suivi.suivi_id = 21 or suivi.suivi_id = 25 or suivi.suivi_id = 10 ) ORDER BY suivi_date DESC") ;
$suivcompta = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.client_suivi_clos = '0' and ( suivi.suivi_id = 21 or suivi.suivi_id = 25 or suivi.suivi_id = 10 ) ORDER BY suivi_date DESC") ;
$sRoucv = dbi_fetch_row($suivRoucv) ;
$slitige = dbi_fetch_row($suivlitge) ;
$scompta = dbi_fetch_row($suivcompta) ;
if($sRoucv['suivi_parent_id']== 0)
{
$rec= $sRoucv['client_suivi_id'] ;
// echo "yasss $rec <br/>" ;
}
else
{
$rec= $sRoucv['suivi_parent_id'] ;
// echo "aa $rec <br/>" ;
}
if($slitige['suivi_parent_id']== 0)
{
$litg= $slitige['client_suivi_id'] ;
}
else
{
$litg= $slitige['suivi_parent_id'] ;
}
if($scompta['suivi_parent_id']== 0)
{
$comp= $scompta['client_suivi_id'] ;
}
else
{
$comp= $scompta['suivi_parent_id'] ;
}
$s = dbi_fetch_row($suiv) ;
if(!empty($s['Admin_ID']))
{
}
// echo "<pre>" ;
// print_r($s) ;
// echo "</pre>" ;
// if( )
// {
// }
if(!empty($s['client_suivi_id']))
{
$suiva = dbi_query("SELECT suivi_biais_id FROM `client_suivi` WHERE client_id = $a and client_suivi_id = ".$s['client_suivi_id']) ;
}
$ssv = dbi_fetch_row($suiva) ;
if(!empty($ssv['suivi_biais_id']))
{
$suiva2 = dbi_query(" SELECT * FROM `suivi_biais` WHERE suivi_biais_id = ".$ssv['suivi_biais_id']) ;
}
$ssv_bia = dbi_fetch_row($suiva2) ;
$action = '';
if($s['suivi_programme']=='1')
{
// if ($ssv['suivi_biais_id']=='4' or $ssv['suivi_biais_id']=='41' ) original
if ($ssv['suivi_biais_id']=='4')
$action = ' '.$ssv_bia['suivi_biais_intitule'].' effectué';
else if ($s['suivi_programme']=='1')
$action = ' Prévoir un '.strtolower($ssv_bia['suivi_biais_intitule']);
else $action = $s['suivi_biais_intitule'].' effectué';
if ($ssv['suivi_biais_id']=='6')
$action = ' Prévoir une '.strtolower($ssv_bia['suivi_biais_intitule']);
$total+= $l['montant_devis'];
// $action = $ssv_bia['suivi_biais_intitule'] ;
// if($s['suivi_date'])
// $action = mysql_datefrrr($s['suivi_date'],'-','Djma').' <b>'.$action;
// else
// $action = "";
}
else
{
$action = '';
}
if($action != "")
{
list($n , $p) = dbi_fetch_row(dbi_query(" SELECT Admin_nom,Admin_pnom FROM `administratif` where Admin_ID = ".$s['Admin_ID'] )) ;
$salarier_admin = $n." ".$p ;
}
else
{
$salarier_admin = "" ;
}
$get = 'client_id='.$a;
if($nb==1) //afficher sauf les clients qui ont le nombre de pieces egale 1
{
// echo "===================================>".$Client[$client_id][0]['date_fact']."<br/>" ;
$date_fact_plus_reglement_delai = date("Y-m-d", strtotime($Client[$client_id][0]['date_fact']."+".$cl['regday']." days"));
// echo "EEEEEEEEEEEEE==>".$date_fact_plus_reglement_delai."<br/>" ;
// echo "333333333333==>".$todayform."<br/>" ;
$date1 = new DateTime($date_fact_plus_reglement_delai);
$date2 = new DateTime($todayform);
$diff = $date2->diff($date1)->format("%a");
// echo 'sddddddddddddddddd'.$diff."<br/>";
//----------------------------------------------------------------------------------
$query = dbi_query("SELECT f.client_id, reglement_delai , f.num_fact,
f.fact_id, total,total-sum(if(p.montant is null, 0, p.montant))-sum(if(a.montant is null, 0, a.montant)) AS paye,
if(a.montant is null, 0, a.montant) avoir,
f.date_fact, f.relance
FROM ".TABLE_FACT." f
LEFT JOIN ".TABLE_PAIEMENT." p ON f.fact_id=p.fact_id AND f.client_id=p.client_id
LEFT JOIN ".TABLE_AVOIR." a ON f.fact_id = a.fact_id
LEFT JOIN ".TABLE_CLIENT." c ON c.client_id = f.client_id
WHERE f.client_id = $client_id
GROUP BY date_fact, f.fact_id, total
HAVING paye > 0.001 ") ;
$tabnumfact = array();
while($acd = dbi_fetch_row($query))
{
$tabnumfact[] =$acd['num_fact'] ;
}
$ab =count($tabnumfact);
// afficher juste les clients qui ont un seul facture
//----------------------------------------------------------------------------------------------
// echo " $client_id bbbbbbbbbbbbbbbbbb kkkkkkkkkk ===> $ab <br/>" ;
if($diff<=20 && $nb == 1)
{
$depasse = mktime(0,0,0,date("m"), date("d")+1, date("Y"));
$de= mktime($s['suivi_date'] );
if( $suivdate< $depasse )
{
$color= "rouge" ;
}
else
{
$color= "normale" ;
}
// echo $de."===>".$color."==".$depasse."<br/>" ;
$CA+=$soldaa;
if(!empty($solde))
$solde=number_format($solde, 2, ', ', '');
echo '<tr>';
echo "<td >".$cl['civ']."</td>";
?>
<td align='center' > <input type="checkbox" name="check_client[]" value="<?=$client_id?>"> </td>
<?
echo "<td align='center' >$soldaa</td>";
$var_nn=$ya["date_fact"];
$var_yes =$yb["max_fact"] ;
//if($dateF > $dateP)
?>
<td align='center' > <?=$recouvrement ?> </td>
<?
// $color= "rouge" ;
// echo "==aaaaa=>".$color."<br/>" ;
if($color== "rouge")
{
// echo "tttttttttttt" ;
echo "<td align='center' style='color:red' > $action</td>";
}
else
{
echo "<td align='center' > $action</td>";
}
echo "<td align='center' >$salarier_admin</td>";
?>
<td align='center'>
<A onclick="window.open('suivi_concern.php?client_id=<?=$a?>&link=client&page=suivi_gestion&suivi=historique&suiviiid=<?=$rec?>','nom_de_ma_popup','menubar=no, scrollbars=no, top=300, left=600, width=900, height=700');" target="edit" ><i class="fa fa-fw fa-plus-square"></i> </a>
</td>
<td align='center'>
<A onclick="window.open('relancesuiv_moin_20.php?client_id=<?=$a?>&link=client&page=suivi_gestion&suivi=historique&suiviiid=<?=$rec?>','nom_de_ma_popup','menubar=no, scrollbars=no, top=300, left=600, width=900, height=700');" target="edit" ><i class="fa fa-fw fa-envelope"></i> </a>
</td>
<td align='center'>
<A onclick="window.open('relancesuiv_moin_20.php?client_id=<?=$a?>&link=client&page=suivi_gestion&suivi=historique&suiviiid=<?=$rec?>','nom_de_ma_popup','menubar=no, scrollbars=no, top=300, left=600, width=900, height=700');" target="edit" ><i class="fa fa-fw fa-envelope"></i> </a>
</td>
<?
echo '</tr>';
}
}
}
}
?>
</table>
<input type="submit">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
<div class="p-3">
<h5>Title</h5>
<p>Sidebar content</p>
</div>
</aside>
<!-- /.control-sidebar -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.0.1
</div>
<strong>Copyright © 2014-2019 <a href="http://adminlte.io">AdminLTE.io</a>.</strong> All rights
reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<script>
$(function () {
var TOTALREG ="<?php echo number_format( $CA, 2, ',', ' ').' € ';?>";
$('#TOTALREG').html(TOTALREG);
})
</script>
<script>
// $(function () {
// Summernote
// $('.textarea').summernote()
// }) ;
$(document).ready(function(){
$('#myModal').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('id');
$.ajax({
type : 'post',
url : 'ajaxModifierReglement.php', //Here you will fetch records
data : 'rowid='+ rowid, //Pass $id
success : function(data){
$('#fetch').html(data);//Show fetched data from database
}
});
});
});
</script>
<script>
$(function () {
$("#example1").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
});
});
</script>
</body>
</html>
