示例#1
0
 public function showEstimate($id)
 {
     // show estimate details
     $estimate = Estimate::findOrFail($id);
     $estimateItem = EstimateItem::where('estimate_id', $id)->get();
     return View::make('admin/merck/estimates/show', compact('estimate', 'estimateItem'));
 }
示例#2
0
 public function getEstimateById($id)
 {
     return Estimate::findOrFail($id);
 }
 public function updateEstimate(Request $request)
 {
     if (Gate::denies('addProjectEstimate', new Estimate())) {
         abort(403, 'You are not allowed here');
     }
     $estimate = Estimate::findOrFail($request->input('project_id'));
     $estimate->desc = $request->input('desc');
     $estimate->hours_allocated = $request->input('hours_allocated');
     $estimate->status = $request->input('status');
     $estimate->save();
     Session::flash('flash_message', 'Estimate updated.');
     return redirect('project/estimates/' . $estimate->project->id);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(EstimateRequest $request, $id)
 {
     $estimate = Estimate::findOrFail($id);
     $estimate->update($request->all());
     DB::table('estimate_details')->where('estimate_id', '=', $id)->delete();
     $input = $request->all();
     for ($i = 0; $i < count($input['item_id']); $i++) {
         if ($input['item_id'][$i] != null) {
             $estimate_detail = new EstimateDetail();
             $estimate_detail->item_id = $input['item_id'][$i];
             $estimate_detail->item_description = $input['item_description'][$i];
             $estimate_detail->units = $input['units'][$i];
             $estimate_detail->rate = $input['rate'][$i];
             $estimate_detail->initial_amount = $input['amount'][$i];
             $estimate->estimate_details()->save($estimate_detail);
         }
     }
     return redirect('estimates');
 }
示例#5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $job = Job::findOrFail($id);
     //var_dump($job); die;
     $estimate = Estimate::findOrFail($job->estimate_id);
     $estimate_details = DB::table('estimate_details')->where('estimate_id', '=', $job->estimate_id)->get();
     $department = Department::findOrFail($estimate->department);
     $s_advisor_list = DB::table('stakeholders')->where('role', '=', 's_advisor')->lists('name', 'id');
     $sec_incharge_list = DB::table('stakeholders')->where('role', '=', 'sec_incharge')->lists('name', 'id');
     $customer = Customer::findOrFail($estimate->customer_id);
     $vehicle = Vehicle::findOrFail($estimate->vehicle_id);
     return view('jobs.single-job', compact('job', 'estimate', 'estimate_details', 'department', 's_advisor_list', 'customer', 'vehicle', 'sec_incharge_list'));
 }