MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/imyrqtmy/public_html/builty/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/builty/search_result copy.php
<?php
include("vendor/inc/config.php");
?>
<!DOCTYPE html>
<html>
<head>
    <title>Search GRNO</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 30px;
            background-color: #f9f9f9;
        }

        h2 {
            text-align: center;
            color: #333;
        }

        .center-table {
            display: flex;
            justify-content: center;
            margin-top: 30px;
        }

        table {
            border-collapse: collapse;
            width: 95%;
            max-width: 1000px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }

        th, td {
            padding: 12px 15px;
            border: 1px solid #ccc;
            text-align: center;
        }

        th {
            background-color: #f1f1f1;
        }

        .no-result {
            text-align: center;
            color: red;
            margin-top: 50px;
            font-size: 18px;
        }

        .btn {
            padding: 6px 12px;
            text-decoration: none;
            border-radius: 4px;
            font-size: 14px;
        }

        .btn-primary { background-color: #007bff; color: #fff; }
        .btn-warning { background-color: #ffc107; color: #000; }
    </style>
</head>
<body>

<?php
if (isset($_GET['grno']) && !empty($_GET['grno'])) {
    $grno = $_GET['grno'];

    $sql = "SELECT * FROM builties WHERE grno = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("s", $grno);
    $stmt->execute();
    $result = $stmt->get_result();

    echo "<h2>Search Result for GRNO: $grno</h2>";

    if ($result->num_rows > 0) {
        echo "<div class='center-table'>
                <table>
                    <tr>
                        <th>GRNO</th>
                        <th>GR File</th>
                        <th>Invoice File</th>
                        <th>Consignor</th>
                        <th>Consignee</th>
                        <th>Origin</th>
                        <th>Destination</th>
                        <th>Status</th>
                        <th>Remark</th>
                    </tr>";

        while ($row = $result->fetch_assoc()) {
            $gr_file_link = "vendor/generate_pdf.php?id=" . $row['id'];
            $invoice_file_path = "vendor/invoices/invoice_" . $row['id'] . ".pdf";
            $invoice_exists = file_exists($invoice_file_path);

            echo "<tr>
                    <td>{$row['grno']}</td>
                    <td><a class='btn btn-primary' href='{$gr_file_link}' target='_blank'>View GR</a></td>
                    <td>";
                    
            if ($invoice_exists) {
                echo "<a class=btn btn-primary' href='{$invoice_file_path}' target='_blank'>View Invoice</a>";
            } else {
                echo "<span style='color:red;'>Not Generated</span><br>
                      <a class='btn btn-warning' href='../vendor/invoice.php?id={$row['id']}'>Generate</a>";
            }

            echo "</td>
                    <td>{$row['consignor']}</td>
                    <td>{$row['consignee']}</td>
                    <td>{$row['origin']}</td>
                    <td>{$row['destination']}</td>
                    <td>{$row['status']}</td>
                    <td>{$row['remark']}</td>
                  </tr>";
        }

        echo "</table></div>";
    } else {
        echo "<div class='no-result'>No record found for GRNO: $grno</div>";
    }

    $stmt->close();
    $conn->close();
} else {
    echo "<div class='no-result'>No GRNO provided in the query string.</div>";
}
?>

</body>
</html>

MMCT - 2023