Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
invoice
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
invoice
Commits
6b4f0383
Commit
6b4f0383
authored
Jan 26, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addedit.php: refactored invoice_getHours() and invoice_showtask()
parent
06d0421a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
29 deletions
+15
-29
addedit.php
addedit.php
+15
-29
No files found.
addedit.php
View file @
6b4f0383
...
@@ -52,11 +52,12 @@ if($task_id == '') {
...
@@ -52,11 +52,12 @@ if($task_id == '') {
$q
=
new
w2p_Database_Query
();
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'task_log_id'
);
$q
->
addQuery
(
'task_log_id'
);
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addTable
(
'invoice_task_queue'
);
// FIXME: not sure this solutions is correct
//$temp_billed = db_loadColumn($q->prepare());
//$temp_billed = db_loadColumn($q->prepare());
$temp_billed
=
$q
->
prepare
();
$tmpbilled
=
$q
->
exec
();
$temp_billed
=
db_fetch_assoc
(
$tmpbilled
);
$billed
=
''
;
$billed
=
''
;
foreach
(
$temp_billed
as
$task_log
)
{
foreach
(
$temp_billed
as
$task_log
)
{
echo
"invoice: "
.
$task_log
.
"<br>"
;
$billed
.=
$task_log
.
', '
;
$billed
.=
$task_log
.
', '
;
}
}
if
(
!
empty
(
$billed
))
if
(
!
empty
(
$billed
))
...
@@ -166,29 +167,9 @@ $q->addOrder('billingcode_name ASC');
...
@@ -166,29 +167,9 @@ $q->addOrder('billingcode_name ASC');
$billingcodes
=
$q
->
loadList
();
$billingcodes
=
$q
->
loadList
();
// FIXME: Refactor invoice_showtask() and invoice_getHours()
function
invoice_getTasks
(
&
$a
)
{
// since they query the same database with the same row.
// This would make all more efficient.
function
invoice_getHours
(
&
$a
)
{
global
$project_id
;
global
$project_id
;
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'task_log_id, task_log_hours'
);
$q
->
addTable
(
'task_log'
);
$q
->
addWhere
(
'task_log_id = '
.
$a
[
'task_log_id'
]);
$q
->
addOrder
(
'task_log_name ASC'
);
$tmptasks
=
$q
->
exec
();
$tasks
=
db_fetch_assoc
(
$tmptasks
);
$hours
=
$tasks
[
'task_log_hours'
];
return
$hours
;
}
function
invoice_showtask
(
&
$a
)
{
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
w2p_Database_Query
();
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'
$q
->
addQuery
(
'
task_log_id,
task_log_id,
...
@@ -206,8 +187,14 @@ function invoice_showtask(&$a) {
...
@@ -206,8 +187,14 @@ function invoice_showtask(&$a) {
$tmptasks
=
$q
->
exec
();
$tmptasks
=
$q
->
exec
();
$tasks
=
db_fetch_assoc
(
$tmptasks
);
$tasks
=
db_fetch_assoc
(
$tmptasks
);
return
$tasks
;
}
$q
->
clear
();
function
invoice_showtask
(
&
$a
,
$tasks
)
{
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'
$q
->
addQuery
(
'
contact_first_name,
contact_first_name,
contact_last_name'
);
contact_last_name'
);
...
@@ -405,7 +392,7 @@ Invoices will not be editable once the status changes from Open for Editing.
...
@@ -405,7 +392,7 @@ Invoices will not be editable once the status changes from Open for Editing.
</tr>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Tag
<td
align=
"right"
>
Invoice Tag
<input
type=
"text"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
class=
"text"
/>
<input
type=
"text"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
class=
"text"
pattern=
"^]s*]d{8}"
size=
8
/>
</td>
</td>
</tr>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<tr
valign=
"top"
width=
"90%"
>
...
@@ -449,10 +436,10 @@ for ($s=0; $s < count($tasks); $s++) {
...
@@ -449,10 +436,10 @@ for ($s=0; $s < count($tasks); $s++) {
$tnums
=
count
(
$tasks
);
$tnums
=
count
(
$tasks
);
if
(
$tnums
)
{
if
(
$tnums
)
{
$tmpamount
=
0
;
$tmpamount
=
0
;
$tmpamount
=
invoice_showtask
(
$tasks
[
$s
],
1
);
$t
=
invoice_getTasks
(
$tasks
[
$s
]);
$tmpamount
=
invoice_showtask
(
$tasks
[
$s
],
$t
);
$myamount
=
$myamount
+
$tmpamount
;
$myamount
=
$myamount
+
$tmpamount
;
$t
=
&
$tasks
[
$s
];
$myhours
=
$myhours
+
$t
[
'task_log_hours'
];
$myhours
=
$myhours
+
invoice_getHours
(
$tasks
[
$s
]);
}
}
}
}
?>
?>
...
@@ -544,7 +531,6 @@ if (isset($_POST['start_date']))
...
@@ -544,7 +531,6 @@ if (isset($_POST['start_date']))
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<?php
<?php
//echo '<tr><td>'; print_r($tasks_log); echo '</td></tr>';
for
(
$s
=
0
;
$s
<
count
(
$tasks_log
);
$s
++
)
{
for
(
$s
=
0
;
$s
<
count
(
$tasks_log
);
$s
++
)
{
showtasklog
(
$tasks_log
[
$s
],
1
);
showtasklog
(
$tasks_log
[
$s
],
1
);
}
}
...
...
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