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
23cfda72
Commit
23cfda72
authored
Dec 14, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in report
parent
9e777547
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
25 deletions
+140
-25
app/Exports/ProjectExport.php
+34
-20
app/Exports/RingkasanExport.php
+106
-5
No files found.
app/Exports/ProjectExport.php
View file @
23cfda72
...
@@ -3,7 +3,12 @@
...
@@ -3,7 +3,12 @@
namespace
App\Exports
;
namespace
App\Exports
;
use
App\User
;
use
App\User
;
use
Portal\Timesheet\Model\Users
;
use
Portal\Timesheet\Model\Pmandays
;
use
Portal\Timesheet\Model\Tproject
;
use
Portal\Timesheet\Model\Pteam
;
use
Portal\Timesheet\Model\VwProject
;
use
Portal\Timesheet\Model\VwProject
;
use
Portal\Timesheet\Model\VwProjectStaffRoles
;
// use Illuminate\Contracts\Support\Responsable;
// use Illuminate\Contracts\Support\Responsable;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
...
@@ -14,6 +19,7 @@ use Maatwebsite\Excel\Concerns\ShouldAutoSize;
...
@@ -14,6 +19,7 @@ use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use
Maatwebsite\Excel\Concerns\WithColumnWidths
;
use
Maatwebsite\Excel\Concerns\WithColumnWidths
;
use
Maatwebsite\Excel\Concerns\WithStyles
;
use
Maatwebsite\Excel\Concerns\WithStyles
;
use
PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
;
use
PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
;
use
Auth
;
// class UsersExport implements FromCollection, Responsable
// class UsersExport implements FromCollection, Responsable
...
@@ -40,31 +46,16 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
...
@@ -40,31 +46,16 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
$sheet
->
getStyle
(
'4'
)
->
getFont
()
->
setBold
(
true
);
$sheet
->
getStyle
(
'4'
)
->
getFont
()
->
setBold
(
true
);
}
}
// public function styles(Worksheet $sheet)
// {
// return [
// // Style the first row as bold text.
// '1' => ['font' => ['bold' => true]],
// '2' => ['font' => ['bold' => true]],
// '4' => ['font' => ['bold' => true]],
// '10' => ['font' => ['bold' => true]]
// // Styling a specific cell by coordinate.
// // 'B2' => ['font' => ['italic' => true]],
// // Styling an entire column.
// // 'C' => ['font' => ['size' => 16]],
// ];
// }
public
function
columnWidths
()
:
array
public
function
columnWidths
()
:
array
{
{
return
[
return
[
'A'
=>
50
,
'A'
=>
50
,
'B'
=>
20
,
'B'
=>
20
,
'C'
=>
15
,
'C'
=>
15
,
'D'
=>
15
'D'
=>
15
,
'E'
=>
20
,
'F'
=>
15
,
'G'
=>
15
];
];
}
}
...
@@ -77,6 +68,9 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
...
@@ -77,6 +68,9 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
$year
=
$this
->
request
[
'year'
];
$year
=
$this
->
request
[
'year'
];
$project
=
$this
->
request
[
'pid'
];
$project
=
$this
->
request
[
'pid'
];
$roleid
=
auth
()
->
user
()
->
roles
[
'0'
]
->
id
;
$user
=
Users
::
find
(
Auth
::
id
());
return
view
(
'timesheet::exports.exportProject'
,
[
return
view
(
'timesheet::exports.exportProject'
,
[
'month'
=>
$month
,
'month'
=>
$month
,
...
@@ -97,8 +91,28 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
...
@@ -97,8 +91,28 @@ class ProjectExport implements FromView, ShouldAutoSize, WithColumnWidths, WithS
->
where
(
'year'
,
$year
)
->
where
(
'year'
,
$year
)
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
where
(
'roleid'
,
'<>'
,
'7'
)
->
orderby
(
'roleid'
)
->
orderby
(
'roleid'
)
->
get
()
->
get
()
,
'roles'
=>
Pmandays
::
where
(
'fk_project'
,
$project
)
->
with
(
'role'
)
->
orderby
(
'pm_roles'
,
'ASC'
)
->
get
(),
'pteams'
=>
Pteam
::
where
(
'fk_project_id'
,
$project
)
->
orderby
(
'role_id'
)
// ->where('pt_project_task_sts', 1)
->
get
(),
'accumulates'
=>
VwProjectStaffRoles
::
where
(
'td_project'
,
$project
)
->
where
(
'tp_year'
,
'<='
,
$year
)
->
where
(
'tp_month'
,
'<='
,
$month
)
->
orderby
(
'tp_month'
,
'ASC'
)
->
get
(),
'currentmonthhours'
=>
Tproject
::
where
(
'td_project'
,
$project
)
->
where
(
'tp_year'
,
$year
)
->
where
(
'tp_month'
,
$month
)
->
get
(),
]);
]);
}
}
}
}
app/Exports/RingkasanExport.php
View file @
23cfda72
...
@@ -6,6 +6,7 @@ use App\User;
...
@@ -6,6 +6,7 @@ use App\User;
use
Portal\Timesheet\Model\Overhead
;
use
Portal\Timesheet\Model\Overhead
;
use
Portal\Timesheet\Model\VwStaff
;
use
Portal\Timesheet\Model\VwStaff
;
use
Portal\Timesheet\Model\VwChargeable
;
use
Portal\Timesheet\Model\VwChargeable
;
use
Portal\Timesheet\Model\Tproject
;
use
Portal\Timesheet\Model\VwRingkasanLaporan
;
use
Portal\Timesheet\Model\VwRingkasanLaporan
;
use
Portal\Timesheet\Model\VwNonchargeSummary
;
use
Portal\Timesheet\Model\VwNonchargeSummary
;
use
Portal\Timesheet\Model\VwOverheadSummary
;
use
Portal\Timesheet\Model\VwOverheadSummary
;
...
@@ -50,30 +51,130 @@ class RingkasanExport implements ShouldAutoSize, FromView, WithColumnWidths
...
@@ -50,30 +51,130 @@ class RingkasanExport implements ShouldAutoSize, FromView, WithColumnWidths
public
function
view
()
:
View
public
function
view
()
:
View
{
{
// dd(VwStaff::all());
$dept
=
$this
->
request
[
'dept'
];
$month
=
$this
->
request
[
'month'
];
$month
=
$this
->
request
[
'month'
];
$year
=
$this
->
request
[
'year'
];
$year
=
$this
->
request
[
'year'
];
$liststaffs
=
[];
$chargeproject
=
VwChargeable
::
where
(
'deleted_at'
,
null
)
->
get
();
if
(
$dept
==
'all'
)
{
$staffs
=
VwStaff
::
orderby
(
'deptID'
)
->
where
(
'deptID'
,
'!='
,
8
)
->
get
();
foreach
(
$staffs
as
$key
=>
$staff
)
{
$liststaffs
[]
=
data_get
(
$staff
,
'staffid'
);
}
}
else
{
$staffs
=
VwStaff
::
orderby
(
'deptID'
)
->
where
(
'deptID'
,
'!='
,
8
)
->
where
(
'deptID'
,
$dept
)
->
get
();
foreach
(
$staffs
as
$key
=>
$staff
)
{
$liststaffs
[]
=
data_get
(
$staff
,
'staffid'
);
}
}
// dd($liststaffs);
if
(
$dept
==
'all'
)
{
return
view
(
'timesheet::exports.exportRingkasan'
,
[
return
view
(
'timesheet::exports.exportRingkasan'
,
[
'staffs'
=>
VwStaff
::
orderby
(
'deptID'
)
'staffs'
=>
VwStaff
::
orderby
(
'deptID'
)
->
where
(
'deptID'
,
'!='
,
8
)
->
where
(
'deptID'
,
'!='
,
8
)
->
get
(),
->
get
(),
'chargeproject'
=>
VwChargeable
::
all
(),
'chargeproject'
=>
VwChargeable
::
all
(),
'overhead'
=>
Overhead
::
where
(
'o_overhead_sts'
,
1
)
->
get
(),
'overhead'
=>
Overhead
::
where
(
'o_overhead_sts'
,
1
)
->
get
(),
'ringkasan'
=>
VwRingkasanLaporan
::
where
(
'month'
,
$month
)
'ringkasan'
=>
VwRingkasanLaporan
::
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
4
)
->
where
(
'status'
,
4
)
->
get
(),
->
get
(),
// 'projectnc' => VwNonchargeSummary::where('month', $month)
// ->where('year', $year)
// ->get(),
'ovhours'
=>
VwOverheadSummary
::
where
(
'month'
,
$month
)
'ovhours'
=>
VwOverheadSummary
::
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
4
)
->
where
(
'status'
,
4
)
->
get
()
->
get
(),
'chargehours'
=>
Tproject
::
where
(
'tp_year'
,
$year
)
->
where
(
'tp_month'
,
$month
)
->
where
(
'tp_hours'
,
'<>'
,
null
)
->
where
(
'tp_project_type'
,
1
)
->
whereIn
(
'staffid'
,
$liststaffs
)
->
where
(
'tp_timesheet_sts'
,
4
)
->
get
(),
'chargeprojects'
=>
Tproject
::
select
(
'td_project'
,
'tp_year'
,
'tp_month'
,
'tp_project_name'
)
->
where
(
'tp_year'
,
$year
)
->
where
(
'tp_month'
,
$month
)
->
where
(
'tp_hours'
,
'<>'
,
null
)
->
where
(
'tp_project_type'
,
1
)
->
whereIn
(
'staffid'
,
$liststaffs
)
->
with
(
'project'
)
->
where
(
'tp_timesheet_sts'
,
4
)
->
distinct
()
->
get
(),
'month'
=>
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$month
,
1
,
date
(
'Y'
))),
'year'
=>
$year
,
]);
]);
}
}
else
{
return
view
(
'timesheet::exports.exportRingkasan'
,
[
'staffs'
=>
VwStaff
::
orderby
(
'deptID'
)
->
where
(
'deptID'
,
'!='
,
8
)
->
where
(
'deptID'
,
$dept
)
->
get
(),
'chargeproject'
=>
VwChargeable
::
all
(),
'overhead'
=>
Overhead
::
where
(
'o_overhead_sts'
,
1
)
->
get
(),
'ringkasan'
=>
VwRingkasanLaporan
::
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
4
)
->
get
(),
'ovhours'
=>
VwOverheadSummary
::
where
(
'month'
,
$month
)
->
where
(
'year'
,
$year
)
->
where
(
'status'
,
4
)
->
get
(),
'chargehours'
=>
Tproject
::
where
(
'tp_year'
,
$year
)
->
where
(
'tp_month'
,
$month
)
->
where
(
'tp_hours'
,
'<>'
,
null
)
->
where
(
'tp_project_type'
,
1
)
->
whereIn
(
'staffid'
,
$liststaffs
)
->
where
(
'tp_timesheet_sts'
,
4
)
->
get
(),
'chargeprojects'
=>
Tproject
::
select
(
'td_project'
,
'tp_year'
,
'tp_month'
,
'tp_project_name'
)
->
where
(
'tp_year'
,
$year
)
->
where
(
'tp_month'
,
$month
)
->
where
(
'tp_hours'
,
'<>'
,
null
)
->
where
(
'tp_project_type'
,
1
)
->
whereIn
(
'staffid'
,
$liststaffs
)
->
with
(
'project'
)
->
where
(
'tp_timesheet_sts'
,
4
)
->
distinct
()
->
get
(),
'month'
=>
date
(
'F'
,
mktime
(
0
,
0
,
0
,
$month
,
1
,
date
(
'Y'
))),
'year'
=>
$year
,
]);
}
}
}
}
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