当前位置: 首页>>代码示例>>PHP>>正文


PHP Stock::removeStock方法代码示例

本文整理汇总了PHP中Stock::removeStock方法的典型用法代码示例。如果您正苦于以下问题:PHP Stock::removeStock方法的具体用法?PHP Stock::removeStock怎么用?PHP Stock::removeStock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stock的用法示例。


在下文中一共展示了Stock::removeStock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created order in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validation = array('customer' => 'required', 'date' => 'required');
     $validator = Validator::make(Input::all(), $validation);
     if ($validator->fails()) {
         return Redirect::to('orders/create')->withErrors($validator);
     } else {
         $postorder = Input::all();
         $data = array('customer' => $postorder['customer'], 'date' => $postorder['date'], 'total_amount' => $postorder['total_amount'], 'discount' => $postorder['discount'], 'payable_amount' => $postorder['payable_amount'], 'payment' => $postorder['payment'], 'balance' => $postorder['balance']);
         $id = DB::table('orders')->insertGetId($data);
         for ($i = 0; $i < count($postorder['product_id']); $i++) {
             $data_detail = array('product_id' => $postorder['product_id'][$i], 'item' => $postorder['item'][$i], 'quantity' => $postorder['quantity'][$i], 'price' => $postorder['price'][$i], 'amount_charged' => $postorder['amount_charged'][$i], 'Order_id' => $id);
             DB::table('order_details')->insert($data_detail);
             $date = $postorder['date'];
             $location = Location::findOrFail($postorder['location']);
             foreach ($data_detail as $item) {
                 $it = Item::findOrFail($postorder['item'][$i]);
                 $quantity = $postorder['quantity'][$i];
                 Stock::removeStock($it, $location, $quantity, $date);
             }
         }
         return Redirect::route('orders.index')->with('success', 'Item Successfully Added');
     }
 }
开发者ID:kenkode,项目名称:gasexpress,代码行数:29,代码来源:OrdersController.php

示例2: foreach

    $order->type = 'sales';
    $order->save();
    foreach ($erporderitems as $item) {
        $itm = Item::findOrFail($item['itemid']);
        $ord = Erporder::findOrFail($order->id);
        $location_id = $item['location'];
        $location = Location::find($location_id);
        $date = date('Y-m-d', strtotime(array_get($erporder, 'date')));
        $orderitem = new Erporderitem();
        $orderitem->erporder()->associate($ord);
        $orderitem->item()->associate($itm);
        $orderitem->price = $item['price'];
        $orderitem->quantity = $item['quantity'];
        $orderitem->duration = $item['duration'];
        $orderitem->save();
        Stock::removeStock($itm, $location, $item['quantity'], $date);
    }
    $tax = Input::get('tax');
    $rate = Input::get('rate');
    for ($i = 0; $i < count($rate); $i++) {
        $txOrder = new TaxOrder();
        $txOrder->tax_id = $rate[$i];
        $txOrder->order_number = array_get($erporder, 'order_number');
        $txOrder->amount = $tax[$i];
        $txOrder->save();
    }
    //Session::flush('orderitems');
    //Session::flush('erporder');
    return Redirect::to('salesorders')->withFlashMessage('Order Successfully Placed!');
});
Route::get('erppurchase/commit', function () {
开发者ID:kenkode,项目名称:umash-1,代码行数:31,代码来源:routes.php


注:本文中的Stock::removeStock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。