Skip to content

Commit

Permalink
Add current month filter to transaction status
Browse files Browse the repository at this point in the history
queries in dashboard-count.php
  • Loading branch information
HashJProgramming committed Nov 16, 2023
1 parent da8368a commit 99e0412
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions functions/views/dashboard-count.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ function get_yearly(){

function get_pending(){
global $db;
$current_month = date('m');
$sql = "SELECT COUNT(*) AS total_pending
FROM transactions
WHERE status = 0";
WHERE status = 0
AND MONTH(created_at) = $current_month";
$stmt = $db->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
Expand All @@ -56,9 +58,11 @@ function get_pending(){

function get_processing(){
global $db;
$current_month = date('m');
$sql = "SELECT COUNT(*) AS total_processing
FROM transactions
WHERE status = 1";
WHERE status = 1
AND MONTH(created_at) = $current_month";
$stmt = $db->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
Expand All @@ -73,9 +77,11 @@ function get_processing(){

function get_folding(){
global $db;
$current_month = date('m');
$sql = "SELECT COUNT(*) AS total_folding
FROM transactions
WHERE status = 2";
WHERE status = 2
AND MONTH(created_at) = $current_month";
$stmt = $db->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
Expand All @@ -90,9 +96,11 @@ function get_folding(){

function get_ready(){
global $db;
$current_month = date('m');
$sql = "SELECT COUNT(*) AS total_ready
FROM transactions
WHERE status = 3";
WHERE status = 3
AND MONTH(created_at) = $current_month";
$stmt = $db->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
Expand All @@ -107,9 +115,11 @@ function get_ready(){

function get_claimed(){
global $db;
$current_month = date('m');
$sql = "SELECT COUNT(*) AS total_claimed
FROM transactions
WHERE status = 4";
FROM transactions
WHERE status = 4
AND MONTH(created_at) = $current_month";
$stmt = $db->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
Expand Down

0 comments on commit 99e0412

Please # to comment.