Commit c3f2597f authored by Frank Bergmann's avatar Frank Bergmann

- added project relation code

parent 354f9098
# /packages/intranet-invoices/www/add-project-to-invoice.tcl
#
# Copyright (C) 2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
# ---------------------------------------------------------------
# Page Contract
# ---------------------------------------------------------------
ad_page_contract {
Allows to "associate" a project with a financial document.
This is useful when the document has been created "from scratch".
@author frank.bergmann@project-open.com
} {
{ invoice_id:integer 0}
{ project_id:integer 0}
{ return_url "/intranet-invoices/"}
}
# ---------------------------------------------------------------
# Defaults & Security
# ---------------------------------------------------------------
set user_id [ad_maybe_redirect_for_registration]
if {![im_permission $user_id view_invoices]} {
ad_return_complaint "Insufficient Privileges" "
<li>You don't have sufficient privileges to see this page."
}
set page_focus "im_header_form.keywords"
set bgcolor(0) " class=roweven"
set bgcolor(1) " class=rowodd"
set required_field "<font color=red size=+1><B>*</B></font>"
set page_title "Associate Invoice with Project"
set context_bar [ad_context_bar [list /intranet/invoices/ "Finance"] $page_title]
# ---------------------------------------------------------------
# Get everything about the invoice
# ---------------------------------------------------------------
append query "
select
i.*,
c.*,
o.*,
i.invoice_date + i.payment_days as calculated_due_date,
pm_cat.category as invoice_payment_method,
pm_cat.category_description as invoice_payment_method_desc,
im_name_from_user_id(c.accounting_contact_id) as customer_contact_name,
im_email_from_user_id(c.accounting_contact_id) as customer_contact_email,
c.customer_name,
cc.country_name,
im_category_from_id(i.invoice_status_id) as invoice_status,
im_category_from_id(i.invoice_type_id) as invoice_type,
im_category_from_id(i.invoice_template_id) as invoice_template
from
im_invoices i,
im_customers c,
im_offices o,
country_codes cc,
im_categories pm_cat
where
i.invoice_id=:invoice_id
and i.payment_method_id=pm_cat.category_id(+)
and i.customer_id=c.customer_id(+)
and c.main_office_id=o.office_id(+)
and o.address_country_code=cc.iso(+)
"
if { ![db_0or1row projects_info_query $query] } {
ad_return_complaint 1 "Can't find the document\# $invoice_id"
return
}
set project_select [im_project_select object_id $project_id "Open" "" "" ""]
db_release_unused_handles
......@@ -204,7 +204,7 @@ if {[string equal $invoice_mode "new"]} {
# start formatting the list of sums with the header...
set task_sum_html "
<tr align=center>
<td class=rowtitle>Order</td>
<td class=rowtitle>Line</td>
<td class=rowtitle>Description</td>
<td class=rowtitle>Type</td>
<td class=rowtitle>Units</td>
......@@ -248,7 +248,7 @@ order by
# start formatting the list of sums with the header...
set task_sum_html "
<tr align=center>
<td class=rowtitle>Order</td>
<td class=rowtitle>Line</td>
<td class=rowtitle>Description</td>
<td class=rowtitle>Type</td>
<td class=rowtitle>Units</td>
......
......@@ -258,7 +258,7 @@ append project_list_html "
<tr>
<td align=left colspan=2>
<A href=/intranet-invoices/add-project-to-invoice?invoice_id=$invoice_id>
Add a related Project
Associate with a Project
</A>
</td>
</tr>"
......@@ -409,16 +409,16 @@ append item_html "
</tr>
"
if {$vat != 0} {
#if {0 != $vat} {
append item_html "
<tr>
<td colspan=$colspan_sub align=right>VAT: $vat %&nbsp;</td>
<td class=roweven align=right>$vat_amount $currency</td>
</tr>
"
}
#}
if {$vat != 0} {
if {0 != $tax} {
append item_html "
<tr>
<td colspan=$colspan_sub align=right>TAX: $tax %&nbsp;</td>
......@@ -514,9 +514,10 @@ if {[exists_and_not_null render_template_id]} {
</tr>
</table>
[im_invoices_object_list_component $user_id $invoice_id $return_url]
<br>
<table border=0 cellPadding=0 cellspacing=2>
$project_list_html
<tr><td colspan=2>&nbsp;</td></tr>
$payment_list_html
<tr><td colspan=2>&nbsp;</td></tr>
</table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment