package IIffdf54f1494b3bf443f066e7a818a029::mod_top_aff_amo_comm; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; use IIbbd7c6cf33a8b724d5937c621b455d05; 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}; push @sea, packs => $qh->{packs} if $qh->{packs}; push @sea, prods => $qh->{prods} if $qh->{prods}; push @sea, recur_no => 1 if $qh->{no_recur}; my $data = II720d6e18aa34327713eb014408fc9144::IlllIllllIllIIIl($II720d6e18aa34327713eb014408fc9144::lIIIlIlIlllIIIll{$II720d6e18aa34327713eb014408fc9144::IIIllIIlIlllIIll},121,$II720d6e18aa34327713eb014408fc9144::lIIIlIlIlllIIIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IllIlllllllIlIll})->getRecords( "jin_commission.ben_user_id as id,jin_user.name,sum(jin_commission.amount) as sum", JOIN => "left join jin_user on jin_user.id=jin_commission.ben_user_id", @sea, paid_only => 1, cancelled => 0, GROUP => "jin_commission.ben_user_id", ORDER => "sum desc", NUM => $limit, ); my $total = IIb39071a48a82a07eeb9256f406abebc5::lllllIIIlIIlIlII($II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIllIIlIllIlIIl},121,$II8dae0e141ee45f5daba6a74e4a7c3b6f::lIlllIlIlIlIlIll{$II8dae0e141ee45f5daba6a74e4a7c3b6f::IlIlIlIIIIllIIIl})->getValue( "sum(jin_commission.amount)", @sea, paid_only => 1, cancelled => 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; 