accounting modules

This commit is contained in:
Thanakorn S
2026-05-13 15:11:24 +07:00
parent 511360faa2
commit 04a683bd02
70 changed files with 4451 additions and 42 deletions
+51 -7
View File
@@ -1,7 +1,20 @@
<?php
$current_page = basename($_SERVER['PHP_SELF']);
$master_role = $_SESSION['login_role'] ?? 'viewer';
$cp = $_SERVER['PHP_SELF'];
function master_active(...$frags) {
global $cp;
foreach ($frags as $f) { if (str_contains($cp, $f)) return 'active'; }
return '';
}
$master_role = $_SESSION['login_role'] ?? 'viewer';
$master_can_admin = in_array($master_role, ['owner', 'admin'], true);
$master_app_access = $_SESSION['login_app_access'] ?? 'wms';
$master_show_accounting = in_array($master_app_access, ['all', 'accounting']);
$master_back_url = ($_SESSION['login_current_app'] ?? 'wms') === 'accounting'
? $server_url . 'ac_dashboard/index.php'
: $server_url . 'dashboard/index.php';
$master_back_label = ($_SESSION['login_current_app'] ?? 'wms') === 'accounting'
? 'Back to Accounting'
: 'Back to WMS';
?>
<!-- SIDEBAR -->
@@ -23,7 +36,7 @@
</li>
<li>
<a class="nav-link <?php echo in_array($current_page, ['product.php', 'manage_product.php', 'manage_category.php']) ? 'active' : ''; ?>"
<a class="nav-link <?php echo master_active('/inventory/product', '/inventory/manage_product', '/inventory/manage_category'); ?>"
href="<?php echo $server_url?>inventory/product.php">
<i class="ti ti-category"></i>
<span class="nav-text">Products</span>
@@ -32,7 +45,7 @@
<?php if ($master_can_admin): ?>
<li>
<a class="nav-link <?php echo in_array($current_page, ['warehouse.php', 'manage_warehouse.php', 'manage_storage.php']) ? 'active' : ''; ?>"
<a class="nav-link <?php echo master_active('/inventory/warehouse', '/inventory/manage_warehouse', '/inventory/manage_storage'); ?>"
href="<?php echo $server_url?>inventory/warehouse.php">
<i class="ti ti-map-pin"></i>
<span class="nav-text">Warehouse Location</span>
@@ -41,22 +54,53 @@
<?php endif; ?>
<li>
<a class="nav-link <?php echo in_array($current_page, ['contact.php', 'manage_contact.php', 'manage_contact_type.php']) ? 'active' : ''; ?>"
<a class="nav-link <?php echo master_active('/contact/'); ?>"
href="<?php echo $server_url?>contact/contact.php">
<i class="ti ti-users"></i>
<span class="nav-text">Contact</span>
</a>
</li>
<!-- Accounting -->
<?php if ($master_show_accounting): ?>
<li class="nav-text-space mt-2">
<small class="nav-text text-muted">Accounting</small>
</li>
<li>
<a class="nav-link <?php echo master_active('/accounting/chart_of_accounts', '/accounting/manage_account'); ?>"
href="<?php echo $server_url?>accounting/chart_of_accounts.php">
<i class="ti ti-list-tree"></i>
<span class="nav-text">Chart of Accounts</span>
</a>
</li>
<li>
<a class="nav-link <?php echo master_active('/accounting/departments', '/accounting/manage_department'); ?>"
href="<?php echo $server_url?>accounting/departments.php">
<i class="ti ti-building"></i>
<span class="nav-text">Departments</span>
</a>
</li>
<li>
<a class="nav-link <?php echo master_active('/accounting/periods'); ?>"
href="<?php echo $server_url?>accounting/periods.php">
<i class="ti ti-calendar"></i>
<span class="nav-text">Accounting Periods</span>
</a>
</li>
<?php endif; ?>
<!-- Navigation -->
<li class="nav-text-space mt-2">
<small class="nav-text text-muted">Navigation</small>
</li>
<li>
<a class="nav-link" href="<?php echo $server_url?>dashboard/index.php">
<a class="nav-link" href="<?php echo $master_back_url; ?>">
<i class="ti ti-arrow-left"></i>
<span class="nav-text">Back to App</span>
<span class="nav-text"><?php echo $master_back_label; ?></span>
</a>
</li>