Beispiel #1
0
/**
 * Return all booking headers for the supplied date
 * @param $bdate [in] the date
 * @param $rs [in/out] The result array of headers
 * 
 * @return Number of elements added to RS $rs
 * $rs[idx]['Id'] = Booking Id
 * $rs[idx]['Date'] = Booking date
 * $rs[idx]['Time'] = Booking time
 * $rs[idx]['Name'] = Guest Name
 */
function GetBookingDataForDate($bdate, &$rs)
{
    $conn = connect_Hotel_db(HOST, USER, PASS, DB, PORT);
    if (!$conn) {
        print "Cannot connect to database<br>\n";
    }
    $rs = array();
    $sql = "SELECT g.lastname,g.firstname,g.middlename,b.booking_type,b.checkout_date AS CODate, TIME(b.codatetime) AS COTime, b.book_id\n\t\tFROM guests g RIGHT OUTER JOIN booking b ON g.guestid=b.guestid\n\t\tWHERE b.checkout_date='" . $bdate . "'\n\t\tORDER BY COTime ASC ";
    if (DEBUG) {
        print "Debug BOOKING QRY " . $sql . "<br>\n";
    }
    $result = mysql_query($sql, $conn);
    $i = 0;
    while ($row = mysql_fetch_assoc($result)) {
        if (DEBUG) {
            print "DEBUG Booking " . $row['CODate'] . $row['COTime'] . "<br>\n";
        }
        $rs[$i]['Id'] = $row['book_id'];
        $rs[$i]['Date'] = $row['CODate'];
        $rs[$i]['Time'] = $row['COTime'];
        $rs[$i]['Name'] = $row['lastname'] . "," . $row['firstname'] . " " . $row['middlename'];
        $i++;
    }
    db_close($conn);
    return sizeof($rs);
}
/**
 *getting all guestlist from database based upon sql query<br>
 *@param $sql [in] sql query<br>
 *Connecto to the database and the result display in web page<br>
 *uses constants <b>HOST</b>,<b>USER</b>,<b>PASS</b>,<b>DB</b>,<b>PORT</b> to connecto to the database <br>
 *Generate HTML output by table in web page.<br>
 */
function guestslist($sql)
{
    //global $gueststatus;
    $conn = connect_Hotel_db(HOST, USER, PASS, DB, PORT);
    $results = mkr_query($sql, $conn);
    echo "<table align=\"center\">";
    //get field names to create the column header
    echo "<tr bgcolor=\"#009999\">\n\t\t<th colspan=\"4\">Action</th>\n\t\t<th>Guest</th>\n\t\t<th>PP. No./ID. No.</th>\n\t\t<th>Mobile</th>\n\t\t<th>Phone</th>\n\t\t<th>Email</th>\n\t\t<th>P. O. Box</th>\n\t\t<th>Town-Postal code</th>\n\t\t</tr>";
    //end of field header
    //get data from selected table on the selected fields
    while ($guest = fetch_object($results)) {
        //alternate row colour
        $j++;
        if ($j % 2 == 1) {
            echo "<tr id=\"row{$j}\" onmouseover=\"javascript:setColor('{$j}')\" onmouseout=\"javascript:origColor('{$j}')\" bgcolor=\"#CCCCCC\">";
        } else {
            echo "<tr id=\"row{$j}\" onmouseover=\"javascript:setColor('{$j}')\" onmouseout=\"javascript:origColor('{$j}')\" bgcolor=\"#EEEEF8\">";
        }
        echo "<td><a href=\"guests.php?search={$guest->guestid}\"><img src=\"images/button_view.png\" width=\"16\" height=\"16\" border=\"0\" title=\"view guests details\"/></a></td>";
        echo "<td><a href=\"bookings.php?search={$guest->guestid}\"><img src=\"images/bed.jpg\" width=\"16\" height=\"16\" border=\"0\" title=\"book guest\"/></a></td>";
        echo "<td><a href=\"reservations.php?search={$guest->guestid}\"><img src=\"images/bed2.jpg\" width=\"16\" height=\"16\" border=\"0\" title=\"guest reservtion\"/></a></td>";
        echo "<td><a href=\"billings.php?search={$guest->guestid}\"><img src=\"images/button_signout.png\" width=\"16\" height=\"16\" border=\"0\" title=\"bill guest\"/></a></td>";
        echo "<td>" . trim($guest->guest) . "</td>";
        echo "<td>" . $guest->pp_no . "/" . $guest->idno . "</td>";
        echo "<td>" . $guest->mobilephone . "</td>";
        echo "<td>" . $guest->phone . "</td>";
        echo "<td>" . $guest->email . "</td>";
        echo "<td>" . $guest->address . "</td>";
        echo "<td>" . $guest->town . '-' . $guest->postal_code . "</td>";
        echo "</tr>";
        //end of - data rows
    }
    //end of while row
    echo "</table>";
}
Beispiel #3
0
access("guest");
//check if user is allowed to access this page
$search = "";
$stype = 0;
$agent = array();
if (isset($_GET['del']) && $_GET['del'] > 0) {
    if (is_ebridgeCustomer()) {
        include_once dirname(__FILE__) . "/OTA/advancedFeatures/adv_functions.php";
        delete_advProfile($_GET['del']);
    }
}
if (isset($_GET['id']) && isset($_GET['action']) && $_GET['id'] > 0 && $_GET['action'] == "remove") {
    delete_guest($_GET['id']);
}
if (isset($_POST['Submit'])) {
    $conn = connect_Hotel_db(HOST, USER, PASS, DB, PORT);
    $action = $_POST['Submit'];
    switch ($action) {
        case 'List':
            return;
            break;
        case $_L['BTN_search']:
            //check if user is searching using name, payrollno, national id number or other fields
            $search = $_POST["search"];
            $stype = 0;
            if (isset($_POST["optFind"])) {
                $stype = $_POST["optFind"];
            }
            break;
    }
}
Beispiel #4
0
/**
 * Update the database to mask and clear the credit card number and CVV for a receipt
 * @param $rcptid [in] The receipt id
 * @param $mask_CC [in] 1 to mask the credit card number in the database (optional)
 * @return 1 success 0 fail
 * @note only works when FOP is type for Creditcard.
 */
function mask_CC_clear_CVV($rcptid, $mask_CC = 0)
{
    global $conn;
    if (!$conn) {
        $conn = connect_Hotel_db(HOST, USER, PASS, DB, PORT);
    }
    if (!$conn) {
        return 0;
    }
    $sql = "UPDATE receipts SET cvv ='000'";
    // if mask cc is set then chop the last 4 chars and prepend 12x
    if ($mask_CC) {
        $sql .= ",CCnum = concat('xxxxxxxxxxxx',substring(CCnum,-4)) ";
    }
    $sql .= " WHERE receipt_id =" . strip_specials($rcptid) . " and fop=" . FOP_CC;
    $stmt = $conn->prepare($sql);
    $results = $stmt->execute();
    $stmt = NULL;
    return $results;
}