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
4313c072
Commit
4313c072
authored
Oct 11, 2022
by
Azhan Hannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If chargeable project = 0 - tak perlu hantar Ke PM
parent
bde4ed52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
22 deletions
+67
-22
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
+17
-18
packages/portal/timesheet/src/Http/Controllers/FormController.php
+47
-1
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
+3
-3
No files found.
packages/portal/timesheet/src/Http/Controllers/DashboardController.php
View file @
4313c072
...
@@ -893,13 +893,17 @@ class DashboardController extends Controller
...
@@ -893,13 +893,17 @@ class DashboardController extends Controller
$nonchargeable
=
2
;
$nonchargeable
=
2
;
$overhead
=
3
;
$overhead
=
3
;
$chargeableproject
=
Pteam
::
where
(
'pt_staff_id'
,
$user
->
staff_id
)
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
staff_id
)
->
where
(
'pt_project_type'
,
$chargeable
)
->
where
(
'tm_year'
,
$year
)
->
get
();
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
with
(
'attachement'
)
->
first
();
$nonchargeableproject
=
Pteam
::
where
(
'pt_staff_id'
,
$user
->
staff_id
)
$chargeableproject
=
Tproject
::
where
(
'fk_tm_id'
,
$check
->
id
)
->
where
(
'pt_project_type'
,
$nonchargeable
)
->
where
(
'tp_project_type'
,
1
)
->
get
();
->
with
(
'project'
)
->
get
();
$chargeablelist
=
[];
$chargeablelist
=
[];
$overheadlist
=
[];
$overheadlist
=
[];
...
@@ -908,22 +912,14 @@ class DashboardController extends Controller
...
@@ -908,22 +912,14 @@ class DashboardController extends Controller
$chargeablelist
[]
=
[
$chargeablelist
[]
=
[
'pid'
=>
$value
->
fk_project_id
,
'pid'
=>
$value
->
td_project
,
'pcode'
=>
$value
->
toP
roject
->
p_project_code
,
'pcode'
=>
$value
->
p
roject
->
p_project_code
,
'pname'
=>
$value
->
toP
roject
->
p_project_description
,
'pname'
=>
$value
->
p
roject
->
p_project_description
,
];
];
}
}
$check
=
Ts_master
::
where
(
'tm_staff_id'
,
$user
->
staff_id
)
->
where
(
'tm_year'
,
$year
)
->
where
(
'tm_month'
,
$month
)
->
where
(
'tm_phase'
,
$phase
)
->
with
(
'attachement'
)
->
first
();
if
(
$check
)
if
(
$check
)
{
{
...
@@ -1001,7 +997,10 @@ class DashboardController extends Controller
...
@@ -1001,7 +997,10 @@ class DashboardController extends Controller
public
function
tsubmit
(
Request
$request
)
public
function
tsubmit
(
Request
$request
)
{
{
// dd($request);
$checktpnull
=
Tproject
::
where
(
'fk_tm_id'
,
$request
->
id
)
->
where
(
'tp_hours'
,
'0'
)
->
first
();
dd
(
$request
);
$roleid
=
auth
()
->
user
()
->
roles
[
'0'
]
->
id
;
$roleid
=
auth
()
->
user
()
->
roles
[
'0'
]
->
id
;
$user
=
Staff_info
::
where
(
'fk_users'
,
Auth
::
id
())
->
first
();
$user
=
Staff_info
::
where
(
'fk_users'
,
Auth
::
id
())
->
first
();
...
...
packages/portal/timesheet/src/Http/Controllers/FormController.php
View file @
4313c072
...
@@ -304,6 +304,21 @@ class FormController extends Controller
...
@@ -304,6 +304,21 @@ class FormController extends Controller
$tpdetail
->
save
();
$tpdetail
->
save
();
}
}
$zeroedproject
=
Tproject
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'td_project'
,
$projectid
)
->
first
();
if
(
$zeroedproject
)
{
Tproject
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'td_project'
,
$projectid
)
->
delete
();
Ts_detail
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'td_project'
,
$projectid
)
->
delete
();
}
}
}
$sumdetailhour
=
Ts_detail
::
where
(
'td_project_type'
,
$chargeable
)
$sumdetailhour
=
Ts_detail
::
where
(
'td_project_type'
,
$chargeable
)
...
@@ -794,10 +809,12 @@ class FormController extends Controller
...
@@ -794,10 +809,12 @@ class FormController extends Controller
foreach
(
$detail
as
$key
=>
$value
)
foreach
(
$detail
as
$key
=>
$value
)
{
{
$projectid
=
$key
;
$projectid
=
$key
;
// dump($projectid);
foreach
(
$value
as
$keyday
=>
$day
)
foreach
(
$value
as
$keyday
=>
$day
)
{
{
if
(
$day
==
"0"
){
if
(
$day
==
"0"
||
$day
==
"NaN"
){
$day
=
null
;
$day
=
null
;
$date
=
$request
->
year
.
'-'
.
$request
->
month
.
'-'
.
sprintf
(
'%02d'
,
$keyday
);
$date
=
$request
->
year
.
'-'
.
$request
->
month
.
'-'
.
sprintf
(
'%02d'
,
$keyday
);
...
@@ -813,7 +830,24 @@ class FormController extends Controller
...
@@ -813,7 +830,24 @@ class FormController extends Controller
$checkTimesheetDetail
->
td_hours
=
$day
;
$checkTimesheetDetail
->
td_hours
=
$day
;
$checkTimesheetDetail
->
updated_by
=
$userId
;
$checkTimesheetDetail
->
updated_by
=
$userId
;
$checkTimesheetDetail
->
save
();
$checkTimesheetDetail
->
save
();
$checktproject
=
Tproject
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'fk_o_id'
,
$projectid
)
->
first
();
if
(
$checktproject
)
{
$checkhours
=
Ts_detail
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'fk_o_id'
,
$projectid
)
->
get
();
$checktproject
->
tp_hours
=
$checkhours
->
sum
(
'td_hours'
);
$checktproject
->
save
();
}
$checkTimesheetDetail
->
delete
();
}
}
// dd($checkTimesheetDetail->td_hours);
// dd($checkTimesheetDetail->td_hours);
}
}
...
@@ -945,6 +979,18 @@ class FormController extends Controller
...
@@ -945,6 +979,18 @@ class FormController extends Controller
}
}
}
}
$zeroedproject
=
Tproject
::
where
(
'fk_tm_id'
,
$tmasterid
)
->
where
(
'fk_o_id'
,
$projectid
)
->
first
();
if
(
$zeroedproject
)
{
if
(
$zeroedproject
->
tp_hours
==
'0'
)
{
$zeroedproject
->
delete
();
}
}
}
}
$sumdetailhour
=
Ts_detail
::
where
(
'td_project_type'
,
$overhead
)
$sumdetailhour
=
Ts_detail
::
where
(
'td_project_type'
,
$overhead
)
...
...
packages/portal/timesheet/src/Http/Controllers/MaintenanceController.php
View file @
4313c072
...
@@ -317,9 +317,9 @@ class MaintenanceController extends Controller
...
@@ -317,9 +317,9 @@ class MaintenanceController extends Controller
'id'
=>
$value
->
id
,
'id'
=>
$value
->
id
,
'projectcode'
=>
$value
->
toProject
->
p_project_code
,
'projectcode'
=>
$value
->
toProject
->
p_project_code
,
'projectname'
=>
$value
->
pt_project_description
,
'projectname'
=>
$value
->
pt_project_description
,
'projectteam'
=>
$value
->
pt_team
,
'projectteam'
=>
data_get
(
$value
,
'pt_team'
)
,
'role'
=>
$value
->
toRole
->
role
,
'role'
=>
data_get
(
$value
,
'toRole.role'
)
,
'roleid'
=>
$value
->
toRole
->
id
,
'roleid'
=>
data_get
(
$value
,
'toRole.id'
)
,
'status'
=>
$value
->
pt_project_task_sts
,
'status'
=>
$value
->
pt_project_task_sts
,
'pid'
=>
$value
->
fk_project_id
,
'pid'
=>
$value
->
fk_project_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