Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
timesheet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
web2project
timesheet
Commits
4d3143d3
Commit
4d3143d3
authored
Apr 05, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace tabs by spaces
parent
1e681afe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
99 deletions
+96
-99
addedit.php
addedit.php
+96
-99
No files found.
addedit.php
View file @
4d3143d3
...
@@ -120,27 +120,26 @@ while ( $row = $q->fetchRow()) {
...
@@ -120,27 +120,26 @@ while ( $row = $q->fetchRow()) {
}
}
// Get current submitter name
// Get current submitter name
if
(
"
$obj->timesheet_creator
"
==
""
)
{
if
(
"
$obj->timesheet_creator
"
==
""
)
{
$submitter
=
$users
[
$AppUI
->
user_id
];
$submitter
=
$users
[
$AppUI
->
user_id
];
$obj
->
timesheet_creator
=
$AppUI
->
user_id
;
$obj
->
timesheet_creator
=
$AppUI
->
user_id
;
}
else
{
$submitter
=
$users
[
$obj
->
timesheet_creator
];
}
}
else
$submitter
=
$users
[
$obj
->
timesheet_creator
];
$q
->
Clear
();
$q
->
Clear
();
// Get the current timesheet period
// Get the current timesheet period
if
(
intval
(
$obj
->
timesheet_period
))
{
if
(
intval
(
$obj
->
timesheet_period
))
{
$period
=
new
CDate
();
$period
=
new
CDate
();
$period
->
setMonth
(
$obj
->
timesheet_period
);
$period
->
setMonth
(
$obj
->
timesheet_period
);
}
else
{
$period
=
new
CDate
();
}
}
else
$period
=
new
CDate
();
// Get the current timesheet status
// Get the current timesheet status
if
(
intval
(
$obj
->
timesheet_status
))
if
(
intval
(
$obj
->
timesheet_status
))
$status
=
$obj
->
timesheet_status
;
$status
=
$obj
->
timesheet_status
;
else
else
$status
=
0
;
$status
=
0
;
// Get the current timesheet creation date
// Get the current timesheet creation date
if
(
intval
(
$obj
->
timesheet_date
))
{
if
(
intval
(
$obj
->
timesheet_date
))
{
...
@@ -311,57 +310,57 @@ $project_types = dPgetSysVal("ProjectStatus");
...
@@ -311,57 +310,57 @@ $project_types = dPgetSysVal("ProjectStatus");
// Find all tasks in this timesheet period and account them to the project.
// Find all tasks in this timesheet period and account them to the project.
function
showproject
()
function
showproject
()
{
{
global
$AppUI
,
$period
,
$obj
,
$project_types
;
global
$AppUI
,
$period
,
$obj
,
$project_types
;
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_id'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_name'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addQuery
(
'project_status'
);
$q
->
addTable
(
'projects'
);
$q
->
addTable
(
'projects'
);
$q
->
addOrder
(
'project_name ASC'
);
$q
->
addOrder
(
'project_name ASC'
);
$projects
=
$q
->
LoadList
();
$projects
=
$q
->
LoadList
();
$timesheet_worked
=
0
;
$timesheet_worked
=
0
;
foreach
(
$projects
as
$row
)
{
foreach
(
$projects
as
$row
)
{
$project_id
=
$row
[
"project_id"
];
$project_id
=
$row
[
"project_id"
];
$t
=
new
DBQuery
;
$t
=
new
DBQuery
;
$t
->
addQuery
(
'task_id'
);
$t
->
addQuery
(
'task_id'
);
$t
->
addQuery
(
'task_name'
);
$t
->
addQuery
(
'task_name'
);
$t
->
addQuery
(
'task_owner'
);
$t
->
addQuery
(
'task_owner'
);
$t
->
addQuery
(
'task_start_date'
);
$t
->
addQuery
(
'task_start_date'
);
$t
->
addQuery
(
'task_hours_worked'
);
$t
->
addQuery
(
'task_hours_worked'
);
$t
->
addTable
(
'tasks'
);
$t
->
addTable
(
'tasks'
);
$t
->
addWhere
(
'task_project = '
.
$project_id
);
$t
->
addWhere
(
'task_project = '
.
$project_id
);
$t
->
addOrder
(
'task_start_date DESC'
);
$t
->
addOrder
(
'task_start_date DESC'
);
$tasks
=
$t
->
LoadList
();
$tasks
=
$t
->
LoadList
();
$t
->
Clear
();
$t
->
Clear
();
$amount
=
0
;
$amount
=
0
;
foreach
(
$tasks
as
$item
)
{
foreach
(
$tasks
as
$item
)
{
// Query the task_log table for actual start dates.
// Query the task_log table for actual start dates.
$t
->
addQuery
(
'task_log_id'
);
$t
->
addQuery
(
'task_log_id'
);
$t
->
addQuery
(
'task_log_name'
);
$t
->
addQuery
(
'task_log_name'
);
$t
->
addQuery
(
'task_log_creator'
);
$t
->
addQuery
(
'task_log_creator'
);
$t
->
addQuery
(
'task_log_date'
);
$t
->
addQuery
(
'task_log_date'
);
$t
->
addQuery
(
'task_log_hours'
);
$t
->
addQuery
(
'task_log_hours'
);
$t
->
addTable
(
'task_log'
);
$t
->
addTable
(
'task_log'
);
$t
->
addWhere
(
'task_log_task = '
.
$item
[
"task_id"
]);
$t
->
addWhere
(
'task_log_task = '
.
$item
[
"task_id"
]);
// What if this is different then current user?
// What if this is different then current user?
$t
->
addWhere
(
'task_log_creator = '
.
$AppUI
->
user_id
);
$t
->
addWhere
(
'task_log_creator = '
.
$AppUI
->
user_id
);
$t
->
addOrder
(
'task_log_date DESC'
);
$t
->
addOrder
(
'task_log_date DESC'
);
// TODO: select on user and date
// TODO: select on user and date
$log
=
$t
->
LoadList
();
$log
=
$t
->
LoadList
();
foreach
(
$log
as
$logitem
)
{
foreach
(
$log
as
$logitem
)
{
if
(
intval
(
$logitem
[
'task_log_date'
]))
if
(
intval
(
$logitem
[
'task_log_date'
]))
{
{
$taskDate
=
new
CDate
(
$logitem
[
'task_log_date'
]);
$taskDate
=
new
CDate
(
$logitem
[
'task_log_date'
]);
if
(
(
$period
->
GetMonth
()
==
$taskDate
->
GetMonth
())
&&
if
(
(
$period
->
GetMonth
()
==
$taskDate
->
GetMonth
())
&&
(
$period
->
GetYear
()
==
$taskDate
->
GetYear
())
)
{
(
$period
->
GetYear
()
==
$taskDate
->
GetYear
())
)
{
$amount
=
$amount
+
$logitem
[
'task_log_hours'
];
$amount
=
$amount
+
$logitem
[
'task_log_hours'
];
}
}
// else do not account the worked hours to the project for this month
// else do not account the worked hours to the project for this month
}
}
}
}
}
}
if
(
$amount
>
0
)
if
(
$amount
>
0
)
{
{
...
@@ -370,59 +369,57 @@ function showproject()
...
@@ -370,59 +369,57 @@ function showproject()
echo
'<td><a href="?m=projects&a=view&project_id='
.
$row
[
"project_id"
]
.
'">'
.
$row
[
"project_name"
]
.
'</a>'
;
echo
'<td><a href="?m=projects&a=view&project_id='
.
$row
[
"project_id"
]
.
'">'
.
$row
[
"project_name"
]
.
'</a>'
;
echo
'</td>'
;
echo
'</td>'
;
echo
'<td>'
;
echo
'<td>'
;
echo
$amount
;
echo
$amount
;
$timesheet_worked
=
$timesheet_worked
+
$amount
;
$timesheet_worked
=
$timesheet_worked
+
$amount
;
echo
'</td>'
;
echo
'</td>'
;
echo
'<td>'
.
$project_types
[
$row
[
'project_status'
]]
.
'</td>'
;
echo
'<td>'
.
$project_types
[
$row
[
'project_status'
]]
.
'</td>'
;
echo
'</tr>'
;
echo
'</tr>'
;
}
}
}
}
$obj
->
timesheet_worked
=
$timesheet_worked
;
$obj
->
timesheet_worked
=
$timesheet_worked
;
}
// end of function showproject()
}
// end of function showproject()
function
showtimesheetproject
()
function
showtimesheetproject
()
{
{
global
$timesheet_id
,
$project_types
;
global
$timesheet_id
,
$project_types
;
// FIXME: There is a bug in this function. It doesn't take current timesheet into account
// FIXME: There is a bug in this function. It doesn't take current timesheet into account
// as well as it should. Some hours from other periods maybe accounted on this project, while
// as well as it should. Some hours from other periods maybe accounted on this project, while
// we only want to see the time worked in this period.
// we only want to see the time worked in this period.
$q
=
new
DBQuery
();
$q
=
new
DBQuery
();
$q
->
addQuery
(
'timesheet_id'
);
$q
->
addQuery
(
'timesheet_id'
);
$q
->
addQuery
(
'timesheet_project'
);
$q
->
addQuery
(
'timesheet_project'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addQuery
(
'timesheet_project_amount'
);
$q
->
addTable
(
'timesheet_project'
);
$q
->
addTable
(
'timesheet_project'
);
$q
->
addWhere
(
'timesheet_id = '
.
$timesheet_id
);
$q
->
addWhere
(
'timesheet_id = '
.
$timesheet_id
);
$q
->
addOrder
(
'timesheet_project ASC'
);
$q
->
addOrder
(
'timesheet_project ASC'
);
$timesheet
=
$q
->
LoadList
();
$timesheet
=
$q
->
LoadList
();
foreach
(
$timesheet
as
$row
)
{
foreach
(
$timesheet
as
$row
)
{
$p
=
new
DBQuery
();
$p
=
new
DBQuery
();
$p
->
addQuery
(
'project_id'
);
$p
->
addQuery
(
'project_id'
);
$p
->
addQuery
(
'project_name'
);
$p
->
addQuery
(
'project_name'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addQuery
(
'project_status'
);
$p
->
addTable
(
'projects'
);
$p
->
addTable
(
'projects'
);
$p
->
addWhere
(
'project_id = '
.
$row
[
"timesheet_project"
]);
$p
->
addWhere
(
'project_id = '
.
$row
[
"timesheet_project"
]);
$p
->
addOrder
(
'project_name ASC'
);
$p
->
addOrder
(
'project_name ASC'
);
$projects
=
$p
->
LoadList
();
$projects
=
$p
->
LoadList
();
foreach
(
$projects
as
$project
)
{
foreach
(
$projects
as
$project
)
{
if
(
intval
(
$row
[
'timesheet_project_amount'
]
)
>
0
)
if
(
intval
(
$row
[
'timesheet_project_amount'
]
)
>
0
)
{
{
echo
'<tr>'
;
echo
'<tr>'
;
echo
'<td> </td>'
;
echo
'<td> </td>'
;
echo
'<td><a href="?m=projects&a=view&project_id='
.
$project
[
"project_id"
]
.
'">'
.
$project
[
"project_name"
]
.
'</a>'
;
echo
'<td><a href="?m=projects&a=view&project_id='
.
$project
[
"project_id"
]
.
'">'
.
$project
[
"project_name"
]
.
'</a>'
;
// echo '<td><a href="?m=projects&a=view&project_id=' . $row["timesheet_project"] . '">' . $project["project_name"] . '</a>';
echo
'</td>'
;
echo
'</td>'
;
echo
'<td>'
.
$row
[
'timesheet_project_amount'
]
.
'</td>'
;
echo
'<td>'
.
$row
[
'timesheet_project_amount'
]
.
'</td>'
;
echo
'<td>'
.
$project_types
[
$project
[
'project_status'
]]
.
'</td>'
;
echo
'<td>'
.
$project_types
[
$project
[
'project_status'
]]
.
'</td>'
;
echo
'</tr>'
;
echo
'</tr>'
;
}
}
}
}
}
}
}
// end of function showtimesheetproject()
}
// end of function showtimesheetproject()
?>
<?php
// Print the overview table
echo
'<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">'
;
echo
'<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">'
;
echo
'<tr>'
;
echo
'<tr>'
;
echo
'<th nowrap="nowrap"> </th>'
;
echo
'<th nowrap="nowrap"> </th>'
;
...
@@ -447,7 +444,7 @@ function showtimesheetproject()
...
@@ -447,7 +444,7 @@ function showtimesheetproject()
// recalculated from the projects table, while you actually would like to see the hours as
// recalculated from the projects table, while you actually would like to see the hours as
// submitted/approved by users and manager.
// submitted/approved by users and manager.
showproject
();
showproject
();
//showtimesheetproject();
//showtimesheetproject();
echo
'<script language="javascript">workedHoursChange('
.
$obj
->
timesheet_worked
.
');</script>'
;
echo
'<script language="javascript">workedHoursChange('
.
$obj
->
timesheet_worked
.
');</script>'
;
echo
"</form>"
;
echo
"</form>"
;
echo
"</table>"
;
echo
"</table>"
;
...
...
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