Exemplo n.º 1
0
function sendShippingConfirmEmail($order_id)
{
    $customer = get_customer(get_customer_id($order_id));
    $customer_name = $customer['firstName'] . ' ' . $customer['lastName'];
    $customer_email = $customer['emailAddress'];
    $order = get_order($order_id);
    $order_date = strtotime($order['orderDate']);
    $order_date = date('M j, Y', $order_date);
    $order_items = get_order_items($order_id);
    $ship_date = date('M j, Y', strtotime($order['shipDate']));
    $shipping_address = get_address($order['shipAddressID']);
    $ship_line1 = $shipping_address['line1'];
    $ship_line2 = $shipping_address['line2'];
    $ship_city = $shipping_address['city'];
    $ship_state = $shipping_address['state'];
    $ship_zip = $shipping_address['zipCode'];
    $ship_phone = $shipping_address['phone'];
    $copyright_date = date("Y");
    set_time_limit(0);
    $messageHTML = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- the head section -->
<head>
    <title>My Guitar Shop: Shipping Confirmation</title>
    <style>
    /* the styles for the HTML elements */
    body {
        margin-top: 0;
        background-color: rgb(128, 141, 159);
        font-family: Arial, Helvetica, sans-serif;
    }
    h1 {
        font-size: 150%;
        margin: 0;
        padding: .5em 0 .25em;
    }
    h2 {
        font-size: 120%;
        margin: 0;
        padding: .5em 0 .25em;
    }
    h1, h2 {
        color: rgb(205, 163, 94);
    }

    ul {
        margin: 0 0 1em 0;
        padding: 0 0 0 2.5em;
    }
    li {
        margin: 0;
        padding: .25em;
    }
    a {
        color: rgb(69, 85, 106);   
        font-weight: bold;

    }
    a:hover {
        color: blue;
    }
    p {
        margin: 0;
        padding: .25em 0;
    }

    form {
        margin: .5em 0;
        width: 100%;
    }
    label {
        width: 8em;
        padding-right: .5em;
        padding-bottom: .5em;
        text-align: right;
        float: left;
    }
    textarea {
        width: 25em;
        margin-bottom: .5em;
    }
    table {
        border-collapse: collapse;
    }
    td, th {
        margin: 0;
        padding: .15em 0;
    }
    br {
        clear: both;
    }

    /* the styles for the div tags that divide the page into sections */
    #page {
        width: 850px;
        margin: 0 auto;
        background-color: white;
        border: 1px solid rgb(119, 75, 77);
    }
    #header {
        margin: 0;
        border-bottom: 2px solid rgb(119, 75, 77);
        padding: .5em 2em;
    }
    #header h1 {
        margin: 0;
        padding: .5em 0;
        color: black;
    }
    #main {
        margin: 0;
        padding: .5em 2em;
    }
    #sidebar {
        float: left;
        width: 170px;
    }
    #sidebar h2 {
        padding: 1em 0 .25em;
    }
    #sidebar ul {
        list-style-type: none;
        margin-left: 0;
        padding-left: 0;
        margin-bottom: 2em;
    }
    #sidebar li {
        margin: 0;
        padding-bottom: .25em;
    }
    #content {
        float: left;
        width: 580px;
        padding-bottom: 1.5em;
    }
    #left_column {
        float: left;
        width: 150px;
        padding-left: .5em;
    }
    #right_column {
        float: left;
        width: 300px;
        padding-left: 1em;
    }
    #footer {
        clear: both;
        margin-top: 1em;
        padding-right: 1em;
        border-top: 2px solid rgb(119, 75, 77);
    }
    #footer p {
        text-align: right;
        font-size: 80%;
        margin: 1em 0;
    }
    /********************************************************************
    * styles for the classes
    ********************************************************************/
    .right {
        text-align: right;
    }
    .left {
        text-align: left;
    }
    .cart_qty  {
        text-align: right;
        width: 3em;
    }
    .button_form {
        margin: 0;
        padding: 0;
        float: left;
    }
    .inline {
        display: inline;
        margin-left: .5em;
    }
    /********************************************************************
    * Styles for the Product Manager application
    ********************************************************************/
    #category_table form {
        margin: 0;
    }
    #category_table td {
        margin: 0;
        padding: .15em .5em 0 0;
    }
    #add_category_form {
        margin: 0;
    }
    #add_category_form input {
        margin-right: .5em;  
    }
    #add_admin_user_form  label {
        width: 8.5em;
    }
    #edit_and_delete_buttons {
        margin-bottom: .5em;
    }
    #edit_and_delete_buttons form {
        display: inline;
    }
    #image_manager input {
        margin: .25em;
    }
    /********************************************************************
    * Styles for the Product Catalog application
    ********************************************************************/
    #product_image_column {
        width: 8em;
        text-align: center;
    }
    /*******************************************************************/
    #add_to_cart_form {
        margin: .25em;
    }
    #add_to_cart_form input {
        float: none;
    }
    /*******************************************************************/
    #cart {
        margin: 0;
        padding: 1em .25em;
        border-collapse: collapse;
        width: 100%;
    }
    #cart_header th {
        border-bottom: 2px solid black;
    }
    #cart_footer td {
        border-top: 2px solid black;
        font-style: bold;
    }
    #cart td {
        padding: .25em 0;
    }
    /*******************************************************************/
    #login_form label {
        width: 5em;
        padding-right: 1em;
    }
    #login_form input[text] {

    }
    #payment_form label {
        width: 8em;
        padding-right: 1em;
    }
    #payment_form input[text] {
        width: 5em;
        margin: 0;
        padding-right: 1em;
    }
    #add_category label {
        text-align: left;
        width: 3em;
    }
    #add_category input { 
        margin-right: .25em;
    }
    </style>
