<?php

use_class('jng_sp');
use_class('jng_sp_orders');
use_class('payone');
$class_sp = new jng_sp();
$class_jo = new jng_sp_orders();
$default_comment = 'Comment...';
//SP SETTING
salesPartnerCombo();
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']));
        $orders = $class_jo->searchOrders($search_field, $search_keywords, "joi.status IN (9,11)");
        $itemStatus = $class_jo->statusName();
        $result = '';
        if (count($orders) == 0) {
            $result .= '<h3>No result is found, please check your search field/keywords</h3>';
        } else {
            $orders_result = array();
            $o = array();
            $o['c'] = 'Order Info';
            $o['a'] = 'Article No';
            $o['r'] = 'Return Info';
            $o['t'] = 'Action';
            $orders_result[] = $o;
            foreach ($orders as $row) {
                $returnable = $row['order_quantity'];
                $return_data = $class_jo->retrieveReturnItem($row['jng_sp_orders_items_id']);
                if (!is_null($return_data)) {
<?php

use_class('jng_sp');
$class_sp = new jng_sp();
use_class('jng_sp_download');
$class_jd = new jng_sp_download();
use_class('jng_sp_orders');
$class_jo = new jng_sp_orders();
//SUBMIT ACTION
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'SEARCHORDERS') {
        $max_normal_search = 5;
        $search_field = tep_db_prepare_input($_POST['search_field']);
        $search_keywords = tep_db_prepare_input(utf8_decode($_POST['search_keywords']));
        $orders = $class_jo->searchOrders($search_field, $search_keywords);
        $itemStatus = $class_jo->statusName();
        $result = '';
        if (count($orders) == 0) {
            $result .= '<h3>No result is found, please check your search field/keywords</h3>';
        } else {
            $orders_result = array();
            $o = array();
            $o['sp'] = 'SP';
            $o['d'] = 'Date';
            $o['c'] = 'Customer Name';
            $o['o'] = 'Order No';
            $o['a'] = 'Article No';
            $o['p'] = 'Price';
            $o['q'] = 'Qty';
            $o['s'] = 'Status';
            $o['t'] = 'Action';