<?php

use_class('orders');
$class_o = new orders();
//AJAX ACTION
if (isset($_POST['me_action']) && $_POST['me_action'] != '') {
    if ($_POST['me_action'] == 'LOADRETDETAIL') {
        $detail_id = tep_db_prepare_input($_POST['detail_id']);
        $det = explode('-', $detail_id);
        $return_id = $det[1];
        $return = $class_o->retrieveReturnDetail($return_id);
        $result = array();
        $result['detail_id'] = $detail_id;
        $result['return_comment'] = $return['return_comment'];
        $result['return_request'] = $class_o->productReturnRequestText($return['return_type']);
        $result['email_last_sent'] = $return['email_last_sent'] == '' ? 'N/A' : date('d M Y', strtotime($return['email_last_sent']));
        ajaxReturn($result);
        exit;
    } elseif ($_POST['me_action'] == 'SEARCHRETURNS') {
        $period1 = tep_db_prepare_input($_POST['period1']);
        $period2 = tep_db_prepare_input($_POST['period2']);
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $p1 = explode('.', $period1);
        $date1 = date('Y-m-d', strtotime($p1[2] . '-' . $p1[1] . '-' . $p1[0]));
        $p2 = explode('.', $period2);
        $date2 = date('Y-m-d', strtotime($p2[2] . '-' . $p2[1] . '-' . $p2[0]));
        $searchfilter = " DATE(opr.return_date)>=DATE('{$date1}')";
        $searchfilter .= " AND DATE(opr.return_date)<=DATE('{$date2}')";
        if ($search_keywords != '') {
            switch ($search_field) {
Example #2
0
        $receive .= '<option value="' . $val . '" ' . $sel . '>' . $opt . '</option>';
    }
    $receive .= '</select>';
} else {
    $receive = 'Received';
}
$content .= '<div style="float:left;">' . $pimg . '</div>';
$content .= '<div style="margin-left:150px;">';
$content .= '<table border="0" cellpadding="0" cellspacing="0">';
$content .= '<tr><td width="150"><h3>Product Code</h3></td><td><h3>' . $product['products_model'] . '</h3></td></tr>';
$content .= '<tr><td>Customer</td><td><a href="?open=customer&amp;id=' . $order['customers_id'] . '" target="_blank" title="View Customer Detail">' . $order['customers_name'] . '</a></td></tr>';
$content .= '<tr><td>Order No</td><td><a href="?open=order&amp;id=' . $order['orders_id'] . '" target="_blank" title="View Order Detail">' . $order['orders_no'] . '</a></td></tr>';
$content .= '<tr><td>Order Date</td><td>' . date('d M Y', strtotime($order['date_purchased'])) . '</td></tr>';
$content .= '<tr><td>Return Date</td><td>' . date('d M Y', strtotime($return['return_date'])) . '</td></tr>';
$content .= '<tr><td>Return/Order Qty</td><td>' . $return['return_qty'] . ' / ' . $product['products_quantity'] . '</td></tr>';
$content .= '<tr><td class="bold">Request</td><td class="bold">' . $class_o->productReturnRequestText($return['return_type']) . '</td></tr>';
if ($return['return_type'] == 'R' || $return['return_type'] == 'W') {
    $statusName = $class_o->productStatusName();
    $content .= '<tr><td class="bold">Reproduce Status</td><td class="bold">' . $statusName[$product['status']] . '</td></tr>';
}
if ($return['return_comment'] != '') {
    $content .= '<tr><td>Comment</td><td>' . nl2br($return['return_comment']) . '</td></tr>';
}
$content .= '<tr><td>Product receive</td><td>' . $receive . '</td></tr>';
$content .= '<tr><td>Product Price</td><td>' . displayCurrency($order['currency'], $product['final_price']) . ' / Qty</td></tr>';
if ($return['return_type'] == 'C') {
    $content .= '<tr><td colspan="2">&nbsp;</td></tr>';
    if ($order['paid_status'] == '0') {
        $content .= '<tr><td colspan="2">';
        $content .= '<div class="float-box ui-corner-all red bold">THIS ORDER IS UNPAID</div>';
        $content .= '</td></tr>';