当前位置: 首页>>代码示例>>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;未经允许,请勿转载。