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
dotproject
invoice
Commits
433881e8
Commit
433881e8
authored
Jan 01, 2013
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new tab "Loss" to record invoices never paid and considered losses.
parent
1e528799
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
503 additions
and
494 deletions
+503
-494
addedit.php
addedit.php
+495
-494
index.php
index.php
+1
-0
projects_tab.invoice.php
projects_tab.invoice.php
+2
-0
vw_loss.php
vw_loss.php
+5
-0
No files found.
addedit.php
View file @
433881e8
<?php
/* PROJECTS $Id: addedit.php,v 1.56 2003/09/11 02:47:22 gregorerhardt Exp $ */
$invoice_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"invoice_id"
,
0
)
);
$project_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
// check permissions for this record
// Done automatically in index.php
//$canEdit = !getDenyEdit( $m, $project_id);
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$start_date
=
new
CDate
(
$row
->
project_start_date
);
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
CDate
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
CDate
(
$row
->
project_actual_end_date
)
:
null
;
// setup the title block
$ttl
=
$invoice_id
>
0
?
"Edit Invoice"
:
"New Invoice"
;
$titleBlock
=
new
CTitleBlock
(
$ttl
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
->
addCrumb
(
"?m=projects"
,
"projects list"
);
if
(
$project_id
!=
0
)
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
$titleBlock
->
addCrumb
(
'?m=invoice'
,
'view all invoices'
);
$titleBlock
->
show
();
$task_id
=
(
int
)
$_REQUEST
[
"task_id"
];
if
(
$task_id
==
''
)
{
$task_id
=
0
;
}
$q
=
new
DBQuery
;
$q
->
addQuery
(
'task_log_id'
);
$q
->
addTable
(
'invoice_task_queue'
);
$temp_billed
=
db_loadColumn
(
$q
->
prepare
());
$billed
=
''
;
foreach
(
$temp_billed
as
$task_log
)
$billed
.=
$task_log
.
', '
;
if
(
!
empty
(
$billed
))
$billed
=
'('
.
substr
(
$billed
,
0
,
-
2
)
.
')'
;
<?php
/* PROJECTS $Id: addedit.php,v 1.56 2003/09/11 02:47:22 gregorerhardt Exp $ */
$invoice_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"invoice_id"
,
0
)
);
$project_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
// check permissions for this record
// Done automatically in index.php
//$canEdit = !getDenyEdit( $m, $project_id);
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$start_date
=
new
CDate
(
$row
->
project_start_date
);
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
CDate
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
CDate
(
$row
->
project_actual_end_date
)
:
null
;
// setup the title block
$ttl
=
$invoice_id
>
0
?
"Edit Invoice"
:
"New Invoice"
;
$titleBlock
=
new
CTitleBlock
(
$ttl
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
->
addCrumb
(
"?m=projects"
,
"projects list"
);
if
(
$project_id
!=
0
)
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
$titleBlock
->
addCrumb
(
'?m=invoice'
,
'view all invoices'
);
$titleBlock
->
show
();
$task_id
=
(
int
)
$_REQUEST
[
"task_id"
];
if
(
$task_id
==
''
)
{
$task_id
=
0
;
}
$q
=
new
DBQuery
;
$q
->
addQuery
(
'task_log_id'
);
$q
->
addTable
(
'invoice_task_queue'
);
$temp_billed
=
db_loadColumn
(
$q
->
prepare
());
$billed
=
''
;
foreach
(
$temp_billed
as
$task_log
)
$billed
.=
$task_log
.
', '
;
if
(
!
empty
(
$billed
))
$billed
=
'('
.
substr
(
$billed
,
0
,
-
2
)
.
')'
;
$q
->
clear
();
$q
->
addQuery
(
'invoice_tag, invoice_status'
);
$q
->
addTable
(
'invoice'
);
$q
->
addWhere
(
'invoice_id = '
.
$invoice_id
);
$ptrc
=
$q
->
exec
();
$nums
=
db_num_rows
(
$ptrc
);
$ptrc
=
$q
->
exec
();
$nums
=
db_num_rows
(
$ptrc
);
echo
db_error
();
for
(
$x
=
0
;
$x
<
$nums
;
$x
++
)
{
$row
=
db_fetch_assoc
(
$ptrc
);
$invoice_tag
=
$row
[
"invoice_tag"
];
for
(
$x
=
0
;
$x
<
$nums
;
$x
++
)
{
$row
=
db_fetch_assoc
(
$ptrc
);
$invoice_tag
=
$row
[
"invoice_tag"
];
$invoice_status
=
$row
[
"invoice_status"
];
}
$q
->
clear
();
$q
->
addQuery
(
'
task_log.task_log_id as task_log_id,
task_log_task,
task_log_name,
task_log_description,
task_log_creator,
task_log_hours,
task_log_date,
billingcode_name'
);
$q
->
addTable
(
'task_log'
);
$q
->
addTable
(
'tasks'
);
$q
->
addTable
(
'projects'
);
$q
->
leftJoin
(
'billingcode'
,
'b'
,
'billingcode_id = task_log_costcode'
);
$q
->
addWhere
(
'tasks.task_project = project_id'
);
if
(
!
empty
(
$billed
))
$q
->
addWhere
(
'task_log_id not in '
.
$billed
);
$q
->
addWhere
(
'tasks.task_id = task_log_task'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
if
(
!
empty
(
$_POST
[
"start_date"
]))
{
$actual_start_date
=
strtotime
(
$_REQUEST
[
"start_date"
]);
$start_date
=
new
CDate
(
$actual_start_date
);
$q
->
addWhere
(
'task_log_date > \''
.
$_REQUEST
[
'inv_start_date'
]
.
"'"
);
}
if
(
!
empty
(
$_POST
[
'end_date'
]))
{
$actual_end_date
=
strtotime
(
$_REQUEST
[
"end_date"
]);
$end_date
=
new
CDate
(
$actual_end_date
);
$q
->
addWhere
(
"task_log_date < '"
.
$_REQUEST
[
'inv_end_date'
]
.
"' "
);
}
if
(
$task_id
!=
0
)
$q
->
addWhere
(
'task_log_task = '
.
$task_id
);
//$sql .= "ORDER BY task_log_name";
$tasks_log
=
$q
->
loadList
();
$q
->
clear
();
$q
->
addQuery
(
'
task_queue_id,
task_log_id,
task_amount'
);
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_invoice = '
.
$invoice_id
);
$q
->
addOrder
(
'task_log_id DESC'
);
$tasks
=
$q
->
loadList
();
$q
->
clear
();
$q
->
addQuery
(
'task_id, task_name'
);
$q
->
addTable
(
'tasks'
);
$q
->
addTable
(
'task_log'
);
$q
->
addWhere
(
'task_id = task_log_task'
);
if
(
!
empty
(
$billed
))
$q
->
addWhere
(
'task_log_id not in '
.
$billed
);
//AND task_percent_complete > 0
$q
->
addWhere
(
'task_project = '
.
$project_id
);
$q
->
addGroup
(
'task_id HAVING count(task_log_task) > 0'
);
$q
->
addOrder
(
'task_name ASC'
);
$task_list
=
array
(
"0"
=>
"Select Task"
);
$ptrc
=
$q
->
exec
();
$nums
=
db_num_rows
(
$ptrc
);
echo
db_error
();
for
(
$x
=
0
;
$x
<
$nums
;
$x
++
)
{
$row
=
db_fetch_assoc
(
$ptrc
);
$task_list
[
$row
[
"task_id"
]]
=
$row
[
"task_name"
];
}
$q
->
clear
();
$q
->
addQuery
(
'project_company'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
//$tmpprj=db_exec($sql);
//$row=db_fetch_assoc($tmpprj);
//$company_id=$row["project_company"];
$company_id
=
$q
->
loadResult
();
$q
->
clear
();
$q
->
addQuery
(
'
billingcode_id,
billingcode_name,
billingcode_value'
);
$q
->
addTable
(
'billingcode'
);
$q
->
addWhere
(
'company_id = '
.
$company_id
);
$q
->
addOrder
(
'billingcode_name ASC'
);
$billingcodes
=
$q
->
loadList
();
function
showtask
(
&
$a
)
{
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
->
addQuery
(
'
task_log_id,
task_log_task,
task_log_name,
task_log_description,
task_log_costcode,
task_log_creator,
task_log_hours,
task_log_date,
task_log_task'
);
$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
);
$q
->
clear
();
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
$q
->
addTable
(
'contacts'
);
$q
->
leftJoin
(
'users'
,
'u'
,
'user_contact = contact_id'
);
$q
->
addWhere
(
'user_id = '
.
$tasks
[
'task_log_creator'
]);
$tmpuser
=
$q
->
exec
();
$username
=
db_fetch_assoc
(
$tmpuser
);
if
(
$a
[
"task_amount"
]
==
"0"
)
{
$costdesc
=
"None"
;
for
(
$x
=
0
;
$x
<
count
(
$billingcodes
);
$x
++
)
{
if
(
$billingcodes
[
$x
][
"billingcode_id"
]
==
$tasks
[
"task_log_costcode"
])
{
$costdesc
=
$billingcodes
[
$x
][
"billingcode_name"
];
$rate
=
$billingcodes
[
$x
][
"billingcode_value"
];
}
}
$amount
=
round
(
$rate
*
$tasks
[
"task_log_hours"
],
2
);
}
else
{
$costdesc
=
"Fixed Price"
;
$amount
=
round
(
$a
[
"task_amount"
],
2
);
}
$s
=
"
\n
<tr>"
;
$s
.=
'<td><a href="./index.php?m=tasks&a=view&task_id='
.
$tasks
[
"task_log_task"
]
.
'"><img src="./images/icons/pencil.gif" border="0" alt="Edit"></a></td>'
;
$s
.=
"<td><a href=
\"
javascript:delIt2(
{
$a
[
'task_queue_id'
]
}
);
\"
title=
\"
"
.
$AppUI
->
_
(
'delete'
)
.
"
\"
><img src=
\"
./images/icons/stock_delete-16.png
\"
border=
\"
0
\"
alt=
\"
Delete
\"
></a></td>"
;
$tdate
=
new
CDate
(
$tasks
[
'task_log_date'
]);
$s
.=
'<td nowrap align="center">'
.
$tdate
->
format
(
$df
)
.
'</td>'
;
$alt
=
htmlspecialchars
(
$tasks
[
"task_log_name"
]
);
$s
.=
'<td align=left> <a href="./index.php?m=tasks&a=view&task_id='
.
$tasks
[
"task_log_task"
]
.
'" title="'
.
$alt
.
'">'
.
$tasks
[
"task_log_name"
]
.
'</a></td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap">'
.
$costdesc
.
'</td>'
;
$s
.=
'<td nowrap="nowarap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'</tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="2"> </td>'
;
$s
.=
'<td colspan="6">'
;
$s
.=
$tasks
[
"task_log_description"
];
$s
.=
'</td>'
;
$s
.=
"</tr>
\n
"
;
echo
$s
;
return
$amount
;
}
function
showtasklog
(
&
$a
)
{
global
$AppUI
,
$project_id
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
$q
->
addTable
(
'contacts'
);
$q
->
leftJoin
(
'users'
,
'u'
,
'user_contact = contact_id'
);
$q
->
addWhere
(
'user_id = '
.
$a
[
'task_log_creator'
]);
$tmpuser
=
$q
->
exec
();
$username
=
db_fetch_assoc
(
$tmpuser
);
$q
->
clear
();
$q
->
addQuery
(
'task_invoice'
);
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_log_id = '
.
$a
[
'task_log_id'
]);
$tmpcheck
=
$q
->
exec
();
$check
=
db_fetch_assoc
(
$tmpcheck
);
$date
=
new
CDate
(
$a
[
'task_log_date'
]);
$s
=
'
<tr valign="top">
<td><input type="checkbox" name="num_'
.
$a
[
"task_log_id"
]
.
'"></td>
<td nowrap>'
.
$date
->
format
(
$df
)
.
'</td>
<td>'
.
$a
[
"task_log_description"
]
.
'</td>
<td nowrap>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>
<td nowrap>'
.
$a
[
'task_log_hours'
]
.
'</td>
<td nowrap>'
.
$a
[
'billingcode_name'
]
.
'</td>
<td align="right" nowrap="nowrap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' <input type="text" name="fixed_'
.
$a
[
'task_log_id'
]
.
'" size="6">
</tr>
'
;
if
(
trim
(
$check
[
'task_invoice'
])
==
''
)
echo
$s
;
}
?>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"all"
href=
"lib/calendar/calendar-dp.css"
title=
"blue"
/>
<!-- import the calendar script -->
<script
type=
"text/javascript"
src=
"
<?php
echo
$AppUI
->
cfg
[
'base_url'
];
?>
lib/calendar/calendar.js"
></script>
<!-- import the language module -->
<script
type=
"text/javascript"
src=
"
<?php
echo
$AppUI
->
cfg
[
'base_url'
];
?>
lib/calendar/lang/calendar-
<?php
echo
$AppUI
->
user_locale
;
?>
.js"
></script>
<script
language=
"javascript"
>
function
submitIt
()
{
var
f
=
document
.
editFrm
;
var
msg
=
''
;
/*
if (f.project_end_date.value > 0 && f.project_end_date.value < f.project_start_date.value) {
msg += "\n
<?php
echo
$AppUI
->
_
(
'projectsBadEndDate1'
);
?>
";
}
if (f.project_actual_end_date.value > 0 && f.project_actual_end_date.value < f.project_start_date.value) {
msg += "\n
<?php
echo
$AppUI
->
_
(
'projectsBadEndDate2'
);
?>
";
}
*/
if
(
msg
.
length
<
1
)
{
f
.
submit
();
}
else
{
alert
(
msg
);
}
}
function
delIt2
(
id
)
{
if
(
confirm
(
"
<?php
echo
$AppUI
->
_
(
'doDelete'
,
UI_OUTPUT_JS
)
.
' '
.
$AppUI
->
_
(
'Invoice Item'
,
UI_OUTPUT_JS
)
.
'?'
;
?>
"
))
{
document
.
frmDelete2
.
task_queue_id
.
value
=
id
;
document
.
frmDelete2
.
submit
();
}
}
function
changeIt
()
{
var
f
=
document
.
changeMe
;
f
.
submit
();
}
function
searchIt
()
{
document
.
searchMe
.
submit
();
}
function
changeStat
()
{
var
f
=
document
.
frmStatus
;
f
.
submit
();
}
var
calendarField
=
''
;
var
calWin
=
null
;
function
popCalendar
(
field
){
calendarField
=
field
;
idate
=
eval
(
'
document.searchMe.
'
+
field
+
'
.value
'
);
window
.
open
(
'
index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=
'
+
idate
,
'
calwin
'
,
'
top=250,left=250,width=250, height=220, scollbars=false
'
);
}
/**
* @param string Input date in the format YYYYMMDD
* @param string Formatted date
*/
function
setCalendar
(
idate
,
fdate
)
{
fld_date
=
eval
(
'
document.searchMe.inv_
'
+
calendarField
);
fld_fdate
=
eval
(
'
document.searchMe.
'
+
calendarField
);
fld_date
.
value
=
idate
;
fld_fdate
.
value
=
fdate
;
}
function
checkUncheckAll
(
theElement
)
{
//documentation for this script at http://www.shawnolson.net/a/693/
var
theForm
=
theElement
.
form
,
z
=
0
;
while
(
theForm
[
z
].
name
!=
'
checkall
'
)
{
if
(
theForm
[
z
].
type
==
'
checkbox
'
)
theForm
[
z
].
checked
=
theElement
.
checked
;
z
++
;
}
}
</script>
<table
border=
"0"
cellpadding=
"4"
cellspacing=
"0"
width=
"100%"
class=
"std"
>
<form
name=
"frmDelete2"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_invoice_aed"
>
<input
type=
"hidden"
name=
"del"
value=
"1"
/>
<input
type=
"hidden"
name=
"task_queue_id"
value=
"0"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
</form>
<table
cellspacing=
"0"
cellpadding=
"4"
border=
"0"
width=
"40%"
class=
"std"
valign=
"top"
>
<form
name=
"statusFrm"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_invoice_aed"
/>
<input
type=
"hidden"
name=
"del"
value=
"0"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_id"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"left"
>
Invoices will not be editable once the status changes from Open for Editing.
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Number
<?php
echo
$invoice_id
?>
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Tag
<input
type=
"text"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
class=
"text"
/>
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Status
<select
name=
"stat"
size=
"1"
class=
"text"
>
<option
value=
"0"
>
Open for Editing
</option>
<option
value=
"1"
>
Pending Payment
</option>
<option
value=
"2"
>
Paid
</option>
</select>
</td>
</tr>
<tr>
<td
align=
"right"
>
<input
class=
"button"
type=
"submit"
name=
"submit"
value=
"
<?php
echo
$AppUI
->
_
(
'submit'
);
?>
"
/>
</td>
</tr>
</form>
</table>
<br>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
width=
"10"
>
</th>
<th
width=
"15"
>
</td>
<th>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Task Name'
);
?>
</th>
<th
width=
"250"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Creator'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Hours'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Billing Code'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Amount'
);
?>
</th>
</tr>
<?php
$myamount
=
0
;
for
(
$s
=
0
;
$s
<
count
(
$tasks
);
$s
++
)
{
$tnums
=
count
(
$tasks
);
if
(
$tnums
)
{
$tmpamount
=
0
;
$tmpamount
=
showtask
(
$tasks
[
$s
],
1
);
$myamount
=
$myamount
+
$tmpamount
;
}
}
?>
<tr>
<td
colspan=
7
align=
right
><b>
Total
</b></td>
}
$q
->
clear
();
$q
->
addQuery
(
'
task_log.task_log_id as task_log_id,
task_log_task,
task_log_name,
task_log_description,
task_log_creator,
task_log_hours,
task_log_date,
billingcode_name'
);
$q
->
addTable
(
'task_log'
);
$q
->
addTable
(
'tasks'
);
$q
->
addTable
(
'projects'
);
$q
->
leftJoin
(
'billingcode'
,
'b'
,
'billingcode_id = task_log_costcode'
);
$q
->
addWhere
(
'tasks.task_project = project_id'
);
if
(
!
empty
(
$billed
))
$q
->
addWhere
(
'task_log_id not in '
.
$billed
);
$q
->
addWhere
(
'tasks.task_id = task_log_task'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
if
(
!
empty
(
$_POST
[
"start_date"
]))
{
$actual_start_date
=
strtotime
(
$_REQUEST
[
"start_date"
]);
$start_date
=
new
CDate
(
$actual_start_date
);
$q
->
addWhere
(
'task_log_date > \''
.
$_REQUEST
[
'inv_start_date'
]
.
"'"
);
}
if
(
!
empty
(
$_POST
[
'end_date'
]))
{
$actual_end_date
=
strtotime
(
$_REQUEST
[
"end_date"
]);
$end_date
=
new
CDate
(
$actual_end_date
);
$q
->
addWhere
(
"task_log_date < '"
.
$_REQUEST
[
'inv_end_date'
]
.
"' "
);
}
if
(
$task_id
!=
0
)
$q
->
addWhere
(
'task_log_task = '
.
$task_id
);
//$sql .= "ORDER BY task_log_name";
$tasks_log
=
$q
->
loadList
();
$q
->
clear
();
$q
->
addQuery
(
'
task_queue_id,
task_log_id,
task_amount'
);
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_invoice = '
.
$invoice_id
);
$q
->
addOrder
(
'task_log_id DESC'
);
$tasks
=
$q
->
loadList
();
$q
->
clear
();
$q
->
addQuery
(
'task_id, task_name'
);
$q
->
addTable
(
'tasks'
);
$q
->
addTable
(
'task_log'
);
$q
->
addWhere
(
'task_id = task_log_task'
);
if
(
!
empty
(
$billed
))
$q
->
addWhere
(
'task_log_id not in '
.
$billed
);
//AND task_percent_complete > 0
$q
->
addWhere
(
'task_project = '
.
$project_id
);
$q
->
addGroup
(
'task_id HAVING count(task_log_task) > 0'
);
$q
->
addOrder
(
'task_name ASC'
);
$task_list
=
array
(
"0"
=>
"Select Task"
);
$ptrc
=
$q
->
exec
();
$nums
=
db_num_rows
(
$ptrc
);
echo
db_error
();
for
(
$x
=
0
;
$x
<
$nums
;
$x
++
)
{
$row
=
db_fetch_assoc
(
$ptrc
);
$task_list
[
$row
[
"task_id"
]]
=
$row
[
"task_name"
];
}
$q
->
clear
();
$q
->
addQuery
(
'project_company'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
//$tmpprj=db_exec($sql);
//$row=db_fetch_assoc($tmpprj);
//$company_id=$row["project_company"];
$company_id
=
$q
->
loadResult
();
$q
->
clear
();
$q
->
addQuery
(
'
billingcode_id,
billingcode_name,
billingcode_value'
);
$q
->
addTable
(
'billingcode'
);
$q
->
addWhere
(
'company_id = '
.
$company_id
);
$q
->
addOrder
(
'billingcode_name ASC'
);
$billingcodes
=
$q
->
loadList
();
function
showtask
(
&
$a
)
{
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
->
addQuery
(
'
task_log_id,
task_log_task,
task_log_name,
task_log_description,
task_log_costcode,
task_log_creator,
task_log_hours,
task_log_date,
task_log_task'
);
$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
);
$q
->
clear
();
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
$q
->
addTable
(
'contacts'
);
$q
->
leftJoin
(
'users'
,
'u'
,
'user_contact = contact_id'
);
$q
->
addWhere
(
'user_id = '
.
$tasks
[
'task_log_creator'
]);
$tmpuser
=
$q
->
exec
();
$username
=
db_fetch_assoc
(
$tmpuser
);
if
(
$a
[
"task_amount"
]
==
"0"
)
{
$costdesc
=
"None"
;
for
(
$x
=
0
;
$x
<
count
(
$billingcodes
);
$x
++
)
{
if
(
$billingcodes
[
$x
][
"billingcode_id"
]
==
$tasks
[
"task_log_costcode"
])
{
$costdesc
=
$billingcodes
[
$x
][
"billingcode_name"
];
$rate
=
$billingcodes
[
$x
][
"billingcode_value"
];
}
}
$amount
=
round
(
$rate
*
$tasks
[
"task_log_hours"
],
2
);
}
else
{
$costdesc
=
"Fixed Price"
;
$amount
=
round
(
$a
[
"task_amount"
],
2
);
}
$s
=
"
\n
<tr>"
;
$s
.=
'<td><a href="./index.php?m=tasks&a=view&task_id='
.
$tasks
[
"task_log_task"
]
.
'"><img src="./images/icons/pencil.gif" border="0" alt="Edit"></a></td>'
;
$s
.=
"<td><a href=
\"
javascript:delIt2(
{
$a
[
'task_queue_id'
]
}
);
\"
title=
\"
"
.
$AppUI
->
_
(
'delete'
)
.
"
\"
><img src=
\"
./images/icons/stock_delete-16.png
\"
border=
\"
0
\"
alt=
\"
Delete
\"
></a></td>"
;
$tdate
=
new
CDate
(
$tasks
[
'task_log_date'
]);
$s
.=
'<td nowrap align="center">'
.
$tdate
->
format
(
$df
)
.
'</td>'
;
$alt
=
htmlspecialchars
(
$tasks
[
"task_log_name"
]
);
$s
.=
'<td align=left> <a href="./index.php?m=tasks&a=view&task_id='
.
$tasks
[
"task_log_task"
]
.
'" title="'
.
$alt
.
'">'
.
$tasks
[
"task_log_name"
]
.
'</a></td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap">'
.
$costdesc
.
'</td>'
;
$s
.=
'<td nowrap="nowarap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'</tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="2"> </td>'
;
$s
.=
'<td colspan="6">'
;
$s
.=
$tasks
[
"task_log_description"
];
$s
.=
'</td>'
;
$s
.=
"</tr>
\n
"
;
echo
$s
;
return
$amount
;
}
function
showtasklog
(
&
$a
)
{
global
$AppUI
,
$project_id
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
$q
->
addTable
(
'contacts'
);
$q
->
leftJoin
(
'users'
,
'u'
,
'user_contact = contact_id'
);
$q
->
addWhere
(
'user_id = '
.
$a
[
'task_log_creator'
]);
$tmpuser
=
$q
->
exec
();
$username
=
db_fetch_assoc
(
$tmpuser
);
$q
->
clear
();
$q
->
addQuery
(
'task_invoice'
);
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_log_id = '
.
$a
[
'task_log_id'
]);
$tmpcheck
=
$q
->
exec
();
$check
=
db_fetch_assoc
(
$tmpcheck
);
$date
=
new
CDate
(
$a
[
'task_log_date'
]);
$s
=
'
<tr valign="top">
<td><input type="checkbox" name="num_'
.
$a
[
"task_log_id"
]
.
'"></td>
<td nowrap>'
.
$date
->
format
(
$df
)
.
'</td>
<td>'
.
$a
[
"task_log_description"
]
.
'</td>
<td nowrap>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>
<td nowrap>'
.
$a
[
'task_log_hours'
]
.
'</td>
<td nowrap>'
.
$a
[
'billingcode_name'
]
.
'</td>
<td align="right" nowrap="nowrap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' <input type="text" name="fixed_'
.
$a
[
'task_log_id'
]
.
'" size="6">
</tr>
'
;
if
(
trim
(
$check
[
'task_invoice'
])
==
''
)
echo
$s
;
}
?>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"all"
href=
"lib/calendar/calendar-dp.css"
title=
"blue"
/>
<!-- import the calendar script -->
<script
type=
"text/javascript"
src=
"
<?php
echo
$AppUI
->
cfg
[
'base_url'
];
?>
lib/calendar/calendar.js"
></script>
<!-- import the language module -->
<script
type=
"text/javascript"
src=
"
<?php
echo
$AppUI
->
cfg
[
'base_url'
];
?>
lib/calendar/lang/calendar-
<?php
echo
$AppUI
->
user_locale
;
?>
.js"
></script>
<script
language=
"javascript"
>
function
submitIt
()
{
var
f
=
document
.
editFrm
;
var
msg
=
''
;
/*
if (f.project_end_date.value > 0 && f.project_end_date.value < f.project_start_date.value) {
msg += "\n
<?php
echo
$AppUI
->
_
(
'projectsBadEndDate1'
);
?>
";
}
if (f.project_actual_end_date.value > 0 && f.project_actual_end_date.value < f.project_start_date.value) {
msg += "\n
<?php
echo
$AppUI
->
_
(
'projectsBadEndDate2'
);
?>
";
}
*/
if
(
msg
.
length
<
1
)
{
f
.
submit
();
}
else
{
alert
(
msg
);
}
}
function
delIt2
(
id
)
{
if
(
confirm
(
"
<?php
echo
$AppUI
->
_
(
'doDelete'
,
UI_OUTPUT_JS
)
.
' '
.
$AppUI
->
_
(
'Invoice Item'
,
UI_OUTPUT_JS
)
.
'?'
;
?>
"
))
{
document
.
frmDelete2
.
task_queue_id
.
value
=
id
;
document
.
frmDelete2
.
submit
();
}
}
function
changeIt
()
{
var
f
=
document
.
changeMe
;
f
.
submit
();
}
function
searchIt
()
{
document
.
searchMe
.
submit
();
}
function
changeStat
()
{
var
f
=
document
.
frmStatus
;
f
.
submit
();
}
var
calendarField
=
''
;
var
calWin
=
null
;
function
popCalendar
(
field
){
calendarField
=
field
;
idate
=
eval
(
'
document.searchMe.
'
+
field
+
'
.value
'
);
window
.
open
(
'
index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=
'
+
idate
,
'
calwin
'
,
'
top=250,left=250,width=250, height=220, scollbars=false
'
);
}
/**
* @param string Input date in the format YYYYMMDD
* @param string Formatted date
*/
function
setCalendar
(
idate
,
fdate
)
{
fld_date
=
eval
(
'
document.searchMe.inv_
'
+
calendarField
);
fld_fdate
=
eval
(
'
document.searchMe.
'
+
calendarField
);
fld_date
.
value
=
idate
;
fld_fdate
.
value
=
fdate
;
}
function
checkUncheckAll
(
theElement
)
{
//documentation for this script at http://www.shawnolson.net/a/693/
var
theForm
=
theElement
.
form
,
z
=
0
;
while
(
theForm
[
z
].
name
!=
'
checkall
'
)
{
if
(
theForm
[
z
].
type
==
'
checkbox
'
)
theForm
[
z
].
checked
=
theElement
.
checked
;
z
++
;
}
}
</script>
<table
border=
"0"
cellpadding=
"4"
cellspacing=
"0"
width=
"100%"
class=
"std"
>
<form
name=
"frmDelete2"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_invoice_aed"
>
<input
type=
"hidden"
name=
"del"
value=
"1"
/>
<input
type=
"hidden"
name=
"task_queue_id"
value=
"0"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
</form>
<table
cellspacing=
"0"
cellpadding=
"4"
border=
"0"
width=
"40%"
class=
"std"
valign=
"top"
>
<form
name=
"statusFrm"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_invoice_aed"
/>
<input
type=
"hidden"
name=
"del"
value=
"0"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_id"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"left"
>
Invoices will not be editable once the status changes from Open for Editing.
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Number
<?php
echo
$invoice_id
?>
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Tag
<input
type=
"text"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
class=
"text"
/>
</td>
</tr>
<tr
valign=
"top"
width=
"90%"
>
<td
align=
"right"
>
Invoice Status
<select
name=
"stat"
size=
"1"
class=
"text"
>
<option
<?php
if
(
$invoice_status
==
"0"
)
print
"selected"
?>
value=
"0"
>
Open for Editing
</option>
<option
<?php
if
(
$invoice_status
==
"1"
)
print
"selected"
?>
value=
"1"
>
Pending Payment
</option>
<option
<?php
if
(
$invoice_status
==
"2"
)
print
"selected"
?>
value=
"2"
>
Paid
</option>
<option
<?php
if
(
$invoice_status
==
"3"
)
print
"selected"
?>
value=
"3"
>
Loss
</option>
</select>
</td>
</tr>
<tr>
<td
align=
"right"
>
<input
class=
"button"
type=
"submit"
name=
"submit"
value=
"
<?php
echo
$AppUI
->
_
(
'submit'
);
?>
"
/>
</td>
</tr>
</form>
</table>
<br>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
width=
"10"
>
</th>
<th
width=
"15"
>
</td>
<th>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Task Name'
);
?>
</th>
<th
width=
"250"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Creator'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Hours'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Billing Code'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Amount'
);
?>
</th>
</tr>
<?php
$myamount
=
0
;
for
(
$s
=
0
;
$s
<
count
(
$tasks
);
$s
++
)
{
$tnums
=
count
(
$tasks
);
if
(
$tnums
)
{
$tmpamount
=
0
;
$tmpamount
=
showtask
(
$tasks
[
$s
],
1
);
$myamount
=
$myamount
+
$tmpamount
;
}
}
?>
<tr>
<td
colspan=
7
align=
right
><b>
Total
</b></td>
<td>
<?php
echo
dPgetConfig
(
'currency_symbol'
);
?>
<?php
echo
$myamount
?>
</td>
</tr>
</table>
<table
cellspacing=
"0"
cellpadding=
"4"
border=
"0"
width=
"70%"
class=
"std"
>
<tr
valign=
"top"
width=
"90%"
>
<form
name=
"searchMe"
action=
"./index.php?m=invoice&a=addedit"
method=
"post"
>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_id"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_id"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Start Date'
);
?>
<input
type=
"hidden"
name=
"inv_start_date"
value=
""
class=
"text"
/>
<input
type=
"text"
name=
"start_date"
value=
""
class=
"text"
/>
<a
href=
"#"
onClick=
"popCalendar('start_date')"
>
<img
src=
"./images/calendar.gif"
width=
"24"
height=
"12"
alt=
"
<?php
echo
$AppUI
->
_
(
'Calendar'
);
?>
"
border=
"0"
/>
</a>
</td>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'End Date'
);
?>
<input
type=
"hidden"
name=
"inv_end_date"
value=
""
class=
"text"
/>
<input
type=
"text"
name=
"end_date"
value=
""
class=
"text"
/>
<a
href=
"#"
onClick=
"popCalendar('end_date')"
>
<img
src=
"./images/calendar.gif"
width=
"24"
height=
"12"
alt=
"
<?php
echo
$AppUI
->
_
(
'Calendar'
);
?>
"
border=
"0"
/>
</a>
</td>
<td>
<input
class=
"button"
type=
"button"
name=
"btnFuseSearch"
value=
"
<?php
echo
$AppUI
->
_
(
'search'
);
?>
"
onClick=
"searchIt();"
/>
</td>
</tr>
</form>
<form
name=
"changeMe"
action=
"./index.php?m=invoice&a=addedit"
method=
"post"
>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_id"
value=
"
<?php
echo
$project_id
;
?>
"
/>
</td>
</tr>
</table>
<table
cellspacing=
"0"
cellpadding=
"4"
border=
"0"
width=
"70%"
class=
"std"
>
<tr
valign=
"top"
width=
"90%"
>
<form
name=
"searchMe"
action=
"./index.php?m=invoice&a=addedit"
method=
"post"
>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_id"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_id"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Start Date'
);
?>
<input
type=
"hidden"
name=
"inv_start_date"
value=
""
class=
"text"
/>
<input
type=
"text"
name=
"start_date"
value=
""
class=
"text"
/>
<a
href=
"#"
onClick=
"popCalendar('start_date')"
>
<img
src=
"./images/calendar.gif"
width=
"24"
height=
"12"
alt=
"
<?php
echo
$AppUI
->
_
(
'Calendar'
);
?>
"
border=
"0"
/>
</a>
</td>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'End Date'
);
?>
<input
type=
"hidden"
name=
"inv_end_date"
value=
""
class=
"text"
/>
<input
type=
"text"
name=
"end_date"
value=
""
class=
"text"
/>
<a
href=
"#"
onClick=
"popCalendar('end_date')"
>
<img
src=
"./images/calendar.gif"
width=
"24"
height=
"12"
alt=
"
<?php
echo
$AppUI
->
_
(
'Calendar'
);
?>
"
border=
"0"
/>
</a>
</td>
<td>
<input
class=
"button"
type=
"button"
name=
"btnFuseSearch"
value=
"
<?php
echo
$AppUI
->
_
(
'search'
);
?>
"
onClick=
"searchIt();"
/>
</td>
</tr>
</form>
<form
name=
"changeMe"
action=
"./index.php?m=invoice&a=addedit"
method=
"post"
>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_id"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_id"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<tr>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Name'
);
?>
<?php
echo
arraySelect
(
$task_list
,
'task_id'
,
'size="1" class="text" onchange="changeIt();"'
,
$obj
->
task_status
,
true
);
?>
</td>
</form>
</tr>
<tr>
<td
colspan=
"2"
align=
"right"
>
<input
class=
"button"
type=
"button"
name=
"btnFuseAction"
value=
"
<?php
echo
$AppUI
->
_
(
'Add selected tasks log to invoice'
);
?>
"
onClick=
"submitIt();"
/>
</td>
</tr>
<?php
if
(
isset
(
$_POST
[
'start_date'
]))
{
?>
<tr><td
colspan=
"2"
>
<?php
'Dates between: '
.
$_POST
[
'start_date'
]
.
' and '
.
$_POST
[
'end_date'
]
.
'<br />'
?>
</td></tr>
;
<?php
}
?>
</table>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th>
<?php
$AppUI
->
_
(
'Select'
)
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Log Summary'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Creator'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Hours'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Billing Code'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Fixed Amount'
);
?>
</th>
</tr>
<form
name=
"editFrm"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<tr>
<td
align=
"right"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Task Name'
);
?>
<?php
echo
arraySelect
(
$task_list
,
'task_id'
,
'size="1" class="text" onchange="changeIt();"'
,
$obj
->
task_status
,
true
);
?>
</td>
</form>
</tr>
<tr>
<td
colspan=
"2"
align=
"right"
>
<input
class=
"button"
type=
"button"
name=
"btnFuseAction"
value=
"
<?php
echo
$AppUI
->
_
(
'Add selected tasks log to invoice'
);
?>
"
onClick=
"submitIt();"
/>
</td>
</tr>
<?php
if
(
isset
(
$_POST
[
'start_date'
]))
{
?>
<tr><td
colspan=
"2"
>
<?php
'Dates between: '
.
$_POST
[
'start_date'
]
.
' and '
.
$_POST
[
'end_date'
]
.
'<br />'
?>
</td></tr>
;
<?php
}
?>
</table>
<table
width=
"100%"
border=
"0"
cellpadding=
"2"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th>
<?php
$AppUI
->
_
(
'Select'
)
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Date'
);
?>
</th>
<th>
<?php
echo
$AppUI
->
_
(
'Log Summary'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Creator'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Hours'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Billing Code'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Fixed Amount'
);
?>
</th>
</tr>
<form
name=
"editFrm"
action=
"./index.php?m=invoice"
method=
"post"
>
<input
type=
"hidden"
name=
"dosql"
value=
"do_invoice_aed"
/>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<?php
//echo '<tr><td>'; print_r($tasks_log); echo '</td></tr>';
for
(
$s
=
0
;
$s
<
count
(
$tasks_log
);
$s
++
)
{
showtasklog
(
$tasks_log
[
$s
],
1
);
}
?>
<tr><td><input
type=
"checkbox"
name=
"checkall"
onclick=
"checkUncheckAll(this);"
/>
all
</td></tr>
</form>
</table>
*
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
<input
type=
"hidden"
name=
"tag"
value=
"
<?php
echo
$invoice_tag
;
?>
"
/>
<input
type=
"hidden"
name=
"invoice_project"
value=
"
<?php
echo
$project_id
;
?>
"
/>
<input
type=
"hidden"
name=
"task_invoice"
value=
"
<?php
echo
$invoice_id
;
?>
"
/>
<input
type=
"hidden"
name=
"project_creator"
value=
"
<?php
echo
$AppUI
->
user_id
;
?>
"
/>
<?php
//echo '<tr><td>'; print_r($tasks_log); echo '</td></tr>';
for
(
$s
=
0
;
$s
<
count
(
$tasks_log
);
$s
++
)
{
showtasklog
(
$tasks_log
[
$s
],
1
);
}
?>
<tr><td><input
type=
"checkbox"
name=
"checkall"
onclick=
"checkUncheckAll(this);"
/>
all
</td></tr>
</form>
</table>
*
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
index.php
View file @
433881e8
...
...
@@ -45,6 +45,7 @@ $tabBox = new CTabBox( "?m=invoice", dPgetConfig('root_dir') . '/modules/invoice
$tabBox
->
add
(
"vw_open"
,
'Invoices (Open)'
);
$tabBox
->
add
(
"vw_pend"
,
'Invoices (Pending)'
);
$tabBox
->
add
(
"vw_paid"
,
'Invoices (Paid)'
);
$tabBox
->
add
(
"vw_loss"
,
'Invoices (Loss)'
);
$tabBox
->
show
();
?>
projects_tab.invoice.php
View file @
433881e8
...
...
@@ -46,6 +46,8 @@ function showtask_inv( &$a, $level=0 ) {
$invoice_status
=
"Pending"
;
}
elseif
(
$a
[
"invouce_status"
]
==
"2"
)
{
$invoice_status
=
"Paid"
;
}
elseif
(
$a
[
"invouce_status"
]
==
"3"
)
{
^
M
$invoice_status
=
"Loss"
;
}
$start_date
=
strftime
(
$df
,
$a
[
"invoice_date"
]);
...
...
vw_loss.php
0 → 100644
View file @
433881e8
<?php
include
(
"vw_inc.php"
);
echo
invoices
(
3
);
?>
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