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 (0705) :  /home/logmcpe/www/mcg/pages/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/mcg/pages/demliv9.php
<?php

 // $a = 22 ;

 // $b = 6 ;

// $somme = $a + $b ;
// echo "la somme est ==> $somme <br/>" ;

include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;





session_start();



if($_GET['action']=='sup')
	    {
			 // echo "<pre>" ;
			 // print_r($_GET);
			 // echo "</pre>" ;

			 // exit() ;

			$demliv_idd=$_GET['id'];

	$sreussie=dbi_query(" DELETE FROM `demliv` WHERE `demliv`.`demliv_id`  = ".$demliv_idd) ;

	 header('Location:demliv9.php?msg=la demande bien supprimé&color=success');

// exit() ;
		}




	 if($_POST['ajout']== "ajout")
 {

	 // echo "<pre>" ;

	// print_r($_POST);
	// echo "</pre>" ;

	 // echo "==>".count($_POST['product'])."<br/>" ;

	   $client = $_POST["client"];

	for($i=0 ; $i<count($_POST['product']) ; $i++){

	  // list($index)  =  dbi_fetch_row(dbi_query("SELECT id  FROM `Produits_livree_salar` WHERE `Produit_ID` = ".$_POST['product'][$i]." AND `client_id` = ".$_POST["client"])) ;
	  list($demliv_id)=  dbi_fetch_row(dbi_query("SELECT demliv_id FROM `demliv` WHERE  demliv_statut = '0'  and `client_id` = $client")) ;

		// echo "SELECT demliv_id FROM `demliv` WHERE  demliv_statut = '0' and `Produit_ID` = ".$_POST['product'][$i]." and `client_id` = $client <br/>" ;
	  // echo "== $demliv_id === <br/>" ;

	  if($demliv_id != 0){

		 dbi_query("UPDATE `demliv` SET `demliv_statut` = '1' WHERE `demliv`.`demliv_id` = '".$demliv_id."'  ") ;

	  }
	}
// exit() ;
	// exit() ;



   /*
     j'ai comenti ce code pour que commander / deja commander de extractanet fonctionne
	list($demliv_id)=  dbi_fetch_row(dbi_query("SELECT demliv_id FROM `demliv` WHERE  demliv_statut = '0' and `client_id` = $client")) ;
	if($demliv_id != "")
	{
		dbi_query("UPDATE `demliv` SET `demliv_statut` = '1' WHERE `demliv`.`demliv_id` = '".$demliv_id."'  ") ;
	}
  */

      $products = array();
      $quantity = "";
      $date_arr = explode("-",$_POST["date"]);
      $date = $date_arr[0]."".$date_arr[1]."".$date_arr[2];

      // $reference = $_POST["reference"];



     foreach ($_POST["product"] as $key => $value) {
        $products[$key]["item"] = $_POST["product"][$key];
        $products[$key]["quantity"] = $_POST["quantity"][$key];
     }
     $note = $_POST["note"];

	 $local  = $_POST["local-storage"];
	 // echo "<pre>" ;
	// print_r($_POST) ;
	// echo "</pre>" ;

	// exit() ;
     $query = "INSERT INTO `check_out`(`date`, `client`, `note` , `local`) VALUES ('$date','$client','$note','$local')";

     if(mysqli_query($conn,$query)){
        $query = "SELECT * FROM check_out WHERE date='$date' && reference='$reference' && client='$client' && note='$note'";
        $resu = mysqli_query($conn,$query);
        $fetch_row = mysqli_fetch_row($resu);
        $new_id = $fetch_row[0];
        foreach ($products as $key => $value) {
          $prod = $products[$key]["item"];
          $quan = $products[$key]["quantity"];
          $query = "INSERT INTO `check_out_produit`(`check_out_id`, `product_Id`, `quantity`) VALUES ('$new_id','$prod','$quan')";
          mysqli_query($conn,$query);

		     list($categorie_id_produit) = dbi_fetch_row(dbi_query(" SELECT categorie_id_produit FROM `produits` WHERE `Produit_ID` = ".$prod)) ;
			if($categorie_id_produit == 4)
				{
				dbi_query("INSERT INTO `consommables_livres` (`consommables_livres_id`, `client_id`, `date_livaraison`, `quantity`, `Produit_ID`) VALUES (NULL, '$client', '$date', '$quan', '$prod')") ;
			   }
        }
     }
     // header("location: demliv2.php");



$derniere_livraison = $date ;

list($client_intervalle_livraison) = dbi_fetch_row(dbi_query("SELECT client_intervalle_livraison  FROM `client` WHERE `client_id` = ".$client)) ;

list($id_rapelle_livarison) = dbi_fetch_row(dbi_query("SELECT id_rapelle_livarison FROM `rapelle_livarison` WHERE `client_id`  = ".$client)) ;

$livraison_prevu = date('Ymd', strtotime($derniere_livraison. ' + '.$client_intervalle_livraison.' days'));

// echo "===>".$id_rapelle_livarison ."<br/>" ;
// exit() ;
if($id_rapelle_livarison > 0)
{


	dbi_query("UPDATE `rapelle_livarison` SET `derniere_livraison` = '".$derniere_livraison."', `livraison_prevu` = '".$livraison_prevu."' WHERE id_rapelle_livarison = ".$id_rapelle_livarison) ;

}else{







dbi_query("INSERT INTO `rapelle_livarison` (`id_rapelle_livarison`, `client_id`, `derniere_livraison`, `livraison_prevu`)
 VALUES (NULL, '".$client."', '".$derniere_livraison."', '".$livraison_prevu."')") ;

}
	 $livraison_prevu  = "" ;
	 header('Location:demliv9.php?msg=Livraison bien Ajouté&color=success');
    }



if($_POST['Modifier']== "Modifier"){

	// echo "<pre>" ;

	// print_r($_POST);
	// echo "</pre>" ;
$client_id= $_POST['client_id'] ;
$demliv_date= $_POST['demliv_date'] ;
$demliv_info= $_POST['demliv_info'] ;
$demliv_id= $_POST['demliv_id'] ;


dbi_query("UPDATE `demliv` SET `client_id` = '".$client_id."', `demliv_info` = '".$demliv_info."', demliv_date = '".$demliv_date."' WHERE `demliv`.`demliv_id` = ".$demliv_id) ;

}






?><html>

			<head>
<link rel="stylesheet" href="../../plugins/summernote/summernote-bs4.css">

			<?php include('header.php'); ?>


			</head>

<body class="hold-transition sidebar-mini">



<!-- Site wrapper -->
<div class="wrapper">

				<!-- TOP MENU -->
							  <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>
											<!-- liens TOP MENU GAUCHE-->
													<li>
													<a href="nvdemliv9.php"><button type="button" class="btn btn-primary"><i class="fas fa-plus"></i> DEMANDE</button>
													</li>






								   </ul>

							 <!-- liens TOP MENU DROITE -->


								<ul class="navbar-nav ml-auto">
								 <!-- Placer ici l'élément à positionner à droite du TOP MENU -->
								</ul>

							  </nav>






<div  class="modal fade" id="myModal" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
  <div class="modal-dialog modal-lg">
    <div class="modal-content data">
		<div id="fetch" ></div>


        </div>
    </div>
</div>

<div  class="modal fade" id="myModal_info" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
  <div class="modal-dialog modal-lg">
    <div class="modal-content data">
		<div id="fetch_info" ></div>


        </div>
    </div>
</div>





<div  class="modal fade" id="myModal_nouveau" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
  <div class="modal-dialog modal-lg">
    <div class="modal-content data">
		<div id="fetch_nouveau" ></div>


        </div>
    </div>
</div>


<aside class="main-sidebar sidebar-dark-primary elevation-4">

	<!-- Brand Logo -->
	<a href="index3.html" class="brand-link">
		<img src="dist/img/logomcpro.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
				 style="opacity: .8">
		<span class="brand-text font-weight-light">MC PRO</span>
	</a>

	<!-- Sidebar -->
	<div class="sidebar">
		<!-- Sidebar user panel (optional) -->
		<div class="user-panel mt-3 pb-3 mb-3 d-flex">
			<div class="image">
				<img src="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">
			</div>
			<div class="info">
				<a href="#" class="d-block">Steeven ROBLOT</a>
			</div>
		</div>

	<?php include('menu9.php'); ?>

		<!-- Sidebar Menu -->

	</div>
	<!-- /.sidebar -->
</aside>




 <!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
  <div class="content-wrapper">

		<section class="content-header">
		 <div class="container-fluid">
			 <div class="row mb-2">
				 <div class="col-sm-6">
					 <h1>Livraisons en Attente</h1>
				 </div>
				 <div class="col-sm-6">
					 <ol class="breadcrumb float-sm-right">
						 <li class="breadcrumb-item"><a href="index9.php">Accueil</a></li>

						 <li class="breadcrumb-item active">Livraisons en attente</li>

					 </ol>
				 </div>
			 </div>
		 </div><!-- /.container-fluid -->
		</section>


    <!-- Content Header (Page header) -->

													<div class="row mb-2">




																			<div  class="modal fade" id="myModal" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
																			  <div class="modal-dialog modal-lg">
																				<div class="modal-content data">
																					<div id="fetch" >
																					</div>

																					</div>
																				</div>
																			</div>
													</div><!-- /.row -->






												<!-- /.content-header -->

    <!-- PAGE PRINCIPALE -->
										 <script language="Javascript">
										   function GetIdBureau()
										   {
												var id_statu="";
											  id_statu = document.client_statu_form.client_statu.value ;
											if( id_statu > 0 || id_statu=="INDEFINI" )
											  window.location = "demliv.php?id_statu="+id_statu;
												else
											window.location = "demliv.php";
										   }
										</script>

																				 <script language="Javascript">
										   function GetIdBureauB()
										   {
												var id_etab="";
											  id_etab = document.client_statu_form.client_etab.value ;
											if( id_etab > 0 || id_etab=="INDEFINI" )
											  window.location = "demliv2.php?id_etab="+id_etab;
												else
											window.location = "demliv.php";
										   }
										</script>

										<?php


										$_SESSION["id_etab"]= 111 ;
										$_SESSION["id_statu"]=2 ;

										// echo "==>".$_SESSION["id_etab"]."<br/>"  ;
										// echo "==>".$_SESSION["id_statu"]."<br/>"  ;

										if(!empty( $_GET["id_statu"]))
										{
										$_SESSION["id_statu"] = $_GET["id_statu"];
										}


										if(!empty( $_GET["id_etab"]))
										{
										$_SESSION["id_etab"] = $_GET["id_etab"];
										}


										if($_SESSION["id_etab"]== 111){
											$where_etablissement_id="" ;
										}
										else{
										$where_etablissement_id = " AND c.user_id = ".$_SESSION["id_etab"] ;
										}
										// <!--  6 ya3ni tous les clients / 4 ya3ni Clients inactifs / 2 Client actifs   -->
										if($_SESSION["id_statu"]==6)
										{
										$where_statut = "" ;
										}

										if($_SESSION["id_statu"]==4)
										{
										$where_statut = " AND c.client_statut =  '0' " ;
										}

										if($_SESSION["id_statu"]==2)
										{
										$where_statut = " AND c.client_statut =  '1' " ;
										}


										?>




				<section class="content">
					<div class="row">
						<div class="col-12">
							<div class="card">





																							  <?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
									}
								   ?>







									<div class="card-body">




					<!-- Info Boxes Style 2 -->





					<div class="container">

						<div class="row">
