Skip to content

Commit 99e0412

Browse files
Add current month filter to transaction status
queries in dashboard-count.php
1 parent da8368a commit 99e0412

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

functions/views/dashboard-count.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ function get_yearly(){
4343

4444
function get_pending(){
4545
global $db;
46+
$current_month = date('m');
4647
$sql = "SELECT COUNT(*) AS total_pending
4748
FROM transactions
48-
WHERE status = 0";
49+
WHERE status = 0
50+
AND MONTH(created_at) = $current_month";
4951
$stmt = $db->prepare($sql);
5052
$stmt->execute();
5153
$results = $stmt->fetchAll();
@@ -56,9 +58,11 @@ function get_pending(){
5658

5759
function get_processing(){
5860
global $db;
61+
$current_month = date('m');
5962
$sql = "SELECT COUNT(*) AS total_processing
6063
FROM transactions
61-
WHERE status = 1";
64+
WHERE status = 1
65+
AND MONTH(created_at) = $current_month";
6266
$stmt = $db->prepare($sql);
6367
$stmt->execute();
6468
$results = $stmt->fetchAll();
@@ -73,9 +77,11 @@ function get_processing(){
7377

7478
function get_folding(){
7579
global $db;
80+
$current_month = date('m');
7681
$sql = "SELECT COUNT(*) AS total_folding
7782
FROM transactions
78-
WHERE status = 2";
83+
WHERE status = 2
84+
AND MONTH(created_at) = $current_month";
7985
$stmt = $db->prepare($sql);
8086
$stmt->execute();
8187
$results = $stmt->fetchAll();
@@ -90,9 +96,11 @@ function get_folding(){
9096

9197
function get_ready(){
9298
global $db;
99+
$current_month = date('m');
93100
$sql = "SELECT COUNT(*) AS total_ready
94101
FROM transactions
95-
WHERE status = 3";
102+
WHERE status = 3
103+
AND MONTH(created_at) = $current_month";
96104
$stmt = $db->prepare($sql);
97105
$stmt->execute();
98106
$results = $stmt->fetchAll();
@@ -107,9 +115,11 @@ function get_ready(){
107115

108116
function get_claimed(){
109117
global $db;
118+
$current_month = date('m');
110119
$sql = "SELECT COUNT(*) AS total_claimed
111-
FROM transactions
112-
WHERE status = 4";
120+
FROM transactions
121+
WHERE status = 4
122+
AND MONTH(created_at) = $current_month";
113123
$stmt = $db->prepare($sql);
114124
$stmt->execute();
115125
$results = $stmt->fetchAll();

0 commit comments

Comments
 (0)