Example #1
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;
}
Example #2
0
    $q_dp .= $mode == 'ready-printed-unscanned' ? " AND print_count > 0 AND print_confirmed = 0" : " AND print_count = 0";
    $q_dp .= " AND NOT (trans_type='' AND trans_id=5)";
    $q .= $q_dp;
}
$q .= " ) dt";
//$q .= " WHERE products_id != 72385";
$q .= " ORDER BY products_id, priority, row_nr, items_id";
$res = tep_db_query($q);
while ($r = tep_db_fetch_array($res)) {
    $pid = $r['products_id'];
    $brand_id = $class_pb->retrieveProductBrand($pid);
    $type = $r['type'];
    $oid = $r['orders_id'];
    $oiid = $r['items_id'];
    $sp_id = $r['sp_id'];
    $is_prioritized = $r['priority'] == 1 || checkCustomerIsVIP($type, $oid) || in_array($sp_id, $sp_using_red_paper) || in_array($brand_id, $brand_using_red_paper);
    $key = "{$type}|{$oiid}";
    $ok_print = false;
    if ($type == 'SP' || $type == 'JG') {
        /*Disabled this, since all orders that goes to ready will directly printed
          //ignore printing pdf for this order if there item that still on cancel request. 
          $ok_print = (!orderItemHaveStatus($oid, 10, $type));
           */
        $ok_print = true;
    } elseif ($type == 'DP') {
        use_class('depot_orders');
        $class_do = new depot_orders();
        $do = $class_do->retrieveDetail($oid);
        if ($do['trans_type'] == 'SP') {
            use_class('jng_sp_orders');
            $class_jo = new jng_sp_orders();