</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>';
while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_BOTH)) {
    echo "<tr>";
Ejemplo n.º 2
0
}
require_once "Header.inc.php";
$action = '';
$selectList = '';
$dbBaseClass = new BaseDB();
$companyName = '';
$divisionId = '';
if (isset($_POST['Create']) === false) {
    if (isset($_GET['id']) === false || isset($_GET['action']) === false) {
        header("Location: BranchDisplayGrid.php");
    }
    $id = (int) $_GET['id'];
    $action = $_GET['action'];
    sanitizeString($id);
    // Get the Division EntityId
    $divisionStmnt = $dbBaseClass->getFieldsForAll("BusinessEntity", array('BusinessEntityParentId'), "WHERE id = {$_GET['entityId']}");
    if ($divisionStmnt == false) {
        $_SESSION['error'] = "The branch does not have a related division.";
        header("Location: BranchDisplayGrid.php");
        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);
            <td class="noBorder">
                <form name="form3" 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) {
    die("ERROR: Could not connect." . printf('%s', dbGetErrorMsg()));
}
$records = $dbBaseClass->getFieldsForAll('BusinessLevel', array('id', 'Name', 'Active'));
if ($records === false) {
    die(dbGetErrorMsg());
}
echo "<table class ='withBorder'>";
echo "<tr>";
echo "<thead>";
echo "<td>BusinessLevelName</td><td>Active</td>";
echo "</thead>";
echo "</tr>";
while ($record = sqlsrv_fetch_array($records, SQLSRV_FETCH_ASSOC)) {
    echo "<tr>";
    echo "<td>{$record['Name']}</td>";
    echo "<td>{$record['Active']}</td>";
    echo "</tr>";
}
Ejemplo n.º 4
0
 * Time: 09:30 PM
 */
if (isset($_POST['Return'])) {
    header("Location: DivisionDisplayGrid.php");
}
global $record;
global $action;
global $businessEntityRecords;
global $parentName;
global $selectList;
include "Header.inc.php";
$action = '';
$recordBase = BaseBusinessEntity::$BusinessEntity;
$dbBaseClass = new BaseDB();
// Get the BusinessEntity records
$businessEntityRecords = $dbBaseClass->getFieldsForAll("BusinessEntity", array('Id', 'Name'), "WHERE BusinessLevelId = 1");
$selectList = '';
if (!isset($_POST['Create'])) {
    if (isset($_GET['id']) === false || isset($_GET['action']) === false) {
        header("Location: DivisionDisplayGrid.php");
    }
    $id = (int) $_GET['id'];
    $action = $_GET['action'];
    sanitizeString($id);
    $prep = $dbBaseClass->getFieldsForAll("BusinessEntity", array('BusinessEntityParentId'), "WHERE id = {$id}");
    $rec = sqlsrv_fetch_array($prep, SQLSRV_FETCH_ASSOC);
    $businessEntityParentId = $rec['BusinessEntityParentId'];
    $prep = $dbBaseClass->getFieldsForAll("BusinessEntity", array('Name'), "WHERE id = {$rec['BusinessEntityParentId']}");
    if ($prep == false) {
        $_SESSION['error'] = "The division does not have a related company.";
        header("Location: DivisionDisplayGrid.php");
    echo 'alert("No Company was selected.")';
    echo '</script>';
}
$division = $_GET['company'];
$divisionId = $_GET['divisionId'];
$displayType = $_GET['displayType'];
try {
    $dbBaseClass = new BaseDB();
} catch (Exception $exc) {
    if (Database::getConnection() === false) {
        die("ERROR: Could not connect. " . printf('%s', dbGetErrorMsg()));
    }
}
$divisionBase = new BaseBusinessEntity();
//    $companyBase = new BaseCompany();
$prep = $dbBaseClass->getFieldsForAll("BusinessEntity", array('Id', 'Name'), "WHERE BusinessEntityParentId = {$division}");
if ($displayType == 'd' || $displayType == 'r') {
    while ($division = sqlsrv_fetch_array($prep, SQLSRV_FETCH_ASSOC)) {
        if ($division['Id'] == $divisionId) {
            echo "<option selected = \"selected\" value=" . $division['Id'] . ">{$division['Name']}</option>";
            return;
        }
    }
}
while ($division = sqlsrv_fetch_array($prep, SQLSRV_FETCH_ASSOC)) {
    if ($division['Id'] == $divisionId) {
        echo "<option selected = \"selected\" value=" . $division['Id'] . ">{$division['Name']}</option>";
    } else {
        echo "<option value=" . $division['Id'] . ">{$division['Name']}</option>";
    }
}