コード例 #1
0
ファイル: Utility.php プロジェクト: binnguyen/kaffacoffee
 static function insertOrderDetail($data, $orderID)
 {
     $table = self::$servicelocator->get('doctrine');
     $table = new orderdetailModel($table);
     $orderDetail = new OrderDetail();
     $orderDetail->setOrderId($orderID);
     $orderDetail->setMenuId($data['menuid']);
     $orderDetail->setQuantity($data['quantity']);
     $orderDetail->setMenuCost($data['menuCost']);
     $orderDetail->setRealCost($data['realcost']);
     $orderDetail->setIsdelete(0);
     $orderDetail->setCostType($data['orderDetailType']);
     $orderDetail->setDiscount($data['discount']);
     $orderDetail->setCustomerId(0);
     $orderDetail->setTime(date('Y-m-d H:i:s', time()));
     $orderDetailInserted = $table->insert($orderDetail);
     //insert transaction
     TransactionUtility::updateQuantityMenuItemInStore($data['menuid'], $data['quantity'], ADD_ORDER, ADD_ORDER_ACTION, json_encode(array('orderID' => $orderID, 'orderDetailId' => $orderDetailInserted->getID())), $orderID);
     $config = self::getConfig();
 }
コード例 #2
0
ファイル: Utility.php プロジェクト: binnguyen/kaffabasic
 static function insertOrderDetail($data, $orderID)
 {
     $table = self::$servicelocator->get('doctrine');
     $table = new orderdetailModel($table);
     $orderDetail = new OrderDetail();
     $orderDetail->setOrderId($orderID);
     $orderDetail->setMenuId($data['menuid']);
     $orderDetail->setQuantity($data['quantity']);
     $orderDetail->setMenuCost($data['menuCost']);
     $orderDetail->setRealCost($data['realcost']);
     $orderDetail->setIsdelete(0);
     $orderDetail->setCostType($data['orderDetailType']);
     $orderDetail->setDiscount($data['discount']);
     $orderDetailInserted = $table->insert($orderDetail);
     //insert transaction
 }
コード例 #3
0
 public function addAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $data = $this->params()->fromPost();
         echo json_encode($data);
         die;
         //check api
         $userApi = Utility::userApi($data['userName'], $data['apiKey']);
         if ($userApi->getId() == '') {
             die(-1);
         }
         $this->userId = $userApi->getId();
         //end check api
         // insert new customer before insert new  order
         $customerId = Utility::createCustomer($data);
         //insert new order
         $order = new Orders();
         $order->setUserId($this->userId);
         $order->setStatus($data['status']);
         $order->setTotalCost($data['total_cost']);
         $order->setTotalRealCost($data['total_real_cost']);
         $order->setCreateDate(time());
         $order->setIsdelete(0);
         $order->setTableId(0);
         $order->setSurtaxId(0);
         $order->setCustomerId($customerId);
         //end insert new order
         $order = $this->orderModel->insert($order);
         $orderId = $order->getId();
         //insert orderDetail
         $orderDetails = $data['detai'];
         foreach ($orderDetails as $details) {
             $orderDetail = new OrderDetail();
             $orderDetail->setOrderId($orderId);
             $orderDetail->setMenuId($details['menu_id']);
             $orderDetail->setCostType($details['cost_type']);
             $orderDetail->setQuantity($details['quantity']);
             $orderDetail->setMenuCost($details['menu_cost']);
             $orderDetail->setRealCost($details['real_cost']);
             $orderDetail->setCustomerId($customerId);
             $orderDetail->setIsdelete(0);
             $this->orderDetailModel->insert($orderDetail);
         }
         //insert order detail
         die;
     }
     die;
 }