Committer: akanashin
LJSUP-10941: Need a page to display certain figures from the LiveJournal ShopU trunk/htdocs/admin/profit.bml
Modified: trunk/htdocs/admin/profit.bml =================================================================== --- trunk/htdocs/admin/profit.bml 2012-02-20 08:35:29 UTC (rev 11494) +++ trunk/htdocs/admin/profit.bml 2012-02-20 11:54:22 UTC (rev 11495) @@ -12,12 +12,12 @@ while (my $row = $sth->fetchrow_hashref) { $total_sum += $row->{amount} if LJ::SUP->is_sup_enabled(LJ::load_userid($row->{userid})); } -$sth = $dbh->prepare("select userid,amount,propval 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';"); +$sth = $dbh->prepare("SELECT amount-propval/100 from payments left outer join payitems on payments.payid=payitems.payid left outer join payitemprop on payitemprop.piid=payitems.piid WHERE used = 'Y' AND method = 'wallet' AND year(daterecv)=year(now()) and month(daterecv)=month(now()) and item='selfpromo' and payitemprop.propname='selfpromo_refund';"); $sth->execute(); while (my $row = $sth->fetchrow_hashref) { $selfpromo_month += (($row->{amount})-($row->{propval}/100)) if LJ::SUP->is_sup_enabled(LJ::load_userid($row->{userid})); } -$sth = $dbh->prepare("select userid,amount,propval 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';"); +$sth = $dbh->prepare("SELECT amount-propval/100 from payments left outer join payitems on payments.payid=payitems.payid left outer join payitemprop on payitemprop.piid=payitems.piid WHERE used = 'Y' AND method = 'wallet' AND year(daterecv)=year(now()) and month(daterecv)=month(now()) and item='selfpromo' and payitemprop.propname='selfpromo_refund' and day(payments.daterecv)=day(now());"); $sth->execute(); while (my $row = $sth->fetchrow_hashref) { $selfpromo_day += (($row->{amount})-($row->{propval}/100)) if LJ::SUP->is_sup_enabled(LJ::load_userid($row->{userid}));