/
inventory-sub.php
executable file
·92 lines (92 loc) · 3.37 KB
/
inventory-sub.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
92
<?php
include './resources/init.php';
$tmpl->place('header');
?>
<script type="text/javascript" src="./js/inventory-sub.js"></script>
<?php
$tmpl->place('menu');
?>
<div id="content" class="span-24 last">
<?php $tmpl->place('menuInventory'); ?>
<div id="main" class="span-24 last">
<div id="categories span-24 last">
<h2>Sub Category</h2>
<form action = "inventory-sub.php" method = "get">
<label for="maincc">Choose Main Category: </label>
<span id="maincc">
<select name = "maincc">
<?php Inv_maincategory::findAllOption(); ?>
</select>
</span>
<input id="submitBTN" type="submit" value="Submit" />
</form>
<?php
if(isSet($_GET['maincc']))
{
try{
$inv_subcategories = Inv_subcategory::findByMainCategoryCode($_GET['maincc']);
$inv_maincategory = new Inv_maincategory($_GET['maincc']);
} catch (fExpectedException $e) {
echo $e->printMessage();
}
printf("<br /><h3 id=\"mainCategoryTitle\" key=\"%s\">%s</h3>",$_GET['maincc'],$inv_maincategory->prepareDescription());
printf("<table><thead><tr><td>Sub Category Code</td><td>Description</td><td>Main Category Code</td><td>Status</td></tr></thead><tbody>");
foreach($inv_subcategories as $inv_subcategory)
{
printf("<tr><td class=\"hideFirst\"><span class=\"varInput\" id=\"Id\">%s</span></td>
<td><span class=\"varInput\" id=\"Categorycode\">%s</span></td>
<td><span class=\"varInput\" id=\"Description\">%s</span></td>
<td><span class=\"varInput\" id=\"MainCategorycode\">%s</span></td>
<td><span class=\"varInput\" id=\"Status\">%s</span></td>",
$inv_subcategory->prepareId(),
$inv_subcategory->prepareCategoryCode(),
$inv_subcategory->prepareDescription(),
$inv_subcategory->prepareMainCategoryCode(),
($inv_subcategory->prepareStatus() == 1 ? "Active" : "Inactive"));
printf("<td id=\"iconCell\" class=\"hideFirst\"><ul id=\"icons\" class=\"ui-widget ui-helper-clearfix\">
<li id=\"save\" title=\"Save\" class=\"ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-circle-check\"></span></li>
<li id=\"cancel\" title=\"Cancel\" class=\"ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-circle-close\"></span></li>
</ul></td></tr>");
}
?>
<tr id="newItem">
<td>
<span id="Categorycode">
<input type="text" name="category_code" value="Input Category Code" />
</span>
</td>
<td>
<span id="Description">
<input type="text" name="description" value="Input Description" />
</span>
</td>
<td>
<span id="MainCategorycode">
<select name="main_category_code">
<?php Inv_maincategory::findAllOption(); ?>
</select>
</span>
</td>
<td>
<span id="Status">
<select>
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
</span>
</td>
<td id="iconCell">
<ul id="icons" class="ui-widget ui-helper-clearfix">
<li id="add" title="Save" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-circle-check"></span></li>
</ul>
</td>
</tr>
<?php
echo "</tbody>";
echo "</table>";
}
?>
</div>
</div>
</div>
<?php $tmpl->place('footer'); ?>