AnonSec Team
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 (0755) :  /home/logmcpe/www/TMCPRO/pages/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TMCPRO/pages/cRvouvrement_bien_bien.php
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// error_reporting(E_ALL);
// ini_set("ddisplay_errors", 1);
// ini_set('memory_limit', '1000M');

// exit()  ;


if(!empty($_POST))
{

echo "<pre>" ; 
print_r($_POST) ; 
echo "</pre>" ; 
exit() ;	
}
$pagemenu = basename($_SERVER["PHP_SELF"]) ;
$now   = time();

 
function dateDiff($date1, $date2){
    $diff = abs($date1 - $date2); // abs vour avoir la valeur absolute, ainsi éviter d'avoir une différence négative
    $retour = array();
 
    $tmp = $diff;
    $retour['second'] = $tmp % 60;
 
    $tmp = floor( ($tmp - $retour['second']) /60 );
    $retour['minute'] = $tmp % 60;
 
    $tmp = floor( ($tmp - $retour['minute'])/60 );
    $retour['hour'] = $tmp % 24;
 
    $tmp = floor( ($tmp - $retour['hour'])  /24 );
    $retour['day'] = $tmp;
 
    return $retour;
}

// if(!empty($_POST))
// {
	// echo 'test';
// print_r($_POST);
// echo '</pre>';
// exit() ; 
// }
// ini_set('display_errors','on');
// error_reporting(E_ALL);

///////////variable session de client ///////////////////////////////

						// if(!empty($_GET['client_id']))
						// {
						// $_SESSION["client_id"]=$_GET['client_id'];

						// }
						 // $client_id =$_SESSION["client_id"] ; 
						 
						 
						  if(!empty($_GET['client_id']))
	 {
		 $client_id = $_GET['client_id'] ;
		 $_SESSION["client_id"] = $client_id ;
	 }
	 else
	 {
		 $client_id=$_SESSION["client_id"] ; 
	 }
						 
						 
//////////////////////////function////////////////////////////////////
					function get_drop_down_reglement2 ($name='', $param = '', $value='')
					{
						$q = dbi_query("SELECT * FROM reglement") ;
						$res = "<select  class='form-control' name=\"$name\" $param>" ;
						while($r = dbi_fetch_row($q))
							$res .= "<option value=\"{$r['reglement_id']}\"".($r['reglement_id'] == $value ? ' selected' : (($value==''&&$r['reglement_id'] == 2) ? ' selected' : '')).">".utf8_encode($r['reglement_desc'])."</option>" ;
						return "$res</select>" ;
					}

 
 // /////////////////////saisir infos de facturations  ///////////////////////////////////

				
					
					
	// /////////////////////saisir infos de facturations  ///////////////////////////////////
					
			

	?>
<!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">
    <style>
