[tmp page_title][L]Customer manager[/L]: [L]View customer[/L] [cgi customer][/tmp] [set ui_class]Customers[/set] [set page_banner][L]View customer[/L][/set] [set help_name]customer.view[/set] [set icon_name]icon_people.gif[/set] @_UI_STD_HEAD_@ [calc] delete $Scratch->{ui_bounce}; $CGI->{customer} ||= $CGI->{mv_arg} or $Scratch->{ui_bounce} = '__UI_BASE__/customer'; return; [/calc] [if scratch ui_bounce] [bounce page="[scratch ui_bounce]"] [/if] [perl tables=country]### pre-open database for calcs below[/perl] [query list=1 table=userdb prefix=loop sql="select * from userdb where username = '[cgi customer]'"]

[L]User Name[/L]: [loop-code]

[L]Account Status[/L]: [filter uc] [if-loop-param inactive] [L]inactive[/L] [else] [L]active[/L] [/else] [/if-loop-param] [/filter]

[L]Total Sales[/L]: [query arrayref=totals table=transactions sql=| SELECT total_cost,status FROM transactions WHERE username = '[loop-code]' |][/query] [calc] my $q = $Tmp->{totals}; my $ary; return '[L]no orders[/L]' unless $q and defined $q->[0]; my $total = 0; for(@$q) { next if $_->[1] eq 'canceled'; $total += $_->[0]; } return $Tag->currency({ body => $total } ); [/calc]

[L]Last login[/L]: [if-loop-param !mod_time] [L]Never[/L] [else] [time time="[loop-param mod_time]"]%b %e, %Y %l:%M %P[/time] [/else] [/if-loop-param]

[L]Customer Details[/L]

[L]Customer[/L]: | [loop-param fname] [loop-param lname]
[L]Company[/L]: | [loop-param company]
[L]Home phone[/L]: | [loop-param phone_night]
[L]Work phone[/L]: | [loop-param phone_day]
[L]Email[/L]: | [loop-param email]
[if variable CUSTOMER_VIEW_DEALER]
[L]Dealer[/L]: | [page href=admin/customer_pref form=" customer=[loop-code] start_at=dealer "][if-loop-param dealer][L]Yes[/L][else][L]No[/L][/else][/if-loop-param]
[L]Price Level[/L]: | [page href=admin/customer_pref form=" customer=[loop-code] start_at=price_level "][display type=display table=userdb col=price_level key="[loop-code]"]
[/if]

[L]Billing Details[/L]

[if-loop-param b_address1]

[L]Name[/L]: | [loop-param b_fname] [loop-param b_lname]
[if-loop-param b_company]
[L]Company[/L]: | [loop-param b_company]
[/if-loop-param]
[L]Address[/L]: | [loop-param b_address1] [if-loop-param b_address2] [loop-param b_address2] [/if-loop-param]
[if-loop-param b_country =~ /^US|^CA/]
[L]City, State, Zip[/L]: | [loop-param b_city], [loop-param b_state] [loop-param b_zip]
[else]
[L]City[/L]: | [loop-param b_city]
[if-loop-param b_state]
[L]State[/L]: | [loop-param b_state]
[/if-loop-param] [if-loop-param b_zip]
[L]Postal code[/L]: | [loop-param b_zip]
[/if-loop-param] [/else] [/if-loop-param]
[L]Country[/L]: | [data table=country col=name key="[loop-param b_country]"]

[else] [L]Same as shipping address[/L] [/else] [/if-loop-param]

[L]Shipping Details[/L]

[L]Name[/L]: | [loop-param fname] [loop-param lname]
[if-loop-param company]
[L]Company[/L]: | [loop-param company]
[/if-loop-param]
[L]Address[/L]: | [loop-param address1] [if-loop-param address2] [loop-param address2] [/if-loop-param]
[if-loop-param country =~ /^US|^CA/]
[L]City, State, Zip[/L]: | [loop-param city], [loop-param state] [loop-param zip]
[else]
[L]City[/L]: | [loop-param city]
[if-loop-param state]
[L]State[/L]: | [loop-param state]
[/if-loop-param] [if-loop-param zip]
[L]Postal code[/L]: | [loop-param zip]
[/if-loop-param] [/else] [/if-loop-param]
[L]Country[/L]: | [data table=country col=name key="[loop-param country]"]

[L]Status[/L] | [L]Order Number[/L] | [L]Order Date[/L] | [L]Shipped to[/L] | [L]Number of items[/L] | [L]Subtotal[/L] | [L]Total[/L]
[query list=1 table=transactions sql="select * from transactions where username = '[loop-param username]'"]

[page href="admin/order_status" form="order=[sql-code]" ] [display table=transactions column=status key="[sql-code]" arbitrary=order_view ]

[page href='__UI_BASE__/order_view' form='order=[sql-code]'][sql-code]

[convert-date fmt="%b %e, %Y %H:%M"][sql-param order_date][/convert-date]

[loop-param city], [loop-param state] [loop-param country]

[sql-param nitems]

[currency][sql-param subtotal][/currency]

[currency][sql-param total_cost][/currency]

[/query]

[seti page_banner][L]View Customer[/L]: [if-loop-param company] [loop-param company] [else][loop-param fname] [loop-param lname][/else] [/if-loop-param] [/seti] [output name=bottom_buttons] [form-session-id] [set [L]Return[/L]] viewnext= vieworder= [/set] [if-loop-data transactions archived] [else] [/else] [/if-loop-data] [if-mm advanced order=d] [/if-mm] [output] [/query] @_UI_STD_FOOTER_@