holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r11475: LJSUP-10941: Need a page to display cert...

Committer: akanashin
LJSUP-10941: Need a page to display certain figures from the LiveJournal Shop
U   trunk/htdocs/admin/profit.bml
Modified: trunk/htdocs/admin/profit.bml
===================================================================
--- trunk/htdocs/admin/profit.bml	2012-02-15 06:53:27 UTC (rev 11474)
+++ trunk/htdocs/admin/profit.bml	2012-02-15 10:50:36 UTC (rev 11475)
@@ -4,32 +4,11 @@
 use LJ::Pay::Wallet;
 use LJ::Pay::SelfPromo;
 my $dbh = LJ::get_db_writer;
-my $info = LJ::Pay::SelfPromo->current_promo_info;
-#my ($selfpromo) = $dbh->selectrow_array("select sum(payitemprop.propval) from payments inner join payitems using(payid) inner join payitemprop on payitems.piid=payitemprop.piid and payitemprop.propname='selfpromo_profit' where payments.daterecv > '2012-01-01' and used != 'C' and method = 'wallet' and payitems.item='selfpromo';");
-
-my $select_payments_sql = "SELECT * FROM payments WHERE used = 'Y' AND method = 'wallet' AND year(daterecv) = year(now()) AND month(daterecv) = month(now())";
-my $sth = $dbh->prepare($select_payments_sql);
-$sth->execute;
-
-my $payments_ref;
-my @users;
-while (my $row = $sth->fetchrow_hashref) {
-    $payments_ref->{$row->{payid}} = $row;
-    push @users, $row->{userid} if $users ne 'all' and $users ne 'anon';
+my ($total) = $dbh->selectrow_array("select sum(amount) from payments where daterecv > '2012-01-01' and used != 'C' and method != 'wallet';");
+my ($selfpromo_month) = $dbh->selectrow_array("select sum(amount)-sum(propval)/100 from payments,payitems,payitemprop where payments.payid=payitems.payid and year(payments.daterecv)=year(now()) and month(payments.daterecv)=month(now()) and payitems.piid=payitemprop.piid and payments.method='wallet' and payitems.status='done' and payments.used!='C' and payitemprop.propname='selfpromo_refund';");
+my ($selfpromo_day) = $dbh->selectrow_array("select sum(amount)-sum(propval)/100 from payments,payitems,payitemprop where payments.payid=payitems.payid and year(payments.daterecv)=year(now()) and month(payments.daterecv)=month(now()) and day(payments.daterecv)=day(now()) and payitems.piid=payitemprop.piid and payments.method='wallet' and payitems.status='done' and payments.used!='C' and payitemprop.propname='selfpromo_refund';");
+return int($total) . "," . 
+int($selfpromo_month*LJ::Pay::Wallet::EXCHANGE_RATE) . "," . 
+int($selfpromo_day*LJ::Pay::Wallet::EXCHANGE_RATE);
 }
-  
-my $us = LJ::load_userids(@users);
-    
-foreach my $payid (keys %{$payments_ref}) {
-    my $userid = $payments_ref->{$payid}->{userid};
-    delete $payments_ref->{$payid} if not $us->{$userid} or $users eq 'cyr' and not LJ::SUP->is_sup_enabled($us->{$userid});
-}
-
-my $selfpromo;
-$selfpromo+=$payments_ref->{$_}->{amount} foreach (keys %$payments_ref);
-     
-return int($dbh->selectrow_array("select sum(amount) from payments where daterecv > '2012-01-01' and used != 'C' and method != 'wallet';")) . "," . 
-int($selfpromo*LJ::Pay::Wallet::EXCHANGE_RATE) . "," . 
-int($info ? $info->cost : 0);
-}
 _code?>

Tags: akanashin, bml, holyandrew, ljcom
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