Index: openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml,v diff -u -r1.37 -r1.38 --- openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 17 Aug 2005 09:31:58 -0000 1.37 +++ openacs-4/packages/dotlrn-ecommerce/catalog/dotlrn-ecommerce.en_US.ISO-8859-1.xml 17 Aug 2005 16:24:22 -0000 1.38 @@ -63,6 +63,7 @@ Expires Export For PreReq Approval + Fully Paid Gift Certificate: Go to My Account Grade @@ -110,6 +111,7 @@ Credit card information eCommerce Administration Edit Section Information + Financial Transactions for %first_names% %last_name% (if you're not %first_names% %last_name% for the current purchases Waiting list @@ -131,6 +133,7 @@ One or more prerequisites for this section have not been met: Or create an account for the participant Put this purchase in the waiting list + Order Details for %order_id% Orders in the Last 7 Days Participant pays for course %patron_name% also pays for the course @@ -207,6 +210,7 @@ Member Request More Information: My Shopping Cart + No No applications No orders No related users @@ -295,6 +299,7 @@ Waiting List Welcome message Welcome to %course_name% + Yes You have no orders Your Applications Your Order Index: openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.adp 14 Aug 2005 05:03:37 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.adp 17 Aug 2005 16:24:22 -0000 1.3 @@ -3,7 +3,7 @@
- This order was paid by invoice. + This order was partially paid by invoice.
- +
This order was fully paid by scholarship. @@ -76,7 +76,7 @@ -
This order was fully paid by check.
+
This order was partiallyfully paid by check.
No credit card transactions
Index: openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.tcl 14 Aug 2005 05:00:14 -0000 1.1 +++ openacs-4/packages/dotlrn-ecommerce/lib/financial-transactions.tcl 17 Aug 2005 16:24:22 -0000 1.2 @@ -27,55 +27,51 @@ where order_id = :order_id } -default cc] -if { [db_0or1row scholarship { +set scholarship_p [db_0or1row scholarship { select 1 where exists (select * from ec_gift_certificate_usage where order_id = :order_id and exists (select * from scholarship_fund_grants where ec_gift_certificate_usage.gift_certificate_id = gift_certificate_id)) -}] } { - set method scholarship -} +}] set total_price [db_string total_price {select ec_total_price(:order_id)} -default 0] set total_refunds [db_string total_refunds {select ec_total_refund(:order_id)} -default 0] -switch $method { - - "invoice" { - # List invoice payments - set invoice_payment_sum 0 - db_multirow invoice_payments invoice_payments { - select amount, to_char(payment_date, 'Month dd, yyyy hh:miam') as pretty_payment_date, method as invoice_method - from dotlrn_ecommerce_transaction_invoice_payments - where order_id = :order_id - order by payment_date - } { - set amount [ec_pretty_price $amount] - set invoice_method [ad_decode $invoice_method cc "Credit Card" internal_account "Internal Account" check "Check" cash "Cash" lockbox "Lock Box" "Credit Card"] - set invoice_payment_sum [expr $invoice_payment_sum + $amount] - } - +if { $method == "invoice" } { + # List invoice payments + set invoice_payment_sum 0 + db_multirow invoice_payments invoice_payments { + select amount, to_char(payment_date, 'Month dd, yyyy hh:miam') as pretty_payment_date, method as invoice_method + from dotlrn_ecommerce_transaction_invoice_payments + where order_id = :order_id + order by payment_date + } { + set invoice_payment_sum [expr $invoice_payment_sum + $amount] + set amount [ec_pretty_price $amount] + set invoice_method [ad_decode $invoice_method cc "Credit Card" internal_account "Internal Account" check "Check" cash "Cash" lockbox "Lock Box" "Credit Card"] } - "scholarship" { - set gc_amount [db_string gc_amount {select ec_order_gift_cert_amount(:order_id)} -default 0] - db_multirow funds funds { - select f.title, u.amount_used, g.grant_amount, to_char(g.grant_date, 'Month dd, yyyy hh:miam') as grant_date - from ec_gift_certificate_usage u, scholarship_fund_grants g, scholarship_fundi f - where u.gift_certificate_id = g.gift_certificate_id - and g.fund_id = f.fund_id - and u.order_id = :order_id - and not u.amount_used is null +} - order by g.grant_date - } { - set grant_amount [ec_pretty_price $grant_amount] - set amount_used [ec_pretty_price $amount_used] - - } +if { $scholarship_p } { + set gc_amount [db_string gc_amount {select ec_order_gift_cert_amount(:order_id)} -default 0] + + db_multirow funds funds { + select f.title, u.amount_used, g.grant_amount, to_char(g.grant_date, 'Month dd, yyyy hh:miam') as grant_date + from ec_gift_certificate_usage u, scholarship_fund_grants g, scholarship_fundi f + where u.gift_certificate_id = g.gift_certificate_id + and g.fund_id = f.fund_id + and u.order_id = :order_id + and not u.amount_used is null + + order by g.grant_date + } { + set grant_amount [ec_pretty_price $grant_amount] + set amount_used [ec_pretty_price $amount_used] + } } Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.adp 17 Aug 2005 16:24:22 -0000 1.1 @@ -0,0 +1,7 @@ + + #dotlrn-ecommerce.lt_Financial_Transaction# + @context@ + + +

+ #dotlrn-ecommerce.lt_Order_Details_for_ord# \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.tcl 17 Aug 2005 16:24:22 -0000 1.1 @@ -0,0 +1,18 @@ +# packages/dotlrn-ecommerce/www/admin/ecommerce/financial-transactions.tcl + +ad_page_contract { + + Financial transactions page + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-08-17 + @arch-tag: e3a4648c-6ae1-4a93-ac7f-f1fd97f04d2f + @cvs-id $Id: financial-transactions.tcl,v 1.1 2005/08/17 16:24:22 roelc Exp $ +} { + order_id:integer,notnull +} -properties { +} -validate { +} -errors { +} + +set context [list [list index Orders] [list one?order_id=$order_id "One Order"] "Financial Transactions"] \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl 10 Aug 2005 21:18:23 -0000 1.10 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/index.tcl 17 Aug 2005 16:24:22 -0000 1.11 @@ -69,6 +69,14 @@ } method { label "[_ dotlrn-ecommerce.Payment_Method]" + display_template { + + @orders.method@, #dotlrn-ecommerce.Scholarship# + + + @orders.method@ + + } } total_price { label "[_ dotlrn-ecommerce.Total_Amount]" @@ -84,6 +92,9 @@ html { align right } display_template { @orders.pretty_refund@ + + » + } aggregate sum aggregate_label "[_ dotlrn-ecommerce.Total_1]:" @@ -98,15 +109,16 @@ aggregate_label "[_ dotlrn-ecommerce.Total_1]:" } balance { - label "[_ dotlrn-ecommerce.Balance]" + label "[_ dotlrn-ecommerce.Fully_Paid]" html { align right } display_template { - - Fully Paid + + [_ dotlrn-ecommerce.No] - @orders.pretty_balance@ + [_ dotlrn-ecommerce.Yes] + » } aggregate sum aggregate_label "[_ dotlrn-ecommerce.Total_1]:" @@ -144,7 +156,17 @@ payment_method { label "[_ dotlrn-ecommerce.Payment_method]" values { $method_filters } - where_clause { t.method = :payment_method } + where_clause { + (t.method = :payment_method or + (:payment_method = 'scholarship' and + coalesce((select true + where exists (select * + from ec_gift_certificate_usage + where order_id = o.order_id + and exists (select * + from scholarship_fund_grants + where ec_gift_certificate_usage.gift_certificate_id = gift_certificate_id))), false))) + } } } -orderby { order_id { @@ -185,45 +207,61 @@ } } -db_multirow -extend { order_url section_url pretty_total pretty_balance person_url pretty_refund pretty_actual_total } orders orders [subst { +db_multirow -extend { order_url section_url pretty_total pretty_balance person_url pretty_refund pretty_actual_total refund_url } orders orders [subst { select o.order_id, to_char(o.confirmed_date, 'Mon dd, yyyy hh:miam') as confirmed_date, o.order_state, - ec_total_price(o.order_id) - (case when t.method = 'invoice' - then ec_total_price(o.order_id) - - (select coalesce(sum(amount), 0) - from dotlrn_ecommerce_transaction_invoice_payments - where order_id = o.order_id) + ec_total_refund(o.order_id) - else 0 end) as price_to_display, + (i.price_charged + coalesce(i.shipping_charged, 0) + coalesce(i.price_tax_charged, 0) + - coalesce(i.price_refunded, 0) - coalesce(i.shipping_refunded, 0) - coalesce(i.price_tax_refunded, 0)) as price_to_display, - o.user_id as purchasing_user_id, u.first_names, u.last_name, count(*) as n_items, t.method, s.section_id as _section_id, + o.user_id as purchasing_user_id, u.first_names, u.last_name, - (select course_name - from dlec_view_sections - where section_id = s.section_id)||': '||s.section_name as _section_name, s.course_id, - + t.method, coalesce((select true + where exists (select * + from ec_gift_certificate_usage + where order_id = o.order_id + and exists (select * + from scholarship_fund_grants + where ec_gift_certificate_usage.gift_certificate_id = gift_certificate_id))), false) as has_scholarship_p, + + s.section_id as _section_id, + + coalesce((select course_name + from dlec_view_sections + where section_id = s.section_id)||': '||s.section_name, p.product_name) as _section_name, s.course_id, + case when t.method = 'invoice' then ec_total_price(o.order_id) - ec_order_gift_cert_amount(o.order_id) - (select coalesce(sum(amount), 0) from dotlrn_ecommerce_transaction_invoice_payments where order_id = o.order_id) + ec_total_refund(o.order_id) - else 0 end as balance, ec_total_refund(o.order_id) as refund_price, ec_total_price(o.order_id) + ec_total_refund(o.order_id) as total_price, + else 0 end as balance, + + (coalesce(i.price_refunded, 0) + coalesce(i.shipping_refunded, 0) - coalesce(i.price_tax_refunded, 0)) as refund_price, + + (i.price_charged + coalesce(i.shipping_charged, 0) + coalesce(i.price_tax_charged, 0)) as total_price, + (select to_char(refund_date, 'Mon dd, yyyy') from ec_refunds where order_id = o.order_id order by refund_date desc - limit 1) as refund_date, u.first_names||' '||u.last_name as purchaser + limit 1) as refund_date, + u.first_names||' '||u.last_name as purchaser, + + i.item_id + from ec_orders o join ec_items i using (order_id) + join ec_products p using (product_id) join dotlrn_ecommerce_transactions t using (order_id) - join dotlrn_ecommerce_section s on (i.product_id = s.product_id) + left join dotlrn_ecommerce_section s on (i.product_id = s.product_id) left join cc_users u on (o.user_id=u.user_id) where o.order_state in ('confirmed', 'authorized', 'fulfilled', 'returned') [template::list::filter_where_clauses -and -name orders] - group by o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id), o.user_id, u.first_names, u.last_name, o.in_basket_date, t.method, section_name, s.section_id, s.course_id, o.authorized_date, balance, refund_price, refund_date, purchaser +-- group by o.order_id, o.confirmed_date, o.order_state, ec_total_price(o.order_id), o.user_id, u.first_names, u.last_name, o.in_basket_date, t.method, section_name, s.section_id, s.course_id, o.authorized_date, balance, refund_price, refund_date, purchaser [template::list::orderby_clause -name orders -orderby] }] { @@ -245,6 +283,8 @@ set person_url [export_vars -base ../one-user { {user_id $purchasing_user_id} }] set pretty_refund [ec_pretty_price $refund_price] set pretty_actual_total [ec_pretty_price $total_price] + + set refund_url [export_vars -base "items-return-2" { order_id item_id }] } if { [info exists section_id] } { Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-2.tcl 12 Aug 2005 10:10:14 -0000 1.3 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-2.tcl 17 Aug 2005 16:24:22 -0000 1.4 @@ -7,22 +7,30 @@ } { - refund_id:notnull + refund_id:notnull,optional order_id:notnull,naturalnum - reason_for_return + {reason_for_return ""} all_items_p:optional item_id:optional,multiple - received_back_date:date,array - received_back_time:time,array + received_back_date:date,array,optional + received_back_time:time,array,optional } ad_require_permission [ad_conn package_id] admin -set received_back_datetime $received_back_date(date) -if { [exists_and_not_null received_back_time(time)] } { - append received_back_datetime " [ec_timeentrywidget_time_check \"$received_back_time(time)\"]$received_back_time(ampm)" +if { ! [info exists refund_id] } { + set refund_id [db_nextval refund_id_sequence] +} + +if { [array exists received_back_date] && [array exists received_back_time] } { + set received_back_datetime $received_back_date(date) + if { [exists_and_not_null received_back_time(time)] } { + append received_back_datetime " [ec_timeentrywidget_time_check \"$received_back_time(time)\"]$received_back_time(ampm)" + } else { + append received_back_datetime " 12:00:00AM" + } } else { - append received_back_datetime " 12:00:00AM" + set received_back_datetime [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"] } # The customer service rep must be logged on Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl 14 Aug 2005 05:00:14 -0000 1.6 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl 17 Aug 2005 16:24:22 -0000 1.7 @@ -230,12 +230,15 @@ " -set financial_transactions [template::adp_compile -string {}] +#set financial_transactions [template::adp_compile -string {}] # Hack to not display ds stuff even if it's enabled, demo purposes -regsub -all {\[::ds_show_p\]} $financial_transactions 0 financial_transactions +#regsub -all {\[::ds_show_p\]} $financial_transactions 0 financial_transactions +#[eval $financial_transactions] doc_body_append " -[eval $financial_transactions] +

Shipments

"