<?php

include '../../resources/init.php';
$q = strtolower($_GET["q"]);
if (!$q) {
    return;
}
$items = Inv_item::findLike($q);
//echo $items->count();
$jsonString = "[";
foreach ($items as $item) {
    if (strpos(strtolower($item->getId()), $q) !== false) {
        $jsonString = $jsonString . "{ name: \"" . $item->prepareId() . "\", desc: \"" . $item->prepareDescription() . "\", uom:\"" . $item->prepareUnitOfMeasure() . "\" },";
    }
}
$jsonString = substr($jsonString, 0, strlen($jsonString) - 1) . "]";
echo $jsonString;
示例#2
0
 } else {
     if ($_POST['type'] == "delete") {
         try {
             $branch = new Branch($_POST['key']);
             $branch->delete();
         } catch (fExpectedException $e) {
             echo $e->printMessage();
         }
     } else {
         if ($_POST['type'] == "add") {
             try {
                 $branch = new Branch();
                 $branch->populate();
                 $branch->store();
                 $theId = $branch->getId();
                 $ids = Inv_item::findIdUB($db);
                 foreach ($ids as $id) {
                     $stock = new Inv_stock();
                     $stock->setBranchId($theId);
                     $stock->setItemId($id);
                     $stock->setQuantity(0);
                     $stock->store();
                 }
             } catch (fExpectedException $e) {
                 echo $e->printMessage();
             }
         } else {
             if ($_POST['type'] == "name") {
                 $branch = new Branch($_POST['key']);
                 echo $branch->prepareName();
             }
        $branch = new Branch($production->getBranchId());
        echo $branch->prepareName() . " / " . "<span id=\"branchId\">" . $production->prepareBranchId() . "</span>";
        ?>
<br />
		<table id="formContent">
			<thead>
				<tr><th>No</th>
					<th>Item Code</th><th width="400">Description</th><th>Quantity</th><th>UOM</th><th>Remarks</th><th>Icons</th></tr>
			</thead>
			<tbody>
				<?php 
        $hideCancel = false;
        $counter = 1;
        foreach ($production_details as $production_detail) {
            echo "<tr id=\"rowNo" . $counter . "\"><td id=\"detailId\" class=\"hideFirst\">" . $production_detail->getId() . "</td><td>" . $counter . "</td><td id=\"itemCode\">" . $production_detail->prepareItemId() . "</td>";
            $item = new Inv_item($production_detail->getItemId());
            echo "<td class=\"itemDesc\">" . $item->prepareDescription() . "</td>\n\t\t\t\t\t\t\t\t<td id=\"itemQuan\">" . $production_detail->prepareQuantity() . "</td>\n\t\t\t\t\t\t\t \t<td>" . $item->prepareUnitOfMeasure() . "</td><td>" . $production_detail->prepareRemark() . "</td>";
            if ($production_detail->getStatus() == "pending") {
                echo "<td id=\"iconCell\"><ul id=\"icons\" class=\"ui-widget ui-helper-clearfix\">\n\t\t\t\t\t\t\t\t<li id=\"save\" title=\"Save\" class=\"ui-state-default ui-corner-all\">\n\t\t\t\t\t\t\t\t\t<span class=\"ui-icon ui-icon-disk\"></span>\n\t\t\t\t\t\t\t\t\t<span class=\"text-icon\">Save</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t<li title=\"Loading\" class=\"hideFirst ui-corner-all\">\n\t\t\t\t\t\t\t\t\t<img src=\"./img/layout/ajax-loader2.gif\" />\n\t\t\t\t\t\t\t\t</li></ul></td></tr>";
            } else {
                echo "<td id=\"iconCell\"><ul id=\"icons\" class=\"ui-widget ui-helper-clearfix\"><li title=\"Complete\" class=\"ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-check\"></span></li><li title=\"Loading\" class=\"hideFirst ui-corner-all\"><img src=\"./img/layout/ajax-loader2.gif\" /></li></ul></td></tr>";
                $hideCancel = true;
            }
            $counter++;
        }
        ?>
			</tbody>
		</table>
		<label>Notes</label><br /><?php 
        echo $production->prepareNotes();
        ?>
?>
	<div id="main" class="span-24 last">
		<h2>Administration</h2><h3>Stock</h3>
		<br />
		<form action = "admin-stock.php" method = "get">
			<label for="inv_item">Choose Inventory Item: </label>
			<span id="inv_item">
				<input id="autocompleteItem" name="item"></input>
			</span>
			<input id="submitBTN" type="submit" value="Submit" />
		</form>
		<?php 
if (isset($_GET['item'])) {
    try {
        $inv_stocks = Inv_stock::findByItem($_GET['item']);
        $item = new Inv_item($_GET['item']);
        printf("<br /><h3>%s - %s</h3><table><thead><tr><th>Branch</th><th>Quantity</th><th width=\"100\">Update</th></tr></thead><tbody>", $item->prepareId(), $item->prepareDescription());
        foreach ($inv_stocks as $inv_stock) {
            $branch = new Branch($inv_stock->getBranchId());
            printf("<tr><td>%s</td><td><input type=\"text\" value=\"%s\" /> %s</td><td><input class=\"updateBTN\" id=\"%s\" type=\"button\" value=\"Update\"/></td></tr>", $branch->prepareName() . " [" . $branch->prepareId() . "]", $inv_stock->getQuantity(), $item->prepareUnitOfMeasure(), $inv_stock->getId());
        }
        echo "</tbody></table>";
    } catch (fExpectedException $e) {
        echo $e->printMessage();
    }
}
?>
	</div>
</div>
<div id="messageBox" style="display: none;">Loading</div>
<?php 
                                try {
                                    $uploader = new fUpload();
                                    $uploader->setMIMETypes(array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'), 'The file uploaded is not an image');
                                    $uploader->enableOverwrite();
                                    $file = $uploader->move($uploadDirectory, 'file');
                                    $inv_item = new Inv_item($_POST['hiddenId']);
                                    $inv_item->setImageUrl('storage/image/' . $_POST['hiddenId'] . '/' . $file->getFilename());
                                    $inv_item->store();
                                    echo "Image uploaded";
                                } catch (fExpectedException $e) {
                                    echo $e->printMessage();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
} else {
    if (isset($_GET['type'])) {
        if ($_GET['type'] == "uom") {
            try {
                $inv_item = new Inv_item($_GET['key']);
                echo $inv_item->prepareUnitOfMeasure();
            } catch (fExpectedException $e) {
                echo $e->printMessage();
            }
        }
    }
}
				<?php 
        }
        ?>
			</div>
		<table id="formContent">
			<thead>
				<tr><th>No</th>
					<th>Item Code</th><th width="300px">Description</th><th>Quantity</th><th>UOM</th><th>Unit Price</th><th>Extended Price</th></tr>
			</thead>
			<tbody>
				<?php 
        $counter = 1;
        $totalchecker = 0;
        foreach ($purchase_details as $purchase_detail) {
            echo "<tr><td>" . $counter . "</td><td>" . $purchase_detail->prepareItemId() . "</td>";
            $item = new Inv_item($purchase_detail->getItemId());
            echo "<td>" . $purchase_detail->prepareDescription() . "</td><td>" . $purchase_detail->prepareQuantity() . "</td>\n\t\t\t\t\t\t\t \t<td>" . $item->prepareUnitOfMeasure() . "</td><td>" . $purchase_detail->prepareUnitPrice() . "</td>\n\t\t\t\t\t\t\t\t<td>" . $purchase_detail->prepareExtendedPrice() . "</td></tr>";
            $totalchecker = $totalchecker + $purchase_detail->getExtendedPrice();
            $counter++;
        }
        ?>
			</tbody>
			<?php 
        $totalchecker = $totalchecker - $purchase->getDiscount();
        if ($totalchecker != $purchase->getTotal()) {
            $purchaseNu = new Purchase($_GET['id']);
            $purchaseNu->setTotal($totalchecker);
            $purchaseNu->store();
        }
        ?>
			<tfoot>
         if ($row->{'detailId'} == 0) {
             $purchase_detail = new Purchase_detail();
         } else {
             $purchase_detail = new Purchase_detail($row->{'detailId'});
         }
         $purchase_detail->setDocNumber($key);
         $purchase_detail->setItemId($row->{'itemCode'});
         $purchase_detail->setDescription($row->{'itemDesc'});
         $purchase_detail->setQuantity($row->{'itemQuan'});
         $purchase_detail->setUnitPrice($row->{'itemUnitP'});
         $extendedPrice = $row->{'itemQuan'} * $row->{'itemUnitP'};
         $total = $total + $extendedPrice;
         $purchase_detail->setExtendedPrice(round($extendedPrice, 2));
         //$purchase_detail->setExtendedPrice($row->{'itemExtP'});
         if ($_POST['approver_1'] != null && $_POST['approver_1_date'] != null) {
             $item = new Inv_item($row->{'itemCode'});
             $item->setCurrencyId($purchase->getCurrency());
             $item->setRate($row->{'itemUnitP'});
             $item->store();
         }
         if (!$error) {
             $purchase_detail->store();
         }
     } catch (fExpectedException $e) {
         echo $e->printMessage();
         $error = true;
     }
 }
 if (!$error) {
     $total = $total - $_POST['discount'];
     $purchase->setTotal(round($total, 2));
					</tr>
				</table>
				</div>
			</div>
		<table id="formContent">
			<thead>
				<tr><th>No</th>
					<th>Item Code</th><th width="300px">Description</th><th>Quantity</th><th>UOM</th><th>Remarks</th><th>(A)</th></tr>
			</thead>
			<!--
			<tbody>
				<?php 
        $counter = 1;
        foreach ($grn_details as $grn_detail) {
            echo "<tr><td>" . $counter . "</td><td>" . $grn_detail->prepareItemId() . "</td>";
            $item = new Inv_item($grn_detail->getItemId());
            echo "<td>" . $item->prepareDescription() . "</td><td>" . $grn_detail->prepareQuantity() . "</td>\n\t\t\t\t\t\t\t \t<td>" . $item->prepareUnitOfMeasure() . "</td><td>" . $grn_detail->prepareRemark() . "</td>\n\t\t\t\t\t\t\t\t<td class=\"assessText\">" . $grn_detail->prepareAssessment() . "</td></tr>";
            $counter++;
        }
        ?>
			</tbody>
			-->
			<tbody>
			</tbody>
			<tfoot>
				<tr><td colspan="7">
					<p>
						<label>Assesment Of Condition (A)</label><br />
						<b>OK</b> : Item received in good condition<br />
						<b>NG</b> : Item is in damaged condition<br />
						<b>Q </b> : Quantity supplied did not match DO quantity<br />
            echo "<a href=\"inventory-stock.php?branch={$branch}&page={$times}\">Last</a></span>";
        }
        printf("<table><thead><tr><th>Item ID</th><th>Description</th><th>Quantity</th></tr></thead><tbody>");
        foreach ($inv_stocks as $inv_stock) {
            $inv_item = new Inv_item($inv_stock->getItemId());
            printf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>", $inv_item->prepareId(), $inv_item->prepareDescription(), $inv_stock->prepareQuantity() . " " . $inv_item->prepareUnitOfMeasure());
        }
        echo "</tbody></table>";
    } catch (fExpectedException $e) {
        echo $e->printMessage() . $inv_stock->getItemId();
    }
} else {
    if (isset($_GET['item'])) {
        try {
            $inv_stocks = Inv_stock::findByItem($_GET['item']);
            $item = new Inv_item($_GET['item']);
            printf("<br /><h3>%s - %s</h3><table><thead><tr><th>Branch</th><th>Quantity</th></tr></thead><tbody>", $item->prepareId(), $item->prepareDescription());
            foreach ($inv_stocks as $inv_stock) {
                $branch = new Branch($inv_stock->getBranchId());
                printf("<tr><td>%s</td><td>%s</td></tr>", $branch->prepareName() . " [" . $branch->prepareId() . "]", $inv_stock->prepareQuantity() . " " . $item->prepareUnitOfMeasure());
            }
            echo "</tbody></table>";
        } catch (fExpectedException $e) {
            echo $e->printMessage();
        }
    }
}
?>
	</div>
