<?php
session_start();

include "classes/html.class.php";
$db = new db();

$qr = new qrcode();

$html = new html("FUEL");

$date = date('Y-m-d H:i', strtotime("+ 2 hours"));

if (isset($_GET['tran_no'])) {
    $_SESSION['current_transaction'] = $_GET['tran_no'];
} else {


    if (isset($_POST['pump_id'])) {
        if (strlen($_POST['odo']) > 1) {
            $responce = $html->http_get_curl("api.elegantwork.co.za/fuel/inter_site_com.php", ['open_transaction', 'tank_qr', 'asset_id', 'user_id', 'odo'], ['', $_POST['pump_id'], $_POST['asset_record_id'], $_SESSION['user_id'], $_POST['odo']]);
        } else {
            $responce = $html->http_get_curl("api.elegantwork.co.za/fuel/inter_site_com.php", ['open_transaction', 'tank_qr', 'asset_id', 'user_id', 'odo'], ['', $_POST['pump_id'], $_POST['asset_record_id'], $_SESSION['user_id'], $_POST['old_odo']]);
        }
        $_SESSION['current_transaction'] = $responce;
        echo "<script>window.location.href = 'fuel_step_c.php';</script>";
    }
    $_POST['pump_id'] = '';
    $_POST['asset_record_id'] = '';
    $_POST['odo'] = '';
}

?>
