</td> </tr> </table> </div> <br> <?php $dbBaseClass = new BaseDB(); if (Database::getConnection() === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } if (isset($_POST["Search"])) { $bc = $_POST['SearchN']; // echo $bc; $records = $dbBaseClass->getFieldsByFilter('Company', array('id', 'Name', 'CompanyCode', 'Active', 'ShortName'), "WHERE Name LIKE '%{$bc}%'"); } else { $records = $dbBaseClass->getFieldsForAll('Company', array('id', 'Name', 'CompanyCode', 'Active', 'ShortName')); } if ($records === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } //$numFields = sqlsrv_num_fields($records); echo "<table class='withBorder'>"; echo '<thead>'; echo '<tr></tr><th>Name</th><th>Company Code</th><th>Active</th><th>ShortName</th><th colspan="3">Action</th> <tr></tr>'; echo '<tr>'; echo '</tr>'; echo '</thead>';
<form name="form3" action="BranchDisplayGrid.php" method="post"> <input type="submit" value="Return" name="Return" id="Return"> </form> </td> </tr> </table> </div> <br> <?php $dbBaseClass = new BaseDB(); if (Database::getConnection() === false) { $_SESSION['error'] = "ERROR: Could not connect. " . printf('%s', dbGetErrorMsg()); header("Location: Default.php"); exit; } $records = $dbBaseClass->getFieldsByFilter('Branch', array('id', 'BranchCode', 'Name', 'PhoneNumber', 'ContactPersonName', 'ContactPersonNumber', 'FaxNumber', 'ContactPersonEmail', 'BusinessEntityId'), $filter); if ($records === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } $numFields = sqlsrv_num_fields($records); echo "<table class='withBorder'>"; echo "<thead>"; echo "<tr><th>Branch</th><th>Name</th><th>Phone Number</th><th>ContactPersonName</th><th>ContactPersonNumber</th><th>FaxNumber</th><th>ContactPersonEmail</th><th colspan=\"3\">Actions</th></tr>"; echo '</thead>'; while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_BOTH)) { echo "<tr>"; echo "<td>{$record['BranchCode']}</td>"; echo "<td>{$record['Name']}</td>"; echo "<td>{$record['PhoneNumber']}</td>";
exit; } $divisionRecord = sqlsrv_fetch_array($divisionStmnt, SQLSRV_FETCH_ASSOC); $divisionId = $divisionRecord['BusinessEntityParentId']; // Get the Company EntityId $companyStmnt = $dbBaseClass->getFieldsForAll("BusinessEntity", array('Name', 'Id', 'BusinessEntityParentId'), "WHERE id = {$divisionId}"); if ($companyStmnt == false) { $_SESSION['error'] = "The branch does not have a related company."; header("Location: BranchDisplayGrid.php"); exit; } $companyRecord = sqlsrv_fetch_array($companyStmnt, SQLSRV_FETCH_ASSOC); $companyId = $companyRecord['BusinessEntityParentId']; // If a record is only displayed then the Company and Division should not be allowed to change // Get the company that this branch is related with $companyRecords = $dbBaseClass->getFieldsByFilter('BusinessEntity', array('Id', 'Name'), ' WHERE Id = ' . $companyId); $company = sqlsrv_fetch_array($companyRecords, SQLSRV_FETCH_ASSOC); $selectList = "<option selected=selected value='{$company['Id']}'>{$company['Name']}</option>"; // TODO // Get the Division that this branch is related with and make it the only available selection // if ($action == 'r' || $action == 'd') { // $divisionSelectList = "<option selected=\"selected\" value='{$companyRecord['Id']}'>{$companyRecord['Name']}</option>"; // } } else { $companyRecords = $dbBaseClass->getFieldsForAll("BusinessEntity", array('Id', 'Name'), 'WHERE BusinessLevelId = 1'); while ($company = sqlsrv_fetch_array($companyRecords, SQLSRV_FETCH_ASSOC)) { $selectList .= "<option value='{$company['Id']}'>{$company['Name']}</option>"; } $action = 'c'; $id = -1; }
</div> <br> <?php /** * Created by PhpStorm. * User: Danie * Date: 2014/10/21 * Time: 09:38 PM */ $dbBaseClass = new BaseDB(); if (Database::getConnection() === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } $records = $dbBaseClass->getFieldsByFilter('BusinessEntity', array('id', 'Name', 'BusinessEntityCode', 'BusinessEntityDescription', 'BusinessEntityShortName'), $filter); if ($records === false) { $_SESSION['error'] = dbGetErrorMsg(); header("Location: Default.php"); exit; } echo "<table>"; echo "<thead>"; $name = BaseBusinessEntity::$BusinessEntity['Name']['FriendlyName']; $shortName = BaseBusinessEntity::$BusinessEntity['BusinessEntityShortName']['FriendlyName']; $description = BaseBusinessEntity::$BusinessEntity['BusinessEntityDescription']['FriendlyName']; echo "<tr><th>{$name}</th><th>{$shortName}</th><th>{$description}</th></tr>"; echo "<tr>"; echo "</tr>"; echo "</thead>"; while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_BOTH)) {