示例#1
0
 public function getRecover($BranchId)
 {
     return View::make('branch.recover')->with('branch_good_items', BranchGoodItems::where('branch_id', '=', $BranchId)->with('good')->paginate())->with('branch', Branch::find($BranchId));
 }
示例#2
0
 public function postDone($PickingID)
 {
     $rules = array('real_bn' => 'required|unique:delivery');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('picking/done/' . $PickingID)->withErrors($validator)->withInput();
     }
     $delivery = Delivery::find($PickingID);
     $delivery->status = '3';
     $delivery->real_bn = Input::get('real_bn');
     $delivery->pay_status = Input::get('pay_status');
     $delivery->t_confirm = $this->__time();
     $delivery->save();
     // 增加销售记录 用于退换回收 2014.05.21
     $delivery_items = DeliveryItems::where('delivery_id', $delivery->id)->get();
     foreach ($delivery_items as $item) {
         $g = BranchGoodItems::where('good_id', $item->good_id)->where('branch_id', $item->branch_id)->first();
         if ($g) {
             $i = BranchGoodItems::find($g->id);
             $i->sell = $i->sell + $item->number;
             $i->save();
         } else {
             $i = new BranchGoodItems();
             $i->good_id = $item->good_id;
             $i->branch_id = $item->branch_id;
             $i->sell = $item->number;
             $i->save();
         }
     }
     return Redirect::to('picking')->with('success', '出货单(' . $delivery->bn . ')已完成!');
 }