first commit
This commit is contained in:
51
model_controller/controleinventaire.immo.php
Normal file
51
model_controller/controleinventaire.immo.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user