.myCollapse {
    display: none;
}
.myCollapse.in {
    display: block;
}
  .modal-header {
    padding: 15px;
    border-bottom: 1px solid #e5e5e5;
}
  .modal-header {
    background: #226faa;
    background: -webkit-gradient(linear,left top,right top,from(#226faa),color-stop(37%,#2989d8),to(#72c0d3));
    background: linear-gradient(to right,#226faa 0,#2989d8 37%,#72c0d3 100%);
    border-radius: 6px;
    color: #fff;
    padding: 18px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: transparent;
}

.modal-header .close {
    margin-top: -3px;
    font-size: 24px;
    font-weight: 400;
    color: #fff;
    opacity: .9;
    width: 28px;
    height: 28px;
    padding-bottom: 0;
    padding-left: 1px;
}
button.close {
    padding: 0;
    cursor: pointer;
    background: 0 0;
    border: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}



  </style>
  <!-- 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>
				<li> </li>
				<li></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 -->		  
							<?php include('widget_client.php'); ?>	
							<!-- BARRE DE NAVIGATION DU CLIENT -->		  
							<?php include('menu_client.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-body">
											<!-- ><section class="content"> CARD DE DROITE-->
											<?php if(isset($_GET["msg"])){ ?>
												<div class="alert alert-<?php echo $_GET["color"]; ?>  alert-dismissible col-12" role="alert">
												  <strong><?php echo $_GET["color"].': '; ?></strong><?php echo $_GET["msg"]; ?>.
												  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
													<span aria-hidden="true">&times;</span>
												  </button>
												</div>
											<?php  }


//**************************************************** non echu ******************************************

 $requet_non_echu = dbi_query("SELECT 

date_fact , reglement_delai , DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) as echu ,
 DATE_ADD( DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) , INTERVAL 20 DAY) as echu_plus_vingt ,
 DATE_FORMAT(CURRENT_DATE, '%Y%m%d') as today ,

f.num_fact, f.fact_id, total,date_debut,date_fin, total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
 if(a.avoir is null, 0, a.avoir) avoir, f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'Réglé',
 if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de règlement', 'Règlement partiel')) statut, f.relance FROM client c , facture f
 LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) paye, fact_id FROM paiement
 where client_id = $client_id group by fact_id) p ON f.fact_id = p.fact_id LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0,
 sum(if(montant is null, 0, montant))) avoir, fact_id FROM avoir group by fact_id) a ON f.fact_id = a.fact_id WHERE
 c.client_id = f.client_id AND f.client_id= $client_id AND if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) < total
 GROUP BY date_fact, f.fact_id, total  HAVING  today < echu order by num_fact DESC") ; 
 
											
											
											
											
											
											
		// ***************************** plus vingt 	************************************								
 $requet_plus_vingt = dbi_query("SELECT 

date_fact , reglement_delai , DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) as echu ,
 DATE_ADD( DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) , INTERVAL 20 DAY) as echu_plus_vingt ,
 DATE_FORMAT(CURRENT_DATE, '%Y%m%d') as today ,

f.num_fact, f.fact_id, total,date_debut,date_fin, total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
 if(a.avoir is null, 0, a.avoir) avoir, f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'Réglé',
 if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de règlement', 'Règlement partiel')) statut, f.relance FROM client c , facture f
 LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) paye, fact_id FROM paiement
 where client_id = $client_id group by fact_id) p ON f.fact_id = p.fact_id LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0,
 sum(if(montant is null, 0, montant))) avoir, fact_id FROM avoir group by fact_id) a ON f.fact_id = a.fact_id WHERE
 c.client_id = f.client_id AND f.client_id= $client_id AND if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) < total
 GROUP BY date_fact, f.fact_id, total  HAVING  today >  echu_plus_vingt order by num_fact DESC") ; 
 
 
 
 // *****************************************moins vingt *****************************************
 
 
 
 			   $requet_moins_vingt = dbi_query("SELECT client_nom , 

date_fact , reglement_delai , DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) as echu ,
 DATE_ADD( DATE_ADD(STR_TO_DATE(date_fact, '%Y%m%d'), INTERVAL reglement_delai DAY ) , INTERVAL 20 DAY) as echu_plus_vingt ,
 DATE_FORMAT(CURRENT_DATE, '%Y%m%d') as today ,

