52 lines
1016 B
PHP
52 lines
1016 B
PHP
<?php
|
|
|
|
include ('../inc/includes.php');
|
|
|
|
getInventaires();
|
|
Html::redirect("../front/central.php");
|
|
|
|
|
|
function immodepot() {
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT DEP_CODE from `Depot` where immobilisation = 1";
|
|
$result = $DB->query($query);
|
|
$count = $result->num_rows;
|
|
$depots = "(";
|
|
$i = 0;
|
|
if ($count > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$depots = $depots."'".$row['DEP_CODE']."'";
|
|
if($i < $count-1)
|
|
$depots = $depots.",";
|
|
$i++;
|
|
}
|
|
}
|
|
$depots = $depots.")";
|
|
return $depots;
|
|
}
|
|
|
|
function getInventaires() {
|
|
|
|
global $DB;
|
|
|
|
$query = "SELECT * FROM `Inventaire`
|
|
WHERE `DEP_CODE` in ".immodepot();
|
|
$result = $DB->query($query);
|
|
$rows = array();
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$rows[] = $row;
|
|
|
|
if($row['Qt_compt1'] == $row['Qt_compt2']) {
|
|
$query2 = "UPDATE `Inventaire` SET `Qt_controle`= `Qt_compt1` where `id`='".$row['id']."' and `Qt_controle` = 0";
|
|
//echo $query2;
|
|
$result2 = $DB->query($query2);
|
|
}
|
|
}
|
|
}
|
|
return $rows;
|
|
}
|
|
|