-
Notifications
You must be signed in to change notification settings - Fork 0
/
inventory_check.php
91 lines (81 loc) · 2.78 KB
/
inventory_check.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php include("inventory_check_start.php");
include("util.php");
if($_POST)
{
$inputStream = $_POST["inputStream"];
$streamArray = explode( "\r\n", $inputStream );
foreach ($streamArray as $entry) {
$parseEntry = explode( "\t", $entry );
$pid = @$parseEntry[0];
$checked = @$parseEntry[1];//checked qty
//$pidLen = strlen($pid);
//$padLength = 11-$pidLen;
//echo "pid length is $padLength --";
$pid = str_pad($pid, 11, "0", STR_PAD_LEFT);;
echo "$pid $checked <br>";
if (ifExists($pid))
{
$inv = db("select * from inventory_check where pid = '$pid' limit 1");
$prevQty = $inv["checked"];
$checked = $checked + $prevQty;
db("update inventory_check set checked = '$checked' where pid = '$pid' ");
}
else
{
db("insert into inventory_check (pid, checked) values ('$pid', '$checked')");
}
}
}
?>
<form action="inventory_check.php" method="post">
<table id="pack1"class="table table-condensed table-striped table-bordered table-hover">
<tr>
<th>আইডি</th>
<th>বিবরণ</th>
<th>এন্ট্রি</th>
<th>পরিমাণ</th>
<th></th>
<th>চেক বাকি</th>
</tr>
<?php
$inventory = db("select * from inventory_check");
foreach ($inventory as $entry) {
$pid = $entry["pid"];
$checked = $entry["checked"];
$stock = db("select * from inventory where pid = '$pid' limit 1");
$invQty = @$stock["total_qty"];
$unChecked = $invQty - $checked;
$description = getDescription($pid);
if ($unChecked != 0)
{
echo "<tr>
<td>$pid</td>
<td>$description</td>
<td>$checked</td>
<td>$invQty</td>
<td></td>
<td>$unChecked</td>
</tr>";
}
// echo "<tr>
// <td>$pid</td>
// <td>$description</td>
// <td>$checked</td>
// <td>$invQty</td>
// <td></td>
// <td>$unChecked</td>
// </tr>";
}
?>
</table>
<span id="last-space"></span>
<textarea name="inputStream"></textarea>
<input class="btn btn-info pull-right" type="submit" value="যোগ করুন">
</form>
<button class="btn btn-default pull-right pseudoClear" >ক্লিয়ার করুন</button>
<form action="inventory_check_clear.php" method="post">
<input type="hidden" name="clear" value="yes">
<input type="submit" vlaue="clear" class="hidden" id="submitBtn">
</form>
<!-- <span class="btn btn-info pull-right" onclick="javascript:ajaxPrintPreview();">প্রিন্ট প্রিভিউ</span> -->
<?php include("inventory_check_end.php"); ?>