コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     $varr = Auth::user()->empid;
     $empid = Targetassign::where('Employeeid', $varr)->get();
     $cat = Event::all();
     return View('targetmodule/eventdeal')->with(array('cat' => $cat, 'empid' => $empid));
 }
コード例 #2
0
 public function postUpdatetargetassign(Request $request)
 {
     $tid = Input::get('targetid');
     $now = date('d-m-Y');
     $post = Input::get();
     $i = Targetassign::where('Id', $tid)->update(array('Targetvalue' => $post['targetvalue'], 'Targetdate' => $post['duedate']));
     if ($i > 0) {
         $request->session()->flash('alert-success', 'Target Has Been Updated Successfully');
         return redirect('targetmodule/assigntarget');
     }
 }
コード例 #3
0
 public function postVariancecard()
 {
     $empid = Auth::user()->empid;
     $eventName = Input::get('event');
     $targets = Targetassign::where('Employeeid', $empid)->where('Eventname', $eventName)->get();
     $variancedata = $targets;
     $deals = Deal::where('Eventname', $eventName)->where('Empid', $empid)->get();
     $eventDate = Event::where('event', $eventName)->select('date')->get();
     $userData = array();
     $key = 0;
     foreach ($eventDate as $val) {
         $eventdate = $val['date'];
     }
     foreach ($targets as $target) {
         $achieved = 0;
         $userData[$key]['event'] = $target->Eventname;
         $userData[$key]['eventcode'] = $target->Eventcode;
         $userData[$key]['targetVal'] = $target->Targetvalue;
         foreach ($deals as $key1 => $deal) {
             if ($target->Eventname == $deal->Eventname) {
                 $achieved = $achieved + $deal->Dealvalue;
                 $dealx[$key1]['dealdate'] = $deal->Dealdate;
                 $dealx[$key1]['cost'] = (double) $deal->Dealvalue;
             }
         }
         $userData[$key]['achieved'] = $achieved;
         $userData[$key]['variance'] = $achieved - $target->Targetvalue;
         $userData[$key]['cur'] = $target->Currency;
         $date2 = strtotime(date('d-m-Y'));
         $date1 = $target->Targetdate;
         $date5 = $target->Targetassigned;
         // dd($date5);
         $date3 = strtotime($target->Targetdate);
         $diff = $date3 - $date2;
         $days = floor($diff / (60 * 60 * 24));
         // dd($days);
         $userData[$key]['dayleft'] = $days;
         $key++;
     }
     $dealjson = json_encode($dealx);
     // dd($dealjson);
     return View('targetmodule/variancecard')->with(array('target' => $targets, 'userdata' => $userData, 'variancedata' => $variancedata, 'eventdate' => $date1, 'targetdate' => $date5, 'dealjson' => $dealjson));
 }
コード例 #4
0
 public function getUpdatenewdeal($editleadid)
 {
     $varr = Auth::user()->empid;
     $evarr = User::where('empid', $varr)->get();
     $emp = Employee::where('emp_ide_id', $varr)->get();
     $date = date('Y-m-d');
     $ev = array();
     $cat = Event::where('date', '>=', $date)->get();
     // dd($cat);
     foreach ($cat as $key) {
         $ev[] = $key['eventcode'];
     }
     // dd($ev);
     $leadid = leadsheet::where('id', $editleadid)->get();
     // dd($leadid);
     $dealcan = Deal::where('Status', '=', 'Request Cancel')->where('Empid', $varr)->get();
     $event = Event::all();
     $empid = Targetassign::where('Employeeid', $varr)->whereIn('Eventcode', $ev)->get();
     return View('initiator/updatenewdeal')->with(array('evarr' => $evarr, 'emp' => $emp, 'empid' => $empid, 'leadid' => $leadid, 'cat' => $cat));
 }