changed logic of summation of daily revenue

This commit is contained in:
jouls 2024-04-26 17:36:12 +08:00
parent e8b5b6b50c
commit 2ad0c9e955
1 changed files with 4 additions and 3 deletions

View File

@ -756,13 +756,14 @@ $allSignups = array_merge($all_customers, $all_vendors);
$orderCount = 0; // Initialize order count
$dailyRevenue = 0;
foreach ($all_orders as $x => $val) {
foreach (array_reverse($all_orders) as $x => $val) {
$paymentStatus = strtolower($val['payment']['status']);
$returnStatus = strtolower($val['return_order']['status']);
$orderStatus = strtolower($val['status']);
$formattedOrderDate = date('m-d-Y', strtotime($val['order_date']));
if ($formattedOrderDate == $currentDate) {
$orderCount++;
if($paymentStatus == "paid"){
if($paymentStatus == "paid" && (!$returnStatus || $orderStatus != "returned" )){
$dailyRevenue += $val['total_amount'];
} // Increment order count for each order on the current date
}