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
527ffcba
Commit
527ffcba
authored
Dec 14, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in department report
parent
dfc70aea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
52 deletions
+78
-52
app/Exports/DepartmentExport.php
+18
-0
packages/portal/timesheet/resources/views/exports/exportDepartment.blade.php
+60
-52
No files found.
app/Exports/DepartmentExport.php
View file @
527ffcba
...
@@ -64,6 +64,7 @@ class DepartmentExport implements FromView, ShouldAutoSize, WithColumnWidths, Wi
...
@@ -64,6 +64,7 @@ class DepartmentExport implements FromView, ShouldAutoSize, WithColumnWidths, Wi
$month
=
$this
->
request
[
'month'
];
$month
=
$this
->
request
[
'month'
];
$year
=
$this
->
request
[
'year'
];
$year
=
$this
->
request
[
'year'
];
$dept
=
$this
->
request
[
'dept'
];
$dept
=
$this
->
request
[
'dept'
];
$approve
=
4
;
return
view
(
'timesheet::exports.exportDepartment'
,
[
return
view
(
'timesheet::exports.exportDepartment'
,
[
...
@@ -71,15 +72,32 @@ class DepartmentExport implements FromView, ShouldAutoSize, WithColumnWidths, Wi
...
@@ -71,15 +72,32 @@ class DepartmentExport implements FromView, ShouldAutoSize, WithColumnWidths, Wi
'month'
=>
$month
,
'month'
=>
$month
,
'year'
=>
$year
,
'year'
=>
$year
,
'staffs'
=>
VwStaff
::
where
(
'deptID'
,
$dept
)
->
get
(),
'staffs'
=>
VwStaff
::
where
(
'deptID'
,
$dept
)
->
get
(),
'project'
=>
VwProject
::
where
(
'deptid'
,
$dept
)
'project'
=>
VwProject
::
where
(
'deptid'
,
$dept
)
->
where
(
'month'
,
$month
)
->
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
$approve
)
->
get
(),
->
get
(),
'overhead'
=>
VwOverhead
::
where
(
'deptid'
,
$dept
)
'overhead'
=>
VwOverhead
::
where
(
'deptid'
,
$dept
)
->
where
(
'month'
,
$month
)
->
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
$approve
)
->
get
(),
->
get
(),
'projecttitle'
=>
VwProject
::
select
(
'year'
,
'month'
,
'pcode'
,
'pname'
,
'staffid'
,
'deptid'
,
'ptype'
,
'pid'
)
->
where
(
'deptid'
,
$dept
)
->
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
distinct
()
->
get
(),
'overheadtitle'
=>
VwOverhead
::
select
(
'staffid'
,
'deptid'
,
'oid'
,
'ptype'
,
'year'
,
'month'
,
'pname'
)
->
where
(
'deptid'
,
$dept
)
->
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
distinct
()
->
get
(),
]);
]);
}
}
}
}
packages/portal/timesheet/resources/views/exports/exportDepartment.blade.php
View file @
527ffcba
...
@@ -12,64 +12,59 @@
...
@@ -12,64 +12,59 @@
</tr>
</tr>
</thead>
</thead>
</table>
</table>
<table>
<table
class=
"ui unstackable celled table"
>
<thead>
<thead>
<tr>
<tr>
<th>
{{strtoupper('staff')}}
</th>
<th
style=
"width: 35%"
>
staff
</th>
<th>
{{strtoupper('project type')}}
</th>
<th
style=
"width: 5%"
class=
"center aligned"
>
project type
</th>
<th>
{{strtoupper('project code / task')}}
</th>
<th
style=
"width: 15%"
class=
"center aligned"
>
project code / task
</th>
<th>
{{strtoupper('description')}}
</th>
<th
style=
"width: 25%"
class=
"center aligned"
>
description
</th>
<th>
{{strtoupper('total hours')}}
</th>
<th
style=
"width: 10%"
class=
"center aligned"
>
total hours
</th>
<th>
{{strtoupper('total days')}}
</th>
<th
style=
"width: 10%"
class=
"center aligned"
>
total days
</th>
</tr>
</tr>
</thead>
</thead>
<?php
$totalhours
=
$totaldays
=
$staffhours
=
$staffdays
=
0
;
?>
<?php
$totalhours
=
$totaldays
=
$staffhours
=
$staffdays
=
0
;
?>
@foreach($staffs as $key => $staff)
@foreach($staffs as $key => $staff)
<tbody>
<tbody>
<?php
$countproject
=
$projecttitle
->
where
(
'staffid'
,
data_get
(
$staff
,
'staffid'
));
?>
<tr>
<tr>
<td
colspan=
"6"
>
{{data_get($staff,'name')}}
</td>
<td
colspan=
"6"
>
{{data_get($staff,'name')}}
</td>
</tr>
</tr>
<?php
<?php
$chargeproject
=
$project
->
where
(
'ptype'
,
1
);
// $chargeproject = $project->where('ptype', 1);
$chargeproject
=
$projecttitle
->
where
(
'ptype'
,
1
);
// dump($chargeproject);
$chargehours
=
$chargedays
=
0
;
$chargehours
=
$chargedays
=
0
;
?>
?>
@foreach($chargeproject as $key => $chargeable)
@foreach($chargeproject as $key => $chargeable)
@if(data_get($chargeable,'staffid') == data_get($staff,'staffid'))
@if(data_get($chargeable,'staffid') == data_get($staff,'staffid'))
<tr>
<tr>
<td></td>
<td
style=
"width: 35%"
></td>
<td>
C
</td>
<td
style=
"width: 5%"
class=
"center aligned"
>
C
</td>
<td>
{{data_get($chargeable,'pcode')}}
</td>
<td
style=
"width: 15%"
class=
"center aligned"
>
{{data_get($chargeable,'pcode')}}
</td>
<td>
{{data_get($chargeable,'pname')}}
</td>
<td
style=
"width: 25%"
>
{{data_get($chargeable,'pname')}}
</td>
<td>
{{data_get($chargeable,'hours')}}
</td>
<td
style=
"width: 10%"
class=
"center aligned"
>
<td>
{{number_format(data_get($chargeable,'hours')/8, '1', '.', '')}}
</td>
<?php
$projectvaluehours
=
0
;
?>
</tr>
@foreach($project as $key => $projecthours)
@if(data_get($chargeable,'staffid') == data_get($projecthours,'staffid')
&&
data_get($chargeable,'pid') == data_get($projecthours,'pid'))
<?php
<?php
$chargehours
+=
data_get
(
$chargeable
,
'hours'
);
$projectvaluehours
+=
data_get
(
$projecthours
,
'hours'
);
$chargedays
+=
number_format
(
data_get
(
$chargeable
,
'hours'
)
/
8
,
'1'
,
'.'
,
''
);
?>
?>
@endif
@endif
@endforeach
@endforeach
{{ number_format($projectvaluehours, '1', '.', '') }}
<?php
</td>
$nonchargeproject
=
$project
->
where
(
'ptype'
,
2
);
<td
style=
"width: 10%"
class=
"center aligned"
>
$nonchargehours
=
$nonchargedays
=
0
;
{{ number_format($projectvaluehours/8, '1', '.', '') }}
?>
</td>
@foreach($nonchargeproject as $key => $nonchargeable)
@if(data_get($nonchargeable,'staffid') == data_get($staff,'staffid'))
<tr>
<td></td>
<td>
NC
</td>
<td>
{{data_get($nonchargeable,'pcode')}}
</td>
<td>
{{data_get($nonchargeable,'pname')}}
</td>
<td>
{{data_get($nonchargeable,'hours')}}
</td>
<td>
{{number_format(data_get($nonchargeable,'hours')/8, '1', '.', '')}}
</td>
</tr>
</tr>
<?php
<?php
$nonchargehours
+=
data_get
(
$nonchargeable
,
'hours'
)
;
$chargehours
+=
$projectvaluehours
;
$nonchargedays
+=
number_format
(
data_get
(
$nonchargeable
,
'hours'
)
/
8
,
'1'
,
'.'
,
''
);
$chargedays
+=
number_format
(
$projectvaluehours
/
8
,
'1'
,
'.'
,
''
);
?>
?>
@endif
@endif
@endforeach
@endforeach
...
@@ -78,32 +73,44 @@
...
@@ -78,32 +73,44 @@
$overheadhours
=
$overheaddays
=
0
;
$overheadhours
=
$overheaddays
=
0
;
?>
?>
@foreach($overhead
as $key => $value)
@foreach($overheadtitle
as $key => $value)
@if(data_get($value,'staffid') == data_get($staff,'staffid'))
@if(data_get($value,'staffid') == data_get($staff,'staffid'))
<tr>
<tr>
<td></td>
<td
style=
"width: 35%"
></td>
<td>
NC
</td>
<td
style=
"width: 5%"
class=
"center aligned"
>
NC
</td>
<td></td>
<td
style=
"width: 15%"
class=
"center aligned"
></td>
<td>
{{data_get($value,'pname')}}
</td>
<td
style=
"width: 25%"
>
{{data_get($value,'pname')}}
</td>
<td>
{{data_get($value,'hours')}}
</td>
<td
style=
"width: 10%"
class=
"center aligned"
>
<td>
{{number_format(data_get($value,'hours')/8, '1', '.', '')}}
</td>
<?php
$overheadvaluehours
=
0
?>
@foreach($overhead as $key => $valuehours)
@if(data_get($value,'staffid') == data_get($valuehours,'staffid')
&&
data_get($value,'oid') == data_get($valuehours,'oid') )
<?php
$overheadvaluehours
+=
data_get
(
$valuehours
,
'hours'
);
?>
@endif
@endforeach
{{ number_format($overheadvaluehours, '1', '.', '') }}
</td>
<td
style=
"width: 10%"
class=
"center aligned"
>
{{ number_format($overheadvaluehours/8, '1', '.', '') }}
</td>
</tr>
</tr>
<?php
<?php
$overheadhours
+=
data_get
(
$value
,
'hours'
)
;
$overheadhours
+=
$overheadvaluehours
;
$overheaddays
+=
number_format
(
data_get
(
$value
,
'hours'
)
/
8
,
'1'
,
'.'
,
''
);
$overheaddays
+=
number_format
(
$overheadvaluehours
/
8
,
'1'
,
'.'
,
''
);
?>
?>
@endif
@endif
@endforeach
@endforeach
<?php
<?php
$staffhours
=
$chargehours
+
$non
chargehours
+
$overheadhours
;
$staffhours
=
$
chargehours
+
$overheadhours
;
$staffdays
=
$chargedays
+
$non
chargedays
+
$overheaddays
;
$staffdays
=
$
chargedays
+
$overheaddays
;
?>
?>
<tr>
<tr>
<td
colspan=
"3"
></td>
<td
colspan=
"3"
></td>
<td
>
Total
</td>
<td
style=
"width: 25%"
class=
"center aligned"
>
Total
</td>
<td>
{{$staffhours
}}
</td>
<td
style=
"width: 10%"
class=
"center aligned"
>
{{ number_format($staffhours, '1', '.', '')
}}
</td>
<td>
{{$staffdays
}}
</td>
<td
style=
"width: 10%"
class=
"center aligned"
>
{{ number_format($staffdays, '1', '.', '')
}}
</td>
</tr>
</tr>
</tbody>
</tbody>
...
@@ -112,12 +119,12 @@
...
@@ -112,12 +119,12 @@
$totaldays
+=
$staffdays
;
$totaldays
+=
$staffdays
;
?>
?>
@endforeach
@endforeach
<tfoot
>
<tfoot
class=
"full-width"
>
<tr>
<tr>
<th
colspan=
"3"
><strong>
Total
</strong></th>
<th
colspan=
"3"
><strong>
Total
</strong></th>
<th
></th>
<th
style=
"width: 25%"
class=
"center aligned"
></th>
<th><strong>
{{$totalhours
}}
</strong></th>
<th
style=
"width: 10%"
class=
"center aligned"
><strong>
{{ number_format($totalhours, '1', '.', '')
}}
</strong></th>
<th><strong>
{{$totaldays
}}
</strong></th>
<th
style=
"width: 10%"
class=
"center aligned"
><strong>
{{ number_format($totaldays, '1', '.', '')
}}
</strong></th>
</tr>
</tr>
</tfoot>
</tfoot>
</table>
</table>
\ No newline at end of file
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