-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm-scanned.php
47 lines (39 loc) · 1.64 KB
/
confirm-scanned.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
$head = ['title' => 'Verify Scanned Items'];
$header = "<strong>Verify</strong> Scanned Items";
include 'classes/header.php';
?>
<div class="contain" style="text-align: center;">
<h2>Does this information look correct?</h2>
<?php
//print all the scanned data
$data = $_SESSION["barcode"];
$keys = array_keys($data);
$descriptions = $_SESSION['descriptions'];
//combine duplicate barcodes while printing data
foreach($keys as $key){
//get the array of fixture,box,shelf info with this barcode
$currentarray = $data[$key];
$desc = $descriptions[$key];
//removes consecutive leading zeros (remove this if runtimes begin to slow down)
$currentChar = 0;
while($currentChar < strlen($key) && substr($key, $currentChar, 1) == "0"){
$currentChar++;
}
$key = substr($key, $currentChar);
$qty = 0;
foreach($currentarray as $datastring){
$additionalQty = (int)(substr($datastring, strrpos($datastring, "-")+1));
$qty = $qty + $additionalQty;
}
//update this for quantities of the same barcode
echo('<p><strong>'.$qty.'</strong> - '.$key.' - '.$desc.'</p>');
}
?>
<form align="center" method="post" action="import-scanned-data.php">
<input type="submit" class="button textcenter" style="width: 220px;" id="reset" name="reset" value="There is an error, Start over" tabindex="13"/ readonly >
<input class="button textcenter" style="width: 180px;" type="submit" id="submit" name="submit" value="This is correct, Submit" tabindex="13" readonly />
<input class="button textcenter" style="width: 180px;" type="submit" id="submit" name="cancel" value="Exit" tabindex="13" readonly />
</form>
</div><!-- end contain -->
<?php include 'classes/footer.php'; ?>