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.5 -r1.6 --- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl 10 Aug 2005 21:30:05 -0000 1.5 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/one.tcl 14 Aug 2005 05:00:14 -0000 1.6 @@ -228,156 +228,15 @@ Base shipping charged [ec_pretty_price $shipping_charged] [ec_decode $shipping_method "pickup" "(Pickup)" "no shipping" "(No Shipping)" ""] - - -

Financial Transactions

" + " -set table_header " - - - - - - - - - - - - - " +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 -set transaction_counter 0 - -# Check for payment methods -set method [db_string method { - select method, internal_account - from dotlrn_ecommerce_transactions - where order_id = :order_id -} -default cc] - -if { [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 - doc_body_append "
This order was paid by invoice." - - set invoice_payment_sum 0 - doc_body_append " - - TOTAL: [ec_pretty_price $total_price] -
- Balance: [ec_pretty_price [expr $total_price - $invoice_payment_sum + $total_refunds]] -
}] - } - "scholarship" { - set gc_amount [db_string gc_amount {select ec_order_gift_cert_amount(:order_id)} -default 0] - - if { $gc_amount == $total_price } { - doc_body_append "
This order was fully paid by scholarship." - } else { - doc_body_append "
This order was partially paid by scholarship." - } - - doc_body_append "
    " - db_foreach 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 - - order by g.grant_date - } { - doc_body_append "
  • Date: $grant_date, Fund: $title, Amount Granted: [ec_pretty_price $grant_amount], Amount Used: [ec_pretty_price $amount_used]
  • " - } - doc_body_append "
" - - doc_body_append "
" - } -} - -db_foreach financial_transactions_select " - select t.transaction_id, t.inserted_date, t.transaction_amount, t.transaction_type, t.to_be_captured_p, t.authorized_date, - t.marked_date, t.refunded_date, t.failed_p, c.creditcard_last_four - from ec_financial_transactions t, ec_creditcards c - where t.creditcard_id=c.creditcard_id - and t.order_id=:order_id - order by transaction_id" { - - if { $transaction_counter == 0 } { - doc_body_append $table_header - } - doc_body_append " -
- - - - - - - - - - - " - incr transaction_counter -} - -if { $transaction_counter != 0 } { - doc_body_append "
IDDateCreditcard Last 4AmountTypeTo Be CapturedAuth DateMark DateRefund DateFailed
$transaction_id[ec_nbsp_if_null [ec_formatted_full_date $inserted_date]]$creditcard_last_four[ec_pretty_price $transaction_amount][ec_decode $transaction_type "charge" "authorization to charge" "intent to refund"][ec_nbsp_if_null [ec_decode $transaction_type "refund" "Yes" [ec_decode $to_be_captured_p "t" "Yes" "f" "No" ""]]][ec_nbsp_if_null [ec_formatted_full_date $authorized_date]][ec_nbsp_if_null [ec_formatted_full_date $marked_date]][ec_nbsp_if_null [ec_formatted_full_date $refunded_date]][ec_nbsp_if_null [ec_decode $failed_p "t" "Yes" "f" "No" ""]]
" -} else { - - # Check if this was payed via another method - switch $method { - cash - - lockbox - - check { - doc_body_append "
This order was fully paid by ${method}.
" - } - cc { - doc_body_append "
No credit card transactions
" - } - invoice - - scholarship {} - } -} - doc_body_append " +[eval $financial_transactions] +

Shipments

" @@ -428,46 +287,14 @@ } doc_body_append " -
+ " -

Returns

+set refunds [template::adp_compile -string {}] +# Hack to not display ds stuff even if it's enabled, demo purposes +regsub -all {\[::ds_show_p\]} $refunds 0 refunds -
" +doc_body_append "[eval $refunds]" -set old_refund_id 0 - -db_foreach refunds_select " - select r.refund_id, r.refund_date, r.refunded_by, r.refund_reasons, r.refund_amount, u.first_names, u.last_name, p.product_name, p.product_id, i.price_name, i.price_charged, count(*) as quantity - from ec_refunds r, cc_users u, ec_items i, ec_products p - where r.order_id=:order_id - and r.refunded_by=u.user_id - and i.refund_id=r.refund_id - and p.product_id=i.product_id - group by r.refund_id, r.refund_date, r.refunded_by, r.refund_reasons, r.refund_amount, u.first_names, u.last_name, p.product_name, p.product_id, i.price_name, i.price_charged" { - if { $refund_id != $old_refund_id } { - if { $old_refund_id != 0 } { - doc_body_append "" - } - doc_body_append " - Refund ID: $refund_id
- Date: [ec_formatted_full_date $refund_date]
- Amount: [ec_pretty_price $refund_amount]
- Refunded by: $first_names $last_name
- Reason: $refund_reasons - " -} - -doc_body_append "
" - if { $order_state != "void" } { doc_body_append "

Actions