Index: openacs-4/packages/invoices/invoices.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/invoices.info,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/invoices.info 2 Sep 2005 16:09:06 -0000 1.2
+++ openacs-4/packages/invoices/invoices.info 6 Sep 2005 22:55:58 -0000 1.3
@@ -7,15 +7,15 @@
f
t
-
+
Timo Hentschel
Invoices package that will collect costs to invoice items in invoices and store data about received payment.
- 2005-09-02
+ 2005-09-06
Cognovis
Collect costs to invoice items and invoices, store payment information.
0
-
+
@@ -32,7 +32,6 @@
-
Index: openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 16 Aug 2005 20:04:30 -0000 1.1
+++ openacs-4/packages/invoices/catalog/invoices.de_DE.ISO-8859-1.xml 6 Sep 2005 22:56:55 -0000 1.2
@@ -1,5 +1,5 @@
-
+
Akzeptiert am
Admin
@@ -9,6 +9,7 @@
Betrag
Gesamtsumme
Mehrwertsteuer?
+ Zurueck zum projekt
Abzurechnende Projekte
Abbrechen
Abbrechen und zur�ck
@@ -122,25 +123,27 @@
Mehrwertsteuer
Mehrwertsteuersatz
Rechnung ansehen
- Kostenaufstellung
- Kostenaufstellungen
+ Projektaufstellung
+ Projektaufstellungen
Angebot akzeptieren
Akzeptiert am
<html><body><h3>Angebotsbest�tigung</h3>%offer_text%</html></body>
Kostenaufstellung f�r "%organization_name%"
- Neue Kostenaufstellung hinzuf�gen
+ Neue Projektaufstellung hinzuf�gen
Rabatt
Summe
Gesamtsumme
- Kommentar
+ <b>Interner Kommentar</b>
+ Internes Kommentarfeld f�r alle Informationen aus dem Projektmanagement
Anzahl Positionen
erstellt am
erstellt von
W�hrung
+ Teillieferung
Kostenaufstellung l�schen
Beschreibung
- Description of the cost sheet
- Kostenaufstellung �ndern
+ Beschreibung der Kostenaufstellung
+ Projektaufstellung �ndern
Sie d�rfen keine akzeptierte oder berechnete Kostenaufstellung �ndern.
<html><body><h3>Angebot</h3>%offer_text%</html></body>
Timing Datum
@@ -170,9 +173,9 @@
Titel
Mehrwertsteuer
Kostenposition ansehen
- Kostenaufstellungen
- Neue Kostenaufstellung
- Neue Kostenaufstellung hinzuf�gen
+ Projektaufstellungen
+ Neue Projektaufstellung
+ Neue Projektaufstellung hinzuf�gen
Angebotsnummer
Nummer der Kostenaufstellung
Kunde
@@ -189,7 +192,7 @@
Titel des Angebots
Mehrwertsteuer
Mehrwertsteuersatz
- Kostenaufstellung ansehen
+ Projektaufstellung ansehen
Zahlung
Zahlungen
Zahlung hinzuf�gen
@@ -235,6 +238,7 @@
Angebotsnummer
Kostenaufstellungen
Kostenaufstellungen
+ Auftragsbest�tigung
Seitenyahl
Bezug auf Rechnungsposition
Bezug auf Kostenposition
Index: openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 16 Aug 2005 20:04:30 -0000 1.1
+++ openacs-4/packages/invoices/catalog/invoices.en_US.ISO-8859-1.xml 6 Sep 2005 22:56:55 -0000 1.2
@@ -1,28 +1,36 @@
-
+
Accepted on
Admin
Categories Administration
+ Aggregate invocies from this time of years and beyond.
Amount
Amount paid
Amount sum
Total Amount
Apply VAT?
+ Back to project
+ Back to %year%
+ Back to Years
Billable Projects
Cancel
Cancel and Return
Cancelled?
+ Client Account Manager
Continue with Offer Acceptance
Continue with Delete
Cost
Cost cause
Cost item
Cost number
Costs
+ Count
+ CSV
Currency
Currency paid
Customer
+ Day
Delete
Due date
Edit
@@ -56,6 +64,7 @@
Fixed cost?
View Cost
Display price list
+ Invoices from the last %last_years% years:
Invoice
Invoices
Invoice "%organization_name%"
@@ -122,6 +131,8 @@
VAT
%VAT
View Invoice
+ Invoices of %long_month% %year%:
+ Invoices of year %year%:
Cost Sheet
Cost Sheets
Accept Offer
@@ -137,6 +148,7 @@
Created on
Created by
Currency
+ Date Comment:
Delete Cost Sheet
Description
Description of the cost sheet
@@ -224,7 +236,12 @@
Title
View Price List
View Price
+ Invoice Reports
+ Last Years
Link package instances
+ Month
+ New
+ New Clients
No
None
Number of units
@@ -253,10 +270,12 @@
Received on
Recipient
Sort order
+ Table
Total amount
h
Unmounted
%VAT
VAT amount
+ Year
Yes
Index: openacs-4/packages/invoices/lib/invoice-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/invoice-list.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/invoice-list.tcl 16 Aug 2005 20:04:31 -0000 1.1
+++ openacs-4/packages/invoices/lib/invoice-list.tcl 6 Sep 2005 22:59:40 -0000 1.2
@@ -31,7 +31,7 @@
set date_format [lc_get formbuilder_date_format]
set timestamp_format "$date_format [lc_get formbuilder_time_format]"
-set actions [list "[_ invoices.iv_invoice_New]" [export_vars -base invoice-add {organization_id}] "[_ invoices.iv_invoice_New2]" "[_ invoices.iv_invoice_credit_New]" [export_vars -base invoice-credit {organization_id}] "[_ invoices.iv_invoice_credit_New2]" "[_ invoices.iv_offer_2]" [export_vars -base offer-list {organization_id}] "[_ invoices.iv_offer_2]" "[_ invoices.projects]" $pm_base_url "[_ invoices.projects]"]
+set actions [list "[_ invoices.iv_invoice_New]" [export_vars -base invoice-add {organization_id}] "[_ invoices.iv_invoice_New2]" "[_ invoices.iv_invoice_credit_New]" [export_vars -base invoice-credit {organization_id}] "[_ invoices.iv_invoice_credit_New2]" "[_ invoices.iv_offer_2]" [export_vars -base offer-list {organization_id}] "[_ invoices.iv_offer_2]" "[_ invoices.projects]" $pm_base_url "[_ invoices.projects]" "[_ invoices.iv_reports]" [export_vars -base invoice-reports {organization_id}]]
template::list::create \
-name iv_invoice \
Index: openacs-4/packages/invoices/lib/offer-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-list.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/lib/offer-list.tcl 2 Sep 2005 16:51:03 -0000 1.2
+++ openacs-4/packages/invoices/lib/offer-list.tcl 6 Sep 2005 22:59:40 -0000 1.3
@@ -21,7 +21,10 @@
}
}
}
-
+set status_id 2
+if {![info exists status_id]} {
+ db_1row get_offer_status_id {}
+}
if {![info exists format]} {
set format "normal"
}
@@ -41,10 +44,14 @@
append row_list "$element {}\n"
}
-set dotlrn_club_id [lindex [application_data_link::get_linked -from_object_id $organization_id -to_object_type "dotlrn_club"] 0]
+if {[exists_and_not_null organization_id]} {
+ set dotlrn_club_id [lindex [application_data_link::get_linked -from_object_id $organization_id -to_object_type "dotlrn_club"] 0]
-if {$dotlrn_club_id > 0} {
- set pm_base_url [apm_package_url_from_id [dotlrn_community::get_package_id_from_package_key -package_key "project-manager" -community_id $dotlrn_club_id]]
+ if {$dotlrn_club_id > 0} {
+ set pm_base_url [apm_package_url_from_id [dotlrn_community::get_package_id_from_package_key -package_key "project-manager" -community_id $dotlrn_club_id]]
+ }
+} else {
+ set pm_base_url ""
}
#set package_id [ad_conn package_id]
@@ -53,9 +60,11 @@
if {[exists_and_not_null organization_id]} {
set price_list_id [iv::price_list::get_list_id -organization_id $organization_id]
- set actions [list "[_ invoices.iv_offer_New]" [export_vars -base "${base_url}offer-ae" {organization_id}] "[_ invoices.iv_offer_New2]" "[_ invoices.iv_invoice_2]" [export_vars -base "${base_url}invoice-list" {organization_id}] "[_ invoices.iv_invoice_2]" "[_ invoices.iv_price_list]" [export_vars -base "${base_url}price-list" {{list_id $price_list_id}}] "[_ invoices.iv_display_price_list]"]
- if {[exists_and_not_null pm_base_url]} {
- lappend actions "[_ project-manager.Projects]" $pm_base_url "[_ project-manager.Projects]"
+ if {![info exists actions]} {
+ set actions [list "[_ invoices.iv_offer_New]" [export_vars -base "${base_url}offer-ae" {organization_id}] "[_ invoices.iv_offer_New2]" "[_ invoices.iv_invoice_2]" [export_vars -base "${base_url}invoice-list" {organization_id}] "[_ invoices.iv_invoice_2]" "[_ invoices.iv_price_list]" [export_vars -base "${base_url}price-list" {{list_id $price_list_id}}] "[_ invoices.iv_display_price_list]"]
+ if {[exists_and_not_null pm_base_url]} {
+ lappend actions "[_ project-manager.Projects]" $pm_base_url "[_ project-manager.Projects]"
+ }
}
} else {
set actions ""
@@ -77,6 +86,13 @@
description {
label {[_ invoices.iv_offer_Description]}
}
+ comment {
+ label {[_ invoices.iv_offer_comment]}
+ }
+ project_id {
+ label {[_ invoices.iv_offer_project]}
+ display_template {@iv_offer.project_title@}
+ }
amount_total {
label {[_ invoices.iv_offer_amount_total]}
display_template {@iv_offer.amount_total@ @iv_offer.currency@}
@@ -115,6 +131,16 @@
orderby {lower(cr.description)}
default_direction asc
}
+ comment {
+ label {[_ invoices.iv_offer_comment]}
+ orderby {lower(t.comment)}
+ default_direction asc
+ }
+ project_id {
+ label {[_ invoices.iv_offer_project]}
+ orderby {lower(pr.title)}
+ default_direction asc
+ }
amount_total {
label {[_ invoices.iv_offer_amount_total]}
orderby {t.amount_total}
@@ -141,7 +167,7 @@
orderby {t.accepted_date}
default_direction desc
}
- } -orderby_name orderby -html {width 100%} \
+ } -orderby_name orderby \
-page_size_variable_p 1 \
-page_size $page_size \
-page_flush_p 0 \
@@ -150,6 +176,12 @@
organization_id {
where_clause {t.organization_id = :organization_id}
}
+ project_id {
+ where_clause {pi.item_id = :project_id}
+ }
+ status_id {
+ where_clause {pp.status_id = :status_id}
+ }
} \
-formats {
normal {
@@ -166,12 +198,13 @@
}
-db_multirow -extend {creator_link edit_link delete_link title_link} iv_offer iv_offer {} {
+db_multirow -extend {creator_link edit_link delete_link title_link project_link} iv_offer iv_offer {} {
# Ugly hack. We should find out which contact package is linked
# aso. asf.
set creator_link "/contacts/$creation_user"
set edit_link [export_vars -base "${base_url}offer-ae" {offer_id}]
set title_link [export_vars -base "${base_url}offer-ae" {offer_id {mode display}}]
set delete_link [export_vars -base "${base_url}offer-delete" {offer_id}]
+ set project_link [export_vars -base "${pm_base_url}one" {{project_item_id $project_id}}]
}
Index: openacs-4/packages/invoices/lib/offer-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/offer-list.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/offer-list.xql 16 Aug 2005 20:04:31 -0000 1.1
+++ openacs-4/packages/invoices/lib/offer-list.xql 6 Sep 2005 22:59:40 -0000 1.2
@@ -1,23 +1,39 @@
+
+
+
+ select status_id
+ from pm_project_status
+ where description = '#acs-translations.project_manager_status_offer#'
+
+
+
+
select cr.item_id as offer_id, cr.title, cr.description,
t.offer_nr, t.amount_total, t.amount_sum, t.currency,
- p.first_names, p.last_name, o.creation_user,
+ p.first_names, p.last_name, o.creation_user, t.comment,
to_char(o.creation_date, :timestamp_format) as creation_date,
to_char(t.accepted_date, :timestamp_format) as accepted_date,
- to_char(t.finish_date, :timestamp_format) as finish_date
- from cr_folders cf, cr_items ci, cr_revisions cr, iv_offers t,
- acs_objects o, persons p
+ to_char(t.finish_date, :timestamp_format) as finish_date,
+ pi.item_id as project_id, pr.title as project_title
+ from cr_folders cf, cr_revisions cr, iv_offers t,
+ acs_objects o, persons p, cr_items ci, acs_rels r,
+ cr_items pi, cr_revisions pr, pm_projects pp
where cr.revision_id = ci.latest_revision
and t.offer_id = cr.revision_id
and ci.parent_id = cf.folder_id
and cf.package_id = :package_id
and o.object_id = t.offer_id
and p.person_id = o.creation_user
+ and r.object_id_one = ci.item_id
+ and r.object_id_two = pi.item_id
+ and pr.revision_id = pi.latest_revision
+ and pp.project_id = pr.revision_id
[template::list::filter_where_clauses -and -name iv_offer]
[template::list::orderby_clause -name iv_offer -orderby]
@@ -28,19 +44,23 @@
select cr.item_id as offer_id
- from cr_folders cf, cr_items ci, cr_revisions cr, iv_offers t,
- acs_objects o, persons p
+ from cr_folders cf, cr_revisions cr, iv_offers t,
+ acs_objects o, persons p, cr_items ci, acs_rels r,
+ cr_items pi, cr_revisions pr, pm_projects pp
where cr.revision_id = ci.latest_revision
and t.offer_id = cr.revision_id
and ci.parent_id = cf.folder_id
and cf.package_id = :package_id
and o.object_id = t.offer_id
and p.person_id = o.creation_user
+ and r.object_id_one = ci.item_id
+ and r.object_id_two = pi.item_id
+ and pr.revision_id = pi.latest_revision
+ and pp.project_id = pr.revision_id
[template::list::filter_where_clauses -and -name iv_offer]
[template::list::orderby_clause -name iv_offer -orderby]
-
Index: openacs-4/packages/invoices/lib/price-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/price-list.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/price-list.tcl 16 Aug 2005 20:04:31 -0000 1.1
+++ openacs-4/packages/invoices/lib/price-list.tcl 6 Sep 2005 22:59:40 -0000 1.2
@@ -1,6 +1,6 @@
set package_id [ad_conn package_id]
set language [lang::conn::language]
-db_1row currency_name {}
+db_1row currency {}
array set container_objects [iv::util::get_default_objects -package_id $package_id]
set actions [list "[_ invoices.iv_price_Edit]" [export_vars -base "price-ae" {list_id}] "[_ invoices.iv_price_Edit]"]
@@ -9,21 +9,16 @@
-name iv_price \
-key category_id \
-no_data "[_ invoices.None]" \
- -pass_properties {list_id} \
+ -pass_properties {list_id currency} \
-elements {
- tree_name {
- label {}
- }
category_name {
label {[_ invoices.iv_price_category_id]}
display_template {@iv_price.category_name;noquote@}
}
amount {
label {[_ invoices.iv_price_amount]}
+ display_template {@iv_price.amount@ @currency@}
}
- currency {
- label {[_ invoices.iv_price_list_currency]}
- }
} -actions $actions
@@ -45,7 +40,7 @@
}
}
-multirow create iv_price category_id tree_name category_name amount currency
+multirow create iv_price category_id tree_name category_name amount
set old_tree_id ""
foreach category_id $category_list {
@@ -64,5 +59,5 @@
}
set amount [format "%.2f" $amount]
- multirow append iv_price $category_id $tree_name $category_name $amount $currency_name
+ multirow append iv_price $category_id $tree_name $category_name $amount
}
Index: openacs-4/packages/invoices/lib/price-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/price-list.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/lib/price-list.xql 16 Aug 2005 20:04:31 -0000 1.1
+++ openacs-4/packages/invoices/lib/price-list.xql 6 Sep 2005 22:59:40 -0000 1.2
@@ -1,6 +1,17 @@
+
+
+
+ select l.currency
+ from cr_items i, iv_price_lists l
+ where l.list_id = i.latest_revision
+ and i.item_id = :list_id
+
+
+
+
Index: openacs-4/packages/invoices/lib/report-day-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-day-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-day-postgresql.xql 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,53 @@
+
+
+
+
+
+ select
+ to_char(iv.due_date, 'DD') as iv_day,
+ r.description,
+ r.title,
+ i.item_id as invoice_nr,
+ invoice_id
+ from
+ iv_invoices iv,
+ cr_revisions r,
+ cr_items i,
+ acs_objects o
+ where
+ to_char(iv.due_date, 'YYYY') = :year
+ and to_char(due_date, 'MM') = :month
+ and r.revision_id = i.latest_revision
+ and iv.invoice_id = r.revision_id
+ and iv.organization_id = :organization_id
+ and iv.recipient_id = o.object_id
+ [template::list::filter_where_clauses -and -name iv_days]
+ [template::list::orderby_clause -name iv_days -orderby]
+
+
+
+
+
+ select
+ count(invoice_id)
+ from
+ iv_invoices
+ where
+ to_char(due_date, 'MM') = :month
+ and to_char(due_date, 'YYYY') = :year
+ and organization_id = :organization_id
+
+
+
+
+
+ select
+ sum(total_amount)
+ from
+ iv_invoices
+ where
+ invoice_id = :invoice_id
+
+
+
+
Index: openacs-4/packages/invoices/lib/report-day.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-day.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-day.adp 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,4 @@
+#invoices.iv_of_month_year# (@iv_count@)
+
+
+
\ No newline at end of file
Index: openacs-4/packages/invoices/lib/report-day.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-day.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-day.tcl 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,136 @@
+if {![info exists format]} {
+ set format "normal"
+}
+
+if {![info exists orderby]} {
+ set orderby ""
+}
+
+if {![info exists page_size]} {
+ set page_size 25
+}
+
+if {![info exists package_id]} {
+ set package_id [ad_conn package_id]
+}
+
+if {![info exists base_url]} {
+ set base_url [apm_package_url_from_id $package_id]
+}
+
+foreach optional_param {organization_id row_list} {
+ if {![info exists $optional_param]} {
+ set $optional_param {}
+ }
+}
+
+foreach unset_param {new_clients_p account_manager_p} {
+ if {[info exists $unset_param]} {
+ if {[empty_string_p [set $unset_param]]} {
+ unset $unset_param
+ }
+ }
+}
+
+set actions [list "[_ invoices.back_to_year]" \
+ [export_vars -base invoice-reports {organization_id year new_clients_p account_manager_p}]]
+
+# Filter to show only resulst for clients in less than 1 year
+set new_clients_where_clause "o.creation_date > now() - '1 year' :: interval"
+
+if { [string equal $month "08"] || [string equal $month "09"] } {
+ set short_month [template::util::date::monthName [string range $month 1 1] short]
+ set long_month [template::util::date::monthName [string range $month 1 1] long]
+} else {
+ set short_month [template::util::date::monthName $month short]
+ set long_month [template::util::date::monthName $month long]
+}
+
+
+template::list::create \
+ -name iv_days \
+ -no_data "[_ invoices.None]" \
+ -selected_format $format \
+ -elements {
+ iv_day {
+ label "[_ invoices.day]:"
+ }
+ invoice_nr {
+ label {[_ invoices.iv_invoice_invoice_nr]}
+ }
+ title {
+ label {[_ invoices.iv_invoice_1]}
+ link_url_eval {[export_vars -base "invoice-ae" {invoice_id {mode display}}]}
+ }
+ description {
+ label {[_ invoices.iv_invoice_Description]}
+ }
+ iv_total_amount {
+ label {[_ invoices.Amount_total] }
+ }
+ } \
+ -actions $actions \
+ -sub_class narrow \
+ -orderby {
+ default_value invoice_nr
+ invoice_nr {
+ label {[_ invoices.iv_invoice_invoice_nr]}
+ orderby {i.item_id}
+ default_direction asc
+ }
+ title {
+ label {[_ invoices.iv_invoice_1]}
+ orderby_desc {lower(r.title) desc}
+ orderby_asc {lower(r.title) asc}
+ default_direction asc
+ }
+ description {
+ label {[_ invoices.iv_invoice_Description]}
+ orderby_desc {lower(r.description) desc}
+ orderby_asc {lower(r.description) asc}
+ default_direction asc
+ }
+ iv_total_amount {
+ label {[_ invoices.iv_invoice_total_amount]}
+ orderby_desc {iv.total_amount desc}
+ orderby_asc {iv.total_amount asc}
+ default_direction desc
+ }
+ } \
+ -filters {
+ organization_id {
+ }
+ year {
+ }
+ month {
+ }
+ new_clients_p {
+ label "[_ invoices.New_clients]"
+ values {{"[_ invoices.New]" 1}}
+ where_clause { $new_clients_where_clause}
+ }
+ account_manager_p {
+ label "[_ invoices.Client_Account_Man]"
+ values { {Filter 1} }
+ where_clause { iv.recipient_id = iv.recipient_id }
+ }
+ } \
+ -formats {
+ normal {
+ label "[_ invoices.Table]"
+ layout table
+ row $row_list
+ }
+ csv {
+ label "[_ invoices.CSV]"
+ output csv
+ page_size 0
+ row $row_list
+ }
+ }
+
+db_multirow -extend { iv_total_amount } iv_days iv_invoice_days " " {
+ set iv_total_amount [db_string get_iv_total_amount { }]
+}
+
+set iv_count [db_string get_iv_count { }]
\ No newline at end of file
Index: openacs-4/packages/invoices/lib/report-month-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-month-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-month-postgresql.xql 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,44 @@
+
+
+
+
+
+ select
+ distinct to_char(iv.due_date, 'MM') as iv_month
+ from
+ iv_invoices iv,
+ acs_objects o
+ where
+ to_char(iv.due_date, 'YYYY') = :year
+ and iv.organization_id = :organization_id
+ and iv.recipient_id = o.object_id
+ [template::list::filter_where_clauses -and -name iv_months]
+
+
+
+
+
+ select
+ count(invoice_id)
+ from
+ iv_invoices
+ where
+ to_char(due_date, 'YYYY') = :year
+ and to_char(due_date, 'MM') = :iv_month
+ and organization_id = :organization_id
+
+
+
+
+
+ select
+ sum(total_amount)
+ from
+ iv_invoices
+ where
+ to_char(due_date, 'YYYY') = :year
+ and to_char(due_date, 'MM') = :iv_month
+
+
+
+
Index: openacs-4/packages/invoices/lib/report-month.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-month.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-month.adp 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,4 @@
+#invoices.iv_of_year#
+
+
+
Index: openacs-4/packages/invoices/lib/report-month.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-month.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-month.tcl 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,109 @@
+if {![info exists format]} {
+ set format "normal"
+}
+
+if {![info exists orderby]} {
+ set orderby ""
+}
+
+if {![info exists page_size]} {
+ set page_size 25
+}
+
+if {![info exists package_id]} {
+ set package_id [ad_conn package_id]
+}
+
+if {![info exists base_url]} {
+ set base_url [apm_package_url_from_id $package_id]
+}
+
+foreach optional_param {organization_id row_list} {
+ if {![info exists $optional_param]} {
+ set $optional_param {}
+ }
+}
+
+foreach unset_param {new_clients_p account_manager_p} {
+ if {[info exists $unset_param]} {
+ if {[empty_string_p [set $unset_param]]} {
+ unset $unset_param
+ }
+ }
+}
+
+set actions [list "[_ invoices.back_to_years]" \
+ [export_vars -base invoice-reports {organization_id new_clients_p account_manager_p}]]
+
+set extra_url ""
+# Filter to show only resulst for clients in less than 1 year
+if {[exists_and_not_null new_clients_p] } {
+ append extra_url "&new_clients_p=$new_clients_p"
+}
+set new_clients_where_clause "o.creation_date > now() - '1 year' :: interval"
+
+# Account Manager Filter
+if {[exists_and_not_null account_manager_p] } {
+ append extra_url "&account_manager_p=$account_manager_p"
+}
+
+template::list::create \
+ -name iv_months \
+ -no_data "[_ invoices.None]" \
+ -selected_format $format \
+ -elements {
+ iv_month {
+ label "[_ invoices.month]:"
+ display_template {
+ @iv_months.short_month@
+ }
+ }
+ iv_count {
+ label {[_ invoices.count]}
+ }
+ iv_total_amount {
+ label {[_ invoices.Amount_total] }
+ }
+ } \
+ -actions $actions \
+ -sub_class narrow \
+ -filters {
+ organization_id {
+ }
+ year {
+ }
+ new_clients_p {
+ label "[_ invoices.New_clients]"
+ values {{"[_ invoices.New]" 1}}
+ where_clause { $new_clients_where_clause}
+ }
+ account_manager_p {
+ label "[_ invoices.Client_Account_Man]"
+ values { {Filter 1} }
+ where_clause { iv.recipient_id = iv.recipient_id }
+ }
+ } \
+ -formats {
+ normal {
+ label "[_ invoices.Table]"
+ layout table
+ row $row_list
+ }
+ csv {
+ label "[_ invoices.CSV]"
+ output csv
+ page_size 0
+ row $row_list
+ }
+ }
+
+db_multirow -extend { short_month iv_total_amount iv_count } iv_months iv_invoice_months " " {
+ if { [string equal $iv_month "08"] || [string equal $iv_month "09"] } {
+ set short_month [template::util::date::monthName [string range $iv_month 1 1] short]
+ } else {
+ set short_month [template::util::date::monthName $iv_month short]
+ }
+ set iv_total_amount [db_string get_iv_total_amount { }]
+ set iv_count [db_string get_iv_count { }]
+}
+
Index: openacs-4/packages/invoices/lib/report-year-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-year-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-year-postgresql.xql 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,42 @@
+
+
+
+
+
+ select
+ distinct to_char(iv.due_date, 'YYYY') as iv_year
+ from
+ iv_invoices iv,
+ acs_objects o
+ where
+ iv.due_date > now() - '$last_years years' :: interval
+ and iv.organization_id = :organization_id
+ and iv.recipient_id = o.object_id
+ [template::list::filter_where_clauses -and -name iv_years]
+
+
+
+
+
+ select
+ sum(total_amount)
+ from
+ iv_invoices
+ where
+ to_char(due_date, 'YYYY') = :iv_year
+ and organization_id = :organization_id
+
+
+
+
+
+ select
+ count(invoice_id)
+ from
+ iv_invoices
+ where
+ to_char(due_date, 'YYYY') = :iv_year
+ and organization_id = :organization_id
+
+
+
Index: openacs-4/packages/invoices/lib/report-year.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-year.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-year.adp 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,7 @@
+
+
+
+#invoices.iv_from_last_years#
+
+
+
Index: openacs-4/packages/invoices/lib/report-year.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/report-year.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/lib/report-year.tcl 6 Sep 2005 23:00:14 -0000 1.1
@@ -0,0 +1,128 @@
+if {![info exists format]} {
+ set format "normal"
+}
+
+if {![info exists orderby]} {
+ set orderby ""
+}
+
+if {![info exists page_size]} {
+ set page_size 25
+}
+
+if {![info exists package_id]} {
+ set package_id [ad_conn package_id]
+}
+
+if {![info exists base_url]} {
+ set base_url [apm_package_url_from_id $package_id]
+}
+
+foreach optional_param {row_list} {
+ if {![info exists $optional_param]} {
+ set $optional_param {}
+ }
+}
+
+foreach unset_param {new_clients_p account_manager_p} {
+ if {[info exists $unset_param]} {
+ if {[empty_string_p [set $unset_param]]} {
+ unset $unset_param
+ }
+ }
+}
+
+ad_form -name aggregate -form {
+ {organization_id:text(hidden)
+ {value $organization_id}
+ }
+ {last_years:text(text),optional
+ {label "[_ invoices.last_years]:"}
+ {value $last_years}
+ {html {size 2}}
+ {help_text { [_ invoices.aggregate_iv_from] }}
+ }
+}
+
+set extra_url ""
+# Filter to show only resulst for clients in less than 1 year
+if {[exists_and_not_null new_clients_p] } {
+ append extra_url "&new_clients_p=$new_clients_p"
+ ad_form -extend -name aggregate -form {
+ {new_clients_p:text(hidden)
+ {value $new_clients_p}
+ }
+ }
+}
+set new_clients_where_clause "o.creation_date > now() - '1 year' :: interval"
+
+# Account Manager Filter
+if {[exists_and_not_null account_manager_p] } {
+ append extra_url "&account_manager_p=$account_manager_p"
+ ad_form -extend -name aggregate -form {
+ {account_manager_p:text(hidden)
+ {value $account_manager_p}
+ }
+ }
+}
+
+# Calculating from_year to use in the query
+# according of the number of years in last_years
+set act_date [dt_sysdate]
+set act_year [string range $act_date 0 3]
+set from_year [expr $act_year - $last_years]
+regsub "${act_year}-" $act_date "${from_year}-" from_date
+
+template::list::create \
+ -name iv_years \
+ -no_data "[_ invoices.None]" \
+ -selected_format $format \
+ -elements {
+ iv_year {
+ label "[_ invoices.year]:"
+ display_template {
+ @iv_years.iv_year@
+ }
+ }
+ iv_count {
+ label "[_ invoices.count]:"
+ }
+ iv_total_amount {
+ label "[_ invoices.Amount_total]"
+ }
+ } \
+ -sub_class narrow \
+ -filters {
+ organization_id {
+ }
+ last_years {
+ }
+ new_clients_p {
+ label "[_ invoices.New_clients]"
+ values {{"[_ invoices.New]" 1}}
+ where_clause { $new_clients_where_clause}
+ }
+ account_manager_p {
+ label "[_ invoices.Client_Account_Man]"
+ values { {Filter 1} }
+ where_clause { iv.recipient_id = iv.recipient_id }
+ }
+ } \
+ -formats {
+ normal {
+ label "[_ invoices.Table]"
+ layout table
+ row $row_list
+ }
+ csv {
+ label "[_ invoices.CSV]"
+ output csv
+ page_size 0
+ row $row_list
+ }
+ }
+
+db_multirow -extend { iv_count iv_total_amount } iv_years iv_invoice_years " " {
+ set iv_count [db_string get_iv_count { }]
+ set iv_total_amount [db_string get_iv_total_amount { }]
+}
\ No newline at end of file
Index: openacs-4/packages/invoices/sql/postgresql/invoices-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/sql/postgresql/invoices-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/sql/postgresql/invoices-create.sql 16 Aug 2005 20:04:31 -0000 1.1
+++ openacs-4/packages/invoices/sql/postgresql/invoices-create.sql 6 Sep 2005 22:57:52 -0000 1.2
@@ -102,6 +102,7 @@
constraint iv_offers_currency_fk
references currencies(codeA),
finish_date timestamptz,
+ date_comment varchar(1000),
payment_days integer,
vat_percent numeric(12,5) default 0,
-- %VAT
Index: openacs-4/packages/invoices/sql/postgresql/upgrade/upgrade-0.01d7-0.01d8.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/sql/postgresql/upgrade/upgrade-0.01d7-0.01d8.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/sql/postgresql/upgrade/upgrade-0.01d7-0.01d8.sql 6 Sep 2005 22:58:25 -0000 1.1
@@ -0,0 +1 @@
+alter table iv_offers add column date_comment varchar(1000);
Index: openacs-4/packages/invoices/tcl/invoice-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/tcl/invoice-procs.tcl 2 Sep 2005 16:10:00 -0000 1.2
+++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 6 Sep 2005 22:59:05 -0000 1.3
@@ -194,15 +194,15 @@
set file_url [parameter::get -parameter MailSendBoxFileP]
if {![empty_string_p $file_url]} {
- set file [open $file_url]
- fconfigure $file -translation binary
- set content [read $file]
-
- # parse template and replace placeholders
- eval [template::adp_compile -string $content]
- set final_content $__adp_output
+ set file [open $file_url]
+ fconfigure $file -translation binary
+ set content [read $file]
+
+ # parse template and replace placeholders
+ eval [template::adp_compile -string $content]
+ set final_content $__adp_output
} else {
- set final_content ""
+ set final_content ""
}
return $final_content
Index: openacs-4/packages/invoices/tcl/invoices-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoices-callback-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/tcl/invoices-callback-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1
+++ openacs-4/packages/invoices/tcl/invoices-callback-procs.tcl 6 Sep 2005 22:59:05 -0000 1.2
@@ -118,6 +118,11 @@
}
}
+ad_proc -public -callback iv::offer_accept {
+ {-offer_id:required}
+} {
+}
+
ad_proc -public -callback contacts::populate::organization::customer_attributes -impl invoices {
{-list_id:required}
} {
Index: openacs-4/packages/invoices/tcl/iv-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/iv-install-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/tcl/iv-install-procs.tcl 2 Sep 2005 16:08:51 -0000 1.2
+++ openacs-4/packages/invoices/tcl/iv-install-procs.tcl 6 Sep 2005 22:59:05 -0000 1.3
@@ -48,6 +48,7 @@
content::type::attribute::new -content_type {iv_offer} -attribute_name {amount_sum} -datatype {number} -pretty_name {[_ invoices.Amount_sum]} -column_spec {numeric(12,2)}
content::type::attribute::new -content_type {iv_offer} -attribute_name {currency} -datatype {string} -pretty_name {[_ invoices.Currency]} -column_spec {char(3)}
content::type::attribute::new -content_type {iv_offer} -attribute_name {finish_date} -datatype {date} -pretty_name {[_ invoices.Finish_date]} -column_spec {timestamptz}
+ content::type::attribute::new -content_type {iv_offer} -attribute_name {date_comment} -datatype {string} -pretty_name {[_ invoices.Date_comment]} -column_spec {varchar(1000)}
content::type::attribute::new -content_type {iv_offer} -attribute_name {payment_days} -datatype {number} -pretty_name {[_ invoices.Payment_after__days]} -column_spec {integer}
content::type::attribute::new -content_type {iv_offer} -attribute_name {vat_percent} -datatype {number} -pretty_name {[_ invoices.VAT]} -column_spec {numeric(12,5)}
content::type::attribute::new -content_type {iv_offer} -attribute_name {vat} -datatype {number} -pretty_name {[_ invoices.VAT_amount]} -column_spec {numeric(12,2)}
@@ -212,6 +213,9 @@
content::type::attribute::new -content_type {iv_offer_item} -attribute_name {comment} -datatype {text} -pretty_name {[_ invoices.Comment]} -column_spec {text}
}
0.01d7 0.01d8 {
+ content::type::attribute::new -content_type {iv_offer} -attribute_name {date_comment} -datatype {string} -pretty_name {[_ invoices.Date_comment]} -column_spec {varchar(1000)}
+ }
+ 0.01d8 0.01d9 {
apm_parameter_register "MailSendBoxFileP" "Location of the file for prefilling the mail send box." "invoices" "" "string"
}
}
Index: openacs-4/packages/invoices/tcl/offer-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/invoices/tcl/offer-procs.tcl 2 Sep 2005 16:10:00 -0000 1.2
+++ openacs-4/packages/invoices/tcl/offer-procs.tcl 6 Sep 2005 22:59:05 -0000 1.3
@@ -18,6 +18,7 @@
{-amount_sum ""}
{-currency ""}
{-finish_date ""}
+ {-date_comment ""}
{-payment_days ""}
{-vat_percent ""}
{-vat ""}
@@ -52,6 +53,7 @@
[list amount_sum $amount_sum] \
[list currency $currency] \
[list finish_date $finish_date] \
+ [list date_comment $date_comment] \
[list payment_days $payment_days] \
[list vat_percent $vat_percent] \
[list vat $vat] ] ]
@@ -71,6 +73,7 @@
{-amount_sum ""}
{-currency ""}
{-finish_date ""}
+ {-date_comment ""}
{-payment_days ""}
{-vat_percent ""}
{-vat ""}
@@ -81,6 +84,7 @@
Edit Offer
} {
db_transaction {
+ set old_rev_id [content::item::get_best_revision -item_id $offer_id]
set new_rev_id [content::revision::new \
-item_id $offer_id \
-content_type {iv_offer} \
@@ -94,9 +98,11 @@
[list amount_sum $amount_sum] \
[list currency $currency] \
[list finish_date $finish_date] \
+ [list date_comment $date_comment] \
[list payment_days $payment_days] \
[list vat_percent $vat_percent] \
[list vat $vat] ] ]
+ db_dml set_accepted_date {}
}
return $new_rev_id
@@ -185,20 +191,19 @@
set file_url [parameter::get -parameter MailSendBoxFileP]
if { ![empty_string_p $file_url] } {
- set file [open "$file_url"]
- fconfigure $file -translation binary
- set content [read $file]
-
-
- # parse template and replace placeholders
- eval [template::adp_compile -string $content]
- set final_content $__adp_output
+ set file [open "$file_url"]
+ fconfigure $file -translation binary
+ set content [read $file]
+
+
+ # parse template and replace placeholders
+ eval [template::adp_compile -string $content]
+ set final_content $__adp_output
} else {
- set final_content ""
+ set final_content ""
}
return $final_content
-
}
ad_proc -public iv::offer::text {
Index: openacs-4/packages/invoices/tcl/offer-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/tcl/offer-procs.xql 16 Aug 2005 20:04:32 -0000 1.1
+++ openacs-4/packages/invoices/tcl/offer-procs.xql 6 Sep 2005 22:59:05 -0000 1.2
@@ -1,6 +1,18 @@
+
+
+
+ update iv_offers
+ set accepted_date = (select accepted_date
+ from iv_offers
+ where offer_id = :old_rev_id)
+ where offer_id = :new_rev_id
+
+
+
+
@@ -11,7 +23,7 @@
o.creation_user, p.first_names, p.last_name,
to_char(o.creation_date, :timestamp_format) as creation_date,
to_char(t.accepted_date, :timestamp_format) as accepted_date,
- t.amount_sum as amount_sum_, t.payment_days,
+ t.amount_sum as amount_sum_, t.payment_days, t.date_comment,
t.currency, t.organization_id, t.amount_sum
from iv_offers t, cr_revisions r, cr_items i, acs_objects o,
persons p
@@ -34,7 +46,7 @@
o.creation_user, p.first_names, p.last_name,
to_char(o.creation_date, :timestamp_format) as creation_date,
to_char(t.accepted_date, :timestamp_format) as accepted_date,
- t.amount_sum as amount_sum_, t.payment_days,
+ t.amount_sum as amount_sum_, t.payment_days, t.date_comment,
t.currency, t.organization_id, t.amount_sum
from iv_offers t, cr_revisions r, cr_items i, acs_objects o,
persons p
Index: openacs-4/packages/invoices/www/invoice-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/invoice-ae.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/invoice-ae.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -266,6 +266,7 @@
-payment_days $payment_days \
-vat_percent $vat_percent \
-vat $vat]
+
if {[exists_and_not_null category_ids]} {
category::map_object -object_id $new_invoice_rev_id $category_ids
}
Index: openacs-4/packages/invoices/www/invoice-ae.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/invoice-ae.xql 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/invoice-ae.xql 6 Sep 2005 23:01:24 -0000 1.2
@@ -62,10 +62,10 @@
select p.first_names || ' ' || p.last_name, p.person_id
- from persons p, pm_projects pj, cr_items i
+ from persons p, pm_projects pj, cr_items i, pm_project_assignment a
where i.item_id in ([join $project_id ,])
and i.latest_revision = pj.project_id
- and pj.recipient_id = p.person_id
+ and p.person_id in ( select party_id from pm_project_assignment where project_id in ([join $project_id ,]))
order by lower(p.last_name), lower(p.first_names)
Index: openacs-4/packages/invoices/www/invoice-reports.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-reports.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/www/invoice-reports.adp 6 Sep 2005 23:02:05 -0000 1.1
@@ -0,0 +1,36 @@
+
+@page_title;noquote@
+@context;noquote@
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/invoices/www/invoice-reports.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-reports.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/invoices/www/invoice-reports.tcl 6 Sep 2005 23:02:05 -0000 1.1
@@ -0,0 +1,37 @@
+# packages/invoices/www/invoice-report.tcl
+ad_page_contract {
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+
+} {
+ {format:optional "normal"}
+ organization_id
+ {last_years:optional "5"}
+ {year:optional ""}
+ {month:optional ""}
+ {new_clients_p ""}
+ {account_manager_p ""}
+ {orderby:optional ""}
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+set user_id [auth::require_login]
+set page_title "[_ invoices.iv_reports]"
+set context [list $page_title]
+
+set year_p 0
+set month_p 0
+set day_p 0
+
+if { ![empty_string_p $year] && ![empty_string_p $month]} {
+ set day_p 1
+} elseif { ![empty_string_p $year] } {
+ set month_p 1
+} else {
+ set year_p 1
+}
+
+
+ad_return_template
Index: openacs-4/packages/invoices/www/offer-accept-2.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-accept-2.adp 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-accept-2.adp 6 Sep 2005 23:01:24 -0000 1.2
@@ -4,6 +4,6 @@
Index: openacs-4/packages/invoices/www/offer-accept-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-accept-2.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-accept-2.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -17,7 +17,10 @@
db_1row offer_data {}
set party_ids [contact::util::get_employees -organization_id $organization_id]
+set project_id [lindex [application_data_link::get_linked -from_object_id $offer_id -to_object_type content_item] 0]
+db_1row project_data {}
+
set context [list [list [export_vars -base offer-list {organization_id}] "[_ invoices.iv_offer_2]"] [list [export_vars -base offer-ae {offer_id}] "[_ invoices.iv_offer_View]"] $page_title]
# set offer_text [iv::offer::text -offer_id $offer_id]
Index: openacs-4/packages/invoices/www/offer-accept-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-accept-2.xql 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-accept-2.xql 6 Sep 2005 23:01:24 -0000 1.2
@@ -12,4 +12,16 @@
+
+
+
+ select p.title as project_title, p.project_code
+ from pm_projectsx p, cr_items oi
+ where oi.latest_revision = p.project_id
+ and oi.item_id = :project_id
+
+
+
+
+
Index: openacs-4/packages/invoices/www/offer-accept.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-accept.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-accept.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -15,19 +15,23 @@
set context [list [list "offer-list" "[_ invoices.iv_offer_2]"] $page_title]
set confirm_options [list [list "[_ invoices.continue_with_accept]" t] [list "[_ invoices.cancel_and_return]" f]]
+set return_url [export_vars -base offer-accept-2 {offer_id}]
ad_form -name accept_confirm -action offer-accept -form {
{offer_id:key}
{title:text(inform) {label "[_ invoices.iv_offer_accept]"}}
- {confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
+ {confirmation:text(radio) {label " "} {options $confirm_options} {value t}}
} -select_query_name {title} \
-on_submit {
if {$confirmation} {
- iv::offer::accept -offer_id $offer_id
+ db_transaction {
+ iv::offer::accept -offer_id $offer_id
+ callback iv::offer_accept -offer_id $offer_id
+ }
}
} -after_submit {
if {$confirmation} {
- ad_returnredirect [export_vars -base offer-accept-2 {offer_id}]
+ ad_returnredirect $return_url
ad_script_abort
} else {
ad_returnredirect [export_vars -base offer-ae {offer_id {mode display}}]
Index: openacs-4/packages/invoices/www/offer-ae-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-ae-postgresql.xql 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-ae-postgresql.xql 6 Sep 2005 23:01:24 -0000 1.2
@@ -24,4 +24,35 @@
+
+
+
+ update iv_offers
+ set finish_date = to_timestamp(:finish_date_list,'YYYY MM DD HH24 MI SS')
+ where offer_id = :new_offer_rev_id
+
+
+
+
+
+
+
+ update iv_offers
+ set accepted_date = now()
+ where offer_id = :new_offer_rev_id
+ and accepted_date is null
+
+
+
+
+
+
+
+ update pm_projects
+ set planned_end_date = to_timestamp(:finish_date_list,'YYYY MM DD HH24 MI SS')
+ where project_id = :project_rev_id
+
+
+
+
Index: openacs-4/packages/invoices/www/offer-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-ae.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-ae.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -9,6 +9,7 @@
{item_nr:array,optional}
{item_title:array,optional}
{item_description:array,optional}
+ {item_comment:array,optional}
{item_files:array,optional}
{item_pages:array,optional}
{item_category:array,optional}
@@ -21,7 +22,9 @@
{accept:optional}
{send:optional}
{send_accepted:optional}
+ {to_project:optional}
{project_id:optional}
+ {return_url:optional ""}
} -properties {
context:onevalue
page_title:onevalue
@@ -31,6 +34,18 @@
set date_format "YYYY-MM-DD"
set has_submit 0
set has_edit 0
+
+if {(![info exists offer_id] || $__new_p) && [exists_and_not_null project_id]} {
+ set _project_id $project_id
+ set offer_id [lindex [application_data_link::get_linked_content -from_object_id $project_id -to_content_type iv_offer] 0]
+
+ if {[empty_string_p $offer_id]} {
+ unset offer_id
+ } else {
+ set mode display
+ }
+}
+
if {![info exists offer_id] || $__new_p} {
set page_title "[_ invoices.iv_offer_Add2]"
set _offer_id 0
@@ -49,11 +64,16 @@
set page_title "[_ invoices.iv_offer_View]"
set has_submit 1
set date_format [lc_get formbuilder_date_format]
- set has_edit 1
+ set has_edit 0
}
set _offer_id [content::item::get_latest_revision -item_id $offer_id]
}
+if {$_offer_id} {
+ # we are editing/displaying data
+ set _project_id [lindex [application_data_link::get_linked -from_object_id $offer_id -to_object_type content_item] 0]
+}
+
if {[info exists accept]} {
ad_returnredirect [export_vars -base offer-accept {organization_id offer_id}]
ad_script_abort
@@ -66,6 +86,12 @@
ad_returnredirect [export_vars -base offer-accept-2 {offer_id}]
ad_script_abort
}
+if {[info exists to_project]} {
+ acs_object::get -object_id $_project_id -array project
+ set pm_url [lindex [site_node::get_url_from_object_id -object_id $project(package_id)] 0]
+ ad_returnredirect [export_vars -base "${pm_url}one" {{project_item_id $project_id}}]
+ ad_script_abort
+}
set organization_name [organizations::name -organization_id $organization_id]
@@ -81,9 +107,9 @@
db_multirow pricelist all_prices {}
-ad_form -name iv_offer_form -action offer-ae -mode $mode -has_submit $has_submit -has_edit $has_edit -export {organization_id} -form {
+ad_form -name iv_offer_form -action offer-ae -mode $mode -has_submit $has_submit -has_edit $has_edit -export {organization_id return_url} -form {
{offer_id:key}
- {organization_namex:text(inform) {label "[_ invoices.iv_offer_organization]"} {value "$organization_name"} {help_text "[_ invoices.iv_offer_organization_help]"}}
+ {organization_namex:text(inform) {label "[_ invoices.iv_offer_organization]"} {value "$organization_name"}}
{title:text {label "[_ invoices.iv_offer_Title]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_offer_Title_help]"}}
{description:text(textarea),optional {label "[_ invoices.iv_offer_Description]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_offer_Description_help]"}}
{comment:text(textarea),optional {label "[_ invoices.iv_offer_comment]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_offer_comment_help]"}}
@@ -97,26 +123,23 @@
{offer_nr:text {label "[_ invoices.iv_offer_offer_nr]"} {html {size 80 maxlength 200}} {help_text "[_ invoices.iv_offer_offer_nr_help]"}}
}
-if {$_offer_id} {
- # we are editing/displaying data
- set _project_id [lindex [application_data_link::get_linked -from_object_id $offer_id -to_object_type content_item] 0]
-}
-
if {[exists_and_not_null _project_id]} {
# display linked project
db_1row get_project {}
+ set project_title $project_name
set dotlrn_club_id [lindex [application_data_link::get_linked -from_object_id $organization_id -to_object_type "dotlrn_club"] 0]
set pm_base_url [apm_package_url_from_id [dotlrn_community::get_package_id_from_package_key -package_key "project-manager" -community_id $dotlrn_club_id]]
set project_name "$project_name"
ad_form -extend -name iv_offer_form -form {
{project:text(inform),optional {label "[_ invoices.iv_offer_project]"} {value $project_name} {help_text "[_ invoices.iv_offer_project_help]"}}
+ {project_id:text(hidden) {value $_project_id}}
}
} elseif {!$has_submit} {
# let user assign project if not displaying data
- set project_options [concat [list [list "" ""]] [db_list_of_lists open_projects {}]]
+ set project_options [concat [list [list "" ""]] [lang::util::localize [db_list_of_lists open_projects {}]]]
if {[llength $project_options] > 1} {
ad_form -extend -name iv_offer_form -form {
{project_id:text(select),optional {label "[_ invoices.iv_offer_project]"} {options $project_options} {help_text "[_ invoices.iv_offer_project_help]"}}
@@ -131,6 +154,7 @@
{creator_name:text,optional {label "[_ invoices.iv_offer_creation_user]"} {html {size 80 maxlength 200}} {help_text "[_ invoices.iv_offer_creation_user_help]"}}
{creation_date:text,optional {label "[_ invoices.iv_offer_creation_date]"} {html {size 12 maxlength 10}} {help_text "[_ invoices.iv_offer_creation_date_help]"}}
{finish_date:text,optional {label "[_ invoices.iv_offer_finish_date]"} {html {size 12 maxlength 10}} {help_text "[_ invoices.iv_offer_finish_date_help]"}}
+ {date_comment:text,optional {label "[_ invoices.iv_offer_date_comment]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_offer_date_comment_help]"}}
}
if {![empty_string_p $accepted_date]} {
@@ -146,6 +170,7 @@
{currency:text(select) {mode display} {label "[_ invoices.iv_offer_currency]"} {options $currency_options} {help_text "[_ invoices.iv_offer_currency_help]"}}
{finish_date:text,optional {label "[_ invoices.iv_offer_finish_date]"} {html {size 12 maxlength 10 id sel1}} {help_text "[_ invoices.iv_offer_finish_date_help]"} {after_html { \[y-m-d \]}}}
{finish_time:date,optional {label "[_ invoices.iv_offer_finish_time]"} {format {[lc_get formbuilder_time_format]}} {help_text "[_ invoices.iv_offer_finish_time_help]"}}
+ {date_comment:text,optional {label "[_ invoices.iv_offer_date_comment]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_offer_date_comment_help]"}}
}
}
@@ -305,7 +330,7 @@
set start $i
}
- for {set i $start} {$i < [expr $start + 5] } {incr i} {
+ for {set i $start} {$i < [expr $start + 2] } {incr i} {
ad_form -extend -name iv_offer_form -form \
[list [list "item_nr.${i}:text,optional" \
[list label "[_ invoices.iv_offer_item_nr]"] \
@@ -409,29 +434,44 @@
{send_accepted:text(submit) {label "[_ invoices.iv_offer_send_accepted]"} {value t}}
}
}
+ ad_form -extend -name iv_offer_form -form {
+ {to_project:text(submit) {label "[_ invoices.back_to_project]"} {value t}}
+ }
}
ad_form -extend -name iv_offer_form -new_request {
- set description ""
+ if {[exists_and_not_null _project_id]} {
+ db_1row get_project_description {}
+ } else {
+ set description ""
+ }
set today [db_string today {}]
set finish_date ""
set finish_time ""
- set title "[_ invoices.iv_offer_1] $organization_name $today"
+ if {[exists_and_not_null project_title]} {
+ set title "[_ invoices.iv_offer_1] $project_title"
+ } else {
+ set title "[_ invoices.iv_offer_1] $organization_name $today"
+ }
set offer_nr [db_nextval iv_offer_seq]
set amount_sum "0.00"
set amount_total "0.00"
# get this from organization_id
- set payment_days ""
+ set payment_days "30"
set vat_percent "16.0"
- # set contacts_package_id [lindex [application_link::get_linked -from_package_id $package_id -to_package_key contacts] 0]
- # array set org_data [contacts::get_values \
-# -group_name "#acs-translation.Customers#" \
-# -object_type "organization" \
-# -party_id $organization_id \
-# -contacts_package_id $contacts_package_id]
- # set payment_days $org_data(payment_days)
- # set vat_percent [format "%.1f" $org_data(vat_percent)]
+ set contacts_package_id [lindex [application_link::get_linked -from_package_id $package_id -to_package_key contacts] 0]
+ array set org_data [contacts::get_values \
+ -group_name "Customers" \
+ -object_type "organization" \
+ -party_id $organization_id \
+ -contacts_package_id $contacts_package_id]
+ if {[info exists org_data(payment_days)]} {
+ set payment_days $org_data(payment_days)
+ }
+ if {[info exists org_data(vat_percent)]} {
+ set vat_percent [format "%.1f" $org_data(vat_percent)]
+ }
} -edit_request {
db_1row get_data {}
set creator_name "$first_names $last_name"
@@ -503,6 +543,7 @@
-amount_sum $item_sum \
-currency $currency \
-finish_date $finish_date \
+ -date_comment $date_comment \
-payment_days $payment_days \
-vat_percent $vat_percent \
-vat $vat]
@@ -547,6 +588,7 @@
-amount_sum $item_sum \
-currency $currency \
-finish_date $finish_date \
+ -date_comment $date_comment \
-payment_days $payment_days \
-vat_percent $vat_percent \
-vat $vat]
@@ -598,18 +640,37 @@
}
} -after_submit {
if {[exists_and_not_null project_id]} {
- application_data_link::new -this_object_id $offer_id -target_object_id $project_id
+ catch {
+ application_data_link::new -this_object_id $offer_id -target_object_id $project_id
+ set _project_id $project_id
+ }
}
+
+ if {[exists_and_not_null _project_id]} {
+ set status [pm::project::get_status_description -project_item_id $_project_id]
+ if {$status == "#acs-kernel.common_Open#"} {
+ db_dml set_accepted_date {}
+ }
+ }
+
if {![empty_string_p $finish_date]} {
- db_dml set_finish_date {
- update iv_offers
- set finish_date = to_timestamp(:finish_date_list,'YYYY MM DD HH24 MI SS')
- where offer_id = :new_offer_rev_id
+ db_dml set_finish_date {}
+
+ if {[exists_and_not_null _project_id]} {
+ set project_rev_id [pm::project::get_project_id -project_item_id $_project_id]
+ # no update of project deadline here
+ # so that it can be different from the offer deadline the customer gets
+ # db_dml set_project_deadline {}
}
}
- ad_returnredirect [export_vars -base offer-ae {offer_id {mode display}}]
- ad_script_abort
+ if {[empty_string_p $return_url]} {
+ ad_returnredirect [export_vars -base offer-ae {offer_id {mode display}}]
+ ad_script_abort
+ } else {
+ ad_returnredirect $return_url
+ ad_script_abort
+ }
}
ad_return_template
Index: openacs-4/packages/invoices/www/offer-ae.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-ae.xql 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-ae.xql 6 Sep 2005 23:01:24 -0000 1.2
@@ -28,7 +28,7 @@
- select '#' || r.item_id || ' ' || r.title as title, r.item_id
+ select r.title, r.item_id
from cr_revisions r, cr_items i, pm_projects p, acs_rels ar
where ar.object_id_one = :organization_id
and ar.object_id_two = r.revision_id
@@ -40,7 +40,7 @@
where ar2.object_id_two = oi.item_id
and ar2.rel_type = 'application_data_link'
and oi.latest_revision = o.offer_id)
- order by r.item_id desc
+ order by r.title desc
@@ -59,11 +59,9 @@
- select '#' || r.item_id || ' ' || r.title as project_name, r.item_id
- from cr_revisions r, cr_items i, pm_projects p, acs_rels ar
- where ar.object_id_one = :offer_id
- and ar.object_id_two = i.item_id
- and ar.rel_type = 'application_data_link'
+ select r.title as project_name, r.item_id
+ from cr_revisions r, cr_items i, pm_projects p
+ where i.item_id = :_project_id
and i.latest_revision = r.revision_id
and p.project_id = r.revision_id
@@ -89,6 +87,17 @@
+
+
+
+ select r.description
+ from cr_revisions r, cr_items i
+ where r.revision_id = i.latest_revision
+ and i.item_id = :_project_id
+
+
+
+
@@ -99,7 +108,7 @@
o.creation_user, p.first_names, p.last_name,
to_char(o.creation_date, :timestamp_format) as creation_date,
to_char(t.accepted_date, :timestamp_format) as accepted_date,
- t.amount_sum as amount_sum_, t.payment_days
+ t.amount_sum as amount_sum_, t.payment_days, t.date_comment
from iv_offers t, cr_revisions r, cr_items i, acs_objects o,
persons p
where r.revision_id = t.offer_id
Index: openacs-4/packages/invoices/www/offer-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-list.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/offer-list.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/offer-list.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -17,6 +17,6 @@
set page_title "[_ invoices.iv_offer_2]"
set context [list $page_title]
-set row_list {offer_nr {} title {} description {} amount_total {} creation_user {} creation_date {} finish_date {} accepted_date {} action {}}
+set row_list {offer_nr {} title {} description {} comment {} project_id {} amount_total {} creation_user {} creation_date {} finish_date {} accepted_date {} action {}}
ad_return_template
Index: openacs-4/packages/invoices/www/price-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/price-list.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/price-list.adp 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/price-list.adp 6 Sep 2005 23:01:24 -0000 1.2
@@ -1,4 +1,8 @@
+
+ @organization_id@
+
+
@page_title;noquote@
@context;noquote@
Index: openacs-4/packages/invoices/www/price-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/price-list.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/invoices/www/price-list.tcl 16 Aug 2005 20:04:34 -0000 1.1
+++ openacs-4/packages/invoices/www/price-list.tcl 6 Sep 2005 23:01:24 -0000 1.2
@@ -4,12 +4,19 @@
@author Timo Hentschel (timo@timohentschel.de)
@creation-date 2005-06-06
} {
- {list_id:notnull}
+ {list_id:integer,optional ""}
+ {organization_id:integer,optional ""}
} -properties {
context:onevalue
page_title:onevalue
}
+set package_id [ad_conn package_id]
+
+if {[empty_string_p $list_id]} {
+ set list_id [iv::price_list::get_list_id -organization_id $organization_id -package_id $package_id]
+}
+
set user_id [auth::require_login]
db_1row list_title {}
set page_title $list_title