Autosave: 20260222-072055
This commit is contained in:
parent
d26b2dd630
commit
f42ddae7e9
82
index.php
82
index.php
@ -256,6 +256,46 @@ function numberToWordsArabic($num) {
|
|||||||
return (string)$num;
|
return (string)$num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderPagination($currentPage, $totalPages) {
|
||||||
|
if ($totalPages <= 1) return '';
|
||||||
|
|
||||||
|
$query = $_GET;
|
||||||
|
unset($query['p']);
|
||||||
|
$url = 'index.php?' . http_build_query($query) . '&p=';
|
||||||
|
|
||||||
|
$html = '<nav aria-label="Page navigation" class="mt-4"><ul class="pagination justify-content-center">';
|
||||||
|
|
||||||
|
// Previous
|
||||||
|
$disabled = ($currentPage <= 1) ? 'disabled' : '';
|
||||||
|
$html .= '<li class="page-item ' . $disabled . '"><a class="page-link" href="' . $url . ($currentPage - 1) . '"><i class="bi bi-chevron-left"></i></a></li>';
|
||||||
|
|
||||||
|
// Pages
|
||||||
|
$start = max(1, $currentPage - 2);
|
||||||
|
$end = min($totalPages, $currentPage + 2);
|
||||||
|
|
||||||
|
if ($start > 1) {
|
||||||
|
$html .= '<li class="page-item"><a class="page-link" href="' . $url . '1">1</a></li>';
|
||||||
|
if ($start > 2) $html .= '<li class="page-item disabled"><span class="page-link">...</span></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = $start; $i <= $end; $i++) {
|
||||||
|
$active = ($i == $currentPage) ? 'active' : '';
|
||||||
|
$html .= '<li class="page-item ' . $active . '"><a class="page-link" href="' . $url . $i . '">' . $i . '</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($end < $totalPages) {
|
||||||
|
if ($end < $totalPages - 1) $html .= '<li class="page-item disabled"><span class="page-link">...</span></li>';
|
||||||
|
$html .= '<li class="page-item"><a class="page-link" href="' . $url . $totalPages . '">' . $totalPages . '</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next
|
||||||
|
$disabled = ($currentPage >= $totalPages) ? 'disabled' : '';
|
||||||
|
$html .= '<li class="page-item ' . $disabled . '"><a class="page-link" href="' . $url . ($currentPage + 1) . '"><i class="bi bi-chevron-right"></i></a></li>';
|
||||||
|
|
||||||
|
$html .= '</ul></nav>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
// Login Logic
|
// Login Logic
|
||||||
$login_error = '';
|
$login_error = '';
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['login'])) {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['login'])) {
|
||||||
@ -2992,11 +3032,24 @@ switch ($page) {
|
|||||||
$params[] = $_GET['end_date'];
|
$params[] = $_GET['end_date'];
|
||||||
}
|
}
|
||||||
$whereSql = implode(" AND ", $where);
|
$whereSql = implode(" AND ", $where);
|
||||||
|
|
||||||
|
$limit = 20;
|
||||||
|
$page_num = isset($_GET['p']) ? (int)$_GET['p'] : 1;
|
||||||
|
if ($page_num < 1) $page_num = 1;
|
||||||
|
$offset = ($page_num - 1) * $limit;
|
||||||
|
|
||||||
|
$countStmt = db()->prepare("SELECT COUNT(*) FROM quotations q JOIN customers c ON q.customer_id = c.id WHERE $whereSql");
|
||||||
|
$countStmt->execute($params);
|
||||||
|
$total_records = (int)$countStmt->fetchColumn();
|
||||||
|
$data['total_pages'] = ceil($total_records / $limit);
|
||||||
|
$data['current_page'] = $page_num;
|
||||||
|
|
||||||
$stmt = db()->prepare("SELECT q.*, c.name as customer_name
|
$stmt = db()->prepare("SELECT q.*, c.name as customer_name
|
||||||
FROM quotations q
|
FROM quotations q
|
||||||
JOIN customers c ON q.customer_id = c.id
|
JOIN customers c ON q.customer_id = c.id
|
||||||
WHERE $whereSql
|
WHERE $whereSql
|
||||||
ORDER BY q.id DESC");
|
ORDER BY q.id DESC
|
||||||
|
LIMIT $limit OFFSET $offset");
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$data['quotations'] = $stmt->fetchAll();
|
$data['quotations'] = $stmt->fetchAll();
|
||||||
break;
|
break;
|
||||||
@ -3030,11 +3083,24 @@ switch ($page) {
|
|||||||
$params[] = $_GET['end_date'];
|
$params[] = $_GET['end_date'];
|
||||||
}
|
}
|
||||||
$whereSql = implode(" AND ", $where);
|
$whereSql = implode(" AND ", $where);
|
||||||
|
|
||||||
|
$limit = 20;
|
||||||
|
$page_num = isset($_GET['p']) ? (int)$_GET['p'] : 1;
|
||||||
|
if ($page_num < 1) $page_num = 1;
|
||||||
|
$offset = ($page_num - 1) * $limit;
|
||||||
|
|
||||||
|
$countStmt = db()->prepare("SELECT COUNT(*) FROM lpos q JOIN suppliers s ON q.supplier_id = s.id WHERE $whereSql");
|
||||||
|
$countStmt->execute($params);
|
||||||
|
$total_records = (int)$countStmt->fetchColumn();
|
||||||
|
$data['total_pages'] = ceil($total_records / $limit);
|
||||||
|
$data['current_page'] = $page_num;
|
||||||
|
|
||||||
$stmt = db()->prepare("SELECT q.*, s.name as supplier_name
|
$stmt = db()->prepare("SELECT q.*, s.name as supplier_name
|
||||||
FROM lpos q
|
FROM lpos q
|
||||||
JOIN suppliers s ON q.supplier_id = s.id
|
JOIN suppliers s ON q.supplier_id = s.id
|
||||||
WHERE $whereSql
|
WHERE $whereSql
|
||||||
ORDER BY q.id DESC");
|
ORDER BY q.id DESC
|
||||||
|
LIMIT $limit OFFSET $offset");
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$data['lpos'] = $stmt->fetchAll();
|
$data['lpos'] = $stmt->fetchAll();
|
||||||
break;
|
break;
|
||||||
@ -4278,8 +4344,9 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
|
|||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
<?= renderPagination($data['current_page'], $data['total_pages']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="card p-4">
|
<div class="card p-4">
|
||||||
@ -7426,9 +7493,10 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="journalDetailsBody"></tbody>
|
<tbody id="journalDetailsBody"></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
<?= renderPagination($data['current_page'], $data['total_pages']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -10,3 +10,15 @@
|
|||||||
2026-02-22 05:45:16 - POST: {"type":"sale","customer_id":"4","invoice_date":"2026-02-22","due_date":"2026-02-26","payment_type":"cash","status":"unpaid","paid_amount":"0.000","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_invoice":""}
|
2026-02-22 05:45:16 - POST: {"type":"sale","customer_id":"4","invoice_date":"2026-02-22","due_date":"2026-02-26","payment_type":"cash","status":"unpaid","paid_amount":"0.000","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_invoice":""}
|
||||||
2026-02-22 05:45:44 - POST: {"type":"sale","customer_id":"4","invoice_date":"2026-02-22","due_date":"","payment_type":"cash","status":"unpaid","paid_amount":"0.000","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_invoice":""}
|
2026-02-22 05:45:44 - POST: {"type":"sale","customer_id":"4","invoice_date":"2026-02-22","due_date":"","payment_type":"cash","status":"unpaid","paid_amount":"0.000","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_invoice":""}
|
||||||
2026-02-22 05:46:02 - POST: {"invoice_id":"32","return_date":"2026-02-22","quantities":["1"],"item_ids":["6"],"prices":["0.100"],"notes":"","add_sales_return":""}
|
2026-02-22 05:46:02 - POST: {"invoice_id":"32","return_date":"2026-02-22","quantities":["1"],"item_ids":["6"],"prices":["0.100"],"notes":"","add_sales_return":""}
|
||||||
|
2026-02-22 06:41:12 - POST: {"action":"save_theme","theme":"forest"}
|
||||||
|
2026-02-22 06:41:25 - POST: {"action":"save_theme","theme":"forest"}
|
||||||
|
2026-02-22 06:43:27 - POST: {"action":"save_theme","theme":"default"}
|
||||||
|
2026-02-22 06:43:29 - POST: {"action":"save_theme","theme":"ocean"}
|
||||||
|
2026-02-22 06:43:30 - POST: {"action":"save_theme","theme":"dracula"}
|
||||||
|
2026-02-22 06:43:38 - POST: {"action":"save_theme","theme":"default"}
|
||||||
|
2026-02-22 07:19:04 - POST: {"customer_id":"1","quotation_date":"2026-02-22","valid_until":"","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_quotation":""}
|
||||||
|
2026-02-22 07:19:14 - POST: {"customer_id":"1","quotation_date":"2026-02-22","valid_until":"","item_ids":["6"],"quantities":["1"],"prices":["0.100"],"add_quotation":""}
|
||||||
|
2026-02-22 07:19:45 - POST: {"customer_id":"1","quotation_date":"2026-02-22","valid_until":"","item_ids":["2","1"],"quantities":["10","5"],"prices":["0.250","0.450"],"add_quotation":""}
|
||||||
|
2026-02-22 07:19:52 - POST: {"customer_id":"1","quotation_date":"2026-02-22","valid_until":"","item_ids":["2","1"],"quantities":["10","5"],"prices":["0.250","0.450"],"add_quotation":""}
|
||||||
|
2026-02-22 07:20:11 - POST: {"type":"sale","customer_id":"4","invoice_date":"2026-02-22","due_date":"","payment_type":"cash","status":"unpaid","paid_amount":"0.000","item_ids":["2"],"quantities":["1"],"prices":["0.250"],"add_invoice":""}
|
||||||
|
2026-02-22 07:20:34 - POST: {"customer_id":"4","quotation_date":"2026-02-22","valid_until":"","item_ids":["2"],"quantities":["1"],"prices":["0.250"],"add_quotation":""}
|
||||||
|
|||||||
@ -3,3 +3,8 @@
|
|||||||
2026-02-22 05:32:10 - search_items call: q=on
|
2026-02-22 05:32:10 - search_items call: q=on
|
||||||
2026-02-22 05:32:45 - search_items call: q=on
|
2026-02-22 05:32:45 - search_items call: q=on
|
||||||
2026-02-22 05:45:42 - search_items call: q=on
|
2026-02-22 05:45:42 - search_items call: q=on
|
||||||
|
2026-02-22 07:19:01 - search_items call: q=on
|
||||||
|
2026-02-22 07:19:25 - search_items call: q=on
|
||||||
|
2026-02-22 07:19:37 - search_items call: q=to
|
||||||
|
2026-02-22 07:20:08 - search_items call: q=on
|
||||||
|
2026-02-22 07:20:31 - search_items call: q=on
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user