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
1ba1c7d7
Commit
1ba1c7d7
authored
Oct 31, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log Kak Shikin #41.1) revamp - Table project report with mandays
parent
106366c5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
78 deletions
+128
-78
packages/portal/timesheet/resources/views/maintenance/mandays.blade.php
+39
-38
packages/portal/timesheet/resources/views/report/project.blade.php
+64
-35
packages/portal/timesheet/src/Http/Controllers/ReportController.php
+18
-5
packages/portal/timesheet/src/Model/Pmandays.php
+7
-0
No files found.
packages/portal/timesheet/resources/views/maintenance/mandays.blade.php
View file @
1ba1c7d7
...
@@ -18,47 +18,48 @@
...
@@ -18,47 +18,48 @@
</thead>
</thead>
<tbody>
<tbody>
<?php
$limit
= count(
$limitrole
);
<?php
$limit
= count(
$limitrole
);
// dd(
$
limit
role
);
// dd(
$role
);
?>
?>
@foreach(
$role
as
$key
=>
$value
)
@foreach(
$role
as
$key
=>
$value
)
<tr>
<tr>
<td class="
single
line
">
{
{$key+1}
}
</td>
<td class="
single
line
">
{
{$key+1}
}
</td>
<!-- <td data-label="
role
">
{
{data_get($value,'role')}
}
</td> -->
<!-- <td data-label="
role
">
{
{data_get($value,'role')}
}
</td> -->
<td data-label="
role
">
{
{data_get($value,'role.role')}
}
</td>
<td data-label="
role
">
{
{data_get($value,'role.role')}
}
</td>
<?php
<?php
$d
=
$h
=
$tdays
=
$thours
= 0;
$d
=
$h
=
$tdays
=
$thours
= 0;
foreach (
$data
as
$key
=>
$datas
) {
foreach (
$data
as
$key
=>
$datas
) {
if ( (data_get(
$datas
,'fk_project') ==
$id
) && (data_get(
$datas
,'pm_roles') == data_get(
$value
,'role.id')) ) {
if ( (data_get(
$datas
,'fk_project') ==
$id
) && (data_get(
$datas
,'pm_roles') == data_get(
$value
,'role.id')) ) {
$d
= data_get(
$datas
, 'pm_days');
$d
= data_get(
$datas
, 'pm_days');
$h
= data_get(
$datas
, 'pm_hours');
$h
= data_get(
$datas
, 'pm_hours');
}
}
if (data_get(
$datas
,'fk_project') ==
$id
) {
if (data_get(
$datas
,'fk_project') ==
$id
) {
$tdays
+= data_get(
$datas
, 'pm_days');
$tdays
+= data_get(
$datas
, 'pm_days');
$thours
+= data_get(
$datas
, 'pm_hours');
$thours
+= data_get(
$datas
, 'pm_hours');
}
}
}
}
?>
?>
<td data-label="
day
">
<td data-label="
day
">
<input type="
text
"
<input type="
text
"
onkeypress="
onlynumber
(
event
)
"
onkeypress="
onlynumber
(
event
)
"
name="
days
[{{
data_get
(
$value
,
'role.id'
)}}]
"
name="
days
[{{
data_get
(
$value
,
'role.id'
)}}]
"
id="
days
[{{
data_get
(
$value
,
'role.id'
)}}]
"
id="
days
[{{
data_get
(
$value
,
'role.id'
)}}]
"
value="
@
if
(
$d
){{
$d
}}
@
else
0
@
endif
"
value="
@
if
(
$d
){{
$d
}}
@
else
0
@
endif
"
onchange="
calcHours
(
this
.
value
,{{
$limit
}},{{
data_get
(
$value
,
'role.id'
)}})
">
onchange="
calcHours
(
this
.
value
,{{
$limit
}},{{
data_get
(
$value
,
'role.id'
)}})
">
</td>
</td>
<td data-label="
hour
">
<td data-label="
hour
">
<input type="
text
"
<input type="
text
"
onkeypress="
onlynumber
(
event
)
"
onkeypress="
onlynumber
(
event
)
"
name="
hours
[{{
data_get
(
$value
,
'role.id'
)}}]
"
name="
hours
[{{
data_get
(
$value
,
'role.id'
)}}]
"
id="
hours
[{{
data_get
(
$value
,
'role.id'
)}}]
"
id="
hours
[{{
data_get
(
$value
,
'role.id'
)}}]
"
value="
@
if
(
$h
){{
$h
}}
@
else
0
@
endif
"
value="
@
if
(
$h
){{
$h
}}
@
else
0
@
endif
"
onchange="
calcDays
(
this
.
value
,{{
$limit
}},{{
data_get
(
$value
,
'role.id'
)}})
">
onchange="
calcDays
(
this
.
value
,{{
$limit
}},{{
data_get
(
$value
,
'role.id'
)}})
">
</td>
</td>
</tr>
</tr>
@endforeach
@endforeach
<tr>
<tr>
<td class="
single
line
"></td>
<td class="
single
line
"></td>
...
...
packages/portal/timesheet/resources/views/report/project.blade.php
View file @
1ba1c7d7
...
@@ -48,42 +48,71 @@
...
@@ -48,42 +48,71 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<?php
$totalhours
=
$totaldays
= 0;
?>
<?php
$totalhours
=
$totaldays
= 0;?>
@foreach(
$pteam
as
$key
=>
$team
)
@foreach(
$pteam
as
$key
=>
$team
)
<tr>
<?php
$balhours
= 0; ?>
<td style="
width
:
10
%
" class="
center
aligned
">
{
{data_get($team,'role')}
}
</td>
@foreach(
$ptstaffs
as
$key
=>
$staff
)
<td class="
center
aligned
">allocation</td>
@if(data_get(
$team
,'pm_roles') == data_get(
$staff
,'roleid'))
<td class="
center
aligned
">accumulate</td>
<?php
<td style="
width
:
10
%
">
{
{data_get($team,'name')}
}
</td>
// dump(
$staff->staffid
);
<td style="
width
:
15
%
" class="
center
aligned
">
$count
=
$ptstaffs->where
('roleid', data_get(
$team
,'pm_roles'));
<?php
$sumhours
= 0; ?>
$acc
=
$accumulate->where
('staffid', data_get(
$staff
,'staffid'));
@foreach(
$ptdetail
as
$key
=>
$hours
)
// dump(
$acc
);
@if(data_get(
$hours
,'staffid') == data_get(
$team
,'staffid'))
?>
<?php
$sumhours
+= data_get(
$hours
,'hours'); ?>
<tr>
<?php
$totalhours
+= data_get(
$hours
,'hours'); ?>
<td style="
width
:
10
%
" class="
center
aligned
">
{
{data_get($team,'role.role')}
}
</td>
@endif
<td class="
center
aligned
">
@endforeach
{
{data_get($team,'pm_days')}
}
Days <br>
@if(
$sumhours
== 0)
{
{data_get($team,'pm_hours')}
}
Hours
@else
{
{$sumhours}
}
<?php
$balhours
= data_get(
$team
,'pm_hours'); ?>
@endif
</td>
</td>
<td class="
center
aligned
">
<td style="
width
:
15
%
" class="
center
aligned
">
<?php
<?php
$sumdays
= 0; ?>
$sum
= 0;
@foreach(
$ptdetail
as
$key
=>
$hours
)
foreach (
$acc
as
$key
=>
$value
) {
@if(data_get(
$hours
,'staffid') == data_get(
$team
,'staffid'))
$sum
+= data_get(
$value
, 'tp_hours');
<!-- {{number_format(data_get(
$hours
,'hours')/8, 1, '.', '')}} -->
}
<?php
$sumdays
+= number_format(data_get(
$hours
,'hours')/8, 1, '.', ''); ?>
?>
<?php
$totaldays
+= number_format(data_get(
$hours
,'hours')/8, 1, '.', ''); ?>
{{ number_format(
$sum
/8, 1, '.', '') }} Days <br>
@endif
{{ number_format(
$sum
, 1, '.', '') }} Hours
@endforeach
<?php
$balhours
-=
$sum
; ?>
@if(
$sumdays
== 0)
</td>
@else
<td style="
width
:
10
%
">
{
{data_get($staff,'name')}
}
</td>
{
{$sumdays}
}
<td style="
width
:
15
%
" class="
center
aligned
">
@endif
<?php
$sumhours
= 0; ?>
</td>
@foreach(
$ptdetail
as
$key
=>
$hours
)
<td class="
center
aligned
">balance</td>
@if(data_get(
$hours
,'staffid') == data_get(
$staff
,'staffid'))
</tr>
<?php
$sumhours
+= data_get(
$hours
,'hours'); ?>
<?php
$totalhours
+= data_get(
$hours
,'hours'); ?>
@endif
@endforeach
@if(
$sumhours
== 0)
@else
{{ number_format(
$sumhours
, 1, '.', '') }}
@endif
</td>
<td style="
width
:
15
%
" class="
center
aligned
">
<?php
$sumdays
= 0; ?>
@foreach(
$ptdetail
as
$key
=>
$hours
)
@if(data_get(
$hours
,'staffid') == data_get(
$staff
,'staffid'))
<?php
$sumdays
+= number_format(data_get(
$hours
,'hours')/8, 1, '.', ''); ?>
<?php
$totaldays
+= number_format(data_get(
$hours
,'hours')/8, 1, '.', ''); ?>
@endif
@endforeach
@if(
$sumdays
== 0)
@else
{{ number_format(
$sumdays
, 1, '.', '') }}
@endif
</td>
<td class="
center
aligned
">
{{ number_format(
$balhours
/8, 1, '.', '') }} Days <br>
{{ number_format(
$balhours
, 1, '.', '') }} Hours
</td>
</tr>
@endif
@endforeach
@endforeach
@endforeach
</tbody>
</tbody>
<!-- <tfoot class="
full
-
width
">
<!-- <tfoot class="
full
-
width
">
...
...
packages/portal/timesheet/src/Http/Controllers/ReportController.php
View file @
1ba1c7d7
...
@@ -12,6 +12,7 @@ use Portal\Timesheet\Model\Project;
...
@@ -12,6 +12,7 @@ use Portal\Timesheet\Model\Project;
use
Portal\Timesheet\Model\Tproject
;
use
Portal\Timesheet\Model\Tproject
;
use
Portal\Timesheet\Model\Department
;
use
Portal\Timesheet\Model\Department
;
use
Portal\Timesheet\Model\Pteam
;
use
Portal\Timesheet\Model\Pteam
;
use
Portal\Timesheet\Model\Pmandays
;
use
Portal\Timesheet\Model\Staff_info
;
use
Portal\Timesheet\Model\Staff_info
;
use
Portal\Timesheet\Model\Overhead
;
use
Portal\Timesheet\Model\Overhead
;
use
Portal\Timesheet\Model\Role
;
use
Portal\Timesheet\Model\Role
;
...
@@ -144,14 +145,14 @@ class ReportController extends Controller
...
@@ -144,14 +145,14 @@ class ReportController extends Controller
}
}
$checkyear
=
Ts_master
::
select
(
'tm_year'
)
$checkyear
=
Ts_master
::
select
(
'tm_year'
)
->
where
(
'tm_timesheet_master_sts'
,
4
)
//
->where('tm_timesheet_master_sts', 4)
->
distinct
(
'tm_year'
)
->
distinct
(
'tm_year'
)
->
orderby
(
'tm_year'
,
'DESC'
)
->
orderby
(
'tm_year'
,
'DESC'
)
->
first
();
->
first
();
if
(
$checkyear
)
{
if
(
$checkyear
)
{
$year
=
Ts_master
::
select
(
'tm_year'
)
$year
=
Ts_master
::
select
(
'tm_year'
)
->
where
(
'tm_timesheet_master_sts'
,
4
)
//
->where('tm_timesheet_master_sts', 4)
->
distinct
(
'tm_year'
)
->
distinct
(
'tm_year'
)
->
orderby
(
'tm_year'
,
'DESC'
)
->
orderby
(
'tm_year'
,
'DESC'
)
->
get
();
->
get
();
...
@@ -176,16 +177,22 @@ class ReportController extends Controller
...
@@ -176,16 +177,22 @@ class ReportController extends Controller
}
}
$pid
=
$request
->
project
;
$pid
=
$request
->
project
;
// dd($pid);
$pdetail
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
$pdetail
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
->
with
(
'mandays'
)
->
with
(
'mandays'
)
->
first
();
->
first
();
// dd($pdetail);
// dd($pdetail);
$pt
eam
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
$pt
staffs
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
orderby
(
'roleid'
)
->
orderby
(
'roleid'
)
->
groupby
(
'name'
)
->
groupby
(
'name'
)
->
get
();
->
get
();
$pteam
=
Pmandays
::
where
(
'fk_project'
,
$pid
)
->
with
(
'role'
)
->
orderby
(
'pm_roles'
,
'ASC'
)
->
get
();
// dd($pteam);
// dd($pteam);
$ptdetail
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
$ptdetail
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
->
where
(
'MONTH'
,
$request
->
month
)
->
where
(
'MONTH'
,
$request
->
month
)
...
@@ -193,6 +200,12 @@ class ReportController extends Controller
...
@@ -193,6 +200,12 @@ class ReportController extends Controller
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
orderby
(
'roleid'
)
->
orderby
(
'roleid'
)
->
get
();
->
get
();
// dd($ptdetail);
$accumulate
=
Tproject
::
where
(
'td_project'
,
$pid
)
->
where
(
'tp_year'
,
$request
->
year
)
->
where
(
'tp_month'
,
$request
->
month
)
->
get
();
// dd($accumulate);
$year
=
date
(
'Y'
);
$year
=
date
(
'Y'
);
if
(
$request
->
year
)
{
if
(
$request
->
year
)
{
...
@@ -203,7 +216,7 @@ class ReportController extends Controller
...
@@ -203,7 +216,7 @@ class ReportController extends Controller
$month
=
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$request
->
month
,
1
,
date
(
'Y'
)));
$month
=
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$request
->
month
,
1
,
date
(
'Y'
)));
return
view
(
'timesheet::report.project'
,
compact
(
'month'
,
'intmonth'
,
'year'
,
'pteam'
,
'pdetail'
,
'ptdetail'
,
'pid'
));
return
view
(
'timesheet::report.project'
,
compact
(
'month'
,
'intmonth'
,
'year'
,
'pteam'
,
'pdetail'
,
'ptdetail'
,
'pid'
,
'ptstaffs'
,
'accumulate'
));
}
}
public
function
deptreport
()
public
function
deptreport
()
...
...
packages/portal/timesheet/src/Model/Pmandays.php
View file @
1ba1c7d7
...
@@ -24,6 +24,13 @@ class Pmandays extends Model
...
@@ -24,6 +24,13 @@ class Pmandays extends Model
* @return void
* @return void
* @author
* @author
**/
**/
public
function
role
()
{
// dd('1');
return
$this
->
hasOne
(
'Portal\Timesheet\Model\Role'
,
'id'
,
'pm_roles'
);
}
public
function
info
()
public
function
info
()
{
{
...
...
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