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
1baa4d3d
Commit
1baa4d3d
authored
Sep 30, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project man-days - simpan total day n hours dalam table project as p_total_days, p_total_hours
parent
2bd9741e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
+33
-10
No files found.
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
View file @
1baa4d3d
...
...
@@ -193,11 +193,12 @@ class MaintenanceController extends Controller
// dd($data);
$role
=
VwMandays
::
where
(
'fk_project_id'
,
$request
->
id
)
->
where
(
'role_id'
,
'<>'
,
'7'
)
->
with
(
'role'
)
->
orderBy
(
'role_id'
)
->
get
();
// dd($role);
// dd($role);
s
$id
=
$request
->
id
;
// dd($pid);
...
...
@@ -215,25 +216,42 @@ class MaintenanceController extends Controller
$id
=
$request
->
id
;
$check
=
Pmandays
::
where
(
'fk_project'
,
$request
->
id
)
->
first
();
// $check = Pmandays::where('fk_project', $request->id)->get();
// dd($check);
if
(
$check
)
{
//update
$data
=
Pmandays
::
where
(
'fk_project'
,
$request
->
id
)
->
get
();
foreach
(
$data
as
$key
=>
$datas
)
{
foreach
(
$request
->
days
as
$key
=>
$value
)
{
if
(
$datas
->
pm_roles
==
$key
)
{
if
(
$check
)
{
foreach
(
$request
->
days
as
$key
=>
$value
)
{
$datas
=
Pmandays
::
where
(
'fk_project'
,
$id
)
->
where
(
'pm_roles'
,
$key
)
->
first
();
if
(
$datas
)
{
$datas
->
pm_days
=
$value
;
$datas
->
pm_hours
=
$value
*
8
;
$datas
->
updated_by
=
$staffid
;
$datas
->
save
();
}
else
{
$data
=
new
Pmandays
;
$data
->
fk_project
=
$request
->
id
;
$data
->
pm_roles
=
$key
;
$data
->
pm_days
=
$value
;
$data
->
pm_hours
=
$value
*
8
;
$data
->
updated_by
=
$staffid
;
$data
->
save
();
}
}
Project
::
where
(
'id'
,
$request
->
id
)
->
update
([
'p_total_hours'
=>
$request
->
totalhours
,
'p_total_days'
=>
$request
->
totaldays
,
]);
}
else
{
//add baru
foreach
(
$request
->
days
as
$key
=>
$day
)
{
$data
=
new
Pmandays
;
...
...
@@ -243,8 +261,13 @@ class MaintenanceController extends Controller
$data
->
pm_hours
=
$day
*
8
;
$data
->
updated_by
=
$staffid
;
$data
->
save
();
}
Project
::
where
(
'id'
,
$request
->
id
)
->
update
([
'p_total_hours'
=>
$request
->
totalhours
,
'p_total_days'
=>
$request
->
totaldays
,
]);
}
return
redirect
()
->
route
(
'timesheet::maintenance.mandays'
,
compact
(
'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