175 lines
5.1 KiB
PHP
175 lines
5.1 KiB
PHP
<?php
|
||
|
||
use Glpi\Event;
|
||
|
||
use function Sabre\Uri\split;
|
||
|
||
|
||
|
||
|
||
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 = getArticles($all);
|
||
$fams = getSFamille();
|
||
|
||
|
||
echo "<div class='center'> <H3 id='articlescount'></H3>
|
||
|
||
<table border='0' id='tabcenter' class='tab_cadrehov js-dynamitable'>";
|
||
echo"
|
||
<tr class='tab_bg_2'>
|
||
<th>";
|
||
echo '
|
||
<label></label>
|
||
<select id="fam" name="Famille">';
|
||
echo '<option value="" selected>TOUS LES ARTICLES</option>';
|
||
foreach($fams as $row) {
|
||
echo '<option value="'.$row['SFA_CODE'].'">'.$row['SFA_LIB'].'</option>';
|
||
}
|
||
echo "</select>";
|
||
echo "</th>
|
||
<th ></th>
|
||
<th ></th>
|
||
<th ></th>
|
||
<th ></th>
|
||
<th><a id=link>Exporter Par Sous Famille</a></th>";
|
||
echo'<th> </th><th> </th><th> </th><th> </th>
|
||
</tr>';
|
||
|
||
echo"
|
||
<tr class='tab_bg_2'>
|
||
<th> <input class='center' type='text' name='codearticle' placeholder='Code Article' onchange='codearticlechange(this)'></th>
|
||
<th> <input class='center' type='text' name='larticle' placeholder='Libelle Article' onchange='larticlechange(this)'></th>
|
||
<th> <input class='center' type='text' name='famille' placeholder='Famille' onchange='famillechange(this)'></th>
|
||
<th> <input class='center' type='text' name='sfamille' placeholder='Sous Famille' onchange='sfamillechange(this)'></th>
|
||
<th> <input class='center' type='text' name='unite' placeholder='Unite' onchange='unitechange(this)'></th>
|
||
<th></th><th> </th><th> </th>
|
||
</tr>
|
||
<tr class='tab_bg_2'>
|
||
<th >Code Article</th>
|
||
<th >Libelle Article</th>
|
||
<th >Famille</th>
|
||
<th >Sous Famille</th>
|
||
<th >Unite</th>
|
||
<th >Export</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(3).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' style='font-weight:bold'><a href='articleqrgen.php?artcode="+row['ART_CODE']+"&artlib="+row['ART_LIB']+"'>"+row['ART_CODE']+"</a></td><td valign='top' style='font-weight:bold'>"+row['ART_LIB']+"</td><td valign='top' style='font-weight:bold'>"+row['FAR_LIB']+"</td><td valign='top' style='font-weight:bold'>"+row['SFA_LIB']+"</td><td valign='top' style='font-weight:bold'>"+row['ART_UB_STK']+"</td><td valign='top' style='font-weight:bold'><a href='qrcode.pdf.php?artcode="+row['ART_CODE']+"&artlib="+row['ART_LIB']+"'> Exporter en PDF</a></td></tr>"
|
||
);
|
||
}
|
||
|
||
}
|
||
document.getElementById("articlescount").innerHTML = resultsP.length + " article(s)";
|
||
}
|
||
|
||
loadtable(articles);
|
||
|
||
function codearticlechange(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 famillechange(e) {
|
||
var res = articles.filter(a => a.FAR_LIB.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
function sfamillechange(e) {
|
||
var res = articles.filter(a => a.SFA_LIB.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
function sitechange(e){
|
||
var res = articles.filter(a => a.DEP_CODE.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
function zonechange(e){
|
||
var res = articles.filter(a => a.ZONE.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
function responsablechange(e) {
|
||
var res = articles.filter(a => a.Responsable.toUpperCase().includes(e.value.toUpperCase()));
|
||
loadtable(res);
|
||
}
|
||
|
||
$("#fam").on("change", function () {
|
||
sfamillechange(this);
|
||
var holder = document.getElementById("link");
|
||
var v = this.value
|
||
if(v == "")
|
||
v = "all"
|
||
holder.innerHTML = holder.setAttribute('href', "qrcode.pdf.php?bulk="+v);
|
||
holder.innerHTML = "Exporter Par Sous Famille";
|
||
});
|
||
|
||
function unitechange(e) {
|
||
var res = articles.filter(a => a.ART_UB_STK.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="">Articles</a></li>'+
|
||
'</ul>');
|
||
var selected = document.getElementById("fam");
|
||
var v = selected.value;
|
||
if(v == "")
|
||
v = "all"
|
||
var holder = document.getElementById("link");
|
||
holder.innerHTML = holder.setAttribute('href', "qrcode.pdf.php?bulk="+v);
|
||
holder.innerHTML = "Exporter Par Sous Famille";
|
||
});
|
||
</script>
|