diff --git a/admin/index.php b/admin/index.php index 21284dc..54eafe1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -13,6 +13,11 @@ if ($_SESSION["userId"] <> "") { if($_SESSION["user_type"]!="admin"){ header("location: login.php?alert=Only admins allowed here!"); } + +$all_orders = getAllOrder(); +date_default_timezone_set('Asia/Manila'); + + ?> @@ -97,7 +102,7 @@ if($_SESSION["user_type"]!="admin"){
  • @@ -719,8 +724,27 @@ if($_SESSION["user_type"]!="admin"){
    -

    15,503

    -

    Daily Order

    + $val) { + $paymentStatus = strtolower($val['payment']['status']); + + $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); + if ($formattedOrderDate == $currentDate) { + $orderCount++; + if($paymentStatus == "paid"){ + $dailyRevenue += $val['total_amount']; + } // Increment order count for each order on the current date + } + } + + $finalDailyRevenue = number_format($dailyRevenue, 2, '.', ','); + ?> +

    +

    Today's Order

    @@ -728,9 +752,9 @@ if($_SESSION["user_type"]!="admin"){
    -

    $98,503

    -

    Daily Revenue

    - +

    +

    Today's Revenue

    +
    @@ -741,6 +765,7 @@ if($_SESSION["user_type"]!="admin"){
    +

    Sales Report

    @@ -995,9 +1020,6 @@ if($_SESSION["user_type"]!="admin"){

    Recent Orders

    -
    - -
    - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + $val) { + $paymentStatus = strtolower($val['payment']['status']); + $formattedOrderDate = date('m-d-Y', strtotime($val['order_date'])); + $orderId = $val['_id']; + $customerName = $val['customer'][0]['name']; + $vendorName = $val['items'][0]['vendor_name']; + $totalAmount = $val['total_amount']; + $orderStatus = strtoupper($val['status']); + + $statusClass = ''; + if ($orderStatus === 'UNPAID' || $orderStatus === 'RETURNED') { + $statusClass = '#cb3747'; + } elseif ($orderStatus === 'TO PAY') { + $statusClass = '#50d7ab'; + } elseif ($orderStatus === 'TO SHIP') { + $statusClass = '#9586cd'; + } + elseif ($orderStatus === 'TO RECEIVE') { + $statusClass = '#ffc319'; + } elseif ($orderStatus === 'COMPLETED') { + $statusClass = '#88aaf3'; + } + + if ($formattedOrderDate == $currentDate) { + $displayDate = date('m-d-Y, g:i A', strtotime($val['order_date'])); + ?> + + + + + + + + + + = 8) { + break; + } + } + } + ?>
    Order IDProduct NameUnitsCustomer NameVendor NameTotal Amount Order DateOrder Cost Status
    24541 - Coach Swagger - 1 UnitOct 20, 2018$230 - Completed - - -
    24541 - Toddler Shoes, Gucci Watch - 2 UnitsNov 15, 2018$550 - Delayed - - -
    24541 - Hat Black Suits - 1 UnitNov 18, 2018$325 - On Hold - - -
    24541 - Backpack Gents, Swimming Cap Slin - 5 UnitsDec 13, 2018$200 - Completed - - -
    24541 - Speed 500 Ignite - 1 UnitDec 23, 2018$150 - Cancelled - - -
    diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 11acc9f..7769b04 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -83,7 +83,7 @@ if (isset($_SESSION["token"])) { // $token = loginRenew($_SESSION["email"], $_SESSION["password"], $token); // $_SESSION["token"] = $token; - +date_default_timezone_set('Asia/Manila'); ?> @@ -288,7 +288,7 @@ if (isset($_SESSION["token"])) {
    - +
    @@ -312,12 +312,13 @@ if (isset($_SESSION["token"])) { if ($orderItems['payment']['status'] === 'PAID') { foreach ($orderItems['items'] as $item) { + $displayDate = date('m-d-Y, g:i A', strtotime($orderItems['updatedAt'])); $isPayoutCompleted = !empty($orderItems['payout_status']); ?> - + @@ -327,7 +328,7 @@ if (isset($_SESSION["token"])) { - + @@ -650,7 +677,7 @@ $vendorPayoutData = json_decode($response, true);
    Fees, Deductions, Adjustments
    -
    - ${totalFees}
    +
    - ${totalFees} (${feeBreakdown})
    Net Amount
    > + -->
    Payout History
    @@ -320,7 +339,7 @@ $vendorPayoutData = json_decode($response, true);