コード例 #1
0
 public function Edit()
 {
     $input = Input::all();
     $discount_id = $input['id'];
     $role = $this->role->GetAllRoleAgent();
     $listBranch = $this->branch->GetAllBranch();
     $discount = Discount::find($discount_id);
     return View::make('admin.discount.add')->with('discount', $discount)->with('role', $role)->with('listBranch', $listBranch);
 }
コード例 #2
0
 public function getDeletediscount($id)
 {
     $discount = Discount::find($id);
     // No such id
     if ($discount == null) {
         $errors = new \Illuminate\Support\MessageBag();
         $errors->add('deleteError', "The discount may have been deleted.");
         return \Redirect::to('admin/pricelists')->withErrors($errors)->withInput();
     }
     $discount->delete();
     return \Redirect::to('admin/pricelists');
 }
コード例 #3
0
 public function reductionsFilter($types, $id)
 {
     $reductable_type = $types;
     $reduction_id = $id;
     $reductions = Reduction::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('reductable_type', '=', $reductable_type)->where('reductable_id', '=', $reduction_id)->get();
     switch ($reductable_type) {
         case 'Promotion':
             $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Promotion::find($reduction_id);
             break;
         case 'Voucher':
             $discounts = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Voucher::find($reduction_id);
             break;
         case 'Discount':
             $discounts = Discount::all();
             $discount = Discount::find($reduction_id);
             break;
         case 'Charge':
             $discounts = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Charge::find($reduction_id);
             break;
         default:
             $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Promtion::find($reduction_id);
             break;
     }
     $menu = 'report';
     return View::make('reports.reductions', compact('reductable_type', 'reduction_id', 'reductions', 'discounts', 'discount', 'menu'));
 }