</head>
<!-- the body section -->
<body>
<div id="page">
<div id="header">
    <h1>My Guitar Shop</h1>
</div>
<div id="main">
    <div id="content">
        <h2>Shipping Confirmation</h2>
        <p>Hello <b>{$customer_name}</b>,<br /><br />
        Thank you for shopping with us. We thought you'd like to know that we
        shipped your item(s), and that this completes your order. Your order
        is on its way, and can no longer be changed. Please allow 5-7 business
        days for your order to arrive.</p>
    <h2>Shipping Details</h2>
    <p>Order #{$order_id}<br />
    Placed on {$order_date}<br />
    Shipped on {$ship_date}</p>
    <p>&nbsp;</p>
    <p><b>Your order was sent to:</b><br />
        {$customer_name}<br />
        {$ship_line1}<br />
HTML;
    if (strlen($ship_line2) > 0) {
        $messageHTML .= $ship_line2 . '<br />';
    }
    $messageHTML .= <<<HTML
        {$ship_city}, {$ship_state} {$ship_zip}
        </p>
    <p>&nbsp;</p>
    <table id="cart">
        <tr id="cart_header">
            <th class="left">Item</th>
            <th class="right">List Price</th>
            <th class="right">Savings</th>
            <th class="right">Your Cost</th>
            <th class="right">Quantity</th>
            <th class="right">Line Total</th>
        </tr>
HTML;
    $message = <<<TEXT
My Guitar Shop

Shipping Confirmation
------------------

Hello {$customer_name},

Thank you for shopping with us. We thought you'd like to know that we 
shipped your item(s), and that this completes your order. Your order is on  
its way, and can no longer be changed. Please allow 5-7 business days 
for your order to arrive.  

Shipping Details
----------------
    
Order #{$order_id} 
Placed on {$order_date}  
Shipped on {$ship_date} 

