Index: openacs-4/packages/ecommerce/www/admin/orders/items-return-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/orders/items-return-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/orders/items-return-2.tcl 31 Jan 2002 22:43:54 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/orders/items-return-2.tcl 26 May 2002 04:36:50 -0000 1.4 @@ -1,8 +1,9 @@ -# /www/[ec_url_concat [ec_url] /admin]/orders/items-return-2.tcl ad_page_contract { @cvs-id items-return-2.tcl,v 3.2.6.9 2000/09/22 01:34:57 kevin Exp @author ported by Jerry Asher (jerry@theashergroup.com) + @author revised by Bart Teeuwisse + @revision-date April 2002 } { @@ -24,30 +25,32 @@ append received_back_datetime " 12:00:00AM" } +# The customer service rep must be logged on -# the customer service rep must be logged on set customer_service_rep [ad_get_user_id] - if {$customer_service_rep == 0} { set return_url "[ad_conn url]?[export_entire_form_as_url_vars]" ad_returnredirect "/register?[export_url_vars return_url]" return } +# Make sure they haven't already inserted this refund - -# make sure they haven't already inserted this refund -if { [db_string get_refund_count "select count(*) from ec_refunds where refund_id=:refund_id"] > 0 } { - ad_return_complaint 1 "
  • This refund has already been inserted into the database; it looks like you are using an old form. Return to the order." +if { [db_string get_refund_count " + select count(*) + from ec_refunds + where refund_id=:refund_id"] > 0 } { + ad_return_complaint 1 " +
  • This refund has already been inserted into the database. Are you using an old form? Return to the order." return } set exception_count 0 set exception_text "" -# they must have either checked "All items" and none of the rest, or -# at least one of the rest and not "All items" -# they also need to have shipment_date filled in +# They must have either checked "All items" and none of the rest, or +# at least one of the rest and not "All items". They also need to have +# shipment_date filled in if { [info exists all_items_p] && [info exists item_id] } { incr exception_count @@ -63,40 +66,29 @@ return } +append doc_body " + [ad_admin_header "Specify refund amount"] -append doc_body "[ad_admin_header "Specify refund amount"] +

    Specify refund amount

    -

    Specify refund amount

    + [ad_admin_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index" "Orders"] [list "one?[export_url_vars order_id]" "One"] "Mark Items Returned"] +
    " -[ad_admin_context_bar [list "../" "Ecommerce([ec_system_name])"] [list "index" "Orders"] [list "one?[export_url_vars order_id]" "One"] "Mark Items Returned"] - -
    -" - set shipping_refund_percent [ad_parameter -package_id [ec_id] ShippingRefundPercent ecommerce] if { ![info exists all_items_p] } { set item_id_list $item_id - - set sql "select i.item_id, p.product_name, i.price_charged, i.shipping_charged - from ec_items i, ec_products p - where i.product_id=p.product_id - and i.item_id in ([join $item_id_list ", "]) - and i.item_state in ('shipped','arrived')" - # the last line is for error checking (we don't want them to push "back" and - # try to do a refund again for the same items) + set sql [db_map all_items_select] } else { - set sql "select i.item_id, p.product_name, i.price_charged, i.shipping_charged - from ec_items i, ec_products p - where i.product_id=p.product_id - and i.order_id=:order_id - and i.item_state in ('shipped','arrived')" + set sql [db_map selected_items_select] } -# If they select "All items", I want to generate a list of the items because, regardless -# of what happens elsewhere on the site (e.g. an item is added to the order, thereby causing -# the query for all items to return one more item), I want only the items that they confirm -# here to be recorded as part of this return. +# Generate a list of the items if they selected "All items" because, +# regardless of what happens elsewhere on the site (e.g. an item is +# added to the order, thereby causing the query for all items to +# return one more item), only the items that they confirm here should +# be recorded as part of this return. + if { [info exists all_items_p] } { set item_id_list [list] } @@ -107,38 +99,43 @@ if { [info exists all_items_p] } { lappend item_id_list $item_id } - append items_to_print "$product_name (out of [ec_pretty_price $price_charged]) (out of [ec_pretty_price $shipping_charged])" + append items_to_print " + + $product_name + (out of [ec_pretty_price $price_charged]) + + (out of [ec_pretty_price $shipping_charged]) + " } -append doc_body "
    -[export_form_vars refund_id order_id item_id_list received_back_datetime reason_for_return] -
    - - -$items_to_print -
    ItemPrice to RefundShipping to Refund
    -

    -" +append doc_body " + + [export_form_vars refund_id order_id item_id_list received_back_datetime reason_for_return] +

    + + + + + $items_to_print +
    ItemPrice to RefundShipping to Refund
    " -# we assume that, although only one refund may be done on an item, multiple refunds -# may be done on the base shipping cost, so we show them shipping_charged - shipping_refunded -set base_shipping [db_string unused "select nvl(shipping_charged,0) - nvl(shipping_refunded,0) from ec_orders where order_id=:order_id"] +# Although only one refund may be done on an item, multiple refunds +# may be done on the base shipping cost, so show shipping_charged - +# shipping_refunded. -append doc_body "Base shipping charge to refund: - (out of [ec_pretty_price $base_shipping]) +set base_shipping [db_string base_shipping_select " + select nvl(shipping_charged,0) - nvl(shipping_refunded,0) + from ec_orders + where order_id=:order_id"] -

    +append doc_body " +

    Base shipping charge to refund: + + (out of [ec_pretty_price $base_shipping])

    +
    -
    +
    -
    - -
    + [ad_admin_footer]" -[ad_admin_footer] -" - doc_return 200 text/html $doc_body - - -