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/Livraison_cclient.php
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;

include('file_tache.php');

if(!empty($_GET['client_id']))
{
	$_SESSION["client_id"]  =  $_GET['client_id'] ;
}
 $client_id=$_SESSION["client_id"] ;
// echo "ttttttttttjjjjtt<br/>" ;
    $no=1;

    $message = false;
    $suppliers = array();
    $products = array();
    $check_out = array();
    $customerList = array();
    //where status ='pending'
   $select = "SELECT id , date , reference , client ,note ,local, client_nom FROM `check_out` ch  , client c  where ch.client = c.client_id  AND ch.client = $client_id  order by  date ";
   if($res = mysqli_query($conn,$select)){
   $count = mysqli_num_rows($res);

   }else{
       $count=0;
   }




   $select = "SELECT * FROM `check_out_produit`";
   $resu = mysqli_query($conn,$select);
   while ($ro = mysqli_fetch_array($resu)) {
     $products[] = $ro;
   }



    $select = "SELECT * FROM `produits`";
   $resu = mysqli_query($conn,$select);
   while ($pro = mysqli_fetch_array($resu)) {
     $productsList[] = $pro;
   }







   $resu = dbi_query("SELECT * FROM client where 1 ")  ;
   // $select = "SELECT * FROM `client`";
   // $resu = mysqli_query($conn,$select);
   while($cus = dbi_fetch_row($resu)) {
   $customerList[] = $cus['client_id'];
   }


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

	 // echo "testdddddddddd3333333333eeeddddt <br/>" ;