Your order was sent to:
{$customer_name} 
{$ship_line1}
TEXT;
    if (strlen($ship_line2) > 0) {
        $message .= $ship_line2 . ' ';
    }
    $message = <<<TEXT
{$ship_city}, {$ship_state} {$ship_zip}  
TEXT;
    $subtotal = 0;
    $url = 'http://localhost/book_apps/guitar_shop/';
    foreach ($order_items as $item) {
        $product_id = $item['productID'];
        $product_url = $url . 'catalog/?product_id=' . $product_id;
        $product = get_product($product_id);
        $item_name = $product['productName'];
        $list_price = $item['itemPrice'];
        $list_price_txt = sprintf('$%.2f', $list_price);
        $savings = $item['discountAmount'];
        $savings_txt = sprintf('$%.2f', $savings);
        $your_cost = $list_price - $savings;
        $your_cost_txt = sprintf('$%.2f', $your_cost);
        $quantity = $item['quantity'];
        $line_total = $your_cost * $quantity;
        $line_total_txt = sprintf('$%.2f', $line_total);
        $subtotal += $line_total;
        $messageHTML .= <<<HTML
        <tr>
            <td><a href="{$product_url}" target="_blank">
                {$item_name}</a></td>
            <td class="right">
                {$list_price_txt}
            </td>
            <td class="right">
                {$savings_txt}
            </td>
            <td class="right">
                {$your_cost_txt}
            </td>
            <td class="right">
                {$quantity}
            </td>
            <td class="right">
                {$line_total_txt}
            </td>
        </tr>
HTML;
        $message .= <<<TEXT
{$item_name} 
List Price: {$list_price_txt}
Savings:    {$savings_txt} 
Your Cost:  {$your_cost_txt} 
Quantity:   {$quantity} 
Line Total: {$line_total_txt} 
TEXT;
    }
    $order_url = $url . 'account/?action=view_order&order_id=' . $order_id;
    $subtotal_txt = sprintf('$%.2f', $subtotal);
    $tax_amount_txt = sprintf('$%.2f', $order['taxAmount']);
    $ship_amount_txt = sprintf('$%.2f', $order['shipAmount']);
    $total = $subtotal + $order['taxAmount'] + $order['shipAmount'];
    $total_txt = sprintf('$%.2f', $total);
    $messageHTML .= <<<HTML
        <tr id="cart_footer">
            <td colspan="5" class="right">Subtotal:</td>
            <td class="right">
                {$subtotal_txt}
            </td>
        </tr>
        <tr>
            <td colspan="5" class="right">{$ship_state} Tax:</td>
            <td class="right">
                {$tax_amount_txt}
            </td>
        </tr>
        <tr>
            <td colspan="5" class="right">Shipping:</td>
            <td class="right">
                {$ship_amount_txt}
            </td>
        </tr>
            <tr>
            <td colspan="5" class="right">Total:</td>
            <td class="right">
                {$total_txt}
            </td>
        </tr>
    </table>
    <p>&nbsp;</p>
    <p>Thank you for shopping with us.<br /><b>My Guitar Shop</b></p>
    </div>
</div><!-- end main -->
<div id="footer">
    <p class="copyright">
        &copy; {$copyright_date} My Guitar Shop, Inc.
    </p>
</div><!-- end footer -->
</div><!-- end page -->
</body>
</html>
HTML;
    $message .= <<<TEXT
--------------------------------------------
Subtotal: {$subtotal_txt} 
GA Tax:   {$tax_amount_txt} 
Shipping: {$ship_amount_txt} 
Total:    {$total_txt}


