Commit cb4ab009 by Azhan Hannan

Log Pia #107, #108, #109

parent 5700e67c
......@@ -103,6 +103,7 @@
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->where('td_hours','<>',0)
->first();
$totalcharge += data_get($valchargehour,'td_hours');
// dump($totalcharge);
......@@ -125,6 +126,7 @@
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->where('td_hours','<>',0)
->first();
$totalcharge += data_get($valchargehour,'td_hours');
}
......@@ -137,11 +139,11 @@
@endfor
@endif
@if($totalcharge)
<td>{{ number_format($totalcharge, 1, '.', '') }}</td>
<td>{{ number_format($totalcharge/8, 1, '.', '') }}</td>
<td style="width: 5%">{{ number_format($totalcharge, 1, '.', '') }}</td>
<td style="width: 5%">{{ number_format($totalcharge/8, 1, '.', '') }}</td>
@else
<td>0</td>
<td>0</td>
<td style="width: 5%">0</td>
<td style="width: 5%">0</td>
@endif
</tr>
@endforeach
......@@ -362,7 +364,7 @@
<div class="field">
<label>Action</label>
<select class="ui fluid dropdown" name="action">
<option value="1">Approval</option>
<option value="1">Approve</option>
<option value="2">Reject</option>
</select>
</div>
......
......@@ -103,6 +103,7 @@
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->where('td_hours','<>',0)
->first();
$totalcharge += data_get($valchargehour,'td_hours');
// dump($totalcharge);
......@@ -125,6 +126,7 @@
$valchargehour = $chargehour->where('td_date','=',$date)
->where('td_project',$projectchargeable['pid'])
->where('tm_phase',$phase)
->where('td_hours','<>',0)
->first();
$totalcharge += data_get($valchargehour,'td_hours');
}
......@@ -137,11 +139,11 @@
@endfor
@endif
@if($totalcharge)
<td>{{ number_format($totalcharge, 1, '.', '') }}</td>
<td>{{ number_format($totalcharge/8, 1, '.', '') }}</td>
<td style="width: 5%">{{ number_format($totalcharge, 1, '.', '') }}</td>
<td style="width: 5%">{{ number_format($totalcharge/8, 1, '.', '') }}</td>
@else
<td>0</td>
<td>0</td>
<td style="width: 5%">0</td>
<td style="width: 5%">0</td>
@endif
</tr>
@endforeach
......@@ -356,7 +358,7 @@
<div class="field">
<label>Action</label>
<select class="ui fluid dropdown" name="action">
<option value="1">Approval</option>
<option value="1">Approve</option>
<option value="2">Reject</option>
</select>
</div>
......
......@@ -789,10 +789,10 @@ class DashboardController extends Controller
$pm = Users::find(Auth::id());
// if(data_get($request,'page') == 1){
// return redirect()->route('timesheet::dashboard.index')->withWarning('You wanted to rejected the project submission. Kindly give remarks for team references. Thank you 😊');
// return redirect()->route('timesheet::dashboard.index')->withWarning('You wanted to rejected the project submission. Kindly give remarks for team references. Thank you.');
// }
return redirect()->route('timesheet::dashboard.projectaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the project submission. Kindly give remarks for team references. Thank you 😊');
return redirect()->route('timesheet::dashboard.projectaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the project submission. Kindly give remarks for team references. Thank you.');
}
// dd($request);
......@@ -900,7 +900,7 @@ class DashboardController extends Controller
$pm = Users::find(Auth::id());
if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.revaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the overhead submission. Kindly give remarks for staff references. Thank you 😊');
return redirect()->route('timesheet::dashboard.revaction', compact('profile', 'pm', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to rejected the overhead submission. Kindly give remarks for staff references. Thank you.');
}
}
......@@ -1147,11 +1147,11 @@ class DashboardController extends Controller
$bod = Users::find(Auth::id());
if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.index')->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you 😊');
}
// if(data_get($request,'page') == 1){
// return redirect()->route('timesheet::dashboard.index')->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you.');
// }
return redirect()->route('timesheet::dashboard.approvalaction', compact('profile', 'bod', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you 😊');
return redirect()->route('timesheet::dashboard.approvalaction', compact('profile', 'bod', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you.');
}
// dd($request);
......@@ -1203,11 +1203,11 @@ class DashboardController extends Controller
]);
}
if(data_get($request,'page') == 1){
// if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.index')->withSuccess('Staff project has been approved.');
}
// }
return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withSuccess('Staff project has been approved.');
// return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withSuccess('Staff project has been approved.');
} else {
......@@ -1243,11 +1243,11 @@ class DashboardController extends Controller
]);
}
if(data_get($request,'page') == 1){
// if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.index')->withErrors('Staff project has been rejected with remarks');
}
// }
return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withErrors('Staff project has been rejected with remarks');
// return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withErrors('Staff project has been rejected with remarks');
}
}
......@@ -1405,7 +1405,7 @@ class DashboardController extends Controller
foreach ($checknotes as $key => $value) {
if($value->td_overhead_note == null)
{
return redirect()->route('timesheet::form.notelist', ['year' => $request->year, 'month'=> $request->month, 'phase'=> $request->phase, 'fk_tm_id'=> $request->tid ])->withSuccess('Kindly fill in and save your notes before submit your timesheet. Thank you 😊');
return redirect()->route('timesheet::form.notelist', ['year' => $request->year, 'month'=> $request->month, 'phase'=> $request->phase, 'fk_tm_id'=> $request->tid ])->withSuccess('Kindly fill in and save your notes before submit your timesheet. Thank you.');
}
}
......@@ -1626,7 +1626,7 @@ class DashboardController extends Controller
public function selectapproval(Request $request)
{
// dd($request->pid);
// dd($request);
if($request->pid)
{
}
......@@ -1791,42 +1791,334 @@ class DashboardController extends Controller
return view('timesheet::dashboard.selectapprovalpage', compact('tm' ,'phase', 'month', 'year', 'staff', 'strMonth', 'profile', 'strdays', 'overheadlist', 'overheadhour', 'totaloverheadhrs', 'chargeablelist', 'chargehour', 'totalchargehrs', 'page', 'bod', 'daymonth'));
}
public function approvalselected(Request $request)
public function selectapprovalpage(Request $request)
{
// dd($request);
$pid = [];
foreach ($request->pid as $key => $value) {
$pid[] = $value;
}
// dd($pid);
$tmid = $request->tmid;
$page = data_get($request,'page');
if($request->action == 2 && $request->remarks == null)
{
$user = Staff_info::where('id', Auth::id())->first();
// dd($user);
$bod = Users::find(Auth::id());
$tm = Ts_master::where('id', $request->tmid)->first();
$staffid = data_get($tm,'tm_staff_id');
$profile = Tproject::whereIn('id', $pid)
->with('team')
->get();
// dd($profile);
// dd($request);
// $tpid = $profile->id;
// $year = $profile->tp_year;
// $month = $profile->tp_month;
// $phase = $profile->tp_phase;
$phase = $tm->tm_phase;
$month = $tm->tm_month;
$year = $tm->tm_year;
$staff = VwViewer::where('STAFF_ID', $tm->tm_staff_id)
->first();
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$myDate = $month.'/'.'1'.'/'.$year;
$date = Carbon::createFromFormat('m/d/Y', $myDate);
$strMonth = $date->format('F');
$strdays = [];
for ($i=0; $i < $daymonth; $i++) {
$tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l');
$strdays[$i] = substr($strday, 0, 3);
}
$chargeable = 1;
$overhead = 3;
$check = Ts_master::where('tm_staff_id', $tm->tm_staff_id)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->with('attachement')
->first();
$chargeableproject = Tproject::whereIn('id', $pid)
->where('tp_project_type', 1)
->with('project')
->get();
$chargeablelist = [];
$overheadlist = [];
foreach($chargeableproject as $key => $value) {
// dd($value);
$chargeablelist[] = [
'pid' => $value->td_project,
'pcode' => data_get($value,'project.p_project_code'),
'pname' => data_get($value,'tp_project_name'),
];
}
// dd($chargeablelist);
if($check)
{
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
$tempOverhead[0] = "";
$tempOverheadid[0] = 0;
if(isset($overheadhour[0]))
{
// dd('sini ke?');
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++)
{
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
}
else
{
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
if (count($profile) > 0) {
foreach ($profile as $key => $value) {
if($value->tp_project_type == 3){
$overheadlist[] = [
'pid' => $value->fk_o_id,
'pname' => $value->tp_project_name,
];
}
}
// dd($overheadlist);
}
}
else
{
// dd('ke sini?');
}
$totalchargehrs = $check->tm_chargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $tm->tm_staff_id)
->where('td_project_type', $overhead)
->whereNotNull('td_hours')
->orderby('td_date')
->get();
}
else
{
$chargehour = null;
$overheadhour = null;
$totalchargehrs = null;
$totaloverheadhrs = null;
$notes = null;
$check = null;
}
$page = data_get($request,'page');
$user = Staff_info::where('id', Auth::id())->first();
// dd($user);
$bod = Users::find(Auth::id());
if(data_get($request,'page') == 1){
return redirect()->route('timesheet::dashboard.index')->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you');
$tm = Ts_master::where('id', $request->tmid)->first();
$staffid = data_get($tm,'tm_staff_id');
$profile = Tproject::whereIn('id', $pid)
->with('team')
->get();
// dd($profile);
$phase = $tm->tm_phase;
$month = $tm->tm_month;
$year = $tm->tm_year;
$staff = VwViewer::where('STAFF_ID', $tm->tm_staff_id)
->first();
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$myDate = $month.'/'.'1'.'/'.$year;
$date = Carbon::createFromFormat('m/d/Y', $myDate);
$strMonth = $date->format('F');
$strdays = [];
for ($i=0; $i < $daymonth; $i++) {
$tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l');
$strdays[$i] = substr($strday, 0, 3);
}
$chargeable = 1;
$overhead = 3;
$check = Ts_master::where('tm_staff_id', $tm->tm_staff_id)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->with('attachement')
->first();
$chargeableproject = Tproject::whereIn('id', $pid)
->where('tp_project_type', 1)
->with('project')
->get();
$chargeablelist = [];
$overheadlist = [];
foreach($chargeableproject as $key => $value) {
// dd($value);
$chargeablelist[] = [
'pid' => $value->td_project,
'pcode' => data_get($value,'project.p_project_code'),
'pname' => data_get($value,'tp_project_name'),
];
}
// dd($chargeablelist);
if($check)
{
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$overheadhour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
$tempOverhead[0] = "";
$tempOverheadid[0] = 0;
if(isset($overheadhour[0]))
{
// dd('sini ke?');
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++)
{
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
}
else
{
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
return redirect()->route('timesheet::dashboard.approvalaction', compact('profile', 'bod', 'tpid', 'year', 'month', 'phase'))->with('warning', 'You wanted to reject the submission. Kindly give remarks for staff references. Thank you 😊');
if (count($profile) > 0) {
foreach ($profile as $key => $value) {
if($value->tp_project_type == 3){
$overheadlist[] = [
'pid' => $value->fk_o_id,
'pname' => $value->tp_project_name,
];
}
}
// dd($overheadlist);
}
}
else
{
// dd('ke sini?');
}
$totalchargehrs = $check->tm_chargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $tm->tm_staff_id)
->where('td_project_type', $overhead)
->whereNotNull('td_hours')
->orderby('td_date')
->get();
}
else
{
$chargehour = null;
$overheadhour = null;
$totalchargehrs = null;
$totaloverheadhrs = null;
$notes = null;
$check = null;
}
return view('timesheet::dashboard.selectapprovalpage', compact('tm' ,'phase', 'month', 'year', 'staff', 'strMonth', 'profile', 'strdays', 'overheadlist', 'overheadhour', 'totaloverheadhrs', 'chargeablelist', 'chargehour', 'totalchargehrs', 'page', 'bod', 'daymonth'));
}
public function approvalselected(Request $request)
{
// dd($request);
$pid = [];
foreach ($request->pid as $key => $value) {
$pid[] = $value;
}
$tmid = $request->tmid;
$page = data_get($request,'page');
$tmaster = Ts_master::where('id', data_get($request,'tmid'))->first();
$year = data_get($tmaster,'tp_year');
$month = data_get($tmaster,'tp_month');
$phase = data_get($tmaster,'tp_phase');
if($request->action == 2 && $request->remarks == null)
{
return redirect()->route('timesheet::dashboard.selectapprovalpage', compact('tmid','page','pid'))->with('warning','You wanted to reject the submission. Kindly give remarks for staff references. Thank you.');
}
// dd('wait a minute');
if ($request->action == 1) {
$projects = Tproject::whereIn('id',$pid)
->update([
......@@ -1834,7 +2126,6 @@ class DashboardController extends Controller
'approver_remark' => data_get($request,'remarks')
]);
$checkprojectsapproved = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 4)
->get();
......@@ -1895,6 +2186,7 @@ class DashboardController extends Controller
public function approveallaction(Request $request)
{
// dd($request);
$user = Staff_info::where('id', Auth::id())->first();
$chargeableproject = Tproject::where('tp_project_type', 1)
......@@ -2074,7 +2366,9 @@ class DashboardController extends Controller
if (data_get($request,'action') == 2 && data_get($request,'remarks') == null) {
// dd('sini');
return redirect()->route('timesheet::dashboard.index')->withErrors('Please enter remarks for the timesheet rejection');
$tmid = data_get($request,'tmid');
$page = data_get($request,'page');
return redirect()->route('timesheet::dashboard.approveallaction', compact('tmid', 'page'))->with('warning','Please enter remarks for the timesheet rejection');
}
// dd($request);
if (data_get($request,'cid')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment