[if-mm !advanced orderstats] [calc] $CGI->{affiliate} = $Session->{username}; return; [/calc] [/if-mm] [set page_title][L]Order detail report[/L][/set] [set icon_name]icon_stats.gif[/set] [set ui_class]Reports[/set] [set help_name]orderstats.view[/set] [tmpn third_menu]OrderStats[/tmpn] @_UI_STD_HEAD_@
[L]Order[/L] | [L]Affiliate[/L] | [L]Campaign[/L] | [L]Address[/L] | [L]Date[/L]/[L]Time[/L] | [L]Amount[/L] | [L]Status[/L] | |
Bad query specified, caused error. |
EOF
$out = '';
my $skustring = '';
my $skudisplay = '';
if(my $qary = $Tmp->{qual}) {
$skustring = '&sku=';
my @skus = split /[\s,\0]+/, $CGI->{sku};
$skustring .= join('&sku=', @skus);
$skudisplay = join(', ', @skus);
my %apply;
for(@$qary) {
$apply{$_->[0]} = 1;
}
@$mary = grep $apply{$_->{order_number}}, @$mary;
my $odb = $Db{orderline};
if(! $odb->config('HAS_LIMIT')) {
$Tag->error({
name => 'Totals',
set => 'amounts will be wrong with no SQL',
});
}
else {
for my $t (@$mary) {
my $q = "SELECT subtotal FROM orderline";
$q .= " WHERE order_number = '$t->{order_number}'";
$q .= " AND $Scratch->{tmp_sku_query}";
my $tary = $odb->query($q);
my $cost = 0;
for(@$tary) {
$cost += $_->[0];
}
$t->{total_cost} = $cost;
}
}
}
foreach $line (@$mary) {
$total_sales += $line->{total_cost};
$amount = $Tag->currency({}, $line->{total_cost});
$line->{status} = $Tag->loc('', $line->{status});
$url = $Tag->area({ href => '__UI_BASE__/order_view',
form => "order=$line->{order_number}", });
$out .= <$line->{order_number} | $line->{affiliate} | $line->{campaign} | $line->{city}, $line->{state} | $line->{order_date} | $amount | $line->{status} |
[L]GRAND TOTAL[/L] | $total_sales | ||||||