137 lines
4.2 KiB
PHP
137 lines
4.2 KiB
PHP
<?php
|
||
|
||
use Glpi\Event;
|
||
include ('../model_controller/articles.list.php');
|
||
|
||
Session::checkLoginUser();
|
||
//Html::redirect($CFG_GLPI["root_doc"]."central.php");
|
||
|
||
if (Session::getCurrentInterface() == "helpdesk") {
|
||
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
|
||
} else {
|
||
Html::header("DRH", '', "", "");
|
||
}
|
||
|
||
$all = 0;
|
||
if(isset($_GET['all'])) {
|
||
if($_GET['all'] == 1)
|
||
$all = 1;
|
||
}
|
||
|
||
$results = getStocks($all);
|
||
|
||
//var_dump($results); die;
|
||
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='codedepot' placeholder='Depot' onchange='codedepotchange(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>
|
||
<th> <input class='center' type='text' name='numlot' placeholder='Numero Lot/Serie' onchange='numlotchange(this)'></th>
|
||
<th></th>
|
||
<th> <input class='center' type='text' name='famille' placeholder='Famille' onchange='famchange(this)'></th>
|
||
<th></th>
|
||
</tr>
|
||
<tr class='tab_bg_2'>
|
||
<th ><a href=''></a></th>
|
||
<th class=''>Code Depot</th>
|
||
<th class=''>Depot</th>
|
||
<th class=''>Code Article</th>
|
||
<th class=''>Libelle Article</th>
|
||
<th class=''>Numero de Lot/Serie</th>
|
||
<th class='' onclick='stkchange()'>Stock Reel</th>
|
||
<th class=''>Famille</th>
|
||
<th class=''>Responsable</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];
|
||
var resp = "";
|
||
if(row['STK_RESPONSABLE'] != null)
|
||
resp = row['STK_RESPONSABLE'];
|
||
|
||
$('#tabcenter').append(
|
||
"<tr class='tab_bg_1'><td valign='top'></td><td valign='top'>"+row['DEP_CODE']+"</td><td valign='top' style='font-weight:bold'><a>"+row['DEP_NOM']+"</a></td><td valign='top'>"+row['ART_CODE']+"</td><td valign='top' style='font-weight:bold'>"+row['ART_LIB']+"</a></td><td valign='top' style='font-weight:bold'>"+row['STK_NUMLOT']+"</td><td valign='top' style='font-weight:bold'>"+row['STK_REEL']+"</td><td valign='top' style='font-weight:bold'>"+row['FAR_LIB']+"</td><td valign='top' style='font-weight:bold'>"+resp+"</td></tr>"
|
||
);
|
||
}
|
||
document.getElementById("articlescount").innerHTML = resultsP.length + " stock(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);
|
||
}
|
||
|
||
function numlotchange(e) {
|
||
var res = articles.filter(a => a.STK_NUMLOT.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
var resf;
|
||
|
||
function famchange(e) {
|
||
resf = articles.filter(a => a.FAR_LIB.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(resf);
|
||
}
|
||
|
||
function stkchange() {
|
||
res = resf.filter(a => a.STK_REEL > 0);
|
||
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="">Stock</a></li>'+
|
||
'</ul>');
|
||
|
||
});
|
||
</script>
|