// exit() ;

 if(isset($_GET['delete'])){
  $del = $_GET['delete'];
  $query = "DELETE FROM check_out WHERE id='$del'";
  if(mysqli_query($conn,$query)){
    $query = "DELETE FROM check_out_produit WHERE check_out_id='$del'";
    if(mysqli_query($conn,$query)){
      // header("location: check_out.php");
	  header('Location:Livraison_cclient.php?msg=  livraison  bien Supprimer   &color=success');
    }
  }
 }


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


	 $client = $_POST["client"];


	list($demliv_id)=  dbi_fetch_row(dbi_query("SELECT demliv_id FROM `demliv` WHERE  demliv_statut = '0' and `client_id` = $client")) ;

	// echo "========> $demliv_id <br/>" ;
		// echo "yyyyyy <br/>" ;


	if($demliv_id != "")
	{
		// echo "========> $demliv_id <br/>" ;
		// echo "ggggggg <br/>" ;

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

	// exit() ;

      $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`, `reference`, `client`, `note` , `local`) VALUES ('$date','$reference','$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);
        }
     }
     header("location: check_out.php");
    }





 if($_POST['modifier']== "modifier")
 {
      $products = array();
      $quantity = "";
      $edit = $_POST["edit"];
      $select = "SELECT * FROM check_out where id='$edit'";
      $result = mysqli_query($conn,$select);
      $check_out = mysqli_fetch_row($result);

      if(is_null($_POST["date"]) || empty($_POST["date"]) || !isset($_POST["date"])){
        $date = $check_out[1];
		 $date_arr  = explode("/", $check_out[1]);
		  $date = $date_arr[0]."".$date_arr[1]."".$date_arr[1];
      }else{
        $date_arr = explode("-",$_POST["date"]);
        $date = $date_arr[0]."".$date_arr[1]."".$date_arr[2];
      }


     $reference = $_POST["reference"];

     $client = $_POST["client"];

     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 = "UPDATE `check_out` SET `date`='$date',`reference`='$reference',`client`='$client',`note`='$note',`local`='$local' WHERE id='$edit'";
     if(mysqli_query($conn,$query)){
        $query = "DELETE FROM `check_out_produit` WHERE check_out_id ='$edit'";
        mysqli_query($conn,$query);
          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 ('$edit','$prod','$quan')";
          mysqli_query($conn,$query);
        }

     }
	 header('Location:Livraison_cclient.php?msg=  Commande bien modifier   &color=success');
     // header("location: check_out.php");
    }



$q= dbi_fetch_row(dbi_query("SELECT * FROM client where client_id = ".$client_id)) ;

?>


<!DOCTYPE html>
<html>

<head>

			<?php include('header.php'); ?>
	  <script type="text/javascript" src="plugins/selectize/selectize.js"></script>
	<link rel="stylesheet" type="text/css" href="plugins/selectize/selectize.css" />
	<script type="text/javascript" src="plugins/selectize/selectize.min.js"></script>
	<link rel="stylesheet" type="text/css" href="plugins/selectize/selectize.default.css" />
	<link rel="stylesheet" href="../../plugins/summernote/summernote-bs4.css">







  <!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>

  <style type="text/css">
  .modal-backdrop {
    /* bug fix - no overlay */
    display: none;
}
</style>

			</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">
													<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>
															<a href="Produits_livree.php?client_id=<?=$client_id?>"><button type="button" class="btn btn-info"> STOCK PRODUITS </button>
															</li>
															&nbsp <li> <h3><a href="#myModal_tache_all"  id="custId" data-toggle="modal" >   <button type="button"  class="btn btn-primary" > <i class="fas fa-plus"></i> NOUVELLE TACHE</button> </a></h3></li>

													</ul>
												</nav>


<!-- BARRE DE NAVIGATION -->


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




												  <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_tache_all" 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_tache_all" ></div>


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


												 <div  class="modal fade" id="myModal2" 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="fetch2" ></div>


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




 <!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->



								<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
								  <div class="modal-dialog" role="document">
									<div class="modal-content">
									  <div class="modal-header">
										<h5 class="modal-title" id="exampleModalLongTitle"></h5>
										<button type="button" class="close" data-dismiss="modal" aria-label="Close">
										  <span aria-hidden="true">&times;</span>
										</button>
									  </div>
									  <div class="modal-body">
										<table class="table table-bordered table-striped">
										  <tr >
											<td>
											  Référence:
											</td>
											<td id="checkOutReference">
											  Reference:
											</td>
										  </tr>

										  <tr>
											<td>
											  Date
											</td>
											<td id="checkOutDate">
											  Date
											</td>
										  </tr>

										  <tr>
											<td >
											  Client
											</td>
											<td id="checkOutCustomer">
											  Customer
											</td>
										  </tr>
										</table>
										<br>

										<table id="productTable" class="table table-bordered table-striped">
										  <thead>
											<td>#
											</td>
											<td>Produit
											</td>
											<td>Quantité
											</td>
										  </thead>
										  <tbody><tr></tr></tbody>
										  <tr></tr>
										</table>

										<p style="border: 1px;" id="productNote" readonly></p>

									  </div>
									  <div class="modal-footer">
										<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
										<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
									  </div>
									</div>
								  </div>
								</div>

												<div class="content-header">
												  <div class="container-fluid">
													<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 -->
												  </div>
												</div>
												<!-- /.content-header -->

    <!-- PAGE PRINCIPALE -->





				<section class="content">

					<div class="content">
						<div class="container-fluid">

							<?php include('widget_client_haut.php'); ?>
						</div>
					</div>

					<div class="col-lg-12">
				<!-- CARD DE DROITE-->
						 <div class="card card-info">
							 <?php include('menu_client_haut.php'); ?>



							<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">
										<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>NUM</th>
														  <th>DATE</th>
														  <th>REFERENCE</th>
														  <th>CLIENT</th>
														   <th>NOTE</th>
														   <th></th>

														</tr>
														</thead>
														<tbody>
													   <?php if(!$count<=0){ while($row = mysqli_fetch_array($res)) {

														$check_out[] = $row;
														 $check_out[] = int2date($row['date']);
														// echo "<pre>" ;
														// print_r($check_out) ;
														// echo "</pre>" ;
														$rowid = $row['id'];
															?>
															<tr>


														  <td><?php echo $no++;  ?></td>
														  <td><?php echo int2date($row['date']);  ?></td>
														   <td><?php echo $row['reference'];  ?></td>
															<td>
															  <?php
															 list($nom) =  dbi_fetch_row(dbi_query( " SELECT client_nom FROM  client where `client_id` = ".$row['client'])) ;
																 // echo "=====>".$row['client'] ;

															   echo $nom  ;
															   ?>

															  </td>
															<td><?php echo $row['note'];  ?></td>
															<td>
															 <a id="rowValue" href="<?php echo "edit_check_out.php".'?edit='.$rowid; ?>" style="color:#000000;"></a>


															 <?php echo '<a class="btn btn-info btn-sm" href="#myModal"  id="custId" data-toggle="modal" data-id="'.$rowid.'"><i class="fas fa-pencil-alt"></i></a>';?>

																	<a class="btn btn-danger btn-sm" href="Livraison_cclient.php?delete=<?=$rowid?>&action=sup"  onclick="return confirm('Voulez-vous vraiment supprimer cet Livraison   ?');">

																			<i class="fas fa-trash">
																		  </i>
																		</a>


															</td>


															<?php  } }?>



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


</script>

<script type="text/javascript">
$(document).ready(function(){
    $('#myModal2').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){
            $('#fetch2').html(data);//Show fetched data from database
            }
        });
     });
});


</script>



<!-- page script -->
<script>
  $(function () {
    $("#tables").DataTable();
    $('#example').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": false,
      "info": true,
      "autoWidth": false
    });
  });

$(document).ready(function() {
    $('#tables tr').click(function(e) {
      $("#productTable").empty();
      $('#productTable').append('<thead><td>#</td><td>Produit</td><td>Quantité</td></thead>');
      var table = $('#tables').DataTable();
      var data = table.row(this).data();
      var tempId = data[5].split("?edit=");
      var tempId = tempId[1].split('"');
      // var table = $('#tables').DataTable();
      // var data = table.row( this ).data();
      // var tempId = data.pop().split("?edit=");
      // var rowEdit = document.getElementById("rowValue");
      // var rowHref = rowEdit.getAttribute('href');
      // var splitHref = rowHref.split("=");
      var rowId =tempId[0];
      var te = 1;
        var arr = <?php echo json_encode($check_out); ?>;
        var prod = <?php echo json_encode($products); ?>;
        var prodList = <?php echo json_encode($productsList); ?>;
        var custList = <?php echo json_encode($customerList); ?>;
        var customer = "";
        for(var i=0; i < arr.length; i++){
         if(rowId == arr[i][0]){
          document.getElementById('exampleModalLongTitle').innerHTML = "<b>  Livraison Client ID: "+arr[i][0]+"</b>";
          document.getElementById('checkOutDate').innerHTML = "<b>"+arr[i+1]+"</b>";
          document.getElementById('checkOutReference').innerHTML = "<b>"+arr[i][2]+"</b>";
          document.getElementById("productNote").innerHTML = "<b style='color: red;'>Note</b><b>"+arr[i][4]+"</b>";
          for(var n=0; n < custList.length; n++){
            if(custList[n][0] == arr[i][3]){
              customer = custList[n][1];
            }
          }
          document.getElementById('checkOutCustomer').innerHTML = "<b>"+arr[i][6]+"</b>";
          for(var l=0; l<prod.length; l++){
            if(prod[l][1] == arr[i][0]){
              for(var p = 0; p < prodList.length; p++){
                if(prodList[p][0]==prod[l][2]){
                  $('#productTable').append('<tr><td>'+te+'</td><td>'+prodList[p][3]+'</td><td>'+prod[l][3]+'</td></tr>');
                }
              }
              te++;
            }
          }
         }
        }
        $('#exampleModalLong').modal('show');
    });
});

$('#myModal').on('shown.bs.modal', function () {
  $('#myInput').trigger('focus')
});


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



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


</script>


</body>
</html>

AnonSec - 2021