Files
MYSOPHAL/front/resultatinventaire2.php
2025-08-07 13:15:31 +01:00

101 lines
2.7 KiB
PHP
Raw Permalink Blame History

<?php
use Glpi\Event;
include ('../model_controller/articles.list.php');
Session::checkLoginUser();
if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
} else {
Html::header("DRH", '', "", "");
}
$results = getArticlesWithStock();
//print_r($results);
echo "<div class='center'> <H3 id='articlescount'></H3>
<table border='0' id='tabcenter' class='tab_cadrehov js-dynamitable'>
<tr class='tab_bg_2'>
<th ></th>
<th> <input class='center' type='text' name='cdepot' placeholder='Code Depot' onchange='cdepotchange(this)'></th>
<th> <input class='center' type='text' name='clarticle' placeholder='Code Article' onchange='clarticlechange(this)'></th>
<th> <input class='center' type='text' name='larticle' placeholder='Libelle Article' onchange='larticlechange(this)'></th>
</tr>
<tr class='tab_bg_2'>
<th ><a href=''></a></th>
<th class=''>Code Depot</th>
<th class=''>Code Article</th>
<th class=''>Libelle Article</th>
</tr>
";
if(isset($results)) {
} else {
echo "<tr style=' text-align: center;'><td colspan='3'>Aucune donn<6E>e trouv<75>e</td></tr>";
}
echo"
</table>
</div>";
Html::footer();
?>
<script>
var articles = <?php echo json_encode($results); ?>;
function loadtable(resultsP) {
$('#tabcenter tr').slice(2).remove();
if(resultsP.length > 0) {
for(var i = 0; i < resultsP.length; i++) {
var row = resultsP[i];
$('#tabcenter').append(
"<tr class='tab_bg_1'><td valign='top'></td><td valign='top'>"+row['DEP_CODE']+"</td><td valign='top'>"+row['ART_CODE']+"</td><td valign='top' style='font-weight:bold'>"+row['ART_LIB']+"</td></tr>"
);
}
document.getElementById("articlescount").innerHTML = resultsP.length + " resultat inventaire(s)";
}
}
loadtable(articles);
function cdepotchange(e) {
var res = articles.filter(a => a.DEP_CODE.toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function codedepotchange(e) {
var res = articles.filter(a => a.DEP_NOM.toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function clarticlechange(e) {
var res = articles.filter(a => a.ART_CODE.toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
function larticlechange(e) {
var res = articles.filter(a => a.ART_LIB.toUpperCase().includes(e.value.toUpperCase()));
loadtable(res);
}
$(document).ready(function(){
$("#c_ssmenu2").html('<ul>'+
'<li class="breadcrumb_item"><a href="central.php" title="Accueil">Accueil</a></li>'+
'<li class="breadcrumb_item"><a href="" title="">Resultat Inventaire</a></li>'+
'</ul>');
});
</script>