<?php

use_class('orders');
$class_o = new orders();
use_class('customers_special_list');
$class_csl = new customers_special_list();
$search_days = 60;
//AJAX ACTION
if (isset($_POST['me_action']) && $_POST['me_action'] != '') {
    if ($_POST['me_action'] == 'SEARCHORDERS') {
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $date_filter = date('Y-m-d', strtotime("-{$search_days} day"));
        $orders = $class_o->searchBanktransferOrders($search_field, $search_keywords, "o.date_purchased>DATE('{$date_filter}')");
        $result = '';
        $table = array();
        if (count($orders) > 0) {
            $t = array();
            $t['d'] = 'Date';
            $t['c'] = 'Customer';
            $t['o'] = 'Order No';
            $t['i'] = 'Bank Info';
            $t['p'] = 'Order Value';
            $t['t'] = 'Withdrawal Date';
            $table[] = $t;
            foreach ($orders as $row) {
                $order_date = strtotime($row['date_purchased']);
                $customer_special = $class_csl->getCustomerDetail($row['customers_id']);
                $crown_img = is_null($customer_special) ? '' : $class_csl->getTypeSymbol($customer_special['list_type'], $row['customers_id']);
                $t = array();
                $t['d'] = date('d-M-y', $order_date);
예제 #2
0
/**
 * Get vip status of customer from an order
 * @param String $type
 * @param Int $orders_id
 * @return Boolean
 */
function checkCustomerIsVIP($type, $orders_id)
{
    $type = strtoupper($type);
    $is_vip = false;
    if ($type == 'SP') {
        use_class('jng_sp_orders');
        use_class('jng_sp_customers');
        use_class('jng_sp_customers_special');
        $class_jo = new jng_sp_orders();
        $class_jc = new jng_sp_customers();
        $class_jcs = new jng_sp_customers_special();
        $o = $class_jo->retrieveDetail($orders_id);
        //GET CUSTOMER DETAIL VIP OR NOT
        $cust_data = $class_jc->retrieveDetail(null, $o['jng_sp_id'], $o['customer_billing_id']);
        if (is_array($cust_data) && $cust_data['jng_sp_customers_id'] > 0) {
            $cust_detail = $class_jcs->getCustomerDetail($cust_data['jng_sp_customers_id']);
        }
        $is_vip = $cust_detail['list_type'] == 'V';
    } elseif ($type == 'JG') {
        use_class('orders');
        use_class('customers_special_list');
        $class_o = new orders();
        $class_csl = new customers_special_list();
        $o = $class_o->retrieveDetail($orders_id);
        //GET CUSTOMER DETAIL VIP OR NOT
        $cust_detail = $class_csl->getCustomerDetail($o['customers_id']);
        $is_vip = $cust_detail['list_type'] == 'V';
    } elseif ($type == 'DP') {
        use_class('depot_orders');
        $class_do = new depot_orders();
        $do = $class_do->retrieveDetail($orders_id);
        if ($do['trans_type'] == 'SP' || $do['trans_type'] == 'JG') {
            if ($do['trans_type'] == 'SP') {
                use_class('jng_sp_orders');
                $class_jo = new jng_sp_orders();
                $it = $class_jo->retrieveItemDetail($do['trans_id']);
                $orders_id = $it['jng_sp_orders_id'];
            } elseif ($do['trans_type'] == 'JG') {
                use_class('orders');
                $class_o = new orders();
                $it = $class_o->retrieveProductDetail($do['trans_id']);
                $orders_id = $it['orders_id'];
            }
            $is_vip = checkCustomerIsVIP($do['trans_type'], $orders_id);
        }
    }
    return $is_vip;
}
<?php

use_class('customers_special_list');
$class_csl = new customers_special_list();
$type = isset($_GET['type']) ? tep_db_prepare_input($_GET['type']) : '';
if ($type == '') {
    exit;
}
$typename = $class_csl->getTypeName($type);
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'SEARCHCUSTOMER') {
        $keywords = tep_db_prepare_input(utf8_decode($_POST['keywords']));
        $keywords = strtolower(trim($keywords));
        $result = '';
        if ($keywords == '') {
            $result .= '<h3 class="red">Please enter keywords</h3>';
        } else {
            $customers = $class_csl->getCustomersToAdd($keywords);
            if (count($customers) == 0) {
                $result .= '<h3 class="red">No Customers found for this keywords</h3>';
            } else {
                $table = array();
                $t = array();
                $t['d'] = 'ID';
                $t['c'] = 'Name';
                $t['a'] = 'Action';
                $table[] = $t;
                $keywords_array = explode(' ', $keywords);
                foreach ($customers as $c) {
                    $cname = strtolower($c['customers_name']);
예제 #4
0
<?php

use_class('customers_special_list');
$class_csl = new customers_special_list();
//GET PAGE
$page = 1;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
}
//GET FILTER OPTION
$paging = true;
$filter_query = '';
if (isset($_POST['filterbytype']) && $_POST['filterbytype'] == '') {
    $_SESSION['orders_filterbytype'] = '';
    $_SESSION['orders_filterbyvalue'] = '';
} else {
    if (isset($_POST['filterbytype']) && isset($_POST['filterbyvalue'])) {
        $_SESSION['orders_filterbytype'] = tep_db_prepare_input($_POST['filterbytype']);
        $_SESSION['orders_filterbyvalue'] = tep_db_prepare_input($_POST['filterbyvalue']);
    } else {
        if (!isset($_SESSION['orders_filterbytype'])) {
            $_SESSION['orders_filterbytype'] = '';
        }
        if (!isset($_SESSION['orders_filterbyvalue'])) {
            $_SESSION['orders_filterbyvalue'] = '';
        }
    }
}
$filtertype = $_SESSION['orders_filterbytype'];
$filtervalue = $_SESSION['orders_filterbyvalue'];
if ($filtertype != '' && $filtervalue != '') {
예제 #5
0
<?php

use_class('payone_invoice');
use_class('Order');
use_class('orders');
use_class('depot_orders');
use_class('minierp_customers');
use_class('customers_special_list');
$class_o = new orders();
$class_do = new depot_orders();
$class_mc = new minierp_customers();
$class_csl = new customers_special_list();
$default_order_status_comment = 'Comment for new status';
$order_language = 2;
function drawOrderTotalBox($order_id, $order_total = null)
{
    global $class_o;
    $order = $class_o->retrieveDetail($order_id);
    if (is_null($order_total)) {
        $order_total = $class_o->retrieveTotals($order_id);
    }
    //ORDER TOTAL
    $ot_box = '<div class="draw-table">';
    $ot_box .= '<table class="order-total" cellpadding="0" cellspacing="0">';
    $ot_box .= '<tr>';
    $ot_box .= '<th colspan="2">ORDER TOTAL</th>';
    $ot_box .= '</tr>';
    $ot_box .= '<tr>';
    $ot_box .= '<td class="text">' . $order_total['ot_subtotal']['title'] . '</td>';
    $ot_box .= '<td class="price">' . $order_total['ot_subtotal']['text'] . '</td>';
    $ot_box .= '</tr>';
             if (isset($request['userid']) && $request['userid'] != '') {
                 $q = tep_db_query("SELECT jng_sp_customers_id FROM jng_sp_customers WHERE payone_userid=" . $request['userid']);
                 if (tep_db_num_rows($q) > 0) {
                     $cust = tep_db_fetch_array($q);
                     $jng_sp_customers_id = $cust['jng_sp_customers_id'];
                     if (is_null($class_jcs->getCustomerDetail($jng_sp_customers_id))) {
                         $class_jcs->addCustomer('B', $jng_sp_customers_id);
                     } else {
                         $class_jcs->updateCustomer($jng_sp_customers_id, 'list_type', 'B');
                     }
                 }
             }
             break;
         case 'J':
             use_class('customers_special_list');
             $class_cs = new customers_special_list();
             if (isset($request['userid']) && $request['userid'] != '') {
                 $q = tep_db_query("SELECT customers_id FROM customers WHERE payone_userid=" . $request['userid']);
                 if (tep_db_num_rows($q) > 0) {
                     $cust = tep_db_fetch_array($q);
                     $customers_id = $cust['customers_id'];
                     if (is_null($class_cs->getCustomerDetail($customers_id))) {
                         $class_cs->addCustomer('B', $customers_id);
                     } else {
                         $class_cs->updateCustomer($customers_id, 'list_type', 'B');
                     }
                 }
             }
             break;
     }
 }
 function drawOrderDisplay($order_type, $order_id, $displaypart = 'ALL', $excludecurrentorderinhistory = true)
 {
     //$displaypart = 'ALL' / 'NEW' / 'HISTORY'
     global $class_do, $class_pm, $class_pa, $class_mc, $class_jo, $class_jc, $class_o, $sp_list;
     //ORDERED PRODUCTS DISPLAY SETTING
     $col_limit = 5;
     //max no of columns
     $row_limit = 5;
     //max no of rows
     $border = '1';
     //border width
     $imgsize = '80';
     //image size
     $padding = '5';
     //box padding
     $margin = '10';
     //box margin
     $po_limit = $col_limit * $row_limit;
     //max no of products - auto calc
     $powidth = ceil($col_limit * ($imgsize + 2 * ($border + $padding) + $margin) / 10) * 10;
     $total_price = 0;
     if ($order_type == 'SP') {
         use_class('jng_sp_customers_special');
         $csl = new jng_sp_customers_special();
         $order = $class_jo->retrieveDetail($order_id);
         $order_source = $sp_list[$order['jng_sp_id']]['name'];
         $order_products = $class_jo->retrieveItems($order_id);
         $customer = $class_jc->retrieveDetail(null, $order['jng_sp_id'], $order['customer_billing_id']);
         $list_type = $csl->getListType($customer['jng_sp_customers_id']);
         $cust_crown = $csl->getTypeSymbol($list_type, $customer['jng_sp_customers_id']);
         $customer_name = $cust_crown . $order['customer_billing_firstname'] . ' ' . $order['customer_billing_lastname'];
         $customer_address = $order['customer_billing_address'];
         if ($order['customer_billing_address2'] != '') {
             $customer_address .= ', ' . $order['customer_billing_address2'];
         }
         $customer_address .= ', ' . $order['customer_billing_postcode'];
         $customer_address .= ' ' . $order['customer_billing_city'];
         $customer_address .= ', ' . $order['customer_billing_country'];
         $products_ordered = $class_jc->retrieveOrdersItems($customer['jng_sp_customers_id']);
         $colname_order_id = 'jng_sp_orders_id';
         $colname_items_id = 'jng_sp_orders_items_id';
         $colname_order_date = 'order_date';
         $colname_order_qty = 'order_quantity';
         $colname_return_qty = 'return_quantity';
         $colname_products_id = 'products_id';
         $colname_products_code = 'article_number';
         $colname_articles_id = 'products_articles_id';
         $colname_custom_text1 = null;
         $colname_custom_text2 = null;
         $colname_custom_image = null;
         $order_history_display = null;
         $total_price = getTotalOrderAmount('S', $order_id);
     } elseif ($order_type == 'JG') {
         use_class('customers_special_list');
         $csl = new customers_special_list();
         $order = $class_o->retrieveDetail($order_id);
         $order_source = 'JULIE&amp;GRACE';
         $total_price = getTotalOrderAmount('J', $order_id, $order['currency']);
         $order_products = $class_o->retrieveProducts($order_id);
         //$customer = $class_mc->retrieveDetail($order['customers_id']);
         $list_type = $csl->getListType($order['customers_id']);
         $cust_crown = $csl->getTypeSymbol($list_type, $order['customers_id']);
         $customer_name = $cust_crown . $order['customers_name'];
         $customer_address = '';
         if ($order['customers_company'] != '') {
             $customer_address .= $order['customers_company'] . ', ';
         }
         $customer_address .= $order['customers_street_address'];
         $customer_address .= ', ' . $order['customers_postcode'];
         $customer_address .= ' ' . $order['customers_city'];
         $customer_address .= ', ' . $order['customers_country'];
         $products_ordered = $class_mc->retrieveOrdersProducts($order['customers_id'], 'op.status>0');
         $colname_order_id = 'orders_id';
         $colname_items_id = 'orders_products_id';
         $colname_order_date = 'date_purchased';
         $colname_order_qty = 'products_quantity';
         $colname_return_qty = 'return_quantity';
         $colname_products_id = 'products_id';
         $colname_products_code = 'products_model';
         $colname_articles_id = 'products_articles_id';
         $colname_custom_text1 = 'customers_text_line1';
         $colname_custom_text2 = 'customers_text_line2';
         $colname_custom_image = 'customers_image';
         $order_history_display = null;
     } elseif ($order_type == 'DP') {
         $order = $class_do->retrieveDetail($order_id);
         $product_detail = $class_pm->retrieveDetail($order['products_id'], 'p');
         $order['products_image'] = $product_detail['p']['products_image'];
         $order['products_model'] = $product_detail['p']['products_model'];
         $order['order_item_count'] = '1';
         $order['order_item_total'] = '1';
         $order_products = array();
         $order_products[] = $order;
         $colname_order_id = 'depot_orders_id';
         $colname_items_id = 'depot_orders_id';
         $colname_order_date = 'order_date';
         $colname_order_qty = 'quantity';
         $colname_return_qty = '';
         $colname_products_id = 'products_id';
         $colname_products_code = 'products_model';
         $colname_articles_id = 'articles_id';
         $colname_custom_text1 = null;
         $colname_custom_text2 = null;
         $colname_custom_image = null;
         if ($order['trans_type'] == 'SP' || $order['trans_type'] == 'JG') {
             if ($order['trans_type'] == 'SP') {
                 $item = $class_jo->retrieveItemDetail($order['trans_id']);
                 //if ($item['jng_sp_id'] != '2') {
                 //echo "<pre>";
                 //var_dump($item);
                 //die("ttt");
                 if ($item['stock_status'] == '0') {
                     $order_history_display = drawOrderDisplay($order['trans_type'], $item['jng_sp_orders_id'], 'HISTORY', false);
                 }
                 $total_price = getTotalOrderAmount('S', $item['jng_sp_orders_id']);
                 //}
             } else {
                 //die("test");
                 $item = $class_o->retrieveProductDetail($order['trans_id']);
                 $total_price = getTotalOrderAmount('J', $item['orders_id']);
                 if ($item['stock_status'] == '0') {
                     $order_history_display = drawOrderDisplay($order['trans_type'], $item['orders_id'], 'HISTORY', false);
                 }
             }
         }
     }
     $result = '';
     if ($displaypart == 'ALL' || $displaypart == 'NEW') {
         //NEW ORDER
         $result .= '<h2 style="position:fixed;top:0;left:0;line-height:20px;width:480px;padding:5px 10px;background:#ccc;border-right:1px inset #666;">New ' . $order_type . ' Order ' . $order_id . ' (' . $total_price . ')</h2>';
         //$result .= '<div style="position:fixed;top:30;bottom:0;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">';
         $result .= '<div id="box-order-items" style="position:fixed;top:30;bottom:0;height:93%;left:0;width:480px;padding:10px;background:#efefef;border-right:1px inset #666;overflow:auto;">';
         $neworder = array();
         $no = array();
         $no['l'] = 'No';
         $no['d'] = 'Image';
         $no['t2'] = 'Info';
         $no['q'] = 'Order<br/>Qty.';
         $no['r'] = 'Stock Status<br /> and Actions';
         $neworder[] = $no;
         foreach ($order_products as $op) {
             if ($op[$colname_articles_id] > 0) {
                 $article = $class_pa->retrieveDetail($op[$colname_articles_id]);
                 $prolength = $article['length'];
             } else {
                 $product_detail = $class_pm->retrieveDetail($op[$colname_products_id], 'pnc');
                 $prolength = $product_detail['pnc']['products_length'];
             }
             $customize_info = '';
             if (!is_null($colname_custom_text1) && !is_null($colname_custom_text2)) {
                 if ($op[$colname_custom_text1] != '' || $op[$colname_custom_text2] != '') {
                     $customize_info .= '<div style="margin-top:10px;">';
                     if ($op[$colname_custom_text1] != '') {
                         $customize_info .= $op[$colname_custom_text1];
                     }
                     if ($op[$colname_custom_text2] != '') {
                         $customize_info .= '<br />' . $op[$colname_custom_text2];
                     }
                     $customize_info .= '</div>';
                 }
             }
             if (!is_null($colname_custom_image) && $op[$colname_custom_image] != '') {
                 $customize_info .= webImage($op[$colname_custom_image], '80', '80', 'Custom Image');
             }
             $length_text = $prolength > 0 ? 'Length: ' . textLength($prolength) : '<span class="notice">No Length</span>';
             //$tooltip_data = getTooltipThumbData($op[$colname_products_id], $op[$colname_articles_id], 0);
             $pdata = $class_pm->retrieveDetail($op[$colname_products_id], 'pl,sp');
             $tooltip_text = '<table class="tiny" border="0" cellpadding="0" cellspacing="0" align="center">';
             $tooltip_text .= '<tr><td width="80" title="Sold Last 30 Days">Sold L30D</td><td>' . intval($pdata['pl']['sold_monthly_1']) . ' products</td></tr>';
             $tooltip_text .= '<tr><td>Total sold</td><td>' . intval($pdata['sp']['0']['total_sold']) . ' products</td></tr>';
             $tooltip_text .= '<tr><td>Return Rate</td><td>' . number_format($pdata['sp']['0']['returned_rate'], 1) . '%</td></tr>';
             $tooltip_text .= '<tr><td>Product Age</td><td>' . $pdata['sp']['0']['active_age'] . ' days</td></tr>';
             $tooltip_text .= '</table>';
             $info = array();
             //var_dump($order_type);
             $info[] = $order_type . '-' . $op[$colname_items_id];
             $info[] = $op['products_ean'];
             $info[] = $op[$colname_products_id] . ' / ' . $op[$colname_products_code];
             $info[] = $length_text;
             $info[] = '&nbsp;';
             $info[] = '<strong>All SP Summary</strong>';
             $info[] = $tooltip_text;
             $action_hidden = '<input type="hidden" id="' . $order_type . '-' . $op[$colname_items_id] . '" name="oiid" value="' . $op[$colname_items_id] . '" />';
             $action_hidden .= '<input type="hidden" name="type" value="' . $order_type . '" />';
             $action = array();
             $action[] = stockStatusDisplay($op['stock_status'], $op['status'], $op[$colname_products_id], $op[$colname_articles_id], $op[$colname_order_qty], null);
             $action[] = '&nbsp;';
             if ($op['stock_status'] == 'S') {
                 $action[] = '<input type="button" name="2" value="&raquo; Sourcing" class="bl green" />';
             } elseif ($op['stock_status'] == 'R' || $op['stock_status'] == 'P' || $op['stock_status'] == 'W') {
                 $action[] = '<input type="button" name="3" value="&raquo; Ready" class="bl green" />';
                 //$action[] = '<input type="button" name="test" value="&raquo; Sourcing" class="bl red" />';
             }
             $action[] = '<input type="button" name="10" value="&times; Cancel" class="bl red" />';
             $no = array();
             $no['l'] = $op['order_item_count'] . '/' . $op['order_item_total'];
             $no['d'] = webImage($op['products_image'], '80', '80', 'Product Image') . $customize_info;
             $no['t2'] = implode('<br />', $info);
             if (isset($op['order_quantity'])) {
                 $order_quantity = $op['order_quantity'];
             } elseif (isset($op['products_quantity'])) {
                 $order_quantity = $op['products_quantity'];
             } else {
                 $order_quantity = $op['quantity'];
             }
             $no['q'] = $order_quantity;
             $no['r'] = $action_hidden . implode('<br />', $action);
             $neworder[] = $no;
         }
         $result .= tep_draw_table('spo', $neworder);
         $result .= '<div class="buttons"><input type="button" name="nextorder" value="Next Order" class="button" /></div>';
         $result .= '</div>';
         //NEW ORDER - CLOSER
     }
     if (!is_null($order_history_display)) {
         $result .= $order_history_display;
     } elseif ($displaypart == 'ALL' || $displaypart == 'HISTORY') {
         $result .= '<div style="margin-left:510px;color:#666;" >';
         //HISTORICAL INFO
         if ($order_type == 'DP') {
             $result .= '<h2>DEPOT ' . ($order['trans_type'] == 'AR' ? 'REFILL' : 'MANUAL ORDER') . '</h2>';
         } else {
             //var_dump($order_type);
             $result .= '<h2>Customer Detail</h2>';
             //                    $result .= '<table border="0" cellpadding="0" cellspacing="0">';
             //                    $result .= '<tr><td width="150">Customer From</td><td>'.$order_source.'</td></tr>';
             //                    $result .= '<tr><td>Customer Name</td><td>'.$customer_name.'</td></tr>';
             //                    $result .= '<tr><td>Customer Address</td><td>'.$customer_address.'</td></tr>';
             //                    $result .= '<tr><td></td><td></td></tr>';
             //                    $result .= '</table>';
             $result .= '<div class="bold">' . $order_source . '</div>';
             $result .= '<div>' . $customer_name . '</div>';
             $result .= '<div>' . $customer_address . '</div>';
             $result .= '<div>&nbsp;</div>';
             $orders_collection = array();
             $products_ordered_total = 0;
             $products_returned_total = 0;
             $products_canceled_total = 0;
             $products_inprocess_total = 0;
             foreach ($products_ordered as $pok => $pov) {
                 if ($excludecurrentorderinhistory && $pov[$colname_order_id] == $order[$colname_order_id]) {
                     unset($products_ordered[$pok]);
                 } else {
                     if (!in_array($pov[$colname_order_id], $orders_collection)) {
                         $orders_collection[] = $pov[$colname_order_id];
                     }
                     $products_ordered_total += $pov[$colname_order_qty];
                     $products_returned_total += $pov[$colname_return_qty];
                     if (statusIsCancelled($pov['status'])) {
                         $products_canceled_total += $pov[$colname_order_qty];
                     }
                     if ($pov['status'] < 9) {
                         $products_inprocess_total += $pov[$colname_order_qty];
                     }
                 }
             }
             $result .= '<h2>Customer Historical Info</h2>';
             if ($products_ordered_total > 0) {
                 $products_success_total = $products_ordered_total - ($products_inprocess_total + $products_canceled_total);
                 $return_rate = $products_returned_total == 0 ? 0 : $products_returned_total / $products_success_total * 100;
                 $process_class = $products_inprocess_total > 0 ? 'red' : 'green';
                 $success_class = $products_success_total > 0 ? 'green' : 'red';
                 $return_class = $products_returned_total > 0 ? 'red' : 'green';
                 $return_rate_class = $return_rate <= 10 ? 'green' : 'red';
                 $prevtext = $excludecurrentorderinhistory ? 'Previous' : '';
                 $result .= '<h3>&raquo; Customer ' . $prevtext . ' Orders Total = ' . count($orders_collection) . '</h3>';
                 $result .= '<h3>&raquo; Ordered Products Total = ' . $products_ordered_total . '</h3>';
                 $result .= '<h3>&raquo; Ordered Products Canceled = ' . $products_canceled_total . '</h3>';
                 $result .= '<h3 class="' . $process_class . '">&raquo; Ordered Products in Progress = ' . $products_inprocess_total . '</h3>';
                 $result .= '<h3 class="' . $success_class . '">&raquo; Ordered Products Received = ' . $products_success_total . '</h3>';
                 $result .= '<h3 class="' . $return_class . '">&raquo; Ordered Products Returns = ' . $products_returned_total . '</h3>';
                 $result .= '<h3 class="' . $return_rate_class . '">&raquo; Customer Return Rate = ' . number_format($return_rate, 1) . '%</h3>';
                 $result .= '<h3>&raquo; Recent Ordered Products List (Showing Max ' . $po_limit . ' Products): ' . '</h3>';
                 $result .= '<div style="width:' . $powidth . 'px;">';
                 $pocount = 0;
                 foreach ($products_ordered as $po) {
                     $pocount++;
                     if ($pocount <= $po_limit) {
                         if ($po[$colname_articles_id] > 0) {
                             $article = $class_pa->retrieveDetail($po[$colname_articles_id]);
                             $prolength = $article['length'];
                         } else {
                             $product_detail = $class_pm->retrieveDetail($po[$colname_products_id], 'pnc');
                             $prolength = $product_detail['pnc']['products_length'];
                         }
                         $length_text = $prolength > 0 ? textLength($prolength) : '<span class="notice">No Length</span>';
                         $status = $po['status'] == '8' ? modeName($po['mode']) : statusNameShort($po['status'], true);
                         $status_class = $po['status'] < 9 ? 'red' : 'notice';
                         $qty_class = statusIsCancelled($po['status']) > 0 ? 'notice' : 'green';
                         $result .= '<div style="float:left;border:' . $border . 'px solid #ccc;text-align:center;margin:0 ' . $margin . 'px ' . $margin . 'px 0;padding:' . $padding . 'px;">';
                         $result .= webImage($po['products_image'], $imgsize, $imgsize);
                         $result .= '<br />';
                         $result .= $length_text;
                         $result .= '<br />';
                         $result .= '<span title="Order Date">' . date('d.m.Y', strtotime($po[$colname_order_date])) . '</span>';
                         $result .= '<br />';
                         $result .= '<span class="' . $status_class . '" title="Current Status">' . $status . '</span>';
                         $result .= '<br />';
                         $result .= '<strong class="' . $qty_class . '" title="Order Quantity">+' . intval($po[$colname_order_qty]) . '</strong>';
                         $result .= ' &nbsp; ';
                         $returns = intval($po[$colname_return_qty]);
                         $retclas = $returns > 0 ? 'red' : 'notice';
                         $result .= '<strong class="' . $retclas . '" title="Return Quantity">-' . $returns . '</strong>';
                         $result .= '</div>';
                     }
                 }
                 $result .= '</div>';
                 $result .= '<div style="clear:both;">&nbsp;</div>';
             } else {
                 $result .= '<h3>&raquo; No Order Historical info, a New Customer</h3>';
             }
         }
         $result .= '</div>';
         //HISTORICAL INFO - CLOSER
     }
     return $result;
 }
예제 #8
0
     $old_status = tep_db_prepare_input($_POST['op_status']);
     $new_status = '12';
     $useAltContent = true;
     $product = $class_o->retrieveProductDetail($opid);
     if ($product['status'] == $old_status) {
         $products = $class_o->retrieveProducts($product['orders_id']);
         $opids = array();
         foreach ($products as $p) {
             $class_o->updateProductStatus($p['orders_products_id'], $new_status, $session_userinfo['username']);
             $opids[] = $p['orders_products_id'];
         }
         $class_o->sendProductStatusNotification($opids, $new_status, $languages[2]['path'], $useAltContent);
         //Auto Blacklist Customer
         $order = $class_o->retrieveDetail($product['orders_id']);
         use_class('customers_special_list');
         $class_csl = new customers_special_list();
         $class_csl->addCustomer('B', $order['customers_id']);
         $comment_text = 'Customer is added to blacklist automatically because of Unpaid Vorkasse Cancellation';
         $class_csl->insertComment($order['customers_id'], $comment_text, 'System');
         $result = array();
         $result['op_id'] = implode(',', $opids);
         $result['old_status'] = $old_status;
         $result['new_status'] = $new_status;
         ajaxReturn($result);
     }
 } elseif ($_POST['me_action'] == 'ONHOLDNOTIFICATION') {
     $status = '13';
     $opid = tep_db_prepare_input($_POST['op_id']);
     $product = $class_o->retrieveProductDetail($opid);
     if ($product['status'] == $status) {
         $products = $class_o->retrieveProducts($product['orders_id']);
<?php

use_class('customers_special_list');
$class_csl = new customers_special_list();
use_class('minierp_customers');
$class_mc = new minierp_customers();
$customers_id = isset($_GET['id']) ? tep_db_prepare_input($_GET['id']) : '';
if ($customers_id == '') {
    exit;
}
$detail = $class_csl->getCustomerDetail($customers_id);
if (is_null($detail)) {
    exit;
}
//AJAX ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'ADDNEWCOMMENT') {
        $customer_id = tep_db_prepare_input($_POST['customer_id']);
        $comment = tep_db_prepare_input(utf8_decode($_POST['comment']));
        $comment = trim($comment);
        if ($comment != "") {
            $comment_by = $session_userinfo['username'];
            $comment_id = $class_csl->insertComment($customer_id, $comment, $comment_by);
            //            $comment = $class_csl->retrieveCommentDetail($comment_id);
            //            $comments = array($comment);
            //            $result = $class_csl->drawComments($comments, true);
            $result = drawSingleComment($comment_id, $comment_by, time(), $comment);
            echo utf8_encode($result);
        }
        exit;
    } elseif ($_POST['me_action'] == 'DELETECOMMENT') {
예제 #10
0
<?php

use_class('minierp_customers');
$class_mc = new minierp_customers();
use_class('customers_special_list');
$class_csl = new customers_special_list();
//SUBMIT ACTION
$customer_deleted = false;
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'DELETECUSTOMERDATA') {
        $customer_id = tep_db_prepare_input($_POST['customer_id']);
        $customer_name = tep_db_prepare_input($_POST['customers_firstname']) . " " . tep_db_prepare_input($_POST['customers_lastname']);
        $orders_query = tep_db_query("SELECT COUNT(o.orders_id) AS count, SUM(ot.value) AS total FROM orders o INNER JOIN orders_total ot ON ot.orders_id=o.orders_id AND ot.class='ot_total' WHERE o.customers_id={$customer_id} GROUP BY o.customers_id");
        $orders = tep_db_fetch_array($orders_query);
        $has_orders = is_array($orders) && isset($orders['count']);
        if (!$has_orders) {
            //DELETE CUSTOMER
            $backup_q = "INSERT INTO customers_backup (customers_id, customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_default_address_id, customers_telephone, customers_fax, customers_password, customers_newsletter, customers_activation_code, customers_active_status, customers_referrer_id, customers_status, rent_status, ambassador_id, ambassador_date)";
            $backup_q .= " SELECT customers_id, customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_default_address_id, customers_telephone, customers_fax, customers_password, customers_newsletter, customers_activation_code, customers_active_status, customers_referrer_id, customers_status, rent_status, ambassador_id, ambassador_date FROM customers WHERE customers_id={$customer_id}";
            tep_db_query($backup_q);
            tep_db_query("DELETE FROM customers WHERE customers_id={$customer_id}");
            $messagebox->add("Customer <strong>{$customer_name}</strong> ID {$customer_id} is successfully deleted", 'green');
            $customer_deleted = true;
        }
    } elseif ($_POST['me_action'] == 'UPDATECUSTOMERDATA') {
        $customer_id = tep_db_prepare_input($_POST['customer_id']);
        $sql_data_array = array();
        if (isset($_POST['customers_gender'])) {
            $sql_data_array['customers_gender'] = tep_db_prepare_input($_POST['customers_gender']);
        }
        $sql_data_array['customers_firstname'] = tep_db_prepare_input($_POST['customers_firstname']);
<?php

use_class('customers_special_list');
$class_csl = new customers_special_list();
//AJAX ACTION
if (isset($_GET['type'])) {
    $type = tep_db_prepare_input($_GET['type']);
    $list = $class_csl->retrieveList($type);
    $result = '';
    $result .= '<h2>';
    $result .= $class_csl->getTypeSymbol($type) . ' ';
    $result .= $class_csl->getTypeName($type) . ' Customers';
    $result .= '</h2>';
    $result .= '<div style="margin:10px 0 20px 0;">';
    if ($type != 'N') {
        $result .= '<a href="?open=customers-special-list-add&amp;type=' . $type . '&amp;hidemenu=true" class="view_webpage"></a>';
        $result .= '<input type="button" class="button" name="addnew" value="Add Customer" onclick="$(this).siblings(\'a\').click();" />';
    } else {
        $result .= '<span class="notice">When removed from Blacklist/VIP list, customer will be moved here so all historical information is not lost</span>';
    }
    $result .= '</div>';
    if (count($list) == 0) {
        $result .= '<h3 class="red">No customer is found</h3>';
    } else {
        $table = array();
        $t = array();
        $t['d'] = 'ID';
        $t['c'] = 'Name';
        $t['a'] = 'Action';
        $table[] = $t;
        foreach ($list as $l) {