*
		          <!-- ./col -->

		          <!-- ./col -->

		          <!-- ./col -->

		          <!-- ./col -->
		        </div>

					</div>






							







										<div class="onglet_dotted">
											<div style="width:100%; float:left; vertical-align:top" class="header_ray">
												<div id="tab">
													<div class="box-body">
														<table id="tables" class="table table-hover">
															<thead>
																<tr>
																	<th align="center">Client</th>
																	<th align="center">CP</th>     		<!-- /.Table Client - Champs client_nom -->

																	<th align="center">Demande du</th> 		<!-- /.Table Client - Champs client_adr1 -->

																	<th></th>
																	 	<!-- /.Table Client - Champs client_cp -->

														    	</tr>
															</thead>
                                                            <tbody>
															<?php  $query = dbi_query("SELECT * FROM demliv ,client c, users u ,categorie cat where c.client_id = demliv.client_id  and c.user_id = u.user_id  and demliv_statut = '0' and c.categorie_id = cat.categorie_id and c.user_id = ".$_SESSION['MCPRO']['user_id']." $where_etab  $where_statut  $where_etablissement_id  ORDER BY c.`client_nom` ASC ");
															// echo"SELECT * FROM demliv ,client c, users u ,  etablissement etab,categorie cat where c.client_id = demliv.client_id  and c.user_id = u.user_id  and demliv_statut = '0' and c.categorie_id = cat.categorie_id  $where_etab  $where_statut  $where_etablissement_id  ORDER BY c.`client_nom` ASC ";

															while($cl = dbi_fetch_row($query)){

																$liv = "" ;
																if($cl['demliv_statut'] == 0)
																{
																$liv=" Non livré" ;
																}
															  else{$liv="Livré" ; }
															?>
																	<tr>

																	<td>  <a href="profilclient9.php?client_id= <?php echo $cl['client_id'] ; ?>" target="" ><?php echo $cl['client_nom']; ?> </a></td>
																		<td> <?php echo $cl['client_cp'] ;  ?></td>

																	<td> <?php echo $cl['demliv_date'] ;  ?></td>

																		<td align="center">

																			<?php

																			if( $cl['demliv_info']!="")
																			{
																				echo '<a class="btn btn-primary btn-sm" href="#myModal_info"  id="custId" data-toggle="modal" data-id="'.$cl['demliv_id'].'">
																				
		<i class="fas fa-file"></i> Voirr</a>';

																			}



																			?>


				   <?php echo '<a class="btn btn-info btn-sm" href="#myModal"  id="custId" data-toggle="modal" data-id="'.$cl['demliv_id'].'"><i class="fas fa-pencil-alt"></i> Editer</a>';?>
				     <?php
					 // echo '<a class="btn btn-info btn-sm" href="#myModal_nouveau"  id="custId" data-toggle="modal" data-id="'.$cl['client_id'].'">Nouveau </a>';
					 ?>




				   </td>

																	</tr>


															<?php }?>



															</tbody>
														</table><!-- /.table -->
													</div><!-- /.box-body -->






												<li class="dropdown-divider"></li>
												<li class="dropdown-divider"></li>
												<li class="dropdown-divider"></li>
												<br/>



																									<div class="box-body">
														<table id="tables" class="table table-hover">
															<thead>
																<tr>
																	<th align="center">Client</th>     		<!-- /.Table Client - Champs client_nom -->
																	<th align="center">Dernière Livraison</th>
																	<th align="center">Prochaine Livraison</th> 		<!-- /.Table Client - Champs client_adr1 -->
																	 	<!-- /.Table Client - Champs client_cp -->

														    	</tr>
															</thead>
                                                            <tbody>
															<?php  $qu = dbi_query("SELECT * FROM rapelle_livarison rl ,client c ,  etablissement etab where  rl.client_id = c.client_id  and c.etablissement_id  = etab.etablissement_id  AND c.user_id = ".$_SESSION['MCPRO']['user_id']." $where_etab ORDER BY livraison_prevu ASC ");
															// echo "SELECT * FROM client c, etablissement etab,categorie cat where  c.etablissement_id  = etab.etablissement_id  and c.categorie_id = cat.categorie_id $where_statut  $where_etablissement_id ORDER BY c.`client_nom` ASC " ;

															while($cll = dbi_fetch_row($qu)){


															?>
																	<tr>

																	<td>  <a href="profilclient9.php?client_id= <?php echo $cll['client_id'] ; ?>" target="" ><?php echo $cll['client_nom']; ?> </a></td>
																	<td align="center"> <?php echo int2date($cll['derniere_livraison']) ;  ?></td>
																	<td align="center"> <?php echo int2date($cll['livraison_prevu']) ;?></td>



																	</tr>


															<?php }?>



															</tbody>
														</table><!-- /.table -->
													</div><!-- /.box-body -->


												</div><!-- /.tab -->
											</div><!-- /.header_ray -->
										</div><!-- /.onglet_dotted -->
								    </div><!-- /.card-body -->
							    </div><!-- /.card card-primary card-outline -->
							</div> <!-- /.col-12 -->
						</div>  <!-- /.row -->
				</section> <!-- /.section -->




	</div>


