AnonSec Team
Server IP : 10.128.40.6  /  Your IP : 216.73.216.111
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/MC/../www/mcg/plugins/jszip/../../.github/../sms/../pages/documents/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/MC/../www/mcg/plugins/jszip/../../.github/../sms/../pages/documents/../check_out2.php
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;




//  le message d'infos ne s'affiche pas  possible probléme de reference<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  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:check_out.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`, `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);
        }
     }
     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);




		     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:check_out.php?msg=  Commande bien modifier   &color=success');
     // header("location: check_out.php");
    }





?>


<!DOCTYPE html>
<html>

			<head>

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

      <link rel="stylesheet" href="../../plugins/summernote/summernote-bs4.css">
			</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>
                              &nbsp <a href="#myModal_nouveau"  id="custId" data-toggle="modal" data-id="<?=$c['Fournisseur_ID']?>"> <button type="button" class="btn btn-primary"><i class="fas fa-plus"></i> LIVRAISON </button></a>
                              </li>

															<li>
															 <?php
															 // echo '<a href="#myModal2"  id="custId" data-toggle="modal" data-id="'.$c['Fournisseur_ID'].'"><h3><button type="button"   class="btn btn-primary" ><i class="fas fa-plus"></i> Nouvelle Livraison </button></h3></a>';
															 ?>

															</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="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="row">
						<div class="col-12">
							<div class="card card-info">
															<div class="card-header">
															 <?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="row">
																	<div class="col-sm-11">
																		<h3 class="card-title"> <i class="far fa-hand-point-right"></i>   LIVRAISONS EFFECTUEES   </h3>
																	</div>
																</div>
															</div>
									<div class="card-body">


                    <div class="container">

                      <div class="row">

                        <!-- ./col -->
                        <div class="col 3">
                          <!-- small box -->
                          <div class="small-box bg-danger">
                            <div class="inner">
                              <h3>LIVRAISONS<sup style="font-size: 20px"></sup></h3>

                              <p>En attente</p>
                            </div>
                            <div class="icon">
                              <i class="far fa-list-alt"></i>
                            </div>
                            <a href="demliv2.php" class="small-box-footer">Voir <i class="fas fa-arrow-circle-right"></i></a>
                          </div>
                        </div>
                        <!-- ./col -->
                        <div class="col-6">
                          <!-- small box -->
                          <div class="small-box bg-warning">
                            <div class="inner">
                              <h3>CARTE</h3>

                              <p>des clients à livrer</p>
                            </div>
                            <div class="icon">
                              <i class="ion ion-map"></i>
                            </div>
                            <a href="maps_livraison2.php" class="small-box-footer">Voir <i class="fas fa-arrow-circle-right"></i></a>
                          </div>
                        </div>
                        <!-- ./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>DATE</th>

														  <th>CLIENT</th>
														   <th>LIVRE PAR</th>
														   <th></th>

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

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



														  <td><?php echo int2date_autre_format($row['date']);  ?></td>


															  <?php
															 list($nom,$client_idd , $user_nom , $user_prenom ) =  dbi_fetch_row(dbi_query( " SELECT client_nom , client_id ,user_nom,user_prenom FROM  client c ,  users u  where  c.user_id = u.user_id AND `client_id` = ".$row['client'])) ;
																 list($nom,$client_idd ) =  dbi_fetch_row(dbi_query( " SELECT client_nom , client_id FROM  client c  where   `client_id` = ".$row['client'])) ;

																// echo "=====>".$row['client'] ;
																 list($livrer_par) = dbi_fetch_row(dbi_query("SELECT livrer_par FROM `check_out` WHERE `id` = ".$row['id']));
															  list ($salarie_nom,$salarie_prenom) = dbi_fetch_row(dbi_query("SELECT salarie_nom,salarie_prenom  FROM `salarie` WHERE `salarie_id` = ".$livrer_par)) ;

															   // echo $nom  ;
															   ?>
															   	<td>  <a href="Livraison_cclient.php?client_id= <?php echo $client_idd ; ?>" target="" ><?php echo $nom; ?> </a></td>





															<td> <?php echo $salarie_nom." ".$salarie_prenom;  ?></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="check_out.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.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,

    });
  });

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

$(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>


</body>
</html>

AnonSec - 2021