Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
3
3f-timesheet
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dockers
3f-timesheet
Commits
d6c3e86c
Commit
d6c3e86c
authored
Oct 26, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tkde detail project untuk PM nak refer
Expectation: -Tepek detail timesheet ni ke dalam SCREEN VERIFY/PROJECT
parent
7334001a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
317 additions
and
27 deletions
+317
-27
packages/portal/timesheet/resources/views/dashboard/projectaction.blade.php
+184
-25
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+133
-2
No files found.
packages/portal/timesheet/resources/views/dashboard/projectaction.blade.php
View file @
d6c3e86c
...
...
@@ -3,8 +3,188 @@
@
section
(
'content'
)
<
div
class
="
ui
segment
">
<a class="
ui
blue
left
ribbon
label
">{{data_get(
$profile
, 'project.p_project_description')}}</a>
<br><br>
<a class="
ui
blue
left
ribbon
label
">Project Verification</a>
<br>
<table class="
ui
unstackable
collapsing
table
" style="
width
:
100
%
">
<tbody>
<tr>
<td rowspan="
3
">
<img src="
{{
url
(
'img/3f-logo.svg'
)
}}
" height="
126
" width="
126
" alt="
3
f
-
logo
">
</td>
<td>Name</td>
<td>:</td>
<td>{{ data_get(
$staff
,'STAFF_NAME') }}</td>
<td rowspan="
3
"></td>
<td>Department</td>
<td>:</td>
<td>{{ data_get(
$staff
,'DEPARTMENT') }}</td>
<td rowspan="
3
"></td>
</tr>
<tr>
<td>Staff No</td>
<td>:</td>
<td>{{ data_get(
$staff
,'STAFF_ID') }}</td>
<td>Reporting Manager</td>
<td>:</td>
<td>{{ data_get(
$staff
,'HOD_NAME') }}</td>
</tr>
<tr>
<td>Month</td>
<td>:</td>
<td>{{
$strMonth
}}</td>
<td>Phase</td>
<td>:</td>
<td>
@if(
$phase
== 1) 1st Half-month
@else 2nd Half-month
@endif
</td>
</tr>
</tbody>
</table>
<table class="
ui
celled
structured
table
unstackable
">
<thead>
<tr>
<th colspan="
3
" rowspan="
2
" class="
center
aligned
">Chargeable</th>
<th colspan="
@
if
(
$phase
==
1
)
15
@
else
{{
$daymonth
-
15
}}
@
endif
" class="
center
aligned
">Date</th>
<th colspan="
2
" rowspan="
2
" class="
center
aligned
">Total</th>
</tr>
<tr>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<th>
{
{$i+1}
}
</th>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<th>
{
{$i+1}
}
</th>
@endfor
@endif
</tr>
<tr>
<th style="
width
:
4
%
;
"></th>
<th style="
width
:
10
%
;
">Project Code</th>
<th style="
width
:
13
%
;
">Project Name</th>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<th>
{
{$strdays[$i]}
}
</th>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<th>
{
{$strdays[$i]}
}
</th>
@endfor
@endif
<th>Hours</th>
<th>Days</th>
</tr>
</thead>
<tbody>
@foreach(
$chargeablelist
as
$key
=>
$projectchargeable
)
<?php
$totalcharge
= 0; ?>
<tr>
<td style="
width
:
4
%
;
"></td>
<td style="
width
:
10
%
;
">{{
$projectchargeable['pcode']
}}</td>
<td style="
width
:
13
%
;
">{{
$projectchargeable['pname']
}}</td>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<?php
$valchargehour
= '';
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if(
$chargehour
)
{
// dd('masuk');
// dd(
$chargehour
);
$valchargehour
=
$chargehour->where
('td_date','=',
$date
)
->where('td_project',
$projectchargeable['pid']
)
->where('tm_phase',
$phase
)
->first();
$totalcharge
+= data_get(
$valchargehour
,'td_hours');
// dump(
$totalcharge
);
}
// dump(
$valchargehour
);
?>
@if(
$valchargehour
)
<td style="
width
:
4
%
;
">{{ data_get(
$valchargehour
,'td_hours') }}</td>
@else
<td style="
width
:
4
%
;
"></td>
@endif
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<?php
$valchargehour
= '';
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if(
$chargehour
)
{
$valchargehour
=
$chargehour->where
('td_date','=',
$date
)
->where('td_project',
$projectchargeable['pid']
)
->where('tm_phase',
$phase
)
->first();
$totalcharge
+= data_get(
$valchargehour
,'td_hours');
}
?>
@if(
$valchargehour
)
<td style="
width
:
4
%
;
">{{ data_get(
$valchargehour
,'td_hours') }}</td>
@else
<td style="
width
:
4
%
;
"></td>
@endif
@endfor
@endif
@if(
$totalcharge
)
<td>{{ number_format(
$totalcharge
, 1, '.', '') }}</td>
<td>{{ number_format(
$totalcharge
/8, 1, '.', '') }}</td>
@else
<td>0</td>
<td>0</td>
@endif
</tr>
@endforeach
</tbody>
<tfoot>
<th colspan="
3
">Total (A)</th>
@if(
$phase
== 1)
@for(
$i
= 0;
$i
< 15 ;
$i
++)
<?php
$totalcbyday
= 0;
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if (
$chargehour
)
{
$valcbyday
=
$chargehour->where
('td_date','=',
$date
)
->where('tm_phase',
$phase
);
foreach(
$valcbyday
as
$key
=>
$value
)
{
$totalcbyday
+= data_get(
$value
,'td_hours');
}
}
?>
<th>{{
$totalcbyday
}}</th>
@endfor
@else
@for(
$i
= 15;
$i
<
$daymonth
;
$i
++)
<?php
$totalcbyday
= 0;
$date
=
$year
.'-'.sprintf('%02d',
$month
).'-'.sprintf('%02d',
$i
+1);
if (
$chargehour
)
{
$valcbyday
=
$chargehour->where
('td_date','=',
$date
)
->where('tm_phase',
$phase
);
foreach(
$valcbyday
as
$key
=>
$value
)
{
$totalcbyday
+= data_get(
$value
,'td_hours');
}
}
?>
<th>{{
$totalcbyday
}}</th>
@endfor
@endif
<th>@if(
$totalchargehrs
){{
$totalchargehrs
}}@else 0 @endif</th>
<th>@if(
$totalchargehrs
){{ number_format(
$totalchargehrs
/8, 1, '.', '') }}@else 0 @endif</th>
</tfoot>
</table>
<form action="
{{
route
(
'timesheet::dashboard.verify'
)
}}
" method="
POST
" class="
ui
form
">
{
{csrf_field()}
}
...
...
@@ -13,33 +193,13 @@
<input type="
hidden
" name="
pid
" value="
{{
data_get
(
$profile
,
'td_project'
)
}}
">
<input type="
hidden
" name="
page
" value="
{{
$page
}}
">
<div class="
six
wide
field
">
<label>Staff Name</label>
<input type="
text
" readonly="
readonly
" value="
{{
data_get
(
$profile
,
'team.fullname'
)
}}
">
</div>
<div class="
three
fields
">
<div class="
two
wide
field
">
<label>Year</label>
<input type="
text
" readonly="
readonly
" value="
{{
data_get
(
$profile
,
'tp_year'
)
}}
">
</div>
<div class="
two
wide
field
">
<label>Month</label>
<input type="
text
" readonly="
readonly
" value="
{{
data_get
(
$profile
,
'tp_month'
)
}}
">
</div>
<div class="
two
wide
field
">
<label>Phase</label>
<input type="
text
" readonly="
readonly
" value="
{{
data_get
(
$profile
,
'tp_phase'
)
}}
">
</div>
</div>
<div class="
two
fields
">
<div class="
six
wide
field
">
<div class="
field
">
<input type="
hidden
" name="
verifier
" value="
{{
data_get
(
$pm
,
'id'
)
}}
">
<label>Project Manager</label>
<input type="
text
" readonly="
readonly
" value="
{{
data_get
(
$pm
,
'name'
)
}}
">
</div>
<div class="
three
wide
field
">
<div class="
field
">
<label>Action</label>
<select class="
ui
fluid
dropdown
" name="
action
">
<option value="
1
">Verify</option>
...
...
@@ -51,7 +211,6 @@
<label>Remarks</label>
<textarea name="
remarks
"></textarea>
</div>
<button class="
ui
primary
button
" type="
submit
">Submit</button>
</form>
</div>
...
...
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
d6c3e86c
...
...
@@ -488,9 +488,141 @@ class DashboardController extends Controller
->
first
();
// dd($profile);
// $year = date('Y');
$phase
=
$profile
->
tp_phase
;
$month
=
$profile
->
tp_month
;
$year
=
$profile
->
tp_year
;
$daymonth
=
cal_days_in_month
(
CAL_GREGORIAN
,
$month
,
$year
);
$myDate
=
$month
.
'/'
.
'1'
.
'/'
.
$year
;
$date
=
Carbon
::
createFromFormat
(
'm/d/Y'
,
$myDate
);
$staff
=
VwViewer
::
where
(
'STAFF_ID'
,
$profile
->
staffid
)
->
first
();
$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
);
}
// dd($staff);
$chargeable
=
1
;
$overhead
=
3
;
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$profile
->
staffid
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
with
(
'attachement'
)
->
first
();
$chargeableproject
=
Tproject
::
where
(
'fk_tm_id'
,
data_get
(
$check
,
'id'
))
->
where
(
'tp_project_type'
,
1
)
->
with
(
'project'
)
->
get
();
$chargeablelist
=
[];
$overheadlist
=
[];
foreach
(
$chargeableproject
as
$key
=>
$value
)
{
$chargeablelist
[]
=
[
'pid'
=>
$value
->
td_project
,
'pcode'
=>
$value
->
project
->
p_project_code
,
'pname'
=>
$value
->
project
->
p_project_description
,
];
}
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
;
}
}
foreach
(
$tempOverhead
as
$key
=>
$value
)
{
$overheadlist
[]
=
[
'pid'
=>
$tempOverheadid
[
$key
],
'pname'
=>
$tempOverhead
[
$key
],
];
}
}
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'
,
$profile
->
staffid
)
->
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
;
}
$pm
=
Users
::
find
(
Auth
::
id
());
return
view
(
'timesheet::dashboard.projectaction'
,
compact
(
'profile'
,
'pm'
,
'page'
));
return
view
(
'timesheet::dashboard.projectaction'
,
compact
(
'profile'
,
'pm'
,
'page'
,
'staff'
,
'strMonth'
,
'year'
,
'month'
,
'phase'
,
'strdays'
,
'chargeablelist'
,
'chargehour'
,
'totalchargehrs'
));
}
public
function
verify
(
Request
$request
)
...
...
@@ -900,7 +1032,6 @@ class DashboardController extends Controller
$strMonth
=
$date
->
format
(
'F'
);
$chargeable
=
1
;
$nonchargeable
=
2
;
$overhead
=
3
;
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
staff_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment