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
Show 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 $ */
<?php
/* PROJECTS $Id: addedit.php,v 1.56 2003/09/11 02:47:22 gregorerhardt Exp $ */
$invoice_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"invoice_id"
,
0
)
);
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
$project_id
=
intval
(
dPgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
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
// check permissions for this record
// Done automatically in index.php
// Done automatically in index.php
...
@@ -12,14 +16,14 @@ if (!$canEdit) {
...
@@ -12,14 +16,14 @@ if (!$canEdit) {
// format dates
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$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
;
$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
C
Date
(
$row
->
project_actual_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
// setup the title block
$ttl
=
$invoice_id
>
0
?
"Edit Invoice"
:
"New Invoice"
;
$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"
);
$titleBlock
->
addCrumb
(
"?m=projects"
,
"projects list"
);
if
(
$project_id
!=
0
)
if
(
$project_id
!=
0
)
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
...
@@ -31,7 +35,7 @@ if($task_id == '') {
...
@@ -31,7 +35,7 @@ if($task_id == '') {
$task_id
=
0
;
$task_id
=
0
;
}
}
$q
=
new
DBQuery
;
$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'
);
$temp_billed
=
db_loadColumn
(
$q
->
prepare
());
$temp_billed
=
db_loadColumn
(
$q
->
prepare
());
...
@@ -74,13 +78,13 @@ $q->addWhere('project_id = ' . $project_id);
...
@@ -74,13 +78,13 @@ $q->addWhere('project_id = ' . $project_id);
if
(
!
empty
(
$_POST
[
"start_date"
]))
{
if
(
!
empty
(
$_POST
[
"start_date"
]))
{
$actual_start_date
=
strtotime
(
$_REQUEST
[
"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'
]
.
"'"
);
$q
->
addWhere
(
'task_log_date > \''
.
$_REQUEST
[
'inv_start_date'
]
.
"'"
);
}
}
if
(
!
empty
(
$_POST
[
'end_date'
]))
if
(
!
empty
(
$_POST
[
'end_date'
]))
{
{
$actual_end_date
=
strtotime
(
$_REQUEST
[
"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'
]
.
"' "
);
$q
->
addWhere
(
"task_log_date < '"
.
$_REQUEST
[
'inv_end_date'
]
.
"' "
);
}
}
if
(
$task_id
!=
0
)
if
(
$task_id
!=
0
)
...
@@ -146,7 +150,7 @@ function showtask(&$a) {
...
@@ -146,7 +150,7 @@ function showtask(&$a) {
global
$AppUI
,
$project_id
,
$billingcodes
;
global
$AppUI
,
$project_id
,
$billingcodes
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
task_log_id,
task_log_id,
task_log_task,
task_log_task,
...
@@ -192,14 +196,14 @@ if ($a["task_amount"] == "0") {
...
@@ -192,14 +196,14 @@ if ($a["task_amount"] == "0") {
$s
=
"
\n
<tr>"
;
$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="./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>"
;
$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>'
;
$s
.=
'<td nowrap align="center">'
.
$tdate
->
format
(
$df
)
.
'</td>'
;
$alt
=
htmlspecialchars
(
$tasks
[
"task_log_name"
]
);
$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 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>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap">'
.
$costdesc
.
'</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
.=
'<tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="2"> </td>'
;
$s
.=
'<td colspan="2"> </td>'
;
...
@@ -216,7 +220,7 @@ function showtasklog(&$a) {
...
@@ -216,7 +220,7 @@ function showtasklog(&$a) {
global
$AppUI
,
$project_id
;
global
$AppUI
,
$project_id
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
contact_first_name,
contact_first_name,
contact_last_name'
);
contact_last_name'
);
...
@@ -235,7 +239,7 @@ $q->addWhere('task_log_id = ' . $a['task_log_id']);
...
@@ -235,7 +239,7 @@ $q->addWhere('task_log_id = ' . $a['task_log_id']);
$tmpcheck
=
$q
->
exec
();
$tmpcheck
=
$q
->
exec
();
$check
=
db_fetch_assoc
(
$tmpcheck
);
$check
=
db_fetch_assoc
(
$tmpcheck
);
$date
=
new
C
Date
(
$a
[
'task_log_date'
]);
$date
=
new
w2p_Utilities_
Date
(
$a
[
'task_log_date'
]);
$s
=
'
$s
=
'
<tr valign="top">
<tr valign="top">
<td><input type="checkbox" name="num_'
.
$a
[
"task_log_id"
]
.
'"></td>
<td><input type="checkbox" name="num_'
.
$a
[
"task_log_id"
]
.
'"></td>
...
@@ -245,7 +249,7 @@ $date = new CDate($a['task_log_date']);
...
@@ -245,7 +249,7 @@ $date = new CDate($a['task_log_date']);
<td nowrap>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>
<td nowrap>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>
<td nowrap>'
.
$a
[
'task_log_hours'
]
.
'</td>
<td nowrap>'
.
$a
[
'task_log_hours'
]
.
'</td>
<td nowrap>'
.
$a
[
'billingcode_name'
]
.
'</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>
</tr>
'
;
'
;
if
(
trim
(
$check
[
'task_invoice'
])
==
''
)
if
(
trim
(
$check
[
'task_invoice'
])
==
''
)
...
@@ -413,7 +417,7 @@ for ($s=0; $s < count($tasks); $s++) {
...
@@ -413,7 +417,7 @@ for ($s=0; $s < count($tasks); $s++) {
<tr>
<tr>
<td
colspan=
7
align=
right
><b>
Total
</b></td>
<td
colspan=
7
align=
right
><b>
Total
</b></td>
<td>
<td>
<?php
echo
d
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
w2
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
$myamount
?>
<?php
echo
$myamount
?>
</td>
</td>
</tr>
</tr>
...
@@ -503,4 +507,4 @@ if (isset($_POST['start_date']))
...
@@ -503,4 +507,4 @@ if (isset($_POST['start_date']))
</form>
</form>
</table>
</table>
*
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
<?php
echo
$AppUI
->
_
(
'requiredField'
);
?>
do_invoice_aed.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
$del
=
isset
(
$_POST
[
'del'
])
?
$_POST
[
'del'
]
:
0
;
$del
=
isset
(
$_POST
[
'del'
])
?
$_POST
[
'del'
]
:
0
;
$stat
=
isset
(
$_POST
[
'stat'
])
?
$_POST
[
'stat'
]
:
-
1
;
$stat
=
isset
(
$_POST
[
'stat'
])
?
$_POST
[
'stat'
]
:
-
1
;
$tag
=
isset
(
$_POST
[
'tag'
])
?
$_POST
[
'tag'
]
:
-
1
;
$tag
=
isset
(
$_POST
[
'tag'
])
?
$_POST
[
'tag'
]
:
-
1
;
$obj
=
new
CInvoice
();
$obj
=
new
CInvoice
();
if
(
!
$obj
->
bind
(
$_POST
))
{
if
(
!
$obj
->
bind
(
$_POST
))
{
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
setMsg
(
$obj
->
getError
(),
UI_MSG_ERROR
);
$AppUI
->
redirect
();
$AppUI
->
redirect
();
...
@@ -46,6 +48,4 @@ if ($del) {
...
@@ -46,6 +48,4 @@ if ($del) {
$AppUI
->
redirect
(
"m=invoice&a=addedit&invoice_id="
.
$obj
->
task_invoice
.
"&project_id="
.
$obj
->
_invoice_project
);
$AppUI
->
redirect
(
"m=invoice&a=addedit&invoice_id="
.
$obj
->
task_invoice
.
"&project_id="
.
$obj
->
_invoice_project
);
}
}
?>
?>
index.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
//$AppUI->savePlace();
//$AppUI->savePlace();
if
(
isset
(
$_GET
[
'project_id'
]
))
{
if
(
isset
(
$_GET
[
'project_id'
]
))
{
...
@@ -13,7 +17,7 @@ if (isset( $_GET['tab'] )) {
...
@@ -13,7 +17,7 @@ if (isset( $_GET['tab'] )) {
$tab
=
$AppUI
->
getState
(
'InvoiceIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'InvoiceIdxTab'
)
:
1
;
$tab
=
$AppUI
->
getState
(
'InvoiceIdxTab'
)
!==
NULL
?
$AppUI
->
getState
(
'InvoiceIdxTab'
)
:
1
;
$active
=
intval
(
!
$AppUI
->
getState
(
'InvoiceIdxTab'
)
);
$active
=
intval
(
!
$AppUI
->
getState
(
'InvoiceIdxTab'
)
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
invoice_id,
invoice_id,
invoice_tag,
invoice_tag,
...
@@ -26,7 +30,7 @@ $q->addTable('invoice');
...
@@ -26,7 +30,7 @@ $q->addTable('invoice');
$invoices
=
$q
->
loadList
();
$invoices
=
$q
->
loadList
();
// setup the title block
// 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
();
$titleBlock
->
addCell
();
if
(
$canEdit
&&
$project_id
)
{
if
(
$canEdit
&&
$project_id
)
{
$titleBlock
->
addCell
(
$titleBlock
->
addCell
(
...
@@ -41,7 +45,7 @@ $titleBlock->show();
...
@@ -41,7 +45,7 @@ $titleBlock->show();
// include("{$AppUI->cfg['root_dir']}/modules/invoice/index.php");
// include("{$AppUI->cfg['root_dir']}/modules/invoice/index.php");
// tabbed information boxes
// 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_open"
,
'Invoices (Open)'
);
$tabBox
->
add
(
"vw_pend"
,
'Invoices (Pending)'
);
$tabBox
->
add
(
"vw_pend"
,
'Invoices (Pending)'
);
$tabBox
->
add
(
"vw_paid"
,
'Invoices (Paid)'
);
$tabBox
->
add
(
"vw_paid"
,
'Invoices (Paid)'
);
...
...
invoice.class.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
require_once
(
$AppUI
->
getSystemClass
(
'libmail'
)
);
//
require_once( $AppUI->getSystemClass( 'libmail' ) );
require_once
(
$AppUI
->
getSystemClass
(
'd
p'
)
);
//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
$invoice_task_queue_id
=
NULL
;
var
$task_invoice
=
NULL
;
var
$task_invoice
=
NULL
;
...
@@ -11,7 +14,7 @@ class CInvoice extends CDpObject {
...
@@ -11,7 +14,7 @@ class CInvoice extends CDpObject {
var
$task_amount
=
NULL
;
var
$task_amount
=
NULL
;
function
CInvoice
()
{
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
->
_invoice_project
=
$_POST
[
"invoice_project"
];
$this
->
_task_queue_id
=
$_POST
[
"task_queue_id"
];
$this
->
_task_queue_id
=
$_POST
[
"task_queue_id"
];
}
}
...
@@ -26,7 +29,7 @@ class CInvoice extends CDpObject {
...
@@ -26,7 +29,7 @@ class CInvoice extends CDpObject {
}
}
function
init
()
{
function
init
()
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addTable
(
'invoice'
);
$q
->
addInsert
(
'invoice_project,invoice_date,invoice_creator'
,
$_POST
[
'invoice_project'
]
.
','
.
time
()
.
','
.
$_POST
[
'project_creator'
],
true
);;
$q
->
addInsert
(
'invoice_project,invoice_date,invoice_creator'
,
$_POST
[
'invoice_project'
]
.
','
.
time
()
.
','
.
$_POST
[
'project_creator'
],
true
);;
$q
->
exec
();
$q
->
exec
();
...
@@ -38,7 +41,7 @@ class CInvoice extends CDpObject {
...
@@ -38,7 +41,7 @@ class CInvoice extends CDpObject {
function
store
()
{
function
store
()
{
$msg
=
$this
->
check
();
$msg
=
$this
->
check
();
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice_task_queue'
);
$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
->
addInsert
(
'task_invoice,task_amount,task_log_id'
,
$this
->
task_invoice
.
','
.
$this
->
task_amount
.
','
.
$this
->
task_log_id
,
true
);
$q
->
exec
();
$q
->
exec
();
...
@@ -49,7 +52,7 @@ class CInvoice extends CDpObject {
...
@@ -49,7 +52,7 @@ class CInvoice extends CDpObject {
function
delete
()
function
delete
()
{
{
$this
->
_action
=
'deleted'
;
$this
->
_action
=
'deleted'
;
$q
=
new
DB
Query
();
$q
=
new
w2p_Database_
Query
();
$q
->
setDelete
(
'invoice_task_queue'
);
$q
->
setDelete
(
'invoice_task_queue'
);
$q
->
addWhere
(
'task_queue_id = '
.
$this
->
_task_queue_id
);
$q
->
addWhere
(
'task_queue_id = '
.
$this
->
_task_queue_id
);
if
(
!
$q
->
exec
())
if
(
!
$q
->
exec
())
...
@@ -61,7 +64,7 @@ class CInvoice extends CDpObject {
...
@@ -61,7 +64,7 @@ class CInvoice extends CDpObject {
function
purge
()
function
purge
()
{
{
$this
->
_action
=
'purged'
;
$this
->
_action
=
'purged'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'invoice_status'
);
$q
->
addQuery
(
'invoice_status'
);
$q
->
addTable
(
'invoice'
);
$q
->
addTable
(
'invoice'
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
@@ -96,7 +99,7 @@ class CInvoice extends CDpObject {
...
@@ -96,7 +99,7 @@ class CInvoice extends CDpObject {
function
change_status
(
$stat
)
function
change_status
(
$stat
)
{
{
$this
->
_action
=
'updated'
;
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addTable
(
'invoice'
);
$q
->
addUpdate
(
'invoice_status'
,
$stat
);
$q
->
addUpdate
(
'invoice_status'
,
$stat
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
@@ -106,7 +109,7 @@ class CInvoice extends CDpObject {
...
@@ -106,7 +109,7 @@ class CInvoice extends CDpObject {
function
change_invoice_tag
(
$tag
)
function
change_invoice_tag
(
$tag
)
{
{
$this
->
_action
=
'updated'
;
$this
->
_action
=
'updated'
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addTable
(
'invoice'
);
$q
->
addTable
(
'invoice'
);
$q
->
addUpdate
(
'invoice_tag'
,
$tag
);
$q
->
addUpdate
(
'invoice_tag'
,
$tag
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
$q
->
addWhere
(
'invoice_id = '
.
$this
->
task_invoice
);
...
...
projects_tab.invoice.php
View file @
abc65b0f
<?php
<?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
();
$perms
=&
$AppUI
->
acl
();
if
(
!
$perms
->
checkModuleItem
(
'invoice'
,
'view'
,
$project_id
))
{
if
(
!
$perms
->
checkModuleItem
(
'invoice'
,
'view'
,
$project_id
))
{
...
@@ -12,7 +16,7 @@ if (isset( $_GET['tab'] )) {
...
@@ -12,7 +16,7 @@ if (isset( $_GET['tab'] )) {
}
}
$tab
=
$AppUI
->
getState
(
'ProjVwTab'
)
!==
NULL
?
$AppUI
->
getState
(
'ProjVwTab'
)
:
0
;
$tab
=
$AppUI
->
getState
(
'ProjVwTab'
)
!==
NULL
?
$AppUI
->
getState
(
'ProjVwTab'
)
:
0
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
invoice_id,
invoice_id,
invoice_tag,
invoice_tag,
...
@@ -52,7 +56,7 @@ function showtask_inv( &$a, $level=0 ) {
...
@@ -52,7 +56,7 @@ function showtask_inv( &$a, $level=0 ) {
$start_date
=
strftime
(
$df
,
$a
[
"invoice_date"
]);
$start_date
=
strftime
(
$df
,
$a
[
"invoice_date"
]);
// edit query FROM users; user_first_name and user_last_name
// edit query FROM users; user_first_name and user_last_name
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
contact_first_name,
contact_first_name,
contact_last_name'
);
contact_last_name'
);
...
...
reports.php
View file @
abc65b0f
<?php
/* PROJECTS $Id: reports.php,v 1.12 2005/04/15 11:27:50 cyberhorse Exp $ */
<?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
);
error_reporting
(
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
$project_id
=
intval
(
w2
PgetParam
(
$_REQUEST
,
"project_id"
,
0
)
);
$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
))
if
(
!
empty
(
$report_type_var
))
$report_type_var
=
'&report_type='
.
$report_type
;
$report_type_var
=
'&report_type='
.
$report_type
;
...
...
reports/invoicestyle1.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
error_reporting
(
!
E_ALL
);
error_reporting
(
!
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$project_id
=
intval
(
w2
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_id
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$invoice_to
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
d
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$tasks
=
intval
(
w2
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invToPos
=
600
;
// up/down where to print the To: block
$invToPos
=
600
;
// up/down where to print the To: block
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
//
//
// query the database for the invoiced company address
// query the database for the invoiced company address
//
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
company_name,
company_name,
company_address1,
company_address1,
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
// print invoice date
// print invoice date
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$date
=
new
C
Date
();
$date
=
new
w2p_Utilities_
Date
();
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezSetY
(
$xpos
);
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
'Amount'
);
'Amount'
);
//-- get some data
//-- get some data
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'task_log_description'
);
$q
->
addQuery
(
'task_log_description'
);
...
@@ -217,19 +220,19 @@ $invTotal = 0;
...
@@ -217,19 +220,19 @@ $invTotal = 0;
$hoursTotal
=
0
;
$hoursTotal
=
0
;
foreach
(
$pname
as
$inv
)
{
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
)
if
(
$inv
[
'task_amount'
]
>
0
)
$amt
=
$inv
[
'task_amount'
];
$amt
=
$inv
[
'task_amount'
];
else
else
$amt
=
round
(
$inv
[
'billingcode_value'
]
*
$inv
[
'task_log_hours'
],
2
);
$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
;
$invTotal
=
$invTotal
+
$amt
;
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$pdfdata
[]
=
array
(
$pdfdata
[]
=
array
(
$d
->
format
(
$df
),
$d
->
format
(
$df
),
$inv
[
'task_log_description'
],
$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
),
sprintf
(
"%.2f"
,
$inv
[
'task_log_hours'
],
2
),
$dispAmt
);
$dispAmt
);
}
}
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
// print the invoice total
// print the invoice total
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
array
(
'justification'
=>
'right'
));
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'
));
array
(
'justification'
=>
'right'
));
$options
=
array
(
$options
=
array
(
...
...
reports/invoicestyle2.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
error_reporting
(
!
E_ALL
);
error_reporting
(
!
E_ALL
);
$project_id
=
intval
(
d
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$project_id
=
intval
(
w2
PgetParam
(
$_GET
,
"project_id"
,
0
)
);
$invoice_id
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_id
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
$invoice_to
=
intval
(
d
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$invoice_to
=
intval
(
w2
PgetParam
(
$_GET
,
"invoice_to"
,
0
)
);
$tasks
=
intval
(
d
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$tasks
=
intval
(
w2
PgetParam
(
$_GET
,
"tasks"
,
0
)
);
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invTitlePos
=
650
;
// up/down where to begin printing theINVOICE header
$invToPos
=
600
;
// up/down where to print the To: block
$invToPos
=
600
;
// up/down where to print the To: block
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$invToInfoPos
=
570
;
// up/down where to print the To: and Info data
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
...
@@ -43,7 +46,7 @@ $textBColor = .3;
...
@@ -43,7 +46,7 @@ $textBColor = .3;
//
//
// query the database for company info
// query the database for company info
//
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
company_name,
company_name,
company_address1,
company_address1,
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
...
@@ -113,7 +116,7 @@ $leftIndent = $leftOffset + 15; // how far to indent the text UNDER "Inv
//
//
// query the database for the invoiced company address
// query the database for the invoiced company address
//
//
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
company_name,
company_name,
company_address1,
company_address1,
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
...
@@ -169,7 +172,7 @@ $pdf->ezSetY( $invoiceInfo );
// print invoice date
// print invoice date
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$xpos
=
$pdf
->
ezText
(
$invoice_id
,
$fontSize
,
array
(
'aleft'
=>
$aleftInfo
));
$date
=
new
C
Date
();
$date
=
new
w2p_Utilities_
Date
();
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezText
(
'Invoice Date:'
,
$fontSize
,
array
(
'aleft'
=>
$aleftText
));
$pdf
->
ezSetY
(
$xpos
);
$pdf
->
ezSetY
(
$xpos
);
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
...
@@ -193,7 +196,7 @@ $pdfheaders3 = array(
'Amount'
);
'Amount'
);
//-- get some data
//-- get some data
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'task_amount'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'invoice_task_queue.task_log_id'
);
$q
->
addQuery
(
'task_log_description'
);
$q
->
addQuery
(
'task_log_description'
);
...
@@ -217,19 +220,19 @@ $invTotal = 0;
...
@@ -217,19 +220,19 @@ $invTotal = 0;
$hoursTotal
=
0
;
$hoursTotal
=
0
;
foreach
(
$pname
as
$inv
)
{
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
)
if
(
$inv
[
'task_amount'
]
>
0
)
$amt
=
$inv
[
'task_amount'
];
$amt
=
$inv
[
'task_amount'
];
else
else
$amt
=
round
(
$inv
[
'billingcode_value'
]
*
$inv
[
'task_log_hours'
],
2
);
$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
;
$invTotal
=
$invTotal
+
$amt
;
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$hoursTotal
+=
$inv
[
'task_log_hours'
];
$pdfdata
[]
=
array
(
$pdfdata
[]
=
array
(
$d
->
format
(
$df
),
$d
->
format
(
$df
),
$inv
[
'task_log_description'
],
$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
),
sprintf
(
"%.2f"
,
$inv
[
'task_log_hours'
],
2
),
$dispAmt
);
$dispAmt
);
}
}
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
...
@@ -261,7 +264,7 @@ $pdf->ezText('');
// print the invoice total
// print the invoice total
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
$pdf
->
ezText
(
"Total hours: "
.
sprintf
(
"%.2f"
,
$hoursTotal
),
12
,
array
(
'justification'
=>
'right'
));
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'
));
array
(
'justification'
=>
'right'
));
$options
=
array
(
$options
=
array
(
...
...
setup.php
View file @
abc65b0f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
/*
/*
* Name: Invoice
* Name: Invoice
* Directory: invoice
* Directory: invoice
* Version: 0.
1
* Version: 0.
5
* Class: user
* Class: user
* UI Name: Invoice
* UI Name: Invoice
* UI Icon:
* UI Icon:
...
@@ -20,13 +20,12 @@ $config['mod_ui_icon'] = 'applet3-48.png';
...
@@ -20,13 +20,12 @@ $config['mod_ui_icon'] = 'applet3-48.png';
$config
[
'mod_description'
]
=
'A module for billing tasks'
;
$config
[
'mod_description'
]
=
'A module for billing tasks'
;
if
(
@
$a
==
'setup'
)
{
if
(
@
$a
==
'setup'
)
{
echo
dPshowModuleConfig
(
$config
);
echo
w2PshowModuleConfig
(
$config
);
}
}
class
CSetupInvoice
extends
w2p_Core_Setup
class
CSetupInvoice
{
{
public
function
install
()
{
function
install
()
{
$sql
=
"(
$sql
=
"(
`invoice_id` bigint(20) NOT NULL auto_increment,
`invoice_id` bigint(20) NOT NULL auto_increment,
`invoice_tag` char(10) NOT NULL unique,
`invoice_tag` char(10) NOT NULL unique,
...
@@ -37,7 +36,7 @@ class CSetupInvoice{
...
@@ -37,7 +36,7 @@ class CSetupInvoice{
`invoice_creator` int(11) NOT NULL default '0',
`invoice_creator` int(11) NOT NULL default '0',
PRIMARY KEY (`invoice_id`)
PRIMARY KEY (`invoice_id`)
) TYPE=MyISAM "
;
) TYPE=MyISAM "
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
();
$q
->
createTable
(
'invoice'
);
$q
->
createTable
(
'invoice'
);
$q
->
createDefinition
(
$sql
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$q
->
exec
();
...
@@ -52,11 +51,11 @@ class CSetupInvoice{
...
@@ -52,11 +51,11 @@ class CSetupInvoice{
$q
->
createTable
(
'invoice_task_queue'
);
$q
->
createTable
(
'invoice_task_queue'
);
$q
->
createDefinition
(
$sql
);
$q
->
createDefinition
(
$sql
);
$q
->
exec
();
$q
->
exec
();
return
null
;
return
parent
::
install
();
}
}
function
remove
()
{
public
function
remove
()
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
();
$q
->
dropTable
(
'invoice'
);
$q
->
dropTable
(
'invoice'
);
$q
->
exec
();
$q
->
exec
();
...
@@ -65,11 +64,16 @@ class CSetupInvoice{
...
@@ -65,11 +64,16 @@ class CSetupInvoice{
$q
->
dropTable
(
'invoice_task_queue'
);
$q
->
dropTable
(
'invoice_task_queue'
);
$q
->
exec
();
$q
->
exec
();
return
null
;
return
parent
::
remove
();
}
}
function
upgrade
()
{
public
function
upgrade
(
$old_version
)
{
return
null
;
switch
(
$old_version
)
{
case
0.1
:
default
:
return
true
;
}
return
false
;
}
}
}
}
...
...
view.php
View file @
abc65b0f
<?php
<?php
$invoice_id
=
intval
(
dPgetParam
(
$_GET
,
"invoice_id"
,
0
)
);
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
$project_id
=
intval
(
dPgetParam
(
$_GET
,
"project_id"
,
0
)
);
die
(
'You should not access this file directly.'
);
// //$report_type = dPgetParam( $_REQUEST, "report_type", '' );
}
$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
// check permissions for this record
// Done in index.php
// 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
)
{
if
(
!
$canEdit
)
{
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
$AppUI
->
redirect
(
"m=public&a=access_denied"
);
}
}
...
@@ -13,20 +19,20 @@ if (!$canEdit) {
...
@@ -13,20 +19,20 @@ if (!$canEdit) {
// format dates
// format dates
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$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
;
$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
C
Date
(
$row
->
project_actual_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
// setup the title block
$ttl
=
$project_id
>
0
?
"View Invoice"
:
"View Invoice"
;
$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
)
if
(
$project_id
!=
0
)
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
$titleBlock
->
addCrumb
(
"?m=projects&a=view&project_id=
$project_id
"
,
"view this project"
);
$titleBlock
->
addCrumb
(
'?m=invoice'
,
'view all invoices'
);
$titleBlock
->
addCrumb
(
'?m=invoice'
,
'view all invoices'
);
$titleBlock
->
show
();
$titleBlock
->
show
();
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
task_queue_id,
task_queue_id,
invoice_task_queue.task_log_id,
invoice_task_queue.task_log_id,
...
@@ -97,16 +103,16 @@ foreach($billingcodes as $values)
...
@@ -97,16 +103,16 @@ foreach($billingcodes as $values)
//$amount_code = ;
//$amount_code = ;
//$hours = ;
//$hours = ;
$counter
=
0
;
$counter
=
0
;
$start_date
=
new
C
Date
();
$start_date
=
new
w2p_Utilities_
Date
();
$finish_date
=
new
C
Date
(
0
);
$finish_date
=
new
w2p_Utilities_
Date
(
0
);
function
showtask
(
&
$a
)
{
function
invoice_
showtask
(
&
$a
)
{
global
$AppUI
,
$project_id
,
$billingcodes
,
$bcodes
;
global
$AppUI
,
$project_id
,
$billingcodes
,
$bcodes
;
global
$pdfdata
,
$amount_code
,
$amount_fixed
;
global
$pdfdata
,
$amount_code
,
$amount_fixed
;
global
$counter
,
$hours
,
$hours_fixed
;
global
$counter
,
$hours
,
$hours_fixed
;
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$df
=
$AppUI
->
getPref
(
'SHDATEFORMAT'
);
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
task_log_id,
task_log_id,
task_log_task,
task_log_task,
...
@@ -158,21 +164,21 @@ if ($a["task_amount"] == "0") {
...
@@ -158,21 +164,21 @@ if ($a["task_amount"] == "0") {
$hours_fixed
+=
$tasks
[
'task_log_hours'
];
$hours_fixed
+=
$tasks
[
'task_log_hours'
];
}
}
global
$start_date
,
$finish_date
;
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
)
if
(
$start_date
->
compare
(
$t
,
$start_date
)
<
0
)
$start_date
=
$t
;
$start_date
=
$t
;
if
(
$finish_date
->
compare
(
$t
,
$finish_date
)
>
0
)
if
(
$finish_date
->
compare
(
$t
,
$finish_date
)
>
0
)
$finish_date
=
$t
;
$finish_date
=
$t
;
$s
=
"
\n
<tr>"
;
$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>'
;
$s
.=
'<td nowrap>'
.
$d
->
format
(
$df
)
.
'</td>'
;
$alt
=
htmlspecialchars
(
$tasks
[
"task_log_name"
]
);
$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 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>'
.
$username
[
"contact_first_name"
]
.
' '
.
$username
[
"contact_last_name"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap" align=center>'
.
$tasks
[
"task_log_hours"
]
.
'</td>'
;
$s
.=
'<td nowrap="nowrap"> '
.
$costdesc
.
'</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
.=
'<tr>'
;
$s
.=
'<tr>'
;
$s
.=
'<td colspan="1"> </td>'
;
$s
.=
'<td colspan="1"> </td>'
;
...
@@ -226,11 +232,11 @@ for ($s=0; $s < count($tasks); $s++) {
...
@@ -226,11 +232,11 @@ for ($s=0; $s < count($tasks); $s++) {
foreach
(
$bcodes
as
$code
=>
$rate
)
foreach
(
$bcodes
as
$code
=>
$rate
)
$tmp
[
strtolower
(
$code
)]
=
$hours
[
strtolower
(
$code
)];
$tmp
[
strtolower
(
$code
)]
=
$hours
[
strtolower
(
$code
)];
$tmpfix
=
$amount_fixed
;
$tmpfix
=
$amount_fixed
;
$tmpamount
=
showtask
(
$tasks
[
$s
],
1
);
$tmpamount
=
invoice_
showtask
(
$tasks
[
$s
],
1
);
$myamount
=
$myamount
+
$tmpamount
;
$myamount
=
$myamount
+
$tmpamount
;
$task_log
=
get_task_log
(
$tasks
[
$s
][
'task_log_id'
]);
$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
);
$date
=
$date
->
format
(
$df
);
$tmppdfdata2
=
array
(
$tmppdfdata2
=
array
(
// ++$counter,
// ++$counter,
...
@@ -243,7 +249,7 @@ for ($s=0; $s < count($tasks); $s++) {
...
@@ -243,7 +249,7 @@ for ($s=0; $s < count($tasks); $s++) {
if
(
!
empty
(
$bcodes
))
if
(
!
empty
(
$bcodes
))
foreach
(
$bcodes
as
$code
=>
$rate
)
foreach
(
$bcodes
as
$code
=>
$rate
)
$temp
[]
=
sprintf
(
"%.2f"
,
round
(
$hours
[
strtolower
(
$code
)]
-
$tmp
[
strtolower
(
$code
)],
2
));
$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
);
$pdfdata2t
[]
=
array_merge
(
$tmppdfdata2
,
$temp
);
}
}
...
@@ -261,7 +267,7 @@ for ($s=0; $s < count($tasks); $s++) {
...
@@ -261,7 +267,7 @@ for ($s=0; $s < count($tasks); $s++) {
function
get_user_name
(
$user_id
)
function
get_user_name
(
$user_id
)
{
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'user_username'
);
$q
->
addQuery
(
'user_username'
);
$q
->
addTable
(
'users'
);
$q
->
addTable
(
'users'
);
$q
->
addWhere
(
'user_id = '
.
$user_id
);
$q
->
addWhere
(
'user_id = '
.
$user_id
);
...
@@ -271,7 +277,7 @@ function get_user_name($user_id)
...
@@ -271,7 +277,7 @@ function get_user_name($user_id)
function
get_task_log
(
$task_log_id
,
$task
=
false
)
function
get_task_log
(
$task_log_id
,
$task
=
false
)
{
{
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'
$q
->
addQuery
(
'
task_log_id,
task_log_id,
task_log_task,
task_log_task,
...
@@ -294,7 +300,7 @@ $tasks=db_fetch_assoc($tmptasks);
...
@@ -294,7 +300,7 @@ $tasks=db_fetch_assoc($tmptasks);
<tr>
<tr>
<td
colspan=
5
align=
right
><b>
Total
</b></td>
<td
colspan=
5
align=
right
><b>
Total
</b></td>
<td>
<td>
<?php
echo
d
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
w2
PgetConfig
(
'currency_symbol'
);
?>
<?php
echo
$myamount
?>
<?php
echo
$myamount
?>
</td>
</td>
...
@@ -302,15 +308,15 @@ $tasks=db_fetch_assoc($tmptasks);
...
@@ -302,15 +308,15 @@ $tasks=db_fetch_assoc($tmptasks);
</table>
</table>
<?php
<?php
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
()
;
$q
->
addQuery
(
'project_name, project_short_name'
);
$q
->
addQuery
(
'project_name, project_short_name'
);
$q
->
addTable
(
'projects'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$pname
=
$q
->
loadList
();
$pname
=
$q
->
loadList
();
$font_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$font_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/lib/ezpdf/fonts"
;
$temp_dir
=
d
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$temp_dir
=
w2
PgetConfig
(
'root_dir'
)
.
"/files/temp"
;
$base_url
=
d
PgetConfig
(
'base_url'
);
$base_url
=
w2
PgetConfig
(
'base_url'
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
require
(
$AppUI
->
getLibraryClass
(
'ezpdf/class.ezpdf'
)
);
//TRUE REPORT!!!
//TRUE REPORT!!!
...
@@ -330,12 +336,12 @@ require( $AppUI->getLibraryClass( 'ezpdf/class.ezpdf' ) );
...
@@ -330,12 +336,12 @@ require( $AppUI->getLibraryClass( 'ezpdf/class.ezpdf' ) );
// $pdf->selectFont( "$font_dir/Helvetica.afm" );
// $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))
// if (!empty($report_type_var))
// $report_type_var = '&report_type=' . $report_type;
// $report_type_var = '&report_type=' . $report_type;
...
...
vw_inc.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
function
invoices
(
$type
)
function
invoices
(
$type
)
{
{
GLOBAL
$AppUI
,
$invoices
;
GLOBAL
$AppUI
,
$invoices
;
...
@@ -31,7 +35,7 @@ $df = $AppUI->getPref('SHDATEFORMAT');
...
@@ -31,7 +35,7 @@ $df = $AppUI->getPref('SHDATEFORMAT');
$CR
=
"
\n
"
;
$CR
=
"
\n
"
;
$CT
=
"
\n\t
"
;
$CT
=
"
\n\t
"
;
$none
=
true
;
$none
=
true
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
();
foreach
(
$invoices
as
$row
)
foreach
(
$invoices
as
$row
)
{
{
if
(
$row
[
"invoice_status"
]
==
$type
)
if
(
$row
[
"invoice_status"
]
==
$type
)
...
@@ -71,7 +75,7 @@ foreach ($invoices as $row)
...
@@ -71,7 +75,7 @@ foreach ($invoices as $row)
$s
.=
$CR
.
'</td>'
;
$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">'
.
$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">'
.
$mydate
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
dPgetConfig
(
'currency_symbol'
)
.
' '
.
$total_amount
.
'</td>'
;
$s
.=
$CR
.
'<td nowrap="nowrap">'
.
w2PgetConfig
(
'currency_symbol'
)
.
' '
.
$total_amount
.
'</td>'
;
$s
.=
$CR
.
'</tr>'
;
$s
.=
$CR
.
'</tr>'
;
echo
$s
;
echo
$s
;
}
}
...
@@ -90,7 +94,7 @@ if ($none) {
...
@@ -90,7 +94,7 @@ if ($none) {
function
get_invoice_amount
(
$invoice_id
,
$project_id
)
{
function
get_invoice_amount
(
$invoice_id
,
$project_id
)
{
$amount
=
0
;
$amount
=
0
;
$q
=
new
DBQuery
;
$q
=
new
w2p_Database_Query
();
$q
->
addQuery
(
'project_company'
);
$q
->
addQuery
(
'project_company'
);
$q
->
addTable
(
'projects'
);
$q
->
addTable
(
'projects'
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
$q
->
addWhere
(
'project_id = '
.
$project_id
);
...
...
vw_loss.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
include
(
"vw_inc.php"
);
echo
invoices
(
3
);
echo
invoices
(
3
);
...
...
vw_open.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
include
(
"vw_inc.php"
);
echo
invoices
(
0
);
echo
invoices
(
0
);
...
...
vw_paid.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
include
(
"vw_inc.php"
);
echo
invoices
(
2
);
echo
invoices
(
2
);
...
...
vw_pend.php
View file @
abc65b0f
<?php
<?php
if
(
!
defined
(
'W2P_BASE_DIR'
))
{
die
(
'You should not access this file directly.'
);
}
include
(
"vw_inc.php"
);
include
(
"vw_inc.php"
);
echo
invoices
(
1
);
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