package IIffdf54f1494b3bf443f066e7a818a029::mod_top_pack_amo_sale; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; use IIc006e1d88f66a3969ffd0192be9acb1b; sub search { my ($class, $qh) = @_; my $limit = ($qh->{limit} + 0) || 10; my @sea; push @sea, made_after => $qh->{date_after} if $qh->{date_after}; push @sea, made_until => $qh->{date_before} if $qh->{date_before}; my $data = II982446f8950cc3dc59e487adba22df54::IIllIIllIIIlllll($II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlIIllllIIIlI{$IIb39071a48a82a07eeb9256f406abebc5::lllllllIlIllIlIl},100,$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlIIllllIIIlI{$II720d6e18aa34327713eb014408fc9144::lIIlllIllIlIllll})->getRecords( "jin_order.pack_id as id,jin_package.title as name,sum(jin_sale.amount) as sum", JOIN => "inner join jin_order on jin_order.id=jin_sale.order_id", JOIN => "left join jin_package on jin_package.id=jin_order.pack_id", @sea, paid => 1, refunded => 0, WHERE => "jin_order.pack_id!=0", GROUP => "jin_order.pack_id", ORDER => "sum desc", NUM => $limit, ); my $total = II8dae0e141ee45f5daba6a74e4a7c3b6f::lllIlIIIIlIIlIll($II982446f8950cc3dc59e487adba22df54::lIlllIllIIlIIlll{$II982446f8950cc3dc59e487adba22df54::IlIllIIIlllIlIll},100,$II982446f8950cc3dc59e487adba22df54::lIlllIllIIlIIlll{$II720d6e18aa34327713eb014408fc9144::lIIIlIIIllIlllII})->getValue( "sum(jin_sale.amount)", JOIN => "inner join jin_order on jin_order.id=jin_sale.order_id", @sea, paid => 1, refunded => 0, WHERE => "jin_order.pack_id!=0", ); my $topSum = scalar(@$data) ? $data->[0]{sum} : 0; for my $d (@$data) { $d->{percent} = $total ? ($d->{sum} / $total * 100) : 0; $d->{grad} = $topSum ? ($d->{sum} / $topSum * 100) : 0; } $data; } 1; 