Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/sales_report.php
Назад
<?php require_once('includes/connection.php'); require_once('includes/header.php'); // Search filters $search_conditions = []; $where_sql = ''; // Handle from_date and to_date if (!empty($_GET['from_date']) && !empty($_GET['to_date'])) { $from_date = $conn->real_escape_string($_GET['from_date']); $to_date = $conn->real_escape_string($_GET['to_date']); $search_conditions[] = "DATE(date) BETWEEN '$from_date' AND '$to_date'"; } elseif (!empty($_GET['from_date'])) { $from_date = $conn->real_escape_string($_GET['from_date']); $search_conditions[] = "DATE(date) >= '$from_date'"; } elseif (!empty($_GET['to_date'])) { $to_date = $conn->real_escape_string($_GET['to_date']); $search_conditions[] = "DATE(date) <= '$to_date'"; } // Handle challan_no if (!empty($_GET['challan_no'])) { $challan_no = $conn->real_escape_string($_GET['challan_no']); $search_conditions[] = "challan_no LIKE '%$challan_no%'"; } if (!empty($search_conditions)) { $where_sql = " WHERE " . implode(" AND ", $search_conditions); } $query = "SELECT * FROM `road_challans` $where_sql ORDER BY `id` DESC"; $result = $conn->query($query); ?> <div class="content"> <nav class="navbar navbar-expand-lg navbar-light bg-light mb-4"> <div class="container-fluid"> <button id="sidebarToggle" class="btn btn-outline-secondary d-md-none mr-auto"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand d-md-none" href="#">ECOGENIX</a> </div> </nav> <div class="container-fluid"> <div class="row"> <div class="col-12"> <h2 class="mb-4">Sales Report</h2> </div> </div> <form method="GET" class="row g-3 mb-4"> <div class="col-md-2"> <label class="form-label">From Date</label> <input type="date" name="from_date" value="<?= htmlspecialchars($_GET['from_date'] ?? '') ?>" class="form-control"> </div> <div class="col-md-2"> <label class="form-label">To Date</label> <input type="date" name="to_date" value="<?= htmlspecialchars($_GET['to_date'] ?? '') ?>" class="form-control"> </div> <div class="col-md-2"> <label class="form-label">Challan No.</label> <input type="text" name="challan_no" value="<?= htmlspecialchars($_GET['challan_no'] ?? '') ?>" class="form-control"> </div> <div class="col-md-2 d-flex align-items-end"> <button type="submit" class="btn btn-primary w-100">Search</button> </div> </form> <form method="POST" action="sales_excel_report.php"> <div class="card"> <div class="card-header d-flex justify-content-between align-items-center"> <button type="submit" class="btn btn-sm btn-success">Export to Excel</button> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-striped table-hover table-bordered"> <thead class="table-dark"> <tr> <th><input type="checkbox" id="select_all"> Select All</th> <th>#</th> <th>Seller Company</th> <th>Purchaser Company</th> <th>Challan No.</th> <th>Challan Date</th> <th>Unloaded Date</th> <th>Quantity Unloaded</th> <th>Rate</th> <th>Value</th> <th>CGST</th> <th>SGST</th> <th>IGST</th> <th>Total</th> <th>Action</th> </tr> </thead> <tbody> <?php if ($result && $result->num_rows > 0) { $index = 1; while ($row = $result->fetch_assoc()) { // Handle nulls safely $date_of_unloading = !empty($row['date_of_unloading']) ? new DateTime($row['date_of_unloading']) : null; $unloading_date = $date_of_unloading ? $date_of_unloading->format('Y-m-d') : 'N/A'; $cgst = $row['cgst'] !== null ? htmlspecialchars((string)$row['cgst']) : '0'; $sgst = $row['sgst'] !== null ? htmlspecialchars((string)$row['sgst']) : '0'; $igst = $row['igst'] !== null ? htmlspecialchars((string)$row['igst']) : '0'; echo "<tr> <td><input type='checkbox' name='selected_ids[]' value='" . htmlspecialchars((string)$row['id']) . "' class='select_item'></td> <td>" . $index . "</td> <td>" . htmlspecialchars((string)($row['consignorName'] ?? '')) . "</td> <td>" . htmlspecialchars((string)($row['name'] ?? '')) . "</td> <td>" . htmlspecialchars((string)($row['challan_no'] ?? '')) . "</td> <td>" . htmlspecialchars((string)($row['date'] ?? '')) . "</td> <td>" . $unloading_date . "</td> <td>" . htmlspecialchars((string)($row['quantity_billed'] ?? '')) . "</td> <td>" . htmlspecialchars((string)($row['rate'] ?? '')) . "</td> <td>" . htmlspecialchars((string)($row['amount'] ?? '')) . "</td> <td>" . $cgst . "</td> <td>" . $sgst . "</td> <td>" . $igst . "</td> <td>" . htmlspecialchars((string)($row['finalAmount'] ?? '')) . "</td> <td><a href='view_report.php?id=" . htmlspecialchars((string)$row['id']) . "' class='btn btn-sm btn-warning'>View</a></td> </tr>"; $index++; } } else { echo '<tr><td colspan="15" class="text-center">No records found.</td></tr>'; } ?> </tbody> </table> </div> </div> </div> </form> </div> </div> <script> document.getElementById('select_all').addEventListener('change', function() { const checkboxes = document.querySelectorAll('.select_item'); checkboxes.forEach(cb => cb.checked = this.checked); }); </script> <?php require_once('includes/footer.php'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка