prefix.'ap_transaction WHERE date(`Date`) = date(now()) AND TransactionStatus <> "Cancelled" '; $sum_today = $wpdb->get_var($sql); if ($sum_today) $sum_today = number_format($sum_today, 2, ',', '.').' €'; //yesterday $sql = ' SELECT sum(Commission) FROM '.$wpdb->prefix.'ap_transaction WHERE date(`Date`) = date(now() - interval 1 day) AND TransactionStatus <> "Cancelled" '; $sum_yesterday = $wpdb->get_var($sql); if ($sum_yesterday) $sum_yesterday = number_format($sum_yesterday, 2, ',', '.').' €'; //this month $sql = ' SELECT sum(Commission) FROM '.$wpdb->prefix.'ap_transaction WHERE month(`Date`) = month(now()) AND year(`Date`) = year(now()) AND TransactionStatus <> "Cancelled" '; $sum_this_month = $wpdb->get_var($sql); if ($sum_this_month) $sum_this_month = number_format($sum_this_month, 2, ',', '.').' €'; //last month $month = date('n') - 1; $year = date('Y'); if ($month == 0) {$month=12; $year--;} $sql = ' SELECT sum(Commission) FROM '.$wpdb->prefix.'ap_transaction WHERE month(`Date`) = '.$month.' AND year(`Date`) = '.$year.' AND TransactionStatus <> "Cancelled" '; $sum_last_month = $wpdb->get_var($sql); if ($sum_last_month) $sum_last_month = number_format($sum_last_month, 2, ',', '.').' €'; //total $sql = ' SELECT sum(Commission) FROM '.$wpdb->prefix.'ap_transaction WHERE TransactionStatus <> "Cancelled" '; $sum_total = $wpdb->get_var($sql); if ($sum_total) $sum_total = number_format($sum_total, 2, ',', '.').' €'; $refresh_button = ' '; echo $refresh_button.'
'.__('Today', 'affiliate-power').':'.$sum_today.'
'.__('Yesterday', 'affiliate-power').':'.$sum_yesterday.'
'.__('This month', 'affiliate-power').':'.$sum_this_month.'
'.__('Last month', 'affiliate-power').':'.$sum_last_month.'
'.__('Total', 'affiliate-power').':'.$sum_total.'
'.__('Details', 'affiliate-power').''; } }