<?php
session_start();
include "../../classes/html_items.php";
include "../../classes/db.class.php";
include "../../functions.class.php";
include "../../classes/dashboard.class.php";
$functions = new functions();
$dash = new dash_items();
$functions = new functions();
function get_day_of_the_week($date)
{
    $date = date('w', strtotime($date));
    switch ($date) {
        case 0:
            return 'Sunday';
        case 1:
            return 'Monday';
        case 2:
            return 'Tuesday';
        case 3:
            return 'Wednesday';
        case 4:
            return 'Thursday';
        case 5:
            return 'Friday';
        case 6:
            return 'Saturday';
    }
}

echo DashboardWidget::includeAssets();
?>

<style>
    body {
        margin-top: 1em;
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        align-content: center;
        justify-content: flex-start;
        align-items: center;
    }
</style>
<?php

$fuel_movement_res_table = $db->query("fuel_movement", "SELECT * FROM fuel_movement AS fm LEFT JOIN clients as c ON fm.client_id = c.record_id WHERE ( fm.status = 'DONE' OR fm.status = 'MANUAL OVERRIDE' OR fm.status = 'RFID' )  AND fm.company_id = {$_SESSION['company_id']} AND fm.amount > 100 AND c.company_id = {$_SESSION['company_id']} AND c.exclude_from_reports = 1 ORDER BY fm.date_time_closed DESC LIMIT 150");
$table_data = [];

while ($fuel_movement = $fuel_movement_res_table->fetch_assoc()) {
    $table_data[] = [
        $functions->get_tank_name($fuel_movement['tank_id']),
        $functions->get_client_name($fuel_movement['client_id']),
        number_format(($fuel_movement['amount'] / 1000), 3),
        $fuel_movement['date_time_closed'],
        //$functions->get_username($fuel_movement['user_id']),
        'diesel/slip.pdf.php?record_id=' . $fuel_movement['record_id']
    ];
}
echo "<h2>RECENT MOVEMENTS FOR EXCLUDED TAGS</h2>";
echo DashboardWidget::tableBlock('', ['PUMP', 'TAG', 'AMOUNT', "DATE"], $table_data, '90vw');
?>





<div class="spacer"></div>
<div class="spacer"></div>