|
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/feuillesroute/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
$pagemenu = basename($_SERVER["PHP_SELF"]) ;
$TOTALREG = 0;
?>
<!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 Total") ; ?> </h5></div>
<div class="card-body">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<TH align="center" >Client</TH>
<TH align="center" >Encours Total</TH>
<TH align="center" >Nombre de Pieces </TH>
<TH align="center" >Dernier Paiement </TH>
</tr><tbody>
<?php
$Client=array();
// $order=' ASC ';
$query = dbi_query("SELECT f.client_id, client_nom, f.num_fact, c.client_reglement,
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.agence_id=$agence
GROUP BY date_fact, f.fact_id, total
HAVING paye > 0.001
ORDER BY client_nom $order , f.date_fact ASC ") ;
while($f = dbi_fetch_row($query))
{
$Client[$f['client_id']][]=$f;
}
$R=dbi_query("SELECT client_id id, client_nom civ FROM ".TABLE_CLIENT." ");
while($cl = dbi_fetch_row($R))
{
$client_id=$cl['id'];
$a=$client_id ;
$q = dbi_query("SELECT sum(f.total)
FROM (
(select -montant total from ".TABLE_PAIEMENT." where client_id= '".$client_id."' AND agence_id='$agence')
union all
(
SELECT total-sum(if(a.montant is null, 0, a.montant)) AS total
FROM ".TABLE_FACT." f
LEFT JOIN ".TABLE_AVOIR." a ON f.fact_id = a.fact_id
WHERE f.client_id= '".$client_id."'
AND f.agence_id='$agence'
GROUP BY f.fact_id, f.total
)
) f") ;
$nb=count($Client[$client_id]);
list($solde) = dbi_fetch_row($q) ;
// echo "==> $solde <br/>" ;
if($solde > 0 )
{
$CA+=$solde;
if(!empty($solde))
$solde=number_format($solde, 2, ', ', '');
list($regl) = dbi_fetch_row(dbi_query("select date from ".TABLE_PAIEMENT." where client_id=$a order by date DESC limit 1")) ;
$date_haujourduit = date("d/m/Y");
$date_dernier=int2date($regl) ;
//echo "date dernier facture ".$date_dernier."</br>" ;
//echo " date d'hojourdui est ".$date_haujourduit."</br>";
$date_haujd = explode("/", $date_haujourduit);
$date_dern = explode("/", $date_dernier);
/*echo "<pre>";
print_r($date_haujd) ;
echo "</pre>";
echo "<pre>";
print_r($date_dern) ;
echo "</pre>";*/
//echo "---->".$dfin."<br/>" ;
$red = 0 ;
$bleu = 0 ;
$jour_d = $date_dern[0] ;
$mois_d = $date_dern[1] ;
$anne_d = $date_dern[2] ;
$jour_h = $date_haujd[0] ;
$mois_h = $date_haujd[1] ;
$anne_h = $date_haujd[2] ;
//echo "---->".$jour_d."<br/>" ;
//echo "---->".$mois_d."<br/>" ;
$dif_mois = $mois_h - $mois_d ;
$comp = 0 ;
$nbrjour = 0 ;
for($i=$jour_d ; $i <=30 ; $i++ )
{
$comp = $comp + 1 ;
}
$nbrjour = $comp + $jour_h ;
//echo "********************".$nbrjour."<br/>";*/
//$yass=$anne_h - $ann_d ;
//echo "----->".$anne_h."<br/>" ;
$yass=$anne_h - $anne_d ;
$yass = 0 ;
//echo "---------->".$yass."<br/>" ;
//or $dif_mois >= 2 or $nbrjour >=30
/*if($yass != 0)
{
$red = 1 ;
echo "-> red <br/>";
}*/
//exit();
//$s = strtotime($date)-strtotime($date_ya);
//$d = intval($s/86400)+1;
// echo "-------->".$s ;
//$a = date_diff($date_ya, $date) ;
//echo "-----------------------> le nombre de jours est = ".$a;
//$dfin = explode("-", $date);
/*
echo '<pre>';
print_r($dfin);
echo '</pre>';
exit();
echo "nous soomme ".$dfin[1];
*/
//$heure = date("H:i");
//Print("Nous sommes le $date et il est $heure");
//exit();
// echo
$req_fact_nn=dbi_query("SELECT date_fact FROM `facture` WHERE facture.client_id = $a and `fact_id` not in ( select fact_id from paiement where facture.client_id = $a) and `fact_id` not in (select fact_id from avoir ) ") ;
/*while($factnn = dbi_fetch_row($req_fact_nn))
{
echo"<pre>" ;
print_r($factnn) ;
echo"</pre>" ;
}*/
$req_fact=dbi_query("SELECT max(date_fact) as max_fact FROM facture,paiement WHERE facture.fact_id=paiement.fact_id and facture.client_id = $a") ;
/*$req_fact_pai = dbi_query("select max(date) from paiement where client_id = $a") ;
while($factpai = dbi_fetch_row($req_fact_pai))
{
echo"<pre>" ;
print_r($factpai) ;
echo"</pre>" ;
}
exit();
$factpai['max(date)']
*/
// while($factnot = dbi_fetch_row($req_fact))
// {
// echo"<pre>" ;
// print_r($factnot) ;
// echo"<pre>" ;
// }
// exit();
$ya = dbi_fetch_row($req_fact_nn);
$yb = dbi_fetch_row($req_fact);
/*
$req_fact_pai = dbi_query("select max(date) from paiement where client_id = $a") ;
$ya = dbi_fetch_row($req_fact_pai) ;
/*
echo '<pre>';
print_r($ya);
echo '</pre>';
*/
$var = $ya['max(date)'] ;
//echo "------------++--->".$var."<br/>" ;
if($var != NULL)
{
$req_fac=dbi_query("SELECT max(date_fact) FROM `facture` WHERE `fact_id` in ( select fact_id from paiement where date= $var) ") ;
$yy= dbi_fetch_row($req_fac);
}
$dateP = $yy['max(date_fact)'] ;
$dateF = $y['date_fact'] ;
//echo "-->".$dateP."<br/>" ;
//echo "--->".$dateF."<br/>" ;
//exit();
/*$sqlsuivi="SELECT * FROM `client_suivi`,`suivi` WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id";
while($s = db_fetch_row($sqlsuivi))
{
echo"<pre>";
print_r($s);
echo"</pre>";
}
exit();
*/
// les suivé ************* les suivé *************** les suvé *************les suivé ******************* les suivé
$suivmax = dbi_query("SELECT max(client_suivi_id) as idmaxs FROM `client_suivi` WHERE client_id = $a ") ;
$suivf = dbi_fetch_row($suivmax);
$r=$suivf['idmaxs'];
//echo "----->".$r ;
/*if(empty($r))
{
$suiv = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.suivi_biais_id = suivi_biais.suivi_biais_id and suivi.suivi_id = 10 and client_suivi.client_suivi_clos = '0' ") ;
}
else
{
$suiv = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.client_suivi_id = $r and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.suivi_biais_id = suivi_biais.suivi_biais_id and suivi.suivi_id = 10 and client_suivi.client_suivi_clos = '0' ") ;
}*/
$suiv = dbi_query("SELECT * FROM `client_suivi`,`suivi` , suivi_biais WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id and client_suivi.suivi_biais_id = suivi_biais.suivi_biais_id and suivi.suivi_id = 10 and client_suivi.client_suivi_clos = '0' ORDER BY suivi_date DESC") ;
$s = dbi_fetch_row($suiv) ;
//$suivv = $suivfitch['annotation'] ;
$action = '';
if ($s['suivi_biais_id']=='4')
$action = '<img src="images/icones/warning.gif" alt="Message repondeur" border="0" align="absmiddle"> '.$s['suivi_biais_intitule'].' effectué';
else if ($s['suivi_programme']=='1')
$action = '<img src="images/icones/programme.gif" alt="Action programme" border="0" align="absmiddle"> Prévoir un '.strtolower($s['suivi_biais_intitule']);
else $action = $s['suivi_biais_intitule'].' effectué';
if ($s['suivi_biais_id']=='6')
$action = '<img src="images/controles-16.png" alt="Contrôle au domicile du client" border="0" align="absmiddle"> Prévoir une '.strtolower($s['suivi_biais_intitule']);
// $total+= $l['montant_devis'];
// if($s['suivi_date'])
// $action = $action.' le '.mysql_datefrrr($s['suivi_date'],'-','Djma');
// else
// $action = "";
/*echo "<pre>" ;
print_r($suivfitch) ;
echo "</pre>" ;
exit() ; */
echo '<tr>';
echo "<td >".$cl['civ']."</td>";
echo "<td align='center' >$solde</td>";
echo "<td align='center' >$nb</td>";
if($anne_h != $anne_d)
{
echo "<td align='center' > <font color=\"red\">$date_dernier </font></td>";
}
elseif( ($nbrjour >= 30 or $dif_mois >= 2) and $mois_d != $mois_h )
{
echo "<td align='center' > <font color=\"red\">$date_dernier </font></td>";
//echo "------>".$nbrjour ;
}
else
{
echo "<td align='center' >$date_dernier</td>";
}
/*
if($red = 1)
{
echo "<td align='center' > <b> <font color=\"red\">$date_dernier</font></b></td>";
}
else
{
}
*/
$var_nn=$ya["date_fact"];
$var_yes =$yb["max_fact"] ;
//if($dateF > $dateP)
//---------------------------affichage de suivi-------------------------------------------------------------
//echo "<td>$action</td>";
echo '</tr>';
/*$sqlsuivi="SELECT * FROM `client_suivi`,`suivi` WHERE client_id = $a and client_suivi.suivi_id = `suivi`.suivi_id";
$s = db_fetch_row($sqlsuivi);*/
}
}
?>
</table>
</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>
