<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'));
            }
        }
    }
}