<?php include('footerr.php'); ?>

<script src="../../plugins/summernote/summernote-bs4.min.js"></script>
<script>
  $(function () {
    // Summernote
    $('.textarea').summernote()
  })
</script>


<script type="text/javascript">
  $( document ).ready(function() {
	  // alert('OK');
    // $("#salarie_mutuelle").click(function () {
      // val=$(this).val();
      // if(val==1){
        // $("#end").prop('disabled', false);
      // }else{
        // $("#end").prop('disabled', true);
      // }

    // });

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



// if ($("#yourCheckboxID").is(":checked")) {
    // checkbox is checked
// } else {
    // checkbox is not checked
// }

});


 $('#tables').dataTable({
   "order": [[ 2, 'desc' ]]
});




function enableTxt(elem) {
    var id = $(elem).val();

	var c = 0;

if ( $(elem).prop( "checked" ) )
	c = 1;
        $.ajax({
            type : 'post',
            url : 'demliv_statut_action.php', //Here you will fetch records
            data :  'id='+id+'&c='+c , //Pass $id
            success : function(data){
            // $('#fetch2').html(data);//Show fetched data from database
            }
        });
        // $.ajax({
            // type : 'post',
            // url : 'suivi_sal_action_etat.php', //Here you will fetch records
            // data :  'id='+id+'&c='+c ,//Pass $id
            // success : function(data){
            // $('#fetch2').html(data);//Show fetched data from database
            // }
        // });
    // alert(id);
}

</script>


<script type="text/javascript">
$(document).ready(function(){
    $('#myModal').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'jaxModifierLiv.php', //Here you will fetch records
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('#fetch').html(data);//Show fetched data from database
            }
        });
     });
});


$(document).ready(function(){
    $('#myModal_info').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'jaxModifierLiv_info.php', //Here you will fetch records
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('#fetch_info').html(data);//Show fetched data from database
            }
        });
     });
});







$(document).ready(function(){
    $('#myModal_nouveau').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'ajaxNouvelleLivraison.php', //Here you will fetch records
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('#fetch_nouveau').html(data);//Show fetched data from database
            }
        });
     });
});
</script>


</body>
</html>

AnonSec - 2021