</div>
<?php 
        ?>
<br />
		<table id="formContent">
			<thead>
				<tr><th>No</th>
					<th>Item Code</th><th width="300px">Description</th><th>Quantity</th><th>UOM</th><th>Remarks</th><th>In <?php 
        echo $fromBranch->getId();
        ?>
</th><th width="75px">Receiver</th></tr>
			</thead>
			<tbody>
				<?php 
        $counter = 1;
        foreach ($mattrans_details as $mattrans_detail) {
            echo "<tr class=\"jsonRow\"><td>" . $counter . "</td><td class=\"itemCode\">" . $mattrans_detail->prepareItemId() . "<input class=\"itemId\" type=\"hidden\" value=\"" . $mattrans_detail->getId() . "\"></input></td>";
            $item = new Inv_item($mattrans_detail->getItemId());
            echo "<td>" . $item->prepareDescription() . "</td><td class=\"itemQuan\">" . $mattrans_detail->prepareQuantity() . "</td>\n\t\t\t\t\t\t\t \t<td>" . $item->prepareUnitOfMeasure() . "</td><td>" . $mattrans_detail->prepareRemark() . "</td>";
            $tempRecords = Inv_stock::findStockByBranch($mattrans_detail->getItemId(), $mattrans->getBranchFrom());
            $quanRow = 0;
            foreach ($tempRecords as $tempRecord) {
                $quanRow = $tempRecord->getQuantity();
            }
            echo "<td>" . $quanRow . "</td>";
            if (fAuthorization::checkAuthLevel('admin')) {
                echo "<td><span class=\"loader hideFirst\"><img src=\"./img/layout/ajax-loader2.gif\" /></span>";
                if ($mattrans_detail->getStatus() == "pending" && $quanRow >= $mattrans_detail->getQuantity()) {
                    echo "<input type=\"button\" value=\"Transit\" \n\t\t\t\t\t\t\t\t\t\tkey=\"" . $mattrans_detail->getId() . "\" class=\"transitBTN\"></input></td>";
                } else {
                    if ($mattrans_detail->getStatus() == "transit") {
                        echo "<input type=\"button\" value=\"Reject\" \n\t\t\t\t\t\t\t\t\t\tkey=\"" . $mattrans_detail->getId() . "\" class=\"rejectBTN\"></input>";
                        echo "<input type=\"button\" value=\"Accept\" \n\t\t\t\t\t\t\t\t\t\tkey=\"" . $mattrans_detail->getId() . "\" class=\"acceptBTN\"></input>";
示例#11
0
<?php

include './resources/init.php';
//Find all items
$results = Inv_item::findIdUB($db);
//$results = Inv_item::findAll();
foreach ($results as $result) {
    echo $result . " \n";
}
示例#12
0
     printf("<br /><h3 id=\"mainCategoryTitle\" key=\"%s\">%s</h3>", $_GET['maincc'], $inv_maincategory->prepareDescription());
 } else {
     if (!isset($_GET['page']) || $_GET['page'] == 1) {
         $first = 0;
         $last = 100;
     } else {
         $first = ($_GET['page'] - 1) * 100;
         $last = $first + 100 - 1;
     }
     //$inv_counter = count(Inv_item::findAll());
     $inv_counter = 0;
     $temps = $db->query('SELECT count(*) as num FROM inv_items');
     foreach ($temps as $row) {
         $inv_counter = $row['num'];
     }
     $inv_items = Inv_item::findAllLimit($first, 100);
     //echo "FIRST:". $first ."LAST:". $last;
     $times = ceil($inv_counter / 100);
     //$times = 30;
     echo "<h3>All results</h3>";
     if ($times < 2) {
         echo "<span id=\"pagination\"><a href=\"inventory.php?maincc=all\">First </a>";
         echo "<a href=\"inventory.php?maincc=all&page={$times}\">Last</a></span>";
     } else {
         echo "<span id=\"pagination\"><a href=\"inventory.php?maincc=all\">First </a>";
         for ($i = 1; $i < $times; $i++) {
             echo "<a href=\"inventory.php?maincc=all&page={$i}\">{$i} </a></span>";
         }
         echo "<a href=\"inventory.php?maincc=all&page={$times}\">Last</a></span>";
     }
 }
include './resources/init.php';
fAuthorization::requireLoggedIn();
$tmpl->place('header');
?>
<script type="text/javascript" src="./js/inventory-view.js"></script>
</head>
<body>
<div class = "container">
	<div id="View" class = "view-frame span-23 last">
	<?php 
if (!isset($_GET['id'])) {
    echo "<div class=\"ui-state-error ui-corner-all\">\r\n\t\t\t\t\t<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 30px;\"></span>\r\n\t\t\t\t\tYou arrived to this page in error</div>";
} else {
    try {
        $inv_item = new Inv_item($_GET['id']);
        ?>
		<div id="content">
		<div id="Id" class="span-8"><h1 id="idCaption"><?php 
        echo $inv_item->prepareId();
        ?>
</h1>
			<?php 
        try {
            $profile = new fImage($inv_item->getImageUrl());
            if ($profile->getWidth() != 300) {
                $profile->resize(300, 0);
                $profile->saveChanges();
            }
            echo "<img class=\"view-img\" src=\"" . $inv_item->prepareImageUrl() . "\"></img>";
        } catch (fExpectedException $e) {