|
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/MC/../MCPRO/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AdminLTE 2 | Data Tables</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet" href="../../bower_components/bootstrap/dist/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="../../bower_components/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="../../bower_components/Ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="../../bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../../dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
<style>
body {
background-color: rgb(236,240,245);
}
.box-body {
background-color: rgb(255,255,255);
}
</style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<!-- /.row -->
<?php
// echo "zzzzrrtest <br/>" ;
include_once 'code/init.php';
// echo "<pre>" ;
// print_r($_SESSION) ;
// echo "</pre>" ;
// print_header ();
// [client_actif]
function get_bureau_drop_down($name = '', $param = '', $value ='', $choose = 'auto')
{
global $agence ;
if(!is_array($value))
$value = array($value) ;
$ret = "<select onchange='GetIdBureau()'; name=\"$name\" $param>".((in_array('', $value) || in_array('0', $value)) && count($value) == 1 && $choose == 'auto' || $choose === true ? '<option value="" selected style="font-weight:bold"></option>' : '') ;
$q = dbi_query("SELECT * FROM bureau WHERE agence_id=".$agence." ORDER BY nom_agence") ;
while($res = dbi_fetch_row($q)) {
$ret .= sprintf('<option value="%s"%s>%s </option>', $res['id_bureau'], in_array($res['id_bureau'], $value) ? ' selected' : '', $res['nom_agence']) ;
}
return $ret."</select>" ;
}
$where2='';
if($_GET['id'] && !empty($_GET['id']) )
{
if($_GET['id']>0)
{
$id=$_GET['id'];
$tabbursel=dbi_fetch_row((dbi_query('select * from bureau where id_bureau='.$_GET['id'].' and agence_id='.$agence.''))) ;
$id_bureau=$tabbursel['id_bureau'];
$nom_bureau=$tabbursel['nom_agence'];
$where1=" AND ID_Bureau != $id_bureau ";
$where2=" AND client_bureau = $id_bureau ";
}
elseif($_GET['id']=="INDEFINI")
{
$id_bureau=$_GET['id'];
$where2=" AND client_bureau='0' ";
$selected='selected="selected"';
}
}
$CA=0;
?>
<script language="Javascript">
function GetIdBureau()
{
var id="";
id = document.bureau_form.client_bureau.value ;
if( id > 0 || id=="INDEFINI" )
window.location = "solde.php?id="+id;
else
window.location = "solde.php";
}
</script>
<style type="text/css">
div#hdp {
border:1;
position:absolute;
top:0;
left:25px;
}
</style>
<br/>
<br/>
<br/>
<h2> Encours Non Échu </h2>
<div class="box">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<TH align="center" >Client</TH>
<TH align="center" >Encours Non Éch</TH>
<TH align="center" >Nombre de Pieces </TH>
<TH align="center" >Dernier Paiement </TH>
<TH align="center" >Erreur Reglement </TH>
</tr><tbody>
<?php
$Client=array();
$order=' ASC ';
$query = dbi_query("SELECT f.client_id, client_pnom, client_nom, reglement_delai , 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, IF(client_genre='SERENA',1,0) as serena
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 $where2
GROUP BY date_fact, f.fact_id, total
HAVING paye > 0.001
ORDER BY client_nom $order , client_pnom $order , f.date_fact ASC ") ;
$today = date("Ymd");
// echo "$today <br/>" ;
// exit() ;
while($f = dbi_fetch_row($query))
{
// '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/>" ;
$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'] ;
if($date_fact_plus_reglement_delai >= $today )
{
$Client[$f['client_id']][]=$f;
}
}
// echo "<pre>" ;
// print_r($Client) ;
// echo "</pre>" ;
// exit() ;
$R=dbi_query("SELECT client_id id, concat(client_nom, ' ', client_pnom) civ, client_prospect, IF(client_genre='SERENA',1,0) as serena, IF(client_genre='FORMATION',1,0) as formation FROM ".TABLE_CLIENT." where agence_id=$agence ".( $_SESSION['client_actif']=='off' ? "" : "")." AND client_prospect ='0' $where2 ORDER BY civ");
while($cl = dbi_fetch_row($R))
{
$client_id=$cl['id'];
$a=$client_id ;
// $sommeavoir = 0 ;
$nb=count($Client[$client_id]);
$soldaa = 0 ;
for($i=0 ; $i<$nb ;$i++ )
{
// 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)
{
$CA+=$soldaa;
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) ;
$date_haujd = explode("/", $date_haujourduit);
$date_dern = explode("/", $date_dernier);
$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] ;
$dif_mois = $mois_h - $mois_d ;
$comp = 0 ;
$nbrjour = 0 ;
for($i=$jour_d ; $i <=30 ; $i++ )
{
$comp = $comp + 1 ;
}
$nbrjour = $comp + $jour_h ;
$yass=$anne_h - $anne_d ;
$yass = 0 ;
$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 ) ") ;
$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") ;
$ya = dbi_fetch_row($req_fact_nn);
$yb = dbi_fetch_row($req_fact);
$var = $ya['max(date)'] ;
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'] ;
$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 '<tr>';
echo "<td >".$cl['civ']."</td>";
echo "<td align='center' >$soldaa</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>";
}
$var_nn=$ya["date_fact"];
$var_yes =$yb["max_fact"] ;
//if($dateF > $dateP)
if($ya["date_fact"] < $yb["max_fact"] && $solde!=0 && $solde > 0)
{
$var_nn = substr($var_nn,6,2).'/'.substr($var_nn,4,2).'/'.substr($var_nn,0,4);
echo "<td align='center'> <i class='fa fa-fw fa-close' onclick=\"alert('La date de la facture non reglee : $var_nn')\"></i> </td>";
}
else
{
echo "<td align='center' ><i class='fa fa-fw fa-check' ></i> </td>";
}
echo '</tr>';
}
}
?>
</table>
</div>
<table style="position:absolute; top:10px; right:872px;" >
<tr>
<td class="tdl" style="width:50%;" > <b> <?=number_format($CA, 2, ",", " ")?> <b/> €<br/><br/></td>
</tr>
<tr>
</table>
<!-- /.col -->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<!-- page script -->
<script>
$(function () {
$('#example1').DataTable()
$('#example2').DataTable({
'paging' : true,
'lengthChange': false,
'searching' : false,
'ordering' : true,
'info' : true,
'autoWidth' : false
})
})
</script>
</body>
</html>
