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
41c9baba
Commit
41c9baba
authored
Sep 02, 2022
by
hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export to excel -> project report
parent
14164bfe
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
154 additions
and
4 deletions
+154
-4
app/Exports/ProjectExport.php
+61
-0
packages/portal/timesheet/resources/views/exports/exportProject.blade.php
+58
-0
packages/portal/timesheet/resources/views/report/project.blade.php
+7
-2
packages/portal/timesheet/routes/web.php
+1
-0
packages/portal/timesheet/src/Http/Controllers/ExportController.php
+21
-1
packages/portal/timesheet/src/Http/Controllers/ReportController.php
+6
-1
storage/framework/laravel-excel/laravel-excel-B957e5c3M8hmmJ9TA9Xa7RwIUUtUZlcd.html
+0
-0
storage/framework/laravel-excel/laravel-excel-JQejvVb4IyP0kc69hxYc3atbjxcX2LY9.html
+0
-0
storage/framework/laravel-excel/laravel-excel-eVoJgx1ja01wQvnN7xeYEIoImKF9Neo1.html
+0
-0
storage/framework/laravel-excel/laravel-excel-goRZaQEzWASmKk3VpRcAd5gSjtw4ji8m.html
+0
-0
No files found.
app/Exports/ProjectExport.php
0 → 100644
View file @
41c9baba
<?php
namespace
App\Exports
;
use
App\User
;
use
Portal\Timesheet\Model\VwProject
;
// use Illuminate\Contracts\Support\Responsable;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Http\Request
;
use
Maatwebsite\Excel\Concerns\Exportable
;
use
Maatwebsite\Excel\Concerns\FromCollection
;
use
Maatwebsite\Excel\Concerns\FromView
;
use
Maatwebsite\Excel\Concerns\ShouldAutoSize
;
// class UsersExport implements FromCollection, Responsable
class
ProjectExport
implements
FromView
,
ShouldAutoSize
{
use
Exportable
;
// private $fileName = "Ringkasan Laporan.xlsx";
protected
$request
;
function
__construct
(
$request
)
{
$this
->
request
=
$request
;
}
/**
* @return \Illuminate\Support\Collection
*/
public
function
view
()
:
View
{
// dd($this->request);
$month
=
$this
->
request
[
'month'
];
$year
=
$this
->
request
[
'year'
];
$project
=
$this
->
request
[
'pid'
];
return
view
(
'timesheet::exports.exportProject'
,
[
'month'
=>
$month
,
'year'
=>
$year
,
'pdetail'
=>
VwProject
::
where
(
'pid'
,
$project
)
->
first
(),
'pteam'
=>
VwProject
::
where
(
'pid'
,
$project
)
->
orderby
(
'roleid'
)
->
get
(),
'ptdetail'
=>
VwProject
::
where
(
'pid'
,
$project
)
->
where
(
'MONTH'
,
$month
)
->
where
(
'year'
,
$year
)
->
orderby
(
'roleid'
)
->
get
()
]);
}
}
packages/portal/timesheet/resources/views/exports/exportProject.blade.php
0 → 100644
View file @
41c9baba
<table
class=
"ui unstackable celled table"
>
<thead>
<tr>
<th
style=
"width: 10%"
>
Project
</th>
<th
style=
"width: 1%"
>
:
</th>
<th
colspan=
"3"
>
{{data_get($pdetail,'pcode')}} - {{data_get($pdetail,'pname')}}
</th>
</tr>
<tr>
<th
style=
"width: 10%"
>
Month/Year
</th>
<th
style=
"width: 1%"
>
:
</th>
<th
colspan=
"3"
>
{{$month}} {{$year}}
</th>
</tr>
</thead>
</table>
<table
class=
"ui unstackable celled table"
>
<thead>
<tr>
<th
style=
"width: 45%"
>
Staff Name
</th>
<th
style=
"width: 25%"
class=
"center aligned"
>
Role
</th>
<th
style=
"width: 15%"
class=
"center aligned"
>
Total Hours
</th>
<th
style=
"width: 15%"
class=
"center aligned"
>
Total Days
</th>
</tr>
</thead>
<tbody>
<?php
$totalhours
=
$totaldays
=
0
;
?>
@foreach($pteam as $key => $team)
<tr>
<td
style=
"width: 40%"
>
{{data_get($team,'name')}}
</td>
<td
style=
"width: 30%"
class=
"center aligned"
>
{{data_get($team,'role')}}
</td>
<td
style=
"width: 15%"
class=
"center aligned"
>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
{{data_get($hours,'hours')}}
<?php
$totalhours
+=
data_get
(
$hours
,
'hours'
);
?>
@endif
@endforeach
</td>
<td
style=
"width: 15%"
class=
"center aligned"
>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
{{number_format(data_get($hours,'hours')/8, 1, '.', '')}}
<?php
$totaldays
+=
number_format
(
data_get
(
$hours
,
'hours'
)
/
8
,
1
,
'.'
,
''
);
?>
@endif
@endforeach
</td>
</tr>
@endforeach
</tbody>
<tfoot
class=
"full-width"
>
<tr>
<th
style=
"width: 40%"
><strong>
Total
</strong></th>
<th
style=
"width: 30%"
></th>
<th
style=
"width: 15%"
class=
"center aligned"
><strong>
{{$totalhours}}
</strong></th>
<th
style=
"width: 15%"
class=
"center aligned"
><strong>
{{$totaldays}}
</strong></th>
</tr>
</tfoot>
</table>
\ No newline at end of file
packages/portal/timesheet/resources/views/report/project.blade.php
View file @
41c9baba
...
...
@@ -6,8 +6,13 @@
<div class="
ui
purple
left
ribbon
label
">
Report by Project
</div>
<br>
<br>
<button class="
right
floated
center
aligned
ui
violet
compact
labeled
icon
button
" onclick="
window
.
location
.
href
=
'{{ route('
timesheet
::
export
.
exportproject
', ['
month
'=> $intmonth, '
year
'=> $year, '
pid
'=> $pid ]) }}'
;
">
<i class="
file
excel
outline
icon
"></i>
Export to Excel
</button>
<br><br>
<div class="
ui
styled
fluid
">
<div class="
title
">
...
...
packages/portal/timesheet/routes/web.php
View file @
41c9baba
...
...
@@ -11,6 +11,7 @@ Route::group(
//export
Route
::
get
(
'ringkasan/export/'
,
[
'uses'
=>
'ExportController@export'
,
'as'
=>
'export.exportsummary'
]);
Route
::
get
(
'project/export/'
,
[
'uses'
=>
'ExportController@exportproject'
,
'as'
=>
'export.exportproject'
]);
//dashboard
Route
::
get
(
'home'
,[
'uses'
=>
'DashboardController@index'
,
'as'
=>
'dashboard.index'
]);
...
...
packages/portal/timesheet/src/Http/Controllers/ExportController.php
View file @
41c9baba
...
...
@@ -36,6 +36,7 @@ use Mail;
use
Curl
;
use
Auth
;
use
App\Exports\RingkasanExport
;
use
App\Exports\ProjectExport
;
use
Maatwebsite\Excel\Facades\Excel
;
class
ExportController
extends
Controller
...
...
@@ -53,7 +54,25 @@ class ExportController extends Controller
'month'
=>
$request
->
month
,
'year'
=>
$request
->
year
]))
->
download
(
'Ringkasan Laporan '
.
$month
.
' '
.
$year
.
'.xlsx'
);
]))
->
download
(
'Report Summary '
.
$month
.
' '
.
$year
.
'.xlsx'
);
}
public
function
exportproject
(
Request
$request
)
{
// dd($request);
$month
=
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$request
->
month
,
1
,
date
(
'Y'
)));
$year
=
strval
(
$request
->
year
);
return
(
new
ProjectExport
(
[
'month'
=>
$request
->
month
,
'year'
=>
$request
->
year
,
'pid'
=>
$request
->
pid
]))
->
download
(
'Report by Project '
.
$month
.
' '
.
$year
.
'.xlsx'
);
}
}
\ No newline at end of file
packages/portal/timesheet/src/Http/Controllers/ReportController.php
View file @
41c9baba
...
...
@@ -115,6 +115,9 @@ class ReportController extends Controller
public
function
generateprojectreport
(
Request
$request
)
{
// dd($request);
$pid
=
$request
->
project
;
$pdetail
=
VwProject
::
where
(
'pid'
,
$request
->
project
)
->
first
();
...
...
@@ -133,9 +136,11 @@ class ReportController extends Controller
$year
=
$request
->
year
;
}
$intmonth
=
$request
->
month
;
$month
=
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$request
->
month
,
1
,
date
(
'Y'
)));
return
view
(
'timesheet::report.project'
,
compact
(
'month'
,
'
year'
,
'pteam'
,
'pdetail'
,
'ptdetail
'
));
return
view
(
'timesheet::report.project'
,
compact
(
'month'
,
'
intmonth'
,
'year'
,
'pteam'
,
'pdetail'
,
'ptdetail'
,
'pid
'
));
}
public
function
deptreport
()
...
...
storage/framework/laravel-excel/laravel-excel-B957e5c3M8hmmJ9TA9Xa7RwIUUtUZlcd.html
0 → 100644
View file @
41c9baba
storage/framework/laravel-excel/laravel-excel-JQejvVb4IyP0kc69hxYc3atbjxcX2LY9.html
0 → 100644
View file @
41c9baba
storage/framework/laravel-excel/laravel-excel-eVoJgx1ja01wQvnN7xeYEIoImKF9Neo1.html
0 → 100644
View file @
41c9baba
storage/framework/laravel-excel/laravel-excel-goRZaQEzWASmKk3VpRcAd5gSjtw4ji8m.html
0 → 100644
View file @
41c9baba
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