Index: openacs-4/packages/expenses/tcl/expenses-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/expenses/tcl/expenses-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/expenses/tcl/expenses-procs.tcl 19 Jun 2005 06:05:08 -0000 1.4
+++ openacs-4/packages/expenses/tcl/expenses-procs.tcl 24 Jun 2005 13:05:39 -0000 1.5
@@ -50,4 +50,29 @@
return [join $expense_codes ", "]
}
+ad_proc list_terms {
+ {-id:required }
+} {
+ HAM (hamilton.chua@gmail.com)
+ Return comma separated list of TERMS (e.g Fall, Winter)
+ of the section that this expense belongs to
+ Return null if section is not categorized under any term
+} {
+ # we got an expense id, let's get the community id of the section it belongs to
+ set package_id [db_string "getpackageid" "select community_id from expenses where exp_id = :id"]
+
+ # get the tree id of the terms category
+ set tree_id [db_string "gettreeid" "select tree_id from category_tree_translations where name = 'Terms'"]
+
+ set terms [list]
+ set categories [category::get_mapped_categories $package_id]
+ foreach category_id $categories {
+ if { [category::get_tree $category_id] == $tree_id } {
+ lappend terms "[category::get_name $category_id]"
+ }
+ }
+ return [join $terms ", "]
+}
+
+
}
\ No newline at end of file
Index: openacs-4/packages/expenses/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/expenses/www/admin/index.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/expenses/www/admin/index.adp 31 May 2005 22:07:21 -0000 1.1
+++ openacs-4/packages/expenses/www/admin/index.adp 24 Jun 2005 13:05:39 -0000 1.2
@@ -3,10 +3,4 @@
Administer Expense Codes
-
-
-
-
-
No expenses have been recorded.
-
-
+
Index: openacs-4/packages/expenses/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/expenses/www/admin/index.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/expenses/www/admin/index.tcl 19 Jun 2005 06:05:08 -0000 1.4
+++ openacs-4/packages/expenses/www/admin/index.tcl 24 Jun 2005 13:05:39 -0000 1.5
@@ -1,6 +1,6 @@
ad_page_contract {
- List line expenses for a given class
+ List line expenses for all courses
@author Hamilton Chua (hamilton.chua@gmail.com)
@creation-date 2005-05-14
@@ -21,6 +21,7 @@
-name expenses \
-multirow expenses \
-key exp_id \
+ -no_data "No expense have been recorded yet." \
-actions {
"Export All Non-Transferred and MARK ALL Transfered" "export-confirm?all=1&mark=1" "Export All Expenses"
"Export All but DO NOT MARK Transferred" "export-confirm?all=1&mark=0" "Export Expenses"
@@ -54,20 +55,25 @@
expense_codes {
label "Expense Codes"
}
+ terms {
+ label "Term"
+ }
} -orderby {
exp_date { orderby exp_date }
exp_amount { orderby exp_amount }
+ term { orderby term }
}
# build the multirow
set orderby_clause "[template::list::orderby_clause -name expenses -orderby]"
-db_multirow -extend {course expense_codes} expenses get_expenses { } {
+db_multirow -extend {course expense_codes terms } expenses get_expenses { } {
# retrieve course/section for this expense
if { [db_0or1row "section_info" "select section_name, course_id from dotlrn_ecommerce_section where community_id =:community_id"] } {
set course_name [db_string "getcoursename" "select course_name from dotlrn_catalog where course_id = (select latest_revision from cr_items where item_id =:course_id)"]
set course "$course_name/$section_name"
set expense_codes [expenses::list_expense_codes -id $exp_id]
+ set terms [expenses::list_terms -id $exp_id]
}
}
\ No newline at end of file