[if-mm !advanced orderstats]
[calc]
$CGI->{affiliate} = $Session->{username};
return;
[/calc]
[/if-mm]
[set page_title]Order detail report[/set]
[set icon_name]admin/icon_stats.gif[/set]
[set help_name]orderstats.view[/set]
@_UI_STD_HEAD_@
Order Number
|
Affiliate
|
Campaign
|
Address
|
Date
|
Amount
|
Status
|
[calc]
if($Session->{arg}) {
$Scratch->{date_limit} = "AND order_date like '$Session->{arg}%'";
}
elsif ($CGI->{ui_begin_date}) {
for (qw/ ui_begin_date ui_end_date /) {
$CGI->{$_} = $Tag->filter( {
op => 'date_change',
body => $CGI->{$_}
});
}
$Scratch->{date_limit} = < '$CGI->{ui_begin_date}'
AND order_date < '$CGI->{ui_end_date}Z'
EOF
}
else {
$Scratch->{date_limit} = "AND order_date like '$Scratch->{today}%'";
}
$Scratch->{synd_limit} = '';
return unless $CGI->{affiliate};
$Scratch->{synd_limit} = "AND affiliate = '$CGI->{affiliate}'";
$Scratch->{synd_limit} .= " AND campaign = '$CGI->{campaign}'"
if $CGI->{campaign};
return;
[/calc]
[query hashref=main
st=db
table=transactions
sql="
select order_number, affiliate, campaign, total_cost, payment_method, state, city, status, order_date
from transactions
WHERE deleted != 1
[scratch date_limit] [scratch synd_limit]
order by order_number
"][/query]
[perl tables="store"]
return <{main};
Bad query specified, caused error.
|
EOF
foreach $line (@{$Tmp->{main}}) {
$total_sales += $line->{total_cost};
$amount = sprintf '%.2f', $line->{total_cost};
$url = $Tag->area('__UI_BASE__/order_view', $line->{order_number});
$out .= <
$line->{order_number}
|
$line->{affiliate}
|
$line->{campaign}
|
$line->{city}, $line->{state}
|
$line->{order_date}
|
$amount
|
$line->{status}
|
EOF
}
$total_sales = sprintf '$%.2f', $total_sales;
$out .= <
GRAND TOTAL
|
|
|
|
|
$total_sales
|
|
EOF
[/perl]
@_UI_STD_FOOTER_@