|
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 ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// $tab = array('world','hello','good','planet');
// $element = 'hello';
// $i = array_search($element, $tab) ;
// unset($tab[$i]);
// echo "<pre>" ;
// print_r($tab);
// echo "</pre>"
// affiche
// Array ( [0] => world [2] => good [3] => planet )
// sort(aaa); // Trie un tableau
// echo "<pre>" ;
// print_r($aaa);
// echo "</pre>" ;
// exit() ;
// if(){
$livrer_par=$_SESSION['MCPRO_sal']['user_id'] ;
// exit();
// echo "<pre>" ;
// print_r($_POST);
// echo "</pre>" ;
if($_POST['Valider2']== "Valider") // valider tanya kandkhoul hnaa
{
$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];
$date = date("Ymd");
// $reference = $_POST["reference"];
list($etablissement_id) = dbi_fetch_row(dbi_query("SELECT etablissement_id FROM `client` WHERE `client_id` = $client ")) ;
if($etablissement_id == 1)
{
$local = 20 ; // la table lieux de stockage stock de Paris Pour les clients de BOULOGNE BILLANCOURT
}else{
$local = 21 ; // la table lieux de stockage et stock de Toulon pour les clients de MARSEILLE ET SIX FOURS
}
$local = 20 ; // la table lieux de stockage
foreach ($_POST["product"] as $key => $value) {
$products[$key]["item"] = $_POST["product"][$key];
$products[$key]["quantity"] = $_POST["quantity"][$key];
}
$note = $_POST["note"];
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
// exit() ;
$query = "INSERT INTO `check_out`(`date`, `client`, `note` , `local`,livrer_par) VALUES ('$date','$client','$note','$local','$livrer_par')";
if(mysqli_query($conn,$query)){
// $query = "SELECT * FROM check_out WHERE date='$date' && reference='$reference' && client='$client' && note='$note'";
list($new_id)= dbi_fetch_row(dbi_query("SELECT max(id) FROM `check_out`")) ;
// $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"]; cette ligne est remplacé par la ligne qui se suit
$quan = 1;
$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 = "" ;
// pour filter les produit non coché je prends la totalité des produit et je supperime les produits coché comme ca ne reste que les non coché
for($i=0 ; $i<count($_POST['product']) ; $i++){
// echo "==>".$_POST['product'][$i]."<br/>" ;
$j = array_search($_POST['product'][$i], $_POST['product_all']) ;
// echo "==>".$j."<br/>" ;
unset($_POST['product_all'][$j]);
}
$demliv_info = " " ;
sort($_POST['product_all']);
for($i=0 ; $i<count($_POST['product_all']) ; $i++){
list($Produit_Designation) = dbi_fetch_row(dbi_query("SELECT Produit_Designation FROM `produits` WHERE `Produit_ID` = ".$_POST['product_all'][$i])) ;
$demliv_info .= " - ".$Produit_Designation;
}
$demliv_statut= 0 ;
$client_id=$client;
$demliv_date=$date ;
$demliv_info= addslashes($demliv_info) ;
list($demliv_id)= dbi_fetch_row(dbi_query("SELECT demliv_id FROM `demliv` WHERE demliv_statut = '0' and `client_id` = $client_id")) ;
if($demliv_id != "")
{
header("Location:demliv2.php?msg=Impossible d'jouté une demande:Il existe déjà une demande de livraison en attente pour ce client&color=danger");
}else{
dbi_query(" INSERT INTO demliv (
demliv_statut,
client_id,
demliv_date,
demliv_info
)
VALUES
(
'$demliv_statut',
'$client_id',
'$demliv_date',
'$demliv_info'
)") ;
}
// echo "marhba bik valider 2 2<br/>" ;
header('Location:controle_apres.php?msg=Livraison bien Ajouté&color=success');
}
$indice = 4 ;
if($_POST['Valider1']== "Valider") // valider louwla kandkhoul hnaa
{
$total_product_all =count($_POST['product_all']) ;
$total_product =count($_POST['product']) ;
// echo "==>".$total_product."---".$total_product_all."<br/>" ;
if($total_product == $total_product_all ){
header('Location:controle_apres.php?msg=Livraison bien Ajouté&color=success&liv=bien');
}
// $res = dbi_query("SELECT count(*) FROM produits p WHERE `categorie_id_produit` = 2 and client_id = ".$_GET['client_id']) ;
$indice = 5 ;
$taille =count($_POST['product']) ;
for($i=0 ; $i<$taille ; $i++){
dbi_query("UPDATE `Produits_livree_salar` SET tmp_materiel_remplace = '1' WHERE client_id = ".$_POST['client']." and Produit_ID = ".$_POST['product'][$i]) ;//.........****************************************************************************************************************
}
}
$salarie_id=$_SESSION['MCPRO_sal']['user_id'] ;
$qua = dbi_query ("SELECT client_id FROM `client` WHERE `client_statut` = '1' ORDER BY `client`.`client_nom` ASC ");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mon Stock</title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../../dist/css/adminlte.min.css">
<link rel="stylesheet" href="../plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
</head>
<body class="hold-transition layout-top-nav">
<div class="wrapper">
<!-- Navbar -->
<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="#"></a>
</li>
<li>
<a href="index_sal.php"><button type="button" class="btn btn-info"><i class="fas fa-reply"></i> MENU PRINCIPAL</button>
</li>
</ul>
</nav>
<!-- /.navbar -->
<!-- Main Sidebar Container -->
<?php
include('aside.php');
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<?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">×</span>
</button>
</div>
<?php
}
?>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Profile Image -->
<!-- /.card -->
<!-- About Me Box -->
<div class="card card-primary">
<!-- /.card-header -->
<div class="card-body">
<script language="Javascript">
function GetIdBureau()
{
var id_statu="";
id_statu = document.client_statu_form.client_id.value ;
if( id_statu > 0 || id_statu=="INDEFINI" )
window.location = "produit_extranet.php?client_id="+id_statu;
else
window.location = "produit_extranet.php";
}
</script>
<?php
// echo "<pre>" ;
// print_r($_GET) ;
// echo "</pre>" ;
?>
<script type="text/javascript">
function gestionDiv(element){
var maDiv = document.getElementById(element);
var leBouton = document.getElementById('leBouton');
if(maDiv.style.display == "none"){
maDiv.style.display = "block";
leBouton.value ="affich";
}
else{
maDiv.style.display = "none";
leBouton.value ="affich";
}
}
</script>
<?php if($_POST['remplacement_mat']=="man affichich had la liste "){?>
<form id="client_statu_form" name="client_statu_form" method="POST" action="">
<div class="form-row">
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<select class="form-control select2" style="width: 100%;" id="client_statu" name="client_id" onchange="GetIdBureau()"; >
<option value="0" > ----- Selectionner un client -----</option>
<?php
// for($i=0 ; $i< count($client_unique) ; $i++){
while($value=dbi_fetch_row($qua)){
list($client_nom, $client_id ) = dbi_fetch_row( dbi_query("SELECT client_nom , client_id FROM `client` WHERE `client_id` = ".$value['client_id'])) ;
?>
<option value="<?=$client_id ?>" <?php if($_GET['client_id']==$client_id){echo "selected" ;} ?> > <?=$client_nom ?></option>
<?php }?>
</select>
</div>
</div>
</form>
<?php }?>
<div class="modal-footer justify-content-between"> </div>
<?php if(empty($_POST['remplacement_mat'])){?>
<h2>Vérifiez l'état du matériel (Ne pas cocher si en mauvais état ) </h2>
<?php }else{?>
<h2>Avez-vous pu remplacer le matériel manquant ou abîmé ? (cochez si oui) </h2>
<?php }?>
<br/>
<?php if(!empty($_GET['client_id']) OR !empty($_GET['var']) ){ ?>
<div class="table-responsive">
<form action="" method="POST">
<table id="tables" class="table table-bordered table-striped" >
<thead>
<tr>
<th>Nom de Produits</th>
<th>Photo</th>
<?php if($indice != 4){ ?>
<th> Quantité sur place</th>
<?php } ?>
<?php if($indice == 4){ ?>
<th> Valider</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
if(empty($_POST['remplacement_mat'])){
$res = dbi_query("SELECT * FROM Produits_livree_salar pl , produits p WHERE pl.Produit_ID = p.Produit_ID and `categorie_id_produit` = 2 and client_id = ".$_GET['client_id']) ;
}else{
$res = dbi_query("SELECT * FROM Produits_livree_salar pl , produits p WHERE pl.Produit_ID = p.Produit_ID and `categorie_id_produit` = 2 and tmp_materiel_remplace = 0 and client_id = ".$_GET['client_id']) ;
}
$compt = 0 ;
while($row = dbi_fetch_row($res)) {
$test = "test_".$compt ;
// echo "$test <br/>" ;
$diff =$row['quantite'] - $row['temp_qunt_surplace'] ;
list($demliv_id)= dbi_fetch_row(dbi_query("SELECT demliv_id FROM `demliv` WHERE demliv_statut = '0' and `client_id` = ".$_GET['client_id']." and Produit_ID = ".$row['Produit_ID'])) ;
// echo "SELECT demliv_id FROM `demliv` WHERE demliv_statut = '0' and `client_id` = ".$_GET['client_id']." and Produit_ID = ".$row['Produit_ID']."<br/>" ;
?>
<input type="hidden" name="id[]" value="<?=$row['id']?>">
<tr>
<td><?=$row['Produit_Designation'] ; ?></td>
<td>
<!--<img src="photo_produit/CSUR1-ASP614.jpg" class="staff-profile-image-small"> "form-control" -->
<img src="<?=$row['produit_photo'] ?>" style="width:60px;height:70px;">
</td>
<?
// if($indice == 4){
?>
<input type="hidden" name="remplacement_mat" value="remplacement_mat">
<input type="hidden" value="<?=$row['Produit_ID']?>" name="product_all[]">
<input type="hidden" name="client" value="<?=$_GET['client_id'] ?>">
<input type="hidden" name="ajout" value="ajout">
<td>
<input type="checkbox" class="form-control" value="<?=$row['Produit_ID']?>" name="product[]">
</td>
<?php
// }
$compt ++ ;
?>
<?php
// ";
// }else{
// echo "
// <td>
// <button class='btn btn-success'
// onfocus='change(this)'>
// contrôlé </button></td> ?>
</tr>
<?php } ?>
</tfoot>
</table><!-- /.table -->
<?php if($indice == 4){ ?>
<br/>
<!-- <a href="controle_apres.php" ><button class="btn btn-success" value="Suivant"> Suivant </button> </a> -->
<input type="submit" class="btn btn-primary" name="Valider1" value="Valider">
<?php } ?>
<?php if($indice == 5){ ?>
<br/>
<!-- <a href="controle_apres.php" ><button class="btn btn-success" value="Suivant"> Suivant </button> </a> -->
<input type="submit" class="btn btn-primary" name="Valider2" value="Valider">
<?php } ?>
</form> </div>
<?php }
if(!empty($_POST['remplacement_mat'])){
dbi_query("UPDATE `Produits_livree_salar` SET `tmp_materiel_remplace` = '0'") ;
}
?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<!-- /.col -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.2.0
</div>
<strong>MC PRO 2022 </strong>
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<script src="../plugins/select2/js/select2.full.min.js"></script>
<!-- header -->
<script>
$(function () {
$('.select2').select2()
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
})
// Summernote
$('.textarea').summernote()
})
</script>
<!-- jQuery -->
<script src="../../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
</body>
</html>
