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(); } } }
include './resources/init.php'; $tmpl->place('header'); ?> <script type="text/javascript" src="./js/admin-branch.js"></script> <?php $tmpl->place('menu'); ?> <div id="content" class="span-24 last"> <?php $tmpl->place('menuReport'); ?> <h2>User Report</h2><h3>Aging</h3> <?php $branch = "HQKL"; $items = Inv_stock::findByBranch($branch); ?> <table> <thead> <tr> <th></th> <?php for ($i = 1; $i <= 12; $i++) { $stringmonth = date("F", mktime(0, 0, 0, $i)); echo "<th>" . $stringmonth . "</th>"; } ?> </tr> </thead> <tbody> <?php
$tmpl->place('menuAdmin'); ?> <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>
$grn_detail->setDescription($row->{'itemDesc'}); $grn_detail->setQuantity($row->{'itemQuan'}); $grn_detail->setAssessment($row->{'assess'}); $grn_detail->setRemark($row->{'remarks'}); if (!$error) { $grn_detail->store(); } } catch (fExpectedException $e) { echo $e->printMessage(); $error = true; } } } $details = Good_receipt_note_detail::findDetail($grn->getDocNumber()); foreach ($details as $detail) { Inv_stock::addStock($detail->getItemId(), $grn->getBranchId(), $detail->getQuantity()); } $grn->setStatus("completed"); $grn->store(); if ($_POST['cloneNew'] == "yes") { //if(substr($grn->getDocNumber(),-3) != "rev") $newGRNNo = $grn->getDocNumber() . "/rev"; //else{ // $newGRNNo = $grn->getDocNumber().Good_receipt_note::findRev($grn->getPoNo()); //} $newGRN = $grn->replicate(); $newGRN->setDocNumber($newGRNNo); $newGRN->setDocType("GRNRev"); $newGRN->setStatus('incomplete'); $newGRN->store(); foreach ($jsonForm as $row) {
<?php include '../resources/init.php'; if (isset($_POST['type'])) { if ($_POST['type'] == "add") { try { $inv_item = new Inv_item(); $inv_item->populate(); $inv_item->store(); $branches = Branch::findAll(); foreach ($branches as $branch) { $stock = new Inv_stock(); $stock->setBranchId($branch->getId()); $stock->setItemId($inv_item->getId()); $stock->setQuantity(0); $stock->store(); } } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "delete") { try { $inv_item = new Inv_item($_POST['key']); $inv_item->delete(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "edit") { try {
$error = true; } } } catch (fExpectedException $e) { echo $e->printMessage(); $error = true; } } else { if ($_POST['type'] == "removeStock") { $records = Inv_stock::gotoStock($_POST['itemCode'], $_POST['branch']); if ($records->count()) { foreach ($records as $record) { if ($record->getQuantity() < $_POST['itemQuan']) { echo "Item not enough quantity"; } else { Inv_stock::removeStock($_POST['itemCode'], $_POST['branch'], $_POST['itemQuan']); $stock = new Production_issue_detail($_POST['detailId']); $stock->setStatus('completed'); $stock->store(); } } } else { echo "Item not enough quantity."; } } else { if ($_POST['type'] == "save") { try { $production = new Production_issue($_POST['key']); //$production->populate(); if ($_POST['issuer'] != "") { $production->setIssuer($_POST['issuer']);
$mattrans->setStatus("pending"); } } $mattrans->store(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "accept") { try { $mattrans_detail = new Material_transfer_detail($_POST['key']); $mattrans = new Material_transfer($mattrans_detail->getDocNumber()); if ($mattrans_detail->getStatus() != "transit") { throw new fProgrammerException('Status Overidden: ' . $mattrans_detail->getStatus()); } Inv_stock::moveTransit($mattrans_detail->getItemId(), $mattrans->getBranchFrom(), $mattrans->getBranchTo(), $mattrans_detail->getQuantity()); $mattrans_detail->setStatus("completed"); $mattrans_detail->setReceiver($_POST['user']); $mattrans_detail->store(); $mat_details = Material_transfer_detail::findDetail($mattrans->getDocNumber()); foreach ($mat_details as $mat_detail) { if ($mat_detail->getStatus() == "completed") { $mattrans->setStatus("completed"); } else { $mattrans->setStatus("pending"); } } $mattrans->store(); } catch (fExpectedException $e) { echo $e->printMessage(); }
<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>"; echo "</td>"; } else {
try { Inv_stock::removeStock($row->{'itemCode'}, $row->{'branch'}, $row->{'quantity'}); $mattrans = new Material_transfer($_POST['doc_num']); $mattrans->setStatus("completed"); $mattrans->store(); $mattrans_detail = new Material_transfer_detail($row->{'id'}); $mattrans_detail->setFromBranch($row->{'branch'}); $mattrans_detail->store(); } catch (fExpectedException $e) { echo $e->printMessage(); } Inv_stock::addStock($row->{'itemCode'}, $_POST['branch'], $row->{'quantity'}); } } else { if ($_POST['type'] == "ACcount") { try { $branch = fRequest::get('branch'); $itemcode = fRequest::get('item'); $stocks = Inv_stock::findStockByBranch($itemcode, $branch); $stock = $stocks[0]; echo $stock->prepareQuantity(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "reset") { echo Inv_stock::resetStock(fRequest::get('target'), fRequest::get('quantity', 'integer')); } } } }