예제 #1
0
 /**
  * @param $request
  * @param $userId
  * @return array
  */
 public function generateValidCommissionTable($request, $userId)
 {
     $orderDetailModel = new orderDetailModel();
     $datatables = new DataTables();
     $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'orders.order_code', 'dt' => 0), array('db' => 'order_detail.name AS order_detail_name', 'dt' => 1), array('db' => 'order_detail.image AS order_detail_image', 'dt' => 2), array('db' => 'order_detail.order_service_status AS order_detail_status', 'dt' => 3), array('db' => 'order_detail.subtotal', 'dt' => 4), array('db' => 'order_detail.updated', 'dt' => 5), array('db' => 'shipping.status AS shipping_status', 'dt' => 6), array('db' => 'partner_payment_detail.payment_id', 'dt' => 7), array('db' => 'order_detail.shipping_service_code', 'dt' => 8), array('db' => 'partner_payments.ref AS payment_code', 'dt' => 9));
     $return = $orderDetailModel->generateValidCommissionTable($request, $columns, $userId);
     if (count($return['data'])) {
         foreach ($return['data'] as &$orderDetail) {
             $orderDetail->order_detail_status = self::getStatusOrderDetail($orderDetail);
             $orderDetail->subtotal = formatMoney($orderDetail->subtotal * PARTNER_DISCOUNT_PERCENT_LEVEL_1 / 100);
         }
     }
     $return['data'] = $datatables::data_output($columns, $return['data']);
     return $return;
 }