[comment]
ui_template: Yes
ui_template_name: leftonly
[/comment]
[set component_after]promo_horizontal[/set]
[set members_only]0[/set]
[set page_banner]Order History[/set]
[set component_hsize]2[/set]
[set hbanner]New items[/set]
[set component_before][/set]
[set hpromo_type]new[/set]
[set page_title]__COMPANY__ -- Order History[/set]
@_LEFTONLY_TOP_@
[query st=db arrayref=orders
sql="SELECT
code,status,nitems,subtotal,shipping,handling,total_cost,payment_method,order_date
FROM transactions
WHERE username = '[data base=session field=username filter=sql]'
ORDER by code
"][/query]
[mvasp tables=transactions]
<%
my $uid = $Session->{username};
if (! $uid) {
$Document->write ("
You are not logged in.
");
return;
}
my $orders = $Tmp->{orders};
if(! $orders or scalar @$orders == 0) {
$Document->write( "No pending orders for $uid.");
return;
}
HTML "";
my $header_template = <<'EOF';
DATE
|
ORDER ID
|
QTY TOTAL
|
PAYMENT METHOD
|
SUBTOTAL
|
SHIPPING HANDLING
|
TOTAL
|
STATUS
|
EOF
my $line_template = <<'EOF';
$order_date
|
$order_number
|
$nitems
|
$payment_method
|
$subtotal
|
$shipping$handling
|
$total_cost
|
$status
|
EOF
my %hash;
my @fields = qw/order_number status nitems subtotal shipping
handling total_cost payment_method order_date/;
my $row;
my %summary;
my $first;
my $record;
HTML $header_template;
foreach $record (@$orders) {
my $line = $line_template;
@hash{@fields} = @$record;
$hash{detail_url} = $Tag->area( {
href => 'query/order_detail',
arg => $hash{order_number},
});
if($hash{status} =~ /\d/) {
my @ids = grep /\S/, split /\s+/, $hash{status};
$hash{status} = '';
for(@ids) {
$hash{status} .= <UPS $_
EOF
}
}
else {
$hash{status} = <$hash{status}
EOF
}
for(qw/subtotal shipping total_cost/) {
$hash{$_} = $Tag->currency ({ body=> $hash{$_} });
}
if($hash{handling}) {
$hash{handling} = "
(handling " .
$Tag->currency ({ body=> $hash{handling} }) .
")";
}
else {
$hash{handling} = '';
}
$line =~ s/\$(\w+)/$hash{$1}/g;
HTML $line;
}
HTML "
";
%>
[/mvasp]
[seti export][tag export transactions transactions.txt][/tag][/seti]
[seti export][tag export orderline orderline.txt][/tag][/seti]
@_LEFTONLY_BOTTOM_@