Thank you for shopping with us.
My Guitar Shop
TEXT;
    $email = new PHPMailer();
    $email->IsSMTP();
    // $email->IsSendmail();
    $email->Host = "smtp.gmail.com";
    //Will need to be modified
    $email->SMTPAuth = true;
    $email->Port = 465;
    $email->SMTPDebug = 0;
    // enables SMTP debug information (for testing)
    //$email->SMTPSecure = 'tls';
    $email->SMTPSecure = 'ssl';
    $email->Username = "******";
    // SMTP account username Will need to be modified
    $email->Password = "******";
    // SMTP account password Will need to be modified
    $email->SetFrom('*****@*****.**', 'My Guitar Shop');
    $email->SingleTo = true;
    // true allows that only one person will receive an email per array group
    $email->Subject = 'Your Order with My Guitar Shop has Shipped!';
    // appears in subject of email
    $email->Body = $messageHTML;
    // the body will interpret HTML - $messageHTML identified above
    $email->AltBody = $message;
    // the AltBody will not interpret HTML - $message identified above
    $destination_email_address = "{$customer_email}";
    // destination email address
    $destination_user_name = "{$customer_name}";
    // Destination user name
    $email->AddAddress($destination_email_address, $destination_user_name);
    // AddAddress method identifies destination and sends email
    if (!$email->Send()) {
        return false;
    } else {
        return true;
    }
}
Exemplo n.º 2
0
        $bill_state = $billing_address['state'];
        $bill_zip = $billing_address['zipCode'];
        $bill_phone = $billing_address['phone'];
        include 'order.php';
        break;
    case 'set_ship_date':
        $order_id = intval($_POST['order_id']);
        set_ship_date($order_id);
        $url = '?action=view_order&order_id=' . $order_id;
        sendShippingConfirmEmail($order_id);
        redirect($url);
    case 'confirm_delete':
        // Get order data
        $order_id = intval($_POST['order_id']);
        $order = get_order($order_id);
        $order_date = date('M j, Y', strtotime($order['orderDate']));
        // Get customer data
        $customer = get_customer($order['customerID']);
        $name = $customer['lastName'] . ', ' . $customer['firstName'];
        $email = $customer['emailAddress'];
        include 'confirm_delete.php';
        break;
    case 'delete':
        $order_id = intval($_POST['order_id']);
        delete_order($order_id);
        redirect('.');
        break;
    default:
        display_error("Unknown order action: " . $action);
        break;
}
Exemplo n.º 3
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
if (isset($_POST['id']) && isset($_POST['type'])) {
    $id = isset($_POST['id']) ? htmlspecialchars($_POST['id']) : "";
    $type = isset($_POST['type']) ? htmlspecialchars($_POST['type']) : "";
    $arrHT = get_hotel($id, $type);
    $arrCus = get_customer($id);
    $allData = array('hotels' => json_encode($arrHT), 'customer' => json_encode($arrCus));
    $allData = json_encode($allData);
    echo $allData;
}
function get_hotel($id = '', $type = '')
{
    global $db;
    if ($type == 'ob') {
        $query = "SELECT id, NAME FROM hotels \r\n            WHERE id IN(SELECT\r\n            tours_hote9da4shotels_idb\r\n            FROM tours_hotels_c WHERE tours_hote943flstours_ida IN( SELECT tour_id FROM groupprograms WHERE id='" . $id . "'))";
    } else {
        if ($type == 'dos' || $type == 'ib') {
            $query = "SELECT NAME,id FROM hotels\r\n            WHERE id IN(SELECT\r\n            parent_id\r\n            FROM groupsprogramslines\r\n            WHERE parent = 'Hotels'\r\n            AND groupprogram_id = '" . $id . "'\r\n            AND deleted = 0) AND deleted =0 ";
        }
    }
    $result = $db->query($query);
    while ($row = $db->fetchByAssoc($result)) {
        $arrHT[] = array('id' => $row['id'], 'name' => $row['NAME']);
    }
    return $arrHT;
}
function get_customer($id = '')
Exemplo n.º 4
0
<?php

