Актуальные купоны
Активные: <% $stats{1} || 0 %>
Неактивные: <% $stats{0} || 0 %>
Использованные: <% $stats{3} || 0 %>
Прототипы: <% $stats{2} || 0 %>
Обработанные: <% $stats{4} || 0 %>
Зарегистрировать »
<%args> $status => undef <%init> my $now = Contenido::DateTime->new; # my $sql = $keeper->SQL->prepare( "select status, count(id) as cnt from webshop_coupons where class = 'webshop::Coupon' and ? <= etime group by status" ); # $sql->execute( $now->ymd('-').' '.$now->hms ); my $sql = $keeper->SQL->prepare( "select status, count(id) as cnt from webshop_coupons where class = 'webshop::Coupon' group by status" ); $sql->execute(); my %stats; while ( my $ln = $sql->fetchrow_hashref ) { $stats{$ln->{status}} = $ln->{cnt}; } # my $active = $keeper->get_documents ( # class => 'webshop::Coupon', # status => 1, # count => 1, # interval => [$now, $now], # ); # my $used = $keeper->get_documents ( # class => 'webshop::Coupon', # status => 3, # count => 1, # interval => [$now, $now], # );