本文整理汇总了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();
}
示例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');
}