f.num_fact, f.fact_id, total,date_debut,date_fin, total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
 if(a.avoir is null, 0, a.avoir) avoir, f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'Réglé',
 if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de règlement', 'Règlement partiel')) statut, f.relance FROM client c , facture f
 LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) paye, fact_id FROM paiement
 where client_id = $client_id group by fact_id) p ON f.fact_id = p.fact_id LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0,
 sum(if(montant is null, 0, montant))) avoir, fact_id FROM avoir group by fact_id) a ON f.fact_id = a.fact_id WHERE
 c.client_id = f.client_id AND f.client_id= $client_id AND if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) < total
 GROUP BY date_fact, f.fact_id, total  HAVING today >= echu AND  today <= echu_plus_vingt order by num_fact DESC") ;
 
 
 
 
 
											//printf($query, '<');
											// $date = date("Ymd"); 
											// echo " $reglementDelai  $date <br/>"; 
											// $q2 = dbi_query(sprintf($query2, '<')) ;
											// if(mysqli_num_rows($q2) || mysqli_num_rows($q))
											// {
												// echo ' *************** ';
												
												$badgee = 'badge-danger'; 
												$echu="<span class='badge ".$badgee."'> Plus Vingt</span>   " ; 
												
												$success = 'badge-success'; 
											
												$echu .="<span class='badge ".$success."'> Non Echu  </span>  " ; 
												
												
												$warning = 'badge-warning'; 
												
												$echu .="<span class='badge ".$warning."'>  Moins Vingt</span>  " ; 
												
												echo  $echu."<br/>" ; 

											?>
											
											
											<br clear="all" />
											<div id="tab">
											<div class="box-body">
											<table id="" class="table table-hover">
												<thead>
												<tr>
													<th style="text-align:center;">Numéro</th>
													<th style="text-align:center;">Date facture</th>
													<th style="text-align:center;">Montant</th>
													<th style="text-align:center;">Net &agrave; payer</th>
													<th style="text-align:center;">Règlement</th>
													<th style="text-align:center;"></th>
												</tr>
												</thead>
												<tbody>	
												<form action="relance_1.php"  method="POST"  >
											<?php
											
												
											// *****************************************************non echu ***********************************	
												
												while($f = dbi_fetch_row($requet_non_echu))
												{
											
												$badge = 'badge-success'; 
												$echuu=int2date(date2int_DSI($f['echu'])) ;
												$echu="<span class='badge ".$badge."'>".$echuu."</span>" ; 
											?>
												<tr>
													<td style="text-align:center;"><?=$f['num_fact']?></td>
													<td style="text-align:center;"><?=int2date($f['date_fact'])?></td>
													<td style="text-align:center;"><?=number_format($f['total'], 2, ', ', ' ').' &euro;'?></td>
													<td style="text-align:center;"><?=number_format($f['paye'], 2, ', ', ' ')?> &euro; <?=($f['avoir'] > 0) ? '<br>(avoirrr de '.number_format($f['avoir'], 2, ', ', ' ').' &euro;)' : ''?></td>
													<td style="text-align:center;"> <?=$echu?></td>
												    <td>  <input type="checkbox" id="subscribeNews" name="num_fact[]" value="<?=$f['num_fact']?>"></td>	
												
											
												</tr>
											<?php
											// }
												}
												
												
												
												
												
												
												
												
												
												
																					
												
													// *****************************************************plus vingt ***********************************
												
													while($f = dbi_fetch_row($requet_moins_vingt))
												{
													// echo "aaa <br/>" ; 
												
													// $badge = 'badge-success'; 
																			// $dat_fin="<span class='badge badge-success'>".$dat_fin."</span>" ; 
											 // <span class='badge badge-success'>
												$badge = 'badge-warning'; 
												$echuu=int2date(date2int_DSI($f['echu'])) ;
												$echu="<span class='badge ".$badge."'>".$echuu."</span>" ; 
											?>
												<tr>
													<td style="text-align:center;"><?=$f['num_fact']?></td>
													<td style="text-align:center;"><?=int2date($f['date_fact'])?></td>
													<td style="text-align:center;"><?=number_format($f['total'], 2, ', ', ' ').' &euro;'?></td>
													<td style="text-align:center;"><?=number_format($f['paye'], 2, ', ', ' ')?> &euro; <?=($f['avoir'] > 0) ? '<br>(avoirrr de '.number_format($f['avoir'], 2, ', ', ' ').' &euro;)' : ''?></td>
													<td style="text-align:center;"> <?=$echu?></td>
												    <td>  <input type="checkbox" id="subscribeNews" name="num_fact[]" value="<?=$f['num_fact']?>"></td>	
												
											
												</tr>
											<?php
											// }
												}
												
												
												
												// *****************************************************plus vingt ***********************************
												
													while($f = dbi_fetch_row($requet_plus_vingt))
												{
												
												$badge = 'badge-danger'; 
												$echuu=int2date(date2int_DSI($f['echu'])) ;
												$echu="<span class='badge ".$badge."'>".$echuu."</span>" ; 
												
											?>
												<tr>
													<td style="text-align:center;"><?=$f['num_fact']?></td>
													<td style="text-align:center;"><?=int2date($f['date_fact'])?></td>
													<td style="text-align:center;"><?=number_format($f['total'], 2, ', ', ' ').' &euro;'?></td>
													<td style="text-align:center;"><?=number_format($f['paye'], 2, ', ', ' ')?> &euro; <?=($f['avoir'] > 0) ? '<br>(avoirrr de '.number_format($f['avoir'], 2, ', ', ' ').' &euro;)' : ''?></td>
													<td style="text-align:center;"> <?=$echu?></td>
												    <td>  <input type="checkbox" id="subscribeNews" name="num_fact[]" value="<?=$f['num_fact']?>"></td>	
												
											
												</tr>
											<?php
											// }
												}
												
												
												
												
												
			
												
												
												
												
												
												
												
                  
												echo '</tbody></table></div>';
												
												?>
												 <input type="submit" name="relance_1" class="btn btn-primary" value="Relance 1"> 
												 <input type="submit" name="relance_2" class="btn btn-primary" value="Relance 2">
												 <input type="submit" name="relance_3" class="btn btn-primary" value="Relance 3">
												</form>
												
																			
														</div>


													<div class="card-body">
														<div id="tab">
											<div class="box-body">
											<table id="" class="table table-hover">
												<thead>
												<tr>
													<th style="text-align:center;">Numéro  Factures</th>
													<th style="text-align:center;">Montant</th>
													<th style="text-align:center;">Relance 1</th>
													<th style="text-align:center;">Relance 2</th>
													<th style="text-align:center;">Relance 3</th>
													<th style="text-align:center;">Mise en demeure</th>
													
													
												</tr>
												</thead>
												<tbody>	
												
											<?php
											
											    $q3  = dbi_query("SELECT * FROM histo_relance where client_id=$client_id ") ;
												while($ff = dbi_fetch_row($q3))
												{
										
											?>
												<tr>
													<td style="text-align:center;"><?=$ff['numfact']?></td>
													<td style="text-align:center;"><?=number_format($ff['montant'], 2, ', ', ' ').' &euro;'?></td>
													<td style="text-align:center;"><?=int2date($ff['date_relance_1'])?></td>
													<td style="text-align:center;"><?=int2date($ff['date_relance_2'])?></td>
													<td style="text-align:center;"><?=int2date($ff['date_relance_3'])?></td>
													<td style="text-align:center;"><?=int2date($ff['mise_en_demeure'])?></td>
												
													
													
													
											
												
											
												</tr>
											<?php
											// }
												}
                  
												echo '</tbody></table></div>';?>													
														
														
														
										</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 &copy; 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 () {
    // Summernote
    // $('.textarea').summernote()
  })
</script>
<script>

  
  
  
  $(document).ready(function(){
    // $('#myModal1').on('show.bs.modal', function (e) {
        // var rowid = $(e.relatedTarget).data('id');
		// alert(rowid);
        // $.ajax({
            // type : 'post',
            // url : 'AJAXINFOSFACTURATION.php', //Here you will fetch records 
            // data :  'rowid='+ rowid, //Pass $id
            // success : function(data){
            // $('#fetch1').html(data);//Show fetched data from database
            // }
        // });
     // });
	 
    // $('#myModal2').on('show.bs.modal', function (e) {
        // var rowid = $(e.relatedTarget).data('id');
        // $.ajax({
            // type : 'post',
            // url : 'AJAXSAISIRAVOIR.php', //Here you will fetch records 
            // data :  'rowid='+ rowid, //Pass $id
            // success : function(data){
            // $('#fetch2').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>

AnonSec - 2021