示例#1
0
 public static function convertMenuReportArray($data)
 {
     foreach ($data as $k => $val) {
         $menuInfo = Utility::getMenuInfo($val['menuId']);
         $data[$k]['orderDetailId'] = $val[0]->getId();
         $data[$k]['OrderId'] = $menuInfo->getId();
         $data[$k]['menuName'] = $menuInfo->getName();
         $data[$k]['realCost'] = $data[$k]['realCost'];
         $data[$k]['time'] = date('d-m-Y', $val[0]->getTime());
         $data[$k]['id'] = $k;
     }
     return $data;
 }
示例#2
0
 public function convertSingleToArray($data)
 {
     $parentMenu = Utility::getMenuInfo($data->getMenuParentId());
     $childMenu = Utility::getMenuInfo($data->getMenuChildId());
     $array = array();
     $array['id'] = $data->getId();
     $array['menu_parent_id'] = $parentMenu->getName();
     $array['menu_child_id'] = $childMenu->getName();
     $array['menu_quantity'] = $data->getMenuQuantity();
     $array['menu_cost'] = $childMenu->getCost();
     $array['menu_ta_cost'] = $childMenu->getTakeAwayCost();
     $array['menu_total_cost'] = $childMenu->getCost() * $data->getMenuQuantity();
     $array['menu_total_ta_cost'] = $childMenu->getTakeAwayCost() * $data->getMenuQuantity();
     return $array;
 }
示例#3
0
 public function convertSingleToArray($data)
 {
     $menuInfo = Utility::getMenuInfo($data->getMenuId());
     $menuCostType = Utility::getMenuCostType($data->getCostType());
     $couponInfo = Utility::getCouponInfo($data->getDiscount());
     $array = array();
     $array['id'] = $data->getId();
     $array['orderid'] = 'Order #' . $data->getOrderId();
     $array['menuid'] = '<a href="/admin/index/add/' . $data->getMenuId() . '" target="_blank" >' . $menuInfo->getName() . '</a>';
     $array['quantity'] = $data->getQuantity();
     $array['menucost'] = Utility::formatCost($data->getMenuCost());
     $array['menucosttype'] = $menuCostType;
     $array['discount'] = $couponInfo->getDescription();
     $array['realcost'] = Utility::formatCost($data->getRealCost());
     return $array;
 }
示例#4
0
    public function ajaxDetailOrderAction()
    {
        $response = array();
        $coupons = Utility::getCouponCheckExpire();
        $couponHtml = '';
        foreach ($coupons as $coupon) {
            $couponHtml .= '<option value="' . $coupon->getId() . '">' . $coupon->getDescription() . '</option>';
        }
        if ($this->getRequest()->isXmlHttpRequest()) {
            $orderId = $this->params()->fromPost('order_id');
            $orderDetailModel = $this->modelOrderDetail->findBy(array('orderId' => $orderId));
            $html = '';
            $response['data'] = '';
            if (!empty($orderDetailModel)) {
                foreach ($orderDetailModel as $orderDetail) {
                    $menu = Utility::getMenuInfo($orderDetail->getMenuId());
                    $counponInfo = Utility::getCouponInfo($orderDetail->getDiscount());
                    $html .= '<tr>
                            <td >
                            ' . $menu->getName() . '
                            <input type="hidden" name="data' . $orderDetail->getId() . '[orderDetailId]" value="' . $orderDetail->getId() . '" />
                            </td>
                            <td>' . $orderDetail->getRealCost() . '</td>
                            <td>
                            ' . $orderDetail->getQuantity() . '
                            <input type="hidden" name="data' . $orderDetail->getId() . '[menuCost]" value="' . $orderDetail->getMenuCost() . '" />
                             <input type="hidden" name="data' . $orderDetail->getId() . '[menuId]" value="' . $orderDetail->getMenuId() . '" />
                             <input type="hidden" name="data' . $orderDetail->getId() . '[costType]" value="' . $orderDetail->getCostType() . '" />
                            <input type="hidden" name="data' . $orderDetail->getId() . '[oldQty]" value="' . $orderDetail->getQuantity() . '" />
                            <input type="hidden" name="data' . $orderDetail->getId() . '[discountValue]" value="' . $counponInfo->getValue() . '" />
                            <input type="hidden" name="data' . $orderDetail->getId() . '[discountId]" value="' . $counponInfo->getId() . '" />
                             <input type="hidden" name="data' . $orderDetail->getId() . '[discountType]" value="' . $counponInfo->getType() . '" />

                            </td>
                            <td>
                            <input type="text" name="data' . $orderDetail->getId() . '[qty]" class="input-small" />
                            </td>
                            <td>
                            <select name="data' . $orderDetail->getId() . '[newCoupon]">
                            <option value="-1">Select...</option>
                            ' . $couponHtml . '
                            </select>
                            </td>

                    </tr>';
                }
                $response['data'] = $html;
                $response['oldOrderId'] = $orderId;
            }
            echo json_encode($response);
            die;
        }
    }