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