wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r9451: LJSUP-6699. Need to modify /admin/userhe...

Committer: gprochaev
LJSUP-6699. Need to modify /admin/userheads/stat.bml tool

U   trunk/htdocs/admin/userheads/stat.bml
Modified: trunk/htdocs/admin/userheads/stat.bml
===================================================================
--- trunk/htdocs/admin/userheads/stat.bml	2010-09-01 04:20:56 UTC (rev 9450)
+++ trunk/htdocs/admin/userheads/stat.bml	2010-09-01 05:48:44 UTC (rev 9451)
@@ -20,9 +20,9 @@
 my $lang = $LJ::DEFAULT_LANG;
 
 my $dt = DateTime->now();
-my $current = sprintf ("%02d", $dt->day) . "-" . sprintf ("%02d", $dt->month) . "-" . $dt->year;
+my $current = $POST{'to'} || sprintf ("%02d", $dt->day) . "-" . sprintf ("%02d", $dt->month) . "-" . $dt->year;
 $dt->add (days => -30);
-my $before = sprintf ("%02d", $dt->day) . "-" . sprintf ("%02d", $dt->month) . "-" . $dt->year;
+my $before = $POST{'from'} || sprintf ("%02d", $dt->day) . "-" . sprintf ("%02d", $dt->month) . "-" . $dt->year;
 
 
 my $dbh = LJ::get_db_writer();
@@ -74,8 +74,10 @@
     foreach my $item (@$userheads) {
         my $u = LJ::load_userid($item->{userid});
         if ((LJ::SUP->is_sup_enabled($u) and $POST{'sup'}) or (!LJ::SUP->is_sup_enabled($u) and $POST{nonsup})) {
-            $uh_stat{$item->{subitem}}{qty} += $item->{qty};
+            $uh_stat{$item->{subitem}}{qty} += 1;
+            $uh_stat{total}{qty} += 1;
             $uh_stat{$item->{subitem}}{amt} += $item->{amt};
+            $uh_stat{total}{amt} += $item->{amt};
         }
     }
 
@@ -83,9 +85,11 @@
     $ret .= "<tr><td>id</td><td>img</td><td>price</td><td>author</td><td>quantity</td><td>amount</td></tr>";
     foreach my $item (keys %uh_stat) {
         my ($uh_id) = $item =~ m#uh-(\d+)#;
+        next unless $uh_id;
         my $uh = LJ::UserHead->get_userhead ($uh_id);
         $ret .= "<tr><td>".$uh_id."</td><td><img src='".$uh->get_uh_img."'></td><td>".$uh->get_price."</td><td>".$uh->get_uh_author."</td><td>".$uh_stat{$item}{qty}."</td><td>".$uh_stat{$item}{amt}."</td></tr>" if $uh;
     }
+    $ret .= "<tr><th colspan='4'>Total:</th><th>".$uh_stat{total}{qty}."</th><th>".$uh_stat{total}{amt}."</th></tr>";
     $ret .= "</table>";
 
 }

Tags: bml, ljcom, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments