<?php continue; ?> @else <td width='48%' colspan='3' align="center">{{$values->value}}</td> </tr> @endif <?php } } //End of Addon Display } //Total Function Counting $taskp = TaskDetails::find($lastid); $lastdate = date('Y-m-d', strtotime($taskp->dateFinished)); $start = new DateTime($sectionfirstdate); $end = new DateTime($lastdate); // otherwise the end date is excluded (bug?) $end->modify('+1 day'); $interval = $end->diff($start); // total days $days = $interval->days; // create an iterateable period of date (P1D equates to 1 day) $period = new DatePeriod($start, new DateInterval('P1D'), $end); // best stored as array, so you can add more than one $holidays = array('2012-09-07'); foreach ($period as $dt) { $curr = $dt->format('D'); // for the updated question
<a href="/task/active">Active Tasks<span class="badge pull-right tool-tip" data-placement="left" title="No. of active task"> <?php $user_id = Auth::user()->id; $date_today = date('Y-m-d H:i:s'); $taskcount = TaskDetails::where('status', 'Active')->where("dueDate", ">", $date_today)->whereAssigneeId($user_id)->count(); echo $taskcount; ?> </span></a> </li> <li class="{{Request::is('task/overdue') ? 'active':''}}"> <a href="/task/overdue">Overdue Tasks<span class="badge pull-right tool-tip" data-placement="left" title="No. of overdue task"> <?php $taskcount = 0; $date_today = date('Y-m-d H:i:s'); $taskd = TaskDetails::where('status', 'Active')->where("dueDate", "<", $date_today)->whereAssigneeId($user_id)->count(); echo $taskd; ?> </span></a> </li> </ul> </li> @endif </ul> <ul class="nav navbar-nav navbar-right navbar-user"> @if( Entrust::hasRole('Administrator') ) <li class="dropdown user-dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Administration <b class="caret" style="margin-top: 0;"></b></a>
public function taskpagecall($id) { $user_id = Auth::User()->id; $taskd = TaskDetails::find($id); $task = Task::find($taskd->task_id); $desig = UserHasDesignation::where('users_id', $user_id)->where('designation_id', $task->designation_id)->count(); if ($taskd->status == "Done") { return Redirect::to("task/active"); } if ($taskd->status == "New") { if ($desig == 0) { return Redirect::to('/'); } else { Session::put('taskdetails_id', $id); return View::make('tasks.task'); } } else { if ($taskd->assignee_id == $user_id) { Session::put('taskdetails_id', $id); return View::make('tasks.task'); } else { return Redirect::to('/'); } } }
echo 'value="' . Session::get('custom1') . '"'; Session::forget('custom1'); } else { echo "value = '" . $today . "'"; } } ?> /> </div> </td> <td class="edit-pr-input"> <?php $newid = $taskc->id - 1; $taskprev = TaskDetails::find($newid); ?> @if($taskprev->doc_id!=$taskc->doc_id) <input id="datebasis" type="hidden" name="datebasis" value="{{date('m/d/y', strtotime($purchaseToEdit->dateReceived))}}"> @elseif("1899-11-30 00:00:00"==$taskprev->dateFinished||"0000-00-00 00:00:00"==$taskprev->dateFinished) <input id="datebasis" type="hidden" name="datebasis" value="{{date('m/d/y', strtotime($taskprev->updated_at))}}"> @else <input id="datebasis" type="hidden" name="datebasis" value="{{date('m/d/y', strtotime($taskprev->dateFinished))}}">
@extends('layouts.dashboard') @section('content') <h1 class="page-header">Overdue Tasks</h1> <div class="list-group"> <!-- Get all task details with id = task->id --> <?php $user_id = Auth::user()->id; $date_today = date('Y-m-d H:i:s'); $taskDetails_row = TaskDetails::whereIn('task_id', $taskIds)->whereStatus("Active")->where("dueDate", "<", $date_today)->whereAssigneeId($user_id)->paginate(10); ?> @foreach($taskDetails_row as $taskDetail) {{Session::put('$taskDetails_row','true');}} <?php $task = Task::find($taskDetail->task_id); $doc_id = $taskDetail->doc_id; $document_row = Document::find($doc_id); $purchase_id = $document_row->pr_id; $purchase_row = Purchase::find($purchase_id); $projectName = $purchase_row->projectPurpose; $controlNo = $purchase_row->controlNo; ?> <a href="/task/{{$taskDetail->id}}" class="list-group-item tasks"> <div class="pull-left task-desc" style="margin-left: 10px;"> <span class="list-group-item-heading">{{ $task->taskName }}</span> <small><i> </small><br/> <span class="list-group-item-text">{{ $task->description }}</span> <br>Control No. : <small><font color="blue"><?php echo str_pad($controlNo, 5, '0', STR_PAD_LEFT);
@extends('layouts.dashboard') @section('content') <h1 class="page-header">New Tasks</h1> <div class="list-group"> <!-- Get all task details with id = task->id --> <?php $user_id = Auth::user()->id; $taskDetails_row = TaskDetails::whereIn('task_id', $taskIds)->whereStatus("New")->paginate(10); ?> @foreach($taskDetails_row as $taskDetail) {{Session::put('$taskDetails_row','true');}} <?php $task = Task::find($taskDetail->task_id); $doc_id = $taskDetail->doc_id; $document_row = Document::find($doc_id); $purchase_id = $document_row->pr_id; $purchase_row = Purchase::find($purchase_id); $projectName = $purchase_row->projectPurpose; $controlNo = $purchase_row->controlNo; ?> <a href="/task/{{$taskDetail->id}}" class="list-group-item tasks"> <div class="pull-left task-desc" style="margin-left: 10px;"> <span class="list-group-item-heading">{{ $task->taskName }}</span> <small><i> </small><br/> <span class="list-group-item-text">{{ $task->description }}</span> <br>Control No. : <small><font color="blue"><?php echo str_pad($controlNo, 5, '0', STR_PAD_LEFT); ?>
public function philgeps() { Session::put('goToChecklist', 'true'); //Initializations $referenceno = strip_tags(Input::get('referenceno')); $datepublished = Input::get('datepublished'); $enddate = Input::get('enddate'); $by = " " . strip_tags(Input::get('by')); $by = preg_replace('/\\s+/', ' ', $by); if ($by == " ") { $by = "None"; } $taskdetails_id = Input::get('taskdetails_id'); $check = 0; $taskd = TaskDetails::find($taskdetails_id); $docs = Document::find($taskd->doc_id); if ($taskd->status == "Done") { Session::put('errorchecklist', 'Saved failed. Task was already completed by another user.'); return Redirect::back(); } //Validation Process if (ctype_alnum(str_replace(array(' ', '-', '.', ',', 'ñ', 'Ñ'), '', $by))) { $check = $check + 1; } if (ctype_alnum(str_replace(array(' ', '-', '.'), '', $referenceno))) { $check = $check + 1; } if ($check == 2) { $id = $docs->pr_id; $delcount = Count::where('doc_id', $docs->id)->delete(); $userx = User::get(); foreach ($userx as $userv) { $count = new Count(); $count->user_id = $userv->id; $count->doc_id = $docs->id; $count->save(); } Session::put('successchecklist', 'Task completed.'); $taskd = TaskDetails::find($taskdetails_id); $taskd->status = "Done"; $taskd->custom1 = $referenceno; $taskd->custom2 = $datepublished; $taskd->custom3 = $enddate; $taskd->assignee = $by; $taskd->save(); $tasknext = TaskDetails::find($taskdetails_id + 1); $tasknextc = TaskDetails::where('id', $taskdetails_id + 1)->where('doc_id', $docs->pr_id)->count(); date_default_timezone_set("Asia/Manila"); $upDate = date('Y-m-d H:i:s'); DB::table('purchase_request')->where('id', $id)->update(array('updated_at' => $upDate)); DB::table('taskdetails')->where('id', $taskdetails_id)->update(array('dateFinished' => $upDate)); if ($tasknextc != 0) { //Project Type Filter $counter = 1; $tasknext = TaskDetails::find($taskdetails_id + $counter); while ($tasknext->status == "Lock" || $tasknext->status == "Done") { $counter = $counter + 1; $tasknext = TaskDetails::find($taskdetails_id + $counter); } $tasknext->status = "New"; $tasknext->save(); //End Project Type Filter } else { $purchase = Purchase::find($docs->pr_id); $purchase->status = "Closed"; $purchase->save(); $request_id = Input::get('pr_id'); return Redirect::to("purchaseRequest/vieweach/{$request_id}"); } } else { Session::put('errorchecklist', 'Invalid input.'); return Redirect::back()->withInput(); } return Redirect::back(); }
public function janisawesome() { function generateRandomString($length = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; } return $randomString; } function generateRandomAmount() { $length = rand(4, 8); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= rand(1, 9); } return $randomString; } $numLoop = 1; while ($numLoop < 301) { $purchase = new Purchase(); $document = new Document(); $purchase->projectPurpose = generateRandomString(); $purchase->sourceOfFund = generateRandomString(); $controlAmt = generateRandomAmount(); $controlAmt .= ".00"; $purchase->amount = number_format($controlAmt); $purchase->office = "1"; $purchase->requisitioner = "1"; $purchase->dateRequested = date('Y-m-d H:i:s'); $purchase->dateReceived = date('Y-m-d H:i:s'); $purchase->status = 'Active'; $purchase->otherType = " "; // Get latest control number $cn = 0; $purchase_controlNo = Purchase::orderBy('ControlNo', 'DESC')->first(); if (!$purchase_controlNo == NuLL) { $cn = $purchase_controlNo->controlNo; } $cn += 1; $purchase->controlNo = $cn; if (Input::get('otherType') == ' ') { $purchase->projectType = "None"; } else { $purchase->projectType = "None"; } // Set creator id $user_id = Auth::user()->id; $purchase->created_by = $user_id; $purchase_save = $purchase->save(); if ($purchase_save) { if ($controlAmt < 50000) { $amtControl = 1; } else { if ($controlAmt >= 50000 && $controlAmt <= 500000) { $amtControl = 2; } else { if ($controlAmt >= 500000) { $amtControl = 3; } } } $document->pr_id = $purchase->id; $document->work_id = $amtControl; $document_save = $document->save(); if ($document_save) { $doc_id = $document->id; $workflow = Workflow::find($document->work_id); $section = Section::where('workflow_id', $document->work_id)->orderBy('section_order_id', 'ASC')->get(); $firstnew = 0; // Set due date; $new_purchase = Purchase::find($purchase->id); $workflow_id = "1"; $workflow = Workflow::find($workflow_id); $addToDate = $workflow->totalDays; date_default_timezone_set("Asia/Manila"); $dueDate = date('Y-m-d H:i:s', strtotime("+{$addToDate} days")); $new_purchase->dueDate = $dueDate; $new_purchase->save(); $tasks = Task::where('wf_id', $document->work_id)->orderBy('section_id', 'ASC')->orderBy('order_id', 'ASC')->get(); foreach ($tasks as $task) { $task_details = new TaskDetails(); $task_details->task_id = $task->id; $stringamount = $new_purchase->amount; $stringamount = str_replace(str_split(','), '', $stringamount); $amount = (double) $stringamount; if ($firstnew == 0) { $task_details->status = "New"; } else { $task_details->status = "Pending"; } //Project Type if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT" || $task->taskName == "PRE-BID CONFERENCE") { $task_details->status = "Lock"; if ($new_purchase->projectType == "Goods/Services") { if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") { if ($amount > 2000000) { $task_details->status = "Pending"; } } else { if ($task->taskName == "PRE-BID CONFERENCE") { if ($amount > 1000000) { $task_details->status = "Pending"; } } } } elseif ($new_purchase->projectType == "Infrastructure") { if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") { if ($amount > 5000000) { $task_details->status = "Pending"; } } else { if ($task->taskName == "PRE-BID CONFERENCE") { if ($amount > 1000000) { $task_details->status = "Pending"; } } } } elseif ($new_purchase->projectType == "Consulting Services") { if ($amount > 1000000) { $task_details->status = "Pending"; } } } //End Project Type $firstnew = 1; $task_details->doc_id = $document->id; $task_details->save(); } $users = User::all(); foreach ($users as $user) { $count = new Count(); $count->user_id = $user->id; $count->doc_id = $doc_id; $count->save(); } $pr_id = Session::get('pr_id'); DB::table('attachments')->where('doc_id', $doc_id)->update(array('saved' => 1)); DB::table('attachments')->where('saved', '=', 0)->delete(); Session::forget('doc_id'); $connected = true; // $connected = @fsockopen("www.google.com", 80); //website, port (try 80 or 443) if (!$connected) { $sendee = DB::table('users')->where('id', $purchase->requisitioner)->first(); $email = $sendee->email; $fname = $sendee->firstname; $data = ['id' => $purchase->id]; Mail::send('emails.template', $data, function ($message) use($email, $fname) { $message->from('*****@*****.**', 'Procurement Tracking System Tarlac'); $message->to($email, $fname)->subject('Tarlac Procurement Tracking System: New Purchase Request Created'); }); $notice = "Purchase request created successfully. "; // Insert data to reports table $date_received = Input::get('dateReceived'); $date_received = substr($date_received, 0, strrpos($date_received, ' ')); $reports = Reports::whereDate($date_received)->first(); if ($reports == null) { $reports = new Reports(); $reports->date = $date_received; $reports->pRequestCount = 1; } else { $reports->pRequestCount = $reports->pRequestCount + 1; } $reports->save(); //End Reports } else { // Insert data to reports table $date_received = Input::get('dateReceived'); $date_received = substr($date_received, 0, strrpos($date_received, ' ')); $reports = Reports::whereDate($date_received)->first(); if ($reports == null) { $reports = new Reports(); $reports->date = $date_received; $reports->pRequestCount = 1; } else { $reports->pRequestCount = $reports->pRequestCount + 1; } $reports->save(); //End Reports $notice = "Purchase request created successfully. Email notice was not sent. "; } Session::put('notice', $notice); $office = Office::all(); $users = User::all(); $workflow = Workflow::all(); //return Redirect::to('purchaseRequest/view'); return Redirect::to('janisawesome'); Session::put('imgsuccess', 'Files uploaded.'); } else { $message = "Failed to create purchase request."; Session::put('main_error', $message); // Get Other Error Messages $error_projectPurpose = $purchase->validationErrors->first('projectPurpose'); $error_projectType = $purchase->validationErrors->first('projectType'); $error_sourceOfFund = $purchase->validationErrors->first('sourceOfFund'); $error_amount = $purchase->validationErrors->first('amount'); $error_office = $purchase->validationErrors->first('office'); $error_requisitioner = $purchase->validationErrors->first('requisitioner'); $error_dateRequested = $purchase->validationErrors->first('dateRequested'); $error_dateReceived = $purchase->validationErrors->first('dateReceived'); // Inserting Error Message To a Session Session::put('error_projectPurpose', $error_projectPurpose); Session::put('error_sourceOfFund', $error_sourceOfFund); Session::put('error_amount', $error_amount); Session::put('error_office', $error_office); Session::put('error_requisitioner', $error_requisitioner); Session::put('error_dateRequested', $error_dateRequested); Session::put('error_dateReceived', $error_dateReceived); Session::put('error_projectType', $error_projectType); if (Input::get('hide_modeOfProcurement') == "") { Session::put('m6', 'required'); } Session::put('imgsuccess', 'Files uploaded.'); return Redirect::back()->withInput(); } } else { // Set Main Error $message = "Failed to create purchase request."; Session::put('main_error', $message); // Get Other Error Messages $error_projectPurpose = $purchase->validationErrors->first('projectPurpose'); $error_projectType = $purchase->validationErrors->first('projectType'); $error_sourceOfFund = $purchase->validationErrors->first('sourceOfFund'); $error_amount = $purchase->validationErrors->first('amount'); $error_office = $purchase->validationErrors->first('office'); $error_requisitioner = $purchase->validationErrors->first('requisitioner'); $error_dateRequested = $purchase->validationErrors->first('dateRequested'); $error_dateReceived = $purchase->validationErrors->first('dateReceived'); // Inserting Error Message To a Session Session::put('error_projectPurpose', $error_projectPurpose); Session::put('error_sourceOfFund', $error_sourceOfFund); Session::put('error_amount', $error_amount); Session::put('error_office', $error_office); Session::put('error_requisitioner', $error_requisitioner); Session::put('error_dateRequested', $error_dateRequested); Session::put('error_dateReceived', $error_dateReceived); Session::put('error_projectType', $error_projectType); if (Input::get('hide_modeOfProcurement') == "") { Session::put('error_modeOfProcurement', 'required'); } if (Session::get('imgerror') && Input::hasfile('file')) { $failedpurchasecount = Purchase::where('id', $purchase->id)->count(); if ($failedpurchasecount != 0) { $failedpurchase = Purchase::find($purchase->id); $failedpurchase->delete(); } Session::forget('imgsuccess'); //Image Error Return $task_details = TaskDetails::where('doc_id', $document->id)->delete(); $document->delete(); $message = "Failed to create purchase request."; // Set Main Error $message = "Failed to save purchase request."; Session::put('main_error', $message); // Get Other Error Messages $error_projectPurpose = $purchase->validationErrors->first('projectPurpose'); $error_projectType = $purchase->validationErrors->first('projectType'); $error_sourceOfFund = $purchase->validationErrors->first('sourceOfFund'); $error_amount = $purchase->validationErrors->first('amount'); $error_office = $purchase->validationErrors->first('office'); $error_requisitioner = $purchase->validationErrors->first('requisitioner'); $error_dateRequested = $purchase->validationErrors->first('dateRequested'); $error_dateReceived = $purchase->validationErrors->first('dateReceived'); // Inserting Error Message To a Session Session::put('error_projectPurpose', $error_projectPurpose); Session::put('error_sourceOfFund', $error_sourceOfFund); Session::put('error_amount', $error_amount); Session::put('error_office', $error_office); Session::put('error_requisitioner', $error_requisitioner); Session::put('error_dateRequested', $error_dateRequested); Session::put('error_dateReceived', $error_dateReceived); Session::put('error_projectType', $error_projectType); } return Redirect::back()->withInput(); } $numLoop++; } }