require_once './header.php';
require_once './db.php';
if ($_POST) {
    $error = NULL;
    try {
        if (isset($_POST['customer_id'])) {
            $charge = Stripe_Charge::create(array('customer' => $_POST['customer_id'], 'amount' => 53500, 'currency' => 'usd', 'description' => 'Single quote purchase after login'));
        } else {
            if (isset($_POST['stripeToken'])) {
                // Simple uniqueness check on the email address
                $existing_customer = get_customer($_POST['email']);
                if ($existing_customer) {
                    throw new Exception("That e-mail address already exists");
                }
                if (isset($_POST['subscription_purchase'])) {
                    $customer = Stripe_Customer::create(array('card' => $_POST['stripeToken'], 'email' => $_POST['email'], 'plan' => 'monthly'));
                } else {
                    $customer = Stripe_Customer::create(array('card' => $_POST['stripeToken'], 'email' => $_POST['email']));
                    $charge = Stripe_Charge::create(array('customer' => $customer->id, 'amount' => 53500, 'currency' => 'usd', 'description' => 'Single quote purchase'));
                }
                create_customer($_POST['email'], $_POST['password'], $customer->id);
            } else {
                throw new Exception("The Stripe Token or customer was not generated correctly");
            }
        }
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
    if ($error == NULL) {
Exemplo n.º 5
0
     if ($lastName == NULL || $lastName == FALSE) {
         $error = "Missing or incorrect customer ID.";
         include '../errors/error.php';
     } else {
         $customers = get_searchedcustomers($lastName);
         include 'customer_list.php';
     }
 } else {
     if ($action == 'customer_update') {
         $customerID = filter_input(INPUT_POST, 'customerID', FILTER_VALIDATE_INT);
         if ($customerID == NULL || $customerID == FALSE) {
             $error = "Missing or incorrect customer ID.";
             include '../errors/error.php';
         } else {
             $countrys = get_countrys();
             $customer = get_customer($customerID);
             include 'customer_update.php';
         }
     } else {
         if ($action == 'delete_customer') {
             $techID = filter_input(INPUT_POST, 'techID', FILTER_VALIDATE_INT);
             if ($techID == NULL || $techID == FALSE) {
                 $error = "Missing or incorrect customer ID.";
                 include '../errors/error.php';
             } else {
                 delete_technician($techID);
                 header("Location: .?action=list_customer");
             }
         } else {
             if ($action == 'show_add_form') {
                 include 'customer_add.php';
 public function delete($rest, $id)
 {
     $req = $rest->request();
     $info = $req->post();
     $cust = get_customer($id);
     if ($cust == null) {
         api_error(400, 'Invalid Customer ID');
     }
     delete_customer($id);
     $cust = null;
     $cust = get_customer($id);
     if ($cust != null) {
         api_error(500, 'Could Not Delete from Database');
     } else {
         api_success_response("Customer has been deleted");
     }
 }
            } else {
                $OUTPUT = details2($_POST);
            }
            break;
        default:
            if (isset($_GET['cusnum'])) {
                $OUTPUT = slctacc($_GET);
            } else {
                $OUTPUT = "<li> - Invalid use of module.</li>";
            }
    }
} else {
    if (isset($_GET['cusnum'])) {
        $OUTPUT = slctacc($_GET);
    } else {
        $OUTPUT = get_customer();
    }
}
# Get templete
require "../template.php";
function get_customer()
{
    db_connect();
    $get_cust = "SELECT * FROM customers WHERE div = '" . USER_DIV . "' ORDER BY surname";
    $run_cust = db_exec($get_cust) or errDie("Unable to get customer information.");
    if (pg_numrows($run_cust) < 1) {
        return "\n\t\t\t\t\t<li class='err'>No Customers Could Be Found.</li>" . mkQuickLinks(ql("../core/trans-new.php", "Journal Transactions"), ql("../customers-new.php", "New Customer"), ql("../customers-view.php", "View Customers"));
    } else {
        $customer_drop = "<select name='cusnum'>";
        while ($carr = pg_fetch_array($run_cust)) {
            $customer_drop .= "<option value='{$carr['cusnum']}'>{$carr['surname']}</option>";
Exemplo n.º 8
0
//echo $query;
$result = mysql_query($query);
$num = mysql_numrows($result);
$group_name = mysql_result($result, $i, "group_name");
//$task_start=mysql_result($result,$i,"task_start");
//$task_end=mysql_result($result,$i,"task_end");
mysql_close();
$i = 0;
echo "<font face=verdana size=2 color=gray><b>Manage Tab Headings</b></font><table border=1 cellpadding=0 cellspacing=0 bordercolor=#E5E5E5><tr><td><table border=0 cellpadding=3 cellspacing=2 width=600>";
echo "<font face=verdana size=1><form method=post action=admHeadingManager.php>Filter:<br><input class=inputv type='text' name='filt' value='" . $_GET['filt'] . "'> <input type=submit value='Filter'>";
while ($i < $num) {
    $group_name = mysql_result($result, $i, "group_name");
    $group_id = mysql_result($result, $i, "table_id");
    $customer_id = mysql_result($result, $i, "customer_id");
    echo "<tr><td bgcolor=#E5E5E5><font face=verdana size=1><a href=admHeadingManager.php?group={$group_name}&group_id={$group_id}&filt=" . $_GET['filt'] . ">{$group_name}</a></td>";
    echo "<td bgcolor=#E5E5E5><font face=verdana size=1>" . get_customer($customer_id) . "</td>";
    echo "<td width=10 bgcolor=#E5E5E5><font face=verdana size=1>[<a href=admHeadingManager.php?del={$group_id}&filt=" . $_GET['filt'] . ">DEL</a>]</td></tr>";
    $i++;
}
echo "<tr><form method=get action=admHeadingManager.php><td><font face=verdana size=1><table border=0><tr><td><font size=1>Name:<br><input class=inputv type='text' name='add' value='" . $_GET['group'] . "'></td><Br>";
echo "<td valign=top><font size=1>Customer:<br><select name=customer_id class=inputv>";
//echo "<input type=hidden name=filt value='".$_GET['filt']."'>";
mysql_connect("localhost", "root", "testme");
@mysql_select_db("emc_v2") or die("Unable to select database");
$iv = 0;
$query = "SELECT * FROM customer_table";
$resultv = mysql_query($query);
$numv = mysql_numrows($resultv);
while ($iv < $numv) {
    $customer_id = mysql_result($resultv, $iv, "table_id");
    $customer_name = mysql_result($resultv, $iv, "customer_name");
Exemplo n.º 9
0
     } else {
         $technicians = get_technicians_with_count();
         include 'technician_select.php';
     }
 } else {
     if ($action == 'incident_assign') {
         $incidentID = filter_input(INPUT_POST, 'incidentID');
         $techID = filter_input(INPUT_POST, 'techID');
         $techfullname = filter_input(INPUT_POST, 'techfullname');
         if ($incidentID == NULL || $incidentID == FALSE || $techID == NULL || $techID == FALSE || $techfullname == NULL || $techfullname == FALSE) {
             $error = "Missing or incorrect huh ID.";
             include '../errors/error.php';
         } else {
             $incident = get_incident($incidentID);
             $custid = $incident['customerID'];
             $cust = get_customer($custid);
             $custfullname = $cust['firstName'] . " " . $cust['lastName'];
             include 'incident_assign.php';
         }
     } else {
         if ($action == 'assign') {
             $incidentID = filter_input(INPUT_POST, 'incidentID');
             $techID = filter_input(INPUT_POST, 'techID');
             if ($incidentID == NULL || $incidentID == FALSE || $techID == NULL || $techID == FALSE) {
                 $error = "Missing or incorrect huh ID.";
                 include '../errors/error.php';
             } else {
                 //assign_incident($incidentID,$techID);
                 $message = "This incident was assigned to a technician";
                 include 'incident_assign.php';
             }
Exemplo n.º 10
0
    if ($email_error = has_edd_error('invalid_email')) {
        $email_error_class = 'error';
        edd_unset_error('invalid_email');
    }
}
$fn_error_class = '';
if ($fn_error = has_edd_error('invalid_first_name')) {
    $fn_error_class = 'error';
    edd_unset_error('invalid_first_name');
}
$ln_error_class = '';
if ($ln_error = has_edd_error('invalid_last_name')) {
    $ln_error_class = 'error';
    edd_unset_error('invalid_last_name');
}
$customer = get_customer();
?>
<fieldset id="edd_checkout_user_info">
	<span><legend><?php 
echo apply_filters('edd_checkout_personal_info_text', __('Personal Info', 'yoast-theme'));
?>
</legend></span>

	<p id="edd-first-name-wrap">
		<label class="edd-label <?php 
echo $fn_error_class;
?>
" for="edd_first">
			<?php 
_e('First Name', 'yoast-theme');
?>
Exemplo n.º 11
0
<?php

require_once '../../../util/main.php';
require_once '../../../model/database.php';
require_once '../../../model/customer_db.php';
if (isset($_GET['customerID'])) {
    $customer = get_customer($_GET['customerID']);
} else {
    exit;
}
?>

<div class="modal-header">
    <h3 class="modal-title">
        Customer Information
    </h3>
</div>

<div class="modal-body">
    <div class="row">
        <div class="col-sm-12 col-md-12">
            <form class="form-horizontal">
                <fieldset>
                    <div class="form-group">
                        <label class="control-label col-sm-4"><strong>Username</strong></label>
                        <div class="col-sm-8">
                            <p class="form-control-static">
                                <strong><?php 
echo $customer['userName'];
?>
</strong>
Exemplo n.º 12
0
<?php

require_once './header.php';
require_once './db.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $error = false;
    try {
        if (isset($_POST['customer_id'])) {
            $charge = \Stripe\Charge::create(array('customer' => $_POST['customer_id'], 'amount' => 53500, 'currency' => 'usd', 'description' => 'Single quote purchase after login'));
        } else {
            if (isset($_POST['stripeToken'])) {
                // Simple uniqueness check on the email address
                $existing_customer = get_customer($_POST['stripeEmail']);
                if ($existing_customer) {
                    throw new Exception("That e-mail address already exists");
                }
                if (isset($_POST['ticket_type'])) {
                    $customer = \Stripe\Customer::create(array('source' => $_POST['stripeToken'], 'email' => $_POST['stripeEmail']));
                    if ($_POST['ticket_type'] == 'player_ticket') {
                        $charge = \Stripe\Charge::create(array('customer' => $customer->id, 'amount' => 7000, 'currency' => 'gbp', 'description' => 'Player Ticket'));
                    } else {
                        $charge = \Stripe\Charge::create(array('customer' => $customer->id, 'amount' => 1700, 'currency' => 'gbp', 'description' => 'Crew Ticket'));
                    }
                } else {
                    throw new Exception("No ticket type supplied");
                }
                create_customer($_POST['stripeEmail'], $_POST['password'], $customer->id);
            } else {
                throw new Exception("The Stripe Token or customer was not generated correctly");
            }
        }
Exemplo n.º 13
0
    header("Location:step4.php");
}
if (isset($_POST['formType']) && $_POST['formType'] == 'login') {
    if (empty($_POST['username']) || empty($_POST['password'])) {
        $login_error = 'You must enter your username or password';
    } else {
        try {
            $sql = 'SELECT userID, userName, status, cFlag, password FROM users WHERE userName = :uname LIMIT 1';
            $prestmt = $db->prepare($sql);
            $prestmt->bindValue(':uname', $_POST['username']);
            $prestmt->execute();
            $user = $prestmt->fetch();
            $userlogin = $_POST['username'];
            $userpwd = $_POST['password'];
            if (password_verify($userpwd, $user['password']) && $user['status'] == 'E' && $user['cFlag'] == '1') {
                $customer = get_customer($user['userID']);
                $_SESSION['customer'] = $customer;
                header("Location: step4.php");
            } else {
                $login_error = 'Your username or password was incorrect';
            }
        } catch (PDOException $e) {
            display_db_error($e->getMessage());
        }
    }
}
$user = array();
if (isset($_POST['formType']) && $_POST['formType'] == 'signup') {
    $user['username'] = $_POST['username'];
    $user['email'] = $_POST['email'];
    $user['password'] = $_POST['password'];
Exemplo n.º 14
0
function get_order_customer($order_summary)
{
    $cust_summary = get_customer($order_summary['id_customer']);
    $cust_addr = get_customer_invoice_address($order_summary['id_address_invoice']);
    $name = !empty($cust_addr['company']) ? $cust_addr['company'] : $cust_addr['lastname'] . " " . $cust_addr['firstname'];
    $customer = new KontrahentFlyweightBuilder($name, $cust_addr['postcode'], $cust_addr['city']);
    if (!empty($cust_addr['vat_number'])) {
        $customer->NIP($cust_addr['vat_number']);
    }
    if (!empty($cust_addr['address1'])) {
        $address = $cust_addr['address1'];
        if (!empty($cust_addr['address2'])) {
            $address .= ' ' . $cust_addr['address2'];
        }
        $customer->Ulica($address);
    }
    if (!empty($cust_addr['phone'])) {
        $customer->Telefon($cust_addr['phone']);
    }
    if (!($cust_summary['company'] != $cust_addr['company'] || $cust_summary['lastname'] != $cust_addr['lastname'])) {
        if (!empty($cust_summary['id_customer'])) {
            $customer->Identyfikator('IFI' . $cust_summary['id_customer']);
        }
    }
    return $customer;
}
Exemplo n.º 15
0
function customer_settings($selected_id)
{
    global $SysPrefs, $path_to_root, $auto_create_branch;
    if (!$selected_id) {
        if (list_updated('customer_id') || !isset($_POST['CustName'])) {
            $_POST['CustName'] = $_POST['cust_ref'] = $_POST['address'] = $_POST['tax_id'] = '';
            $_POST['dimension_id'] = 0;
            $_POST['dimension2_id'] = 0;
            $_POST['sales_type'] = -1;
            $_POST['curr_code'] = get_company_currency();
            $_POST['credit_status'] = -1;
            $_POST['payment_terms'] = $_POST['notes'] = '';
            $_POST['discount'] = $_POST['pymt_discount'] = percent_format(0);
            $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit());
        }
    } else {
        $myrow = get_customer($selected_id);
        $_POST['CustName'] = $myrow["name"];
        $_POST['cust_ref'] = $myrow["debtor_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['tax_id'] = $myrow["tax_id"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['sales_type'] = $myrow["sales_type"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['credit_status'] = $myrow["credit_status"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['discount'] = percent_format($myrow["discount"] * 100);
        $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100);
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    }
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Name and Address"));
    text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 80);
    text_row(_("Customer Short Name:"), 'cust_ref', null, 30, 30);
    textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5);
    text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
    if (!$selected_id || is_new_customer($selected_id)) {
        currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
    } else {
        label_row(_("Customer's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    }
    sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
    if ($selected_id) {
        record_status_list_row(_("Customer status:"), 'inactive');
    } elseif (isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        text_row(_("Phone:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        sales_persons_list_row(_("Sales Person:"), 'salesman', null);
    }
    table_section(2);
    table_section_title(_("Sales"));
    percent_row(_("Discount Percent:"), 'discount', $_POST['discount']);
    percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
    amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
    credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
    }
    if ($dim > 1) {
        dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    if ($selected_id) {
        start_row();
        echo '<td class="label">' . _('Customer branches') . ':</td>';
        hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", '<b>' . (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")) . '</b>', "debtor_no=" . $selected_id . (@$_REQUEST['popup'] ? '&popup=1' : ''));
        end_row();
    }
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        locations_list_row(_("Default Inventory Location:"), 'location');
        shippers_list_row(_("Default Shipping Company:"), 'ship_via');
        sales_areas_list_row(_("Sales Area:"), 'area', null);
        tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    }
    end_outer_table(1);
    div_start('controls');
    if (!$selected_id) {
        submit_center('submit', _("Add New Customer"), true, '', 'default');
    } else {
        submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', $selected_id, _("Select this customer and return to document entry."));
        submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true);
    }
    div_end();
}
Exemplo n.º 16
0
                <td><?php 
    echo $config->thaidate($rs['order_date_start']) . ' - ' . $config->thaidate($rs['order_date_end']);
    ?>
</td>
                <td>
                    <?php 
    echo "- " . $rs['driver1'];
    if (!empty($rs['driver2'])) {
        echo "<br/>- " . $rs['driver2'];
    }
    ?>
                </td>
                <td>
                    <?php 
    foreach ($assigns as $as) {
        echo "- " . get_customer($as['cus_start']) . ' - ' . get_customer($as['cus_end']) . "<br/>";
    }
    ?>
                </td>
                <td>
                    <?php 
    foreach ($assigns as $ass) {
        ?>

                        <?php 
        echo "- " . $changwat->find()->where(['changwat_id' => $ass['changwat_start']])->one()['changwat_name'];
        echo "-";
        echo $changwat->find()->where(['changwat_id' => $ass['changwat_end']])->one()['changwat_name'];
        echo "<br/>";
        ?>
    <?php 
Exemplo n.º 17
0
            display_error('Use two-letter code for state.');
        }
        if (empty($zip)) {
            display_error('ZIP code is required.');
        }
        if (empty($phone)) {
            display_error('Phone number is required.');
        }
        // If the old address has orders, disable it
        // Otherwise, delete it
        disable_or_delete_address($address_id);
        // Add the new address
        $address_id = add_address($customer_id, $line1, $line2, $city, $state, $zip, $phone);
        // Relate the address to the customer account
        if ($billing) {
            customer_change_billing_id($customer_id, $address_id);
        } else {
            customer_change_shipping_id($customer_id, $address_id);
        }
        // Set the user data in the session
        $_SESSION['user'] = get_customer($customer_id);
        redirect('.');
        break;
    case 'logout':
        unset($_SESSION['user']);
        redirect('..');
        break;
    default:
        display_error("Unknown account action: " . $action);
        break;
}
Exemplo n.º 18
0
        $bill_city = $billing_address['thanhpho'];
        $bill_state = $billing_address['quanhuyen'];
        $bill_zip = $billing_address['mavung'];
        $bill_phone = $billing_address['sodienthoai'];
        include 'order.php';
        break;
    case 'set_ship_date':
        $order_id = intval($_POST['order_id']);
        set_ship_date($order_id);
        $url = '?action=view_order&order_id=' . $order_id;
        redirect($url);
    case 'confirm_delete':
        // Get order data
        $order_id = intval($_POST['order_id']);
        $order = get_order($order_id);
        $order_date = date('M j, Y', strtotime($order['ngaydathang']));
        // Get customer data
        $customer = get_customer($order['idkhachhang']);
        $name = $customer['lastName'] . ', ' . $customer['firstName'];
        $email = $customer['email'];
        include 'confirm_delete.php';
        break;
    case 'delete':
        $order_id = intval($_POST['order_id']);
        delete_order($order_id);
        redirect('.');
        break;
    default:
        display_error("Unknown order action: " . $action);
        break;
}