當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OrderDetail::find方法代碼示例

本文整理匯總了PHP中OrderDetail::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderDetail::find方法的具體用法?PHP OrderDetail::find怎麽用?PHP OrderDetail::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OrderDetail的用法示例。


在下文中一共展示了OrderDetail::find方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($id, $date, $userID)
 {
     $this->id = $id;
     $this->date = $date;
     $this->userID = $userID;
     $this->order_details = OrderDetail::find($id);
     $this->sum = $this->getSum();
 }
開發者ID:Hield,項目名稱:e-commerce,代碼行數:8,代碼來源:order.php

示例2: postEditModal

 /**
  * postEditModal
  */
 public function postEditModal()
 {
     $stockup = Input::get('stockup');
     $stockup = json_decode($stockup, true);
     $order_id = Input::get('order_id');
     $order = Order::find(Input::get('order_id'));
     //添加表
     $stock = new Stockup();
     $stock->order_id = $order_id;
     $stock->stockup_count = 0;
     $stock->item_count = 0;
     $stock->amount = 0.0;
     $stock->operator = '5';
     $stock->auditors = '4';
     $stock->save();
     //添加細表
     $stockup_count = $item_count = $amount = 0;
     foreach ($order->orderdetails as $orderdetail) {
         $confirm_quantity = 0;
         $ready_stock = $real_stock = 0;
         if ($stockup[$orderdetail->item->code]['stockup']) {
             foreach ($stockup[$orderdetail->item->code]['stockup'] as $value) {
                 //庫存 有位置 identity status
                 if (isset($value['position']) && !empty($value['position'])) {
                     $stockdetail = new StockupDetail();
                     $stockdetail->stockup_id = $stock->id;
                     $stockdetail->identity = isset($value['item']) ? $value['item'] : '';
                     $stockdetail->supplier_id = 0;
                     $stockdetail->item_id = $orderdetail->item->id;
                     $stockdetail->quantity = $value['quantity'];
                     $stockdetail->position = $value['position'];
                     $stockdetail->status = 2;
                     $stockdetail->packaged = 0;
                     $stockdetail->save();
                     //位置減庫存
                     $real_stock += $value['quantity'];
                     //預錄入狀態更新
                     if (isset($value['item'])) {
                         $item_detail = ItemReceivedPackageDetail::find($value['item']);
                         $item_detail->status = 3;
                         $item_detail->save();
                     }
                     //位置庫存
                     $item_position = Warehouse::find($value['position']);
                     $item_position->quantity -= $value['quantity'];
                     $item_position->save();
                 } else {
                     //預錄入 沒有位置
                     $stockdetail = new StockupDetail();
                     $stockdetail->stockup_id = $stock->id;
                     $stockdetail->identity = $value['item'];
                     $stockdetail->supplier_id = '';
                     $stockdetail->item_id = $orderdetail->item->id;
                     $stockdetail->quantity = $value['quantity'];
                     $stockdetail->position = '';
                     $stockdetail->status = 1;
                     $stockdetail->packaged = 0;
                     $stockdetail->save();
                     $ready_stock += $value['quantity'];
                     //預錄入狀態更新
                     $item_detail = ItemReceivedPackageDetail::find($value['item']);
                     $item_detail->status = 3;
                     $item_detail->save();
                 }
                 $item_count++;
                 $stockup_count += $value['quantity'];
                 $confirm_quantity += $value['quantity'];
                 $amount += $value['quantity'] * $orderdetail->confirm_price;
                 //減狀態
                 //減少庫存
             }
         }
         //減少庫存總數
         $item = Item::find($orderdetail->item->id);
         $item->stock -= $real_stock;
         $item->readystock -= $ready_stock;
         $item->save();
         //更新訂單備貨數量
         $detail = OrderDetail::find($orderdetail->id);
         $detail->confirm_quantity = $confirm_quantity;
         $detail->save();
     }
     //總計,匹數,米數,金額
     $stock->stockup_count = $stockup_count;
     $stock->item_count = $item_count;
     $stock->amount = $amount;
     $stock->save();
     //更新訂單狀態|應付款項合計
     $order->item_fee = $amount;
     $order->order_status = 'order_stockuped';
     $order->save();
     return Redirect::to('admin/stockups');
 }
開發者ID:yanguanglan,項目名稱:sz,代碼行數:96,代碼來源:StockupsController.php


注:本文中的OrderDetail::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。