First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
include "db.php";
|
||||
|
||||
$year = date("Y",time() + 60 * 60 * 24 * 25);
|
||||
$month = date("m",time() + 60 * 60 * 24 * 25);
|
||||
$day = date("d",time());
|
||||
|
||||
$total = 0;
|
||||
$gtotal = 0;
|
||||
$ttotal = 0;
|
||||
|
||||
$Amounts = array();
|
||||
|
||||
for ($i = 1; $i < 13; $i++) {
|
||||
$m = $month - $i;
|
||||
if ($m < 1) {
|
||||
$m += 12;
|
||||
if ($m < 1) $m += 12;
|
||||
if ($m == 12) $year--;
|
||||
}
|
||||
$m = sprintf("%02d",$m);
|
||||
$date = "$year-$m";
|
||||
$sdate = "$year-$m-01 00:00:00";
|
||||
$edate = "$year-$m-$day 23:59:59";
|
||||
$query = "SELECT sum(payment_amount) AS total, count(*) AS number FROM `user_bambora_transactions` WHERE `posting_time` BETWEEN '$sdate' AND '$edate'";
|
||||
$results = db_query($query);
|
||||
$row = db_fetch_assoc($results);
|
||||
extract($row);
|
||||
$gtotal += $total;
|
||||
$ttotal += $number;
|
||||
$Amounts[$date] = sprintf("%8s: %8d %16s\n",$date,$number,'$'.number_format($total,2));
|
||||
// $Amounts[$date] = sprintf("%s,%d,%s\n",$date,$number,$total);
|
||||
}
|
||||
|
||||
sort($Amounts);
|
||||
for ($i = 0; $i < count($Amounts); $i++) echo($Amounts[$i]);
|
||||
|
||||
printf("%8s: %8d %16s\n","TOTAL",$ttotal,'$'.number_format($gtotal,2));
|
||||
?>
|
||||
Reference in new issue
Block a user