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
abc65b0f
Commit
abc65b0f
authored
Jan 23, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port to web2project
parent
433881e8
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
387 additions
and
332 deletions
+387
-332
addedit.php
addedit.php
+21
-17
do_invoice_aed.php
do_invoice_aed.php
+8
-8
index.php
index.php
+9
-5
invoice.class.php
invoice.class.php
+13
-10
projects_tab.invoice.php
projects_tab.invoice.php
+12
-8
reports.php
reports.php
+8
-4
reports/invoicestyle1.php
reports/invoicestyle1.php
+17
-14
reports/invoicestyle2.php
reports/invoicestyle2.php
+18
-15
setup.php
setup.php
+81
-77
view.php
view.php
+35
-29
vw_inc.php
vw_inc.php
+149
-145
vw_loss.php
vw_loss.php
+4
-0
vw_open.php
vw_open.php
+4
-0
vw_paid.php
vw_paid.php
+4
-0
vw_pend.php
vw_pend.php
+4
-0
No files found.
addedit.php
View file @
abc65b0f
<?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
)
);
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
$invoice_id
=
intval
(
w2PgetParam
(
$_REQUEST
,
"invoice_id"
,
0
)
);
$project_id
=
intval
(
w2PgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
// check permissions for this record
// Done automatically in index.php
...
...
@@ -12,14 +16,14 @@ if (!$canEdit) {
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$start_date
=
new
C
Date
(
$row
->
project_start_date
);
$start_date
=
new
w2p_Utilities_
Date
(
$row
->
project_start_date
);
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
C
Date
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
C
Date
(
$row
->
project_actual_end_date
)
:
null
;
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
w2p_Utilities_
Date
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
w2p_Utilities_
Date
(
$row
->
project_actual_end_date
)
:
null
;
// setup the title block
$ttl
=
$invoice_id
>
0
?
"Edit Invoice"
:
"New Invoice"
;
$titleBlock
=
new
C
TitleBlock
(
$ttl
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
=
new
w2p_Theme_
TitleBlock
(
$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"
);
...
...
@@ -31,7 +35,7 @@ if($task_id == '') {
$task_id
=
0
;
}
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'task_log_id'
);
$q
->
addTable
(
'invoice_task_queue'
);
$temp_billed
=
db_loadColumn
(
$q
->
prepare
());
...
...
@@ -74,13 +78,13 @@ $q->addWhere('project_id = ' . $project_id);
if
(
!
empty
(
$_POST
[
"start_date"
]))
{
$actual_start_date
=
strtotime
(
$_REQUEST
[
"start_date"
]);
$start_date
=
new
C
Date
(
$actual_start_date
);
$start_date
=
new
w2p_Utilities_
Date
(
$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
C
Date
(
$actual_end_date
);
$end_date
=
new
w2p_Utilities_
Date
(
$actual_end_date
);
$q
->
addWhere
(
"task_log_date < '"
.
$_REQUEST
[
'inv_end_date'
]
.
"' "
);
}
if
(
$task_id
!=
0
)
...
...
@@ -146,7 +150,7 @@ function showtask(&$a) {
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
task_log_id,
task_log_task,
...
...
@@ -192,14 +196,14 @@ if ($a["task_amount"] == "0") {
$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
C
Date
(
$tasks
[
'task_log_date'
]);
$tdate
=
new
w2p_Utilities_
Date
(
$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">'
.
d
PgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'<td nowrap="nowarap">'
.
w2
PgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'</tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="2"> </td>'
;
...
...
@@ -216,7 +220,7 @@ function showtasklog(&$a) {
global
$AppUI
,
$project_id
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
...
...
@@ -235,7 +239,7 @@ $q->addWhere('task_log_id = ' . $a['task_log_id']);
$tmpcheck
=
$q
->
exec
();
$check
=
db_fetch_assoc
(
$tmpcheck
);
$date
=
new
C
Date
(
$a
[
'task_log_date'
]);
$date
=
new
w2p_Utilities_
Date
(
$a
[
'task_log_date'
]);
$s
=
'
<tr valign="top">
<td><input type="checkbox" name="num_'
.
$a
[
"task_log_id"
]
.
'"></td>
...
...
@@ -245,7 +249,7 @@ $date = new CDate($a['task_log_date']);
<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">'
.
d
PgetConfig
(
'currency_symbol'
)
.
' <input type="text" name="fixed_'
.
$a
[
'task_log_id'
]
.
'" size="6">
<td align="right" nowrap="nowrap">'
.
w2
PgetConfig
(
'currency_symbol'
)
.
' <input type="text" name="fixed_'
.
$a
[
'task_log_id'
]
.
'" size="6">
</tr>
'
;
if
(
trim
(
$check
[
'task_invoice'
])
==
''
)
...
...
@@ -413,7 +417,7 @@ for ($s=0; $s < count($tasks); $s++) {
<tr>
<td
colspan=
7
align=
right
><b>
Total
</b></td>
<td>
<?php
echo
d
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
w2
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
$myamount
?>
</td>
</tr>
...
...
@@ -503,4 +507,4 @@ if (isset($_POST['start_date']))
</form>
</table>
*
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
do_invoice_aed.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
$del
=
isset
(
$_POST
[
'del'
])
?
$_POST
[
'del'
]
:
0
;
$stat
=
isset
(
$_POST
[
'stat'
])
?
$_POST
[
'stat'
]
:
-
1
;
$tag
=
isset
(
$_POST
[
'tag'
])
?
$_POST
[
'tag'
]
:
-
1
;
$stat
=
isset
(
$_POST
[
'stat'
])
?
$_POST
[
'stat'
]
:
-
1
;
$tag
=
isset
(
$_POST
[
'tag'
])
?
$_POST
[
'tag'
]
:
-
1
;
$obj
=
new
CInvoice
();
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
...
...
@@ -25,9 +27,9 @@ if ($del) {
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
$AppUI
->
setMsg
(
$msg
.
"updated"
,
UI_MSG_OK
,
true
);
}
if
((
$msg
=
$obj
->
change_invoice_tag
(
$tag
)))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
if
((
$msg
=
$obj
->
change_invoice_tag
(
$tag
)))
{
$AppUI
->
setMsg
(
$msg
,
UI_MSG_ERROR
);
}
else
{
$AppUI
->
setMsg
(
$msg
.
"updated"
,
UI_MSG_OK
,
true
);
}
...
...
@@ -46,6 +48,4 @@ if ($del) {
$AppUI
->
redirect
(
"m=invoice&a=addedit&invoice_id="
.
$obj
->
task_invoice
.
"&project_id="
.
$obj
->
_invoice_project
);
}
?>
index.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
//$AppUI->savePlace();
if
(
isset
(
$_GET
[
'project_id'
]
))
{
...
...
@@ -13,9 +17,9 @@ if (isset( $_GET['tab'] )) {
$tab
=
$AppUI
->
getState
(
'InvoiceIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'InvoiceIdxTab'
)
:
1
;
$active
=
intval
(
!
$AppUI
->
getState
(
'InvoiceIdxTab'
)
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
invoice_id,
invoice_id,
invoice_tag,
invoice_project,
invoice_status,
...
...
@@ -26,7 +30,7 @@ $q->addTable('invoice');
$invoices
=
$q
->
loadList
();
// setup the title block
$titleBlock
=
new
C
TitleBlock
(
'Invoice'
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
=
new
w2p_Theme_
TitleBlock
(
'Invoice'
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
->
addCell
();
if
(
$canEdit
&&
$project_id
)
{
$titleBlock
->
addCell
(
...
...
@@ -41,11 +45,11 @@ $titleBlock->show();
// include("{$AppUI->cfg['root_dir']}/modules/invoice/index.php");
// tabbed information boxes
$tabBox
=
new
CTabBox
(
"?m=
invoice"
,
dPgetConfig
(
'root_dir'
)
.
'/modules/invoice/'
,
$tab
);
$tabBox
=
new
CTabBox
(
"?m=
$m
"
,
W2P_BASE_DIR
.
"/modules/
$m
/"
,
$tab
);
$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
->
add
(
"vw_loss"
,
'Invoices (Loss)'
);
$tabBox
->
show
();
?>
invoice.class.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
require_once
(
$AppUI
->
getSystemClass
(
'libmail'
)
);
require_once
(
$AppUI
->
getSystemClass
(
'd
p'
)
);
//
require_once( $AppUI->getSystemClass( 'libmail' ) );
//require_once( $AppUI->getSystemClass( 'w2
p' ) );
class
CInvoice
extends
CDp
Object
{
class
CInvoice
extends
w2p_Core_Base
Object
{
var
$invoice_task_queue_id
=
NULL
;
var
$task_invoice
=
NULL
;
...
...
@@ -11,7 +14,7 @@ class CInvoice extends CDpObject {
var
$task_amount
=
NULL
;
function
CInvoice
()
{
$this
->
CD
pObject
(
'invoice_task_queue'
,
'task_invoice'
);
$this
->
w2
pObject
(
'invoice_task_queue'
,
'task_invoice'
);
$this
->
_invoice_project
=
$_POST
[
"invoice_project"
];
$this
->
_task_queue_id
=
$_POST
[
"task_queue_id"
];
}
...
...
@@ -26,7 +29,7 @@ class CInvoice extends CDpObject {
}
function
init
()
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addInsert
(
'invoice_project,invoice_date,invoice_creator'
,
$_POST
[
'invoice_project'
]
.
','
.
time
()
.
','
.
$_POST
[
'project_creator'
],
true
);;
$q
->
exec
();
...
...
@@ -38,7 +41,7 @@ class CInvoice extends CDpObject {
function
store
()
{
$msg
=
$this
->
check
();
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice_task_queue'
);
$q
->
addInsert
(
'task_invoice,task_amount,task_log_id'
,
$this
->
task_invoice
.
','
.
$this
->
task_amount
.
','
.
$this
->
task_log_id
,
true
);
$q
->
exec
();
...
...
@@ -49,7 +52,7 @@ class CInvoice extends CDpObject {
function
delete
()
{
$this
->
_action
=
'deleted'
;
$q
=
new
DB
Query
();
$q
=
new
w2p_Database_
Query
();
$q
->
setDelete
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_queue_id = '
.
$this
->
_task_queue_id
);
if
(
!
$q
->
exec
())
...
...
@@ -61,7 +64,7 @@ class CInvoice extends CDpObject {
function
purge
()
{
$this
->
_action
=
'purged'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'invoice_status'
);
$q
->
addTable
(
'invoice'
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
...
@@ -96,7 +99,7 @@ class CInvoice extends CDpObject {
function
change_status
(
$stat
)
{
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addUpdate
(
'invoice_status'
,
$stat
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
...
@@ -106,7 +109,7 @@ class CInvoice extends CDpObject {
function
change_invoice_tag
(
$tag
)
{
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addUpdate
(
'invoice_tag'
,
$tag
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
...
projects_tab.invoice.php
View file @
abc65b0f
<?php
$project_id
=
intval
(
dPgetParam
(
$_GET
,
"project_id"
,
0
)
);
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
$project_id
=
intval
(
w2PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$perms
=&
$AppUI
->
acl
();
if
(
!
$perms
->
checkModuleItem
(
'invoice'
,
'view'
,
$project_id
))
{
...
...
@@ -12,9 +16,9 @@ if (isset( $_GET['tab'] )) {
}
$tab
=
$AppUI
->
getState
(
'ProjVwTab'
)
!==
NULL
?
$AppUI
->
getState
(
'ProjVwTab'
)
:
0
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
invoice_id,
invoice_id,
invoice_tag,
invoice_project,
invoice_status,
...
...
@@ -46,13 +50,13 @@ 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"
;
}
elseif
(
$a
[
"invouce_status"
]
==
"3"
)
{
^
M
$invoice_status
=
"Loss"
;
}
$start_date
=
strftime
(
$df
,
$a
[
"invoice_date"
]);
// edit query FROM users; user_first_name and user_last_name
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
contact_first_name,
contact_last_name'
);
...
...
@@ -75,7 +79,7 @@ $q->addWhere('user_id = ' . $a['invoice_creator']);
$s
.=
"
\n\t
</td>"
;
// name link
$alt
=
htmlspecialchars
(
$a
[
"invoice_id"
]
);
$s
.=
'<td align=right> <a href="./index.php?m=invoice&a=view&invoice_id='
.
$a
[
"invoice_id"
]
.
'&project_id='
.
$project_id
.
'" title="'
.
$alt
.
'"># '
.
$a
[
"invoice_id"
]
.
'</a></td>'
;
$s
.=
'<td align=right> <a href="./index.php?m=invoice&a=view&invoice_id='
.
$a
[
"invoice_id"
]
.
'&project_id='
.
$project_id
.
'" title="'
.
$alt
.
'"># '
.
$a
[
"invoice_id"
]
.
'</a></td>'
;
$s
.=
'<td align=right> <a href="./index.php?m=invoice&a=view&invoice_id='
.
$a
[
"invoice_id"
]
.
'&project_id='
.
$project_id
.
'" title="'
.
$alt
.
'">'
.
$a
[
"invoice_tag"
]
.
'</a></td>'
;
// task owner
$s
.=
'<td nowrap="nowrap" align=center>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>'
;
...
...
@@ -102,7 +106,7 @@ if ($perms->checkModule('invoice', 'add'))
<tr>
<th
width=
"10"
>
</th>
<th
width=
"250"
>
<?php
echo
$AppUI
->
_
(
'Invoice Number'
);
?>
</th>
<th
width=
"250"
>
<?php
echo
$AppUI
->
_
(
'Invoice Tag'
);
?>
</th>
<th
width=
"250"
>
<?php
echo
$AppUI
->
_
(
'Invoice Tag'
);
?>
</th>
<th
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Invoice Creator'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Creation Date'
);
?>
</th>
<th
width=
"100"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'Invoive Status'
);
?>
</th>
...
...
reports.php
View file @
abc65b0f
<?php
/* PROJECTS $Id: reports.php,v 1.12 2005/04/15 11:27:50 cyberhorse Exp $ */
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
error_reporting
(
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
$report_type
=
d
PgetParam
(
$_REQUEST
,
"report_type"
,
''
);
$project_id
=
intval
(
w2
PgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
$report_type
=
w2
PgetParam
(
$_REQUEST
,
"report_type"
,
''
);
$reports
=
$AppUI
->
readFiles
(
d
PgetConfig
(
'root_dir'
)
.
"/modules/invoice/reports"
,
"\.php$"
);
$reports
=
$AppUI
->
readFiles
(
w2
PgetConfig
(
'root_dir'
)
.
"/modules/invoice/reports"
,
"\.php$"
);
// $report_type_var =
d
PgetParam($_GET, 'report_type', '');
// $report_type_var =
w2
PgetParam($_GET, 'report_type', '');
if
(
!
empty
(
$report_type_var
))
$report_type_var
=
'&report_type='
.
$report_type
;
...
...
reports/invoicestyle1.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
error_reporting
(
!
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
d
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$project_id
=
intval
(
w2
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
w2
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invToPos
=
600
;
// up/down where to print the To: block
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
...
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
//
// query the database for the invoiced company address
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
company_name,
company_address1,
...
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
// print invoice date
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$date
=
new
C
Date
();
$date
=
new
w2p_Utilities_
Date
();
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezSetY
(
$xpos
);
...
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
'Amount'
);
//-- get some data
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'task_log_description'
);
...
...
@@ -217,19 +220,19 @@ $invTotal = 0;
$hoursTotal
=
0
;
foreach
(
$pname
as
$inv
)
{
$d
=
new
C
Date
(
$inv
[
'task_log_date'
]);
$d
=
new
w2p_Utilities_
Date
(
$inv
[
'task_log_date'
]);
if
(
$inv
[
'task_amount'
]
>
0
)
$amt
=
$inv
[
'task_amount'
];
else
$amt
=
round
(
$inv
[
'billingcode_value'
]
*
$inv
[
'task_log_hours'
],
2
);
$dispAmt
=
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$amt
,
2
);
$dispAmt
=
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$amt
,
2
);
$invTotal
=
$invTotal
+
$amt
;
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$pdfdata
[]
=
array
(
$d
->
format
(
$df
),
$inv
[
'task_log_description'
],
((
$inv
[
'task_amount'
]
>
0
)
?
'set'
:
(
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$inv
[
'billingcode_value'
],
2
))),
((
$inv
[
'task_amount'
]
>
0
)
?
'set'
:
(
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$inv
[
'billingcode_value'
],
2
))),
sprintf
(
"%.2f"
,
$inv
[
'task_log_hours'
],
2
),
$dispAmt
);
}
...
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
// print the invoice total
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
array
(
'justification'
=>
'right'
));
$pdf
->
ezText
(
"Invoice Total: "
.
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$invTotal
,
2
),
12
,
$pdf
->
ezText
(
"Invoice Total: "
.
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$invTotal
,
2
),
12
,
array
(
'justification'
=>
'right'
));
$options
=
array
(
...
...
reports/invoicestyle2.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
error_reporting
(
!
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
d
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$project_id
=
intval
(
w2
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
w2
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invToPos
=
600
;
// up/down where to print the To: block
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
...
...
@@ -43,7 +46,7 @@ $textBColor = .3;
//
// query the database for company info
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
company_name,
company_address1,
...
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
//
// query the database for the invoiced company address
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
company_name,
company_address1,
...
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
// print invoice date
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$date
=
new
C
Date
();
$date
=
new
w2p_Utilities_
Date
();
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezSetY
(
$xpos
);
...
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
'Amount'
);
//-- get some data
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'task_log_description'
);
...
...
@@ -217,19 +220,19 @@ $invTotal = 0;
$hoursTotal
=
0
;
foreach
(
$pname
as
$inv
)
{
$d
=
new
C
Date
(
$inv
[
'task_log_date'
]);
$d
=
new
w2p_Utilities_
Date
(
$inv
[
'task_log_date'
]);
if
(
$inv
[
'task_amount'
]
>
0
)
$amt
=
$inv
[
'task_amount'
];
else
$amt
=
round
(
$inv
[
'billingcode_value'
]
*
$inv
[
'task_log_hours'
],
2
);
$dispAmt
=
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$amt
,
2
);
$dispAmt
=
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$amt
,
2
);
$invTotal
=
$invTotal
+
$amt
;
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$pdfdata
[]
=
array
(
$d
->
format
(
$df
),
$inv
[
'task_log_description'
],
((
$inv
[
'task_amount'
]
>
0
)
?
'set'
:
(
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$inv
[
'billingcode_value'
],
2
))),
((
$inv
[
'task_amount'
]
>
0
)
?
'set'
:
(
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$inv
[
'billingcode_value'
],
2
))),
sprintf
(
"%.2f"
,
$inv
[
'task_log_hours'
],
2
),
$dispAmt
);
}
...
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
// print the invoice total
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
array
(
'justification'
=>
'right'
));
$pdf
->
ezText
(
"Invoice Total: "
.
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$invTotal
,
2
),
12
,
$pdf
->
ezText
(
"Invoice Total: "
.
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
"%.2f"
,
$invTotal
,
2
),
12
,
array
(
'justification'
=>
'right'
));
$options
=
array
(
...
...
setup.php
View file @
abc65b0f
<?php
/*
* Name: Invoice
* Directory: invoice
* Version: 0.1
* Class: user
* UI Name: Invoice
* UI Icon:
*/
// MODULE CONFIGURATION DEFINITION
$config
=
array
();
$config
[
'mod_name'
]
=
'Invoice'
;
$config
[
'mod_version'
]
=
'0.5'
;
$config
[
'mod_directory'
]
=
'invoice'
;
$config
[
'mod_setup_class'
]
=
'CSetupInvoice'
;
$config
[
'mod_type'
]
=
'user'
;
$config
[
'mod_ui_name'
]
=
'Invoice'
;
$config
[
'mod_ui_icon'
]
=
'applet3-48.png'
;
$config
[
'mod_description'
]
=
'A module for billing tasks'
;
if
(
@
$a
==
'setup'
)
{
echo
dPshowModuleConfig
(
$config
);
}
class
CSetupInvoice
{
function
install
()
{
$sql
=
"(
`invoice_id` bigint(20) NOT NULL auto_increment,
`invoice_tag` char(10) NOT NULL unique,
`invoice_project` int(11) NOT NULL default '0',
`invoice_status` int(4) NOT NULL default '0',
`invoice_date` int(11) NOT NULL default '0',
`invoice_paid` int(11) default NULL,
`invoice_creator` int(11) NOT NULL default '0',
PRIMARY KEY (`invoice_id`)
) TYPE=MyISAM "
;
$q
=
new
DBQuery
;
$q
->
createTable
(
'invoice'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$sql
=
"(
`task_queue_id` int(11) NOT NULL auto_increment,
`task_invoice` int(11) NOT NULL default '0',
`task_amount` float NOT NULL default '0',
`task_log_id` bigint(20) NOT NULL default '0',
PRIMARY KEY (`task_queue_id`)
) TYPE=MyISAM "
;
$q
->
clear
();
$q
->
createTable
(
'invoice_task_queue'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
return
null
;
}
function
remove
()
{
$q
=
new
DBQuery
;
$q
->
dropTable
(
'invoice'
);
$q
->
exec
();
$q
->
clear
();
$q
->
dropTable
(
'invoice_task_queue'
);
$q
->
exec
();
return
null
;
}
function
upgrade
()
{
return
null
;
}
}
?>
<?php
/*
* Name: Invoice
* Directory: invoice
* Version: 0.5
* Class: user
* UI Name: Invoice
* UI Icon:
*/
// MODULE CONFIGURATION DEFINITION
$config
=
array
();
$config
[
'mod_name'
]
=
'Invoice'
;
$config
[
'mod_version'
]
=
'0.5'
;
$config
[
'mod_directory'
]
=
'invoice'
;
$config
[
'mod_setup_class'
]
=
'CSetupInvoice'
;
$config
[
'mod_type'
]
=
'user'
;
$config
[
'mod_ui_name'
]
=
'Invoice'
;
$config
[
'mod_ui_icon'
]
=
'applet3-48.png'
;
$config
[
'mod_description'
]
=
'A module for billing tasks'
;
if
(
@
$a
==
'setup'
)
{
echo
w2PshowModuleConfig
(
$config
);
}
class
CSetupInvoice
extends
w2p_Core_Setup
{
public
function
install
()
{
$sql
=
"(
`invoice_id` bigint(20) NOT NULL auto_increment,
`invoice_tag` char(10) NOT NULL unique,
`invoice_project` int(11) NOT NULL default '0',
`invoice_status` int(4) NOT NULL default '0',
`invoice_date` int(11) NOT NULL default '0',
`invoice_paid` int(11) default NULL,
`invoice_creator` int(11) NOT NULL default '0',
PRIMARY KEY (`invoice_id`)
) TYPE=MyISAM "
;
$q
=
new
w2p_Database_Query
();
$q
->
createTable
(
'invoice'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$sql
=
"(
`task_queue_id` int(11) NOT NULL auto_increment,
`task_invoice` int(11) NOT NULL default '0',
`task_amount` float NOT NULL default '0',
`task_log_id` bigint(20) NOT NULL default '0',
PRIMARY KEY (`task_queue_id`)
) TYPE=MyISAM "
;
$q
->
clear
();
$q
->
createTable
(
'invoice_task_queue'
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
return
parent
::
install
();
}
public
function
remove
()
{
$q
=
new
w2p_Database_Query
();
$q
->
dropTable
(
'invoice'
);
$q
->
exec
();
$q
->
clear
();
$q
->
dropTable
(
'invoice_task_queue'
);
$q
->
exec
();
return
parent
::
remove
();
}
public
function
upgrade
(
$old_version
)
{
switch
(
$old_version
)
{
case
0.1
:
default
:
return
true
;
}
return
false
;
}
}
?>
view.php
View file @
abc65b0f
<?php
$invoice_id
=
intval
(
dPgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$project_id
=
intval
(
dPgetParam
(
$_GET
,
"project_id"
,
0
)
);
// //$report_type = dPgetParam( $_REQUEST, "report_type", '' );
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
$invoice_id
=
intval
(
w2PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$project_id
=
intval
(
w2PgetParam
(
$_GET
,
"project_id"
,
0
)
);
// //$report_type = w2PgetParam( $_REQUEST, "report_type", '' );
// check permissions for this record
// Done in index.php
$canEdit
=
!
getDenyEdit
(
$m
,
$project_id
);
$perms
=
&
$AppUI
->
acl
();
//$canEdit = $perms->checkModuleItem( $m, 'edit', $project_id );
$canEdit
=
$perms
->
checkModule
(
$m
,
'edit'
);
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
...
...
@@ -13,20 +19,20 @@ if (!$canEdit) {
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$start_date
=
new
C
Date
(
$row
->
project_start_date
);
$start_date
=
new
w2p_Utilities_
Date
(
$row
->
project_start_date
);
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
C
Date
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
C
Date
(
$row
->
project_actual_end_date
)
:
null
;
$end_date
=
intval
(
$row
->
project_end_date
)
?
new
w2p_Utilities_
Date
(
$row
->
project_end_date
)
:
null
;
$actual_end_date
=
intval
(
$row
->
project_actual_end_date
)
?
new
w2p_Utilities_
Date
(
$row
->
project_actual_end_date
)
:
null
;
// setup the title block
$ttl
=
$project_id
>
0
?
"View Invoice"
:
"View Invoice"
;
$titleBlock
=
new
C
TitleBlock
(
$ttl
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
$titleBlock
=
new
w2p_Theme_
TitleBlock
(
$ttl
,
'applet3-48.png'
,
$m
,
"
$m
.
$a
"
);
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
();
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
task_queue_id,
invoice_task_queue.task_log_id,
...
...
@@ -97,16 +103,16 @@ foreach($billingcodes as $values)
//$amount_code = ;
//$hours = ;
$counter
=
0
;
$start_date
=
new
C
Date
();
$finish_date
=
new
C
Date
(
0
);
$start_date
=
new
w2p_Utilities_
Date
();
$finish_date
=
new
w2p_Utilities_
Date
(
0
);
function
showtask
(
&
$a
)
{
function
invoice_
showtask
(
&
$a
)
{
global
$AppUI
,
$project_id
,
$billingcodes
,
$bcodes
;
global
$pdfdata
,
$amount_code
,
$amount_fixed
;
global
$counter
,
$hours
,
$hours_fixed
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
task_log_id,
task_log_task,
...
...
@@ -158,21 +164,21 @@ if ($a["task_amount"] == "0") {
$hours_fixed
+=
$tasks
[
'task_log_hours'
];
}
global
$start_date
,
$finish_date
;
$t
=
new
C
Date
(
$tasks
[
'task_log_date'
]);
$t
=
new
w2p_Utilities_
Date
(
$tasks
[
'task_log_date'
]);
if
(
$start_date
->
compare
(
$t
,
$start_date
)
<
0
)
$start_date
=
$t
;
if
(
$finish_date
->
compare
(
$t
,
$finish_date
)
>
0
)
$finish_date
=
$t
;
$s
=
"
\n
<tr>"
;
$d
=
new
C
Date
(
$tasks
[
'task_log_date'
]);
$d
=
new
w2p_Utilities_
Date
(
$tasks
[
'task_log_date'
]);
$s
.=
'<td nowrap>'
.
$d
->
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="nowrap">'
.
d
PgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'<td nowrap="nowrap">'
.
w2
PgetConfig
(
'currency_symbol'
)
.
' '
.
$amount
.
'</td>'
;
$s
.=
'</tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="1"> </td>'
;
...
...
@@ -226,11 +232,11 @@ for ($s=0; $s < count($tasks); $s++) {
foreach
(
$bcodes
as
$code
=>
$rate
)
$tmp
[
strtolower
(
$code
)]
=
$hours
[
strtolower
(
$code
)];
$tmpfix
=
$amount_fixed
;
$tmpamount
=
showtask
(
$tasks
[
$s
],
1
);
$tmpamount
=
invoice_
showtask
(
$tasks
[
$s
],
1
);
$myamount
=
$myamount
+
$tmpamount
;
$task_log
=
get_task_log
(
$tasks
[
$s
][
'task_log_id'
]);
$date
=
new
C
Date
(
$task_log
[
'task_log_date'
]);
$date
=
new
w2p_Utilities_
Date
(
$task_log
[
'task_log_date'
]);
$date
=
$date
->
format
(
$df
);
$tmppdfdata2
=
array
(
// ++$counter,
...
...
@@ -243,7 +249,7 @@ for ($s=0; $s < count($tasks); $s++) {
if
(
!
empty
(
$bcodes
))
foreach
(
$bcodes
as
$code
=>
$rate
)
$temp
[]
=
sprintf
(
"%.2f"
,
round
(
$hours
[
strtolower
(
$code
)]
-
$tmp
[
strtolower
(
$code
)],
2
));
$temp
[]
=
d
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
" %.2f"
,
round
(
$amount_fixed
-
$tmpfix
,
2
));
$temp
[]
=
w2
PgetConfig
(
'currency_symbol'
)
.
sprintf
(
" %.2f"
,
round
(
$amount_fixed
-
$tmpfix
,
2
));
$pdfdata2t
[]
=
array_merge
(
$tmppdfdata2
,
$temp
);
}
...
...
@@ -261,7 +267,7 @@ for ($s=0; $s < count($tasks); $s++) {
function
get_user_name
(
$user_id
)
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'user_username'
);
$q
->
addTable
(
'users'
);
$q
->
addWhere
(
'user_id = '
.
$user_id
);
...
...
@@ -271,7 +277,7 @@ function get_user_name($user_id)
function
get_task_log
(
$task_log_id
,
$task
=
false
)
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
task_log_id,
task_log_task,
...
...
@@ -294,7 +300,7 @@ $tasks=db_fetch_assoc($tmptasks);
<tr>
<td
colspan=
5
align=
right
><b>
Total
</b></td>
<td>
<?php
echo
d
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
w2
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
$myamount
?>
</td>
...
...
@@ -302,15 +308,15 @@ $tasks=db_fetch_assoc($tmptasks);
</table>
<?php
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'project_name, project_short_name'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$pname
=
$q
->
loadList
();
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
//TRUE REPORT!!!
...
...
@@ -330,12 +336,12 @@ require( $AppUI->getLibraryClass( 'ezpdf/class.ezpdf' ) );
// $pdf->selectFont( "$font_dir/Helvetica.afm" );
// $report_type =
d
PgetParam( $_REQUEST, "report_type", '' );
// $report_type =
w2
PgetParam( $_REQUEST, "report_type", '' );
$reports
=
$AppUI
->
readFiles
(
d
PgetConfig
(
'root_dir'
)
.
"/modules/invoice/reports"
,
"\.php$"
);
$reports
=
$AppUI
->
readFiles
(
w2
PgetConfig
(
'root_dir'
)
.
"/modules/invoice/reports"
,
"\.php$"
);
// $report_type_var =
d
PgetParam($_GET, 'report_type', '');
// $report_type_var =
w2
PgetParam($_GET, 'report_type', '');
// if (!empty($report_type_var))
// $report_type_var = '&report_type=' . $report_type;
...
...
vw_inc.php
View file @
abc65b0f
<?php
function
invoices
(
$type
)
{
GLOBAL
$AppUI
,
$invoices
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"3"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
align=
"right"
width=
"65"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'sort by'
);
?>
:
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_id"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Number'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_tag"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Tag'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_project"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Project'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_creator"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Creator'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_date"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Created On'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_amount"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Amount'
);
?>
:
</a>
</th>
</tr>
<?php
$CR
=
"
\n
"
;
$CT
=
"
\n\t
"
;
$none
=
true
;
$q
=
new
DBQuery
;
foreach
(
$invoices
as
$row
)
{
if
(
$row
[
"invoice_status"
]
==
$type
)
{
$none
=
false
;
$q
->
clear
();
$q
->
addQuery
(
'
project_name,
project_description'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$row
[
'invoice_project'
]);
$myproject_name
=
$q
->
loadList
();
// edit query FROM users; user_first_name and user_last_name
$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 = '
.
$row
[
'invoice_creator'
]);
$myuser_name
=
$q
->
loadList
();
$mydate
=
strftime
(
$df
,
$row
[
"invoice_date"
]);
$total_amount
=
get_invoice_amount
(
$row
[
"invoice_id"
],
$row
[
"invoice_project"
]);
$s
=
'<tr>'
;
$s
.=
$CR
.
'<td>'
;
if
(
$type
==
0
)
$s
.=
'<a href="?m=invoice&a=addedit&invoice_id='
.
$row
[
'invoice_id'
]
.
'&project_id='
.
$row
[
'invoice_project'
]
.
'"><img src="./images/icons/pencil.gif" alt="'
.
$AppUI
->
_
(
'Edit Invoice'
)
.
'" border="0" width="12" height="12"></a>'
;
$s
.=
' </td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'&invoice_id='
.
$row
[
"invoice_id"
]
.
'">#'
.
$row
[
"invoice_id"
]
.
'</a></td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'&invoice_id='
.
$row
[
"invoice_id"
]
.
'">'
.
$row
[
"invoice_tag"
]
.
'</a></td>'
;
$s
.=
$CR
.
'<td width=500>'
;
$s
.=
$CT
.
'<a href="?m=projects&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'" title="'
.
$myproject_name
[
0
][
"project_description"
]
.
'">'
.
$myproject_name
[
0
][
"project_name"
]
.
'</a>'
;
$s
.=
$CR
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
$myuser_name
[
0
][
"contact_first_name"
]
.
' '
.
$myuser_name
[
0
][
"contact_last_name"
]
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
$mydate
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' '
.
$total_amount
.
'</td>'
;
$s
.=
$CR
.
'</tr>'
;
echo
$s
;
}
}
if
(
$none
)
{
echo
$CR
.
'<tr><td colspan="7">'
.
$AppUI
->
_
(
'No open invoice available'
)
.
'</td></tr>'
;
}
?>
<tr>
<td
colspan=
"7"
>
</td>
</tr>
</table>
<?php
}
function
get_invoice_amount
(
$invoice_id
,
$project_id
)
{
$amount
=
0
;
$q
=
new
DBQuery
;
$q
->
addQuery
(
'project_company'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$company_id
=
$q
->
loadResult
();
//$tmpprj=db_exec($sql);
//$row=db_fetch_assoc($tmpprj);
//$company_id=$row["project_company"];
$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
();
$q
->
clear
();
$q
->
addQuery
(
'
t.task_invoice,
t.task_queue_id,
t.task_amount,
t.task_log_id,
t1.task_log_costcode,
t1.task_log_hours'
);
$q
->
addTable
(
'invoice_task_queue'
,
't'
);
$q
->
leftJoin
(
'task_log'
,
't1'
,
't.task_log_id=t1.task_log_id'
);
$q
->
addWhere
(
'task_invoice = '
.
$invoice_id
);
$q
->
addGroup
(
't.task_log_id'
);
$tasks
=
$q
->
loadList
();
foreach
(
$tasks
as
$task
)
{
if
(
$task
[
'task_amount'
]
==
'0'
)
{
for
(
$x
=
0
;
$x
<
count
(
$billingcodes
);
$x
++
)
if
(
$billingcodes
[
$x
][
'billingcode_id'
]
==
$task
[
'task_log_costcode'
])
$rate
=
$billingcodes
[
$x
][
'billingcode_value'
];
$amount
+=
round
(
$rate
*
$task
[
'task_log_hours'
],
2
);
}
else
$amount
=
$amount
+
round
(
$task
[
'task_amount'
],
2
);
}
return
$amount
;
}
?>
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
function
invoices
(
$type
)
{
GLOBAL
$AppUI
,
$invoices
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"3"
cellspacing=
"1"
class=
"tbl"
>
<tr>
<th
align=
"right"
width=
"65"
nowrap=
"nowrap"
>
<?php
echo
$AppUI
->
_
(
'sort by'
);
?>
:
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_id"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Number'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_tag"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Tag'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_project"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Project'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_creator"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Creator'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_date"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Created On'
);
?>
</a>
</th>
<th
nowrap=
"nowrap"
>
<a
href=
"?m=invoice&orderby=invoice_amount"
class=
"hdr"
>
<?php
echo
$AppUI
->
_
(
'Invoice Amount'
);
?>
:
</a>
</th>
</tr>
<?php
$CR
=
"
\n
"
;
$CT
=
"
\n\t
"
;
$none
=
true
;
$q
=
new
w2p_Database_Query
();
foreach
(
$invoices
as
$row
)
{
if
(
$row
[
"invoice_status"
]
==
$type
)
{
$none
=
false
;
$q
->
clear
();
$q
->
addQuery
(
'
project_name,
project_description'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$row
[
'invoice_project'
]);
$myproject_name
=
$q
->
loadList
();
// edit query FROM users; user_first_name and user_last_name
$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 = '
.
$row
[
'invoice_creator'
]);
$myuser_name
=
$q
->
loadList
();
$mydate
=
strftime
(
$df
,
$row
[
"invoice_date"
]);
$total_amount
=
get_invoice_amount
(
$row
[
"invoice_id"
],
$row
[
"invoice_project"
]);
$s
=
'<tr>'
;
$s
.=
$CR
.
'<td>'
;
if
(
$type
==
0
)
$s
.=
'<a href="?m=invoice&a=addedit&invoice_id='
.
$row
[
'invoice_id'
]
.
'&project_id='
.
$row
[
'invoice_project'
]
.
'"><img src="./images/icons/pencil.gif" alt="'
.
$AppUI
->
_
(
'Edit Invoice'
)
.
'" border="0" width="12" height="12"></a>'
;
$s
.=
' </td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'&invoice_id='
.
$row
[
"invoice_id"
]
.
'">#'
.
$row
[
"invoice_id"
]
.
'</a></td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap" width=100><a href="?m=invoice&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'&invoice_id='
.
$row
[
"invoice_id"
]
.
'">'
.
$row
[
"invoice_tag"
]
.
'</a></td>'
;
$s
.=
$CR
.
'<td width=500>'
;
$s
.=
$CT
.
'<a href="?m=projects&a=view&project_id='
.
$row
[
"invoice_project"
]
.
'" title="'
.
$myproject_name
[
0
][
"project_description"
]
.
'">'
.
$myproject_name
[
0
][
"project_name"
]
.
'</a>'
;
$s
.=
$CR
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
$myuser_name
[
0
][
"contact_first_name"
]
.
' '
.
$myuser_name
[
0
][
"contact_last_name"
]
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
$mydate
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
w2PgetConfig
(
'currency_symbol'
)
.
' '
.
$total_amount
.
'</td>'
;
$s
.=
$CR
.
'</tr>'
;
echo
$s
;
}
}
if
(
$none
)
{
echo
$CR
.
'<tr><td colspan="7">'
.
$AppUI
->
_
(
'No open invoice available'
)
.
'</td></tr>'
;
}
?>
<tr>
<td
colspan=
"7"
>
</td>
</tr>
</table>
<?php
}
function
get_invoice_amount
(
$invoice_id
,
$project_id
)
{
$amount
=
0
;
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'project_company'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$company_id
=
$q
->
loadResult
();
//$tmpprj=db_exec($sql);
//$row=db_fetch_assoc($tmpprj);
//$company_id=$row["project_company"];
$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
();
$q
->
clear
();
$q
->
addQuery
(
'
t.task_invoice,
t.task_queue_id,
t.task_amount,
t.task_log_id,
t1.task_log_costcode,
t1.task_log_hours'
);
$q
->
addTable
(
'invoice_task_queue'
,
't'
);
$q
->
leftJoin
(
'task_log'
,
't1'
,
't.task_log_id=t1.task_log_id'
);
$q
->
addWhere
(
'task_invoice = '
.
$invoice_id
);
$q
->
addGroup
(
't.task_log_id'
);
$tasks
=
$q
->
loadList
();
foreach
(
$tasks
as
$task
)
{
if
(
$task
[
'task_amount'
]
==
'0'
)
{
for
(
$x
=
0
;
$x
<
count
(
$billingcodes
);
$x
++
)
if
(
$billingcodes
[
$x
][
'billingcode_id'
]
==
$task
[
'task_log_costcode'
])
$rate
=
$billingcodes
[
$x
][
'billingcode_value'
];
$amount
+=
round
(
$rate
*
$task
[
'task_log_hours'
],
2
);
}
else
$amount
=
$amount
+
round
(
$task
[
'task_amount'
],
2
);
}
return
$amount
;
}
?>
vw_loss.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
echo
invoices
(
3
);
...
...
vw_open.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
echo
invoices
(
0
);
...
...
vw_paid.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
echo
invoices
(
2
);
...
...
vw_pend.php
View file @
abc65b0f
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
echo
invoices
(
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