From 425ed2362be335438610d2ecc9977242bdfdbdd3 Mon Sep 17 00:00:00 2001
From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com>
Date: Fri, 12 Apr 2024 19:42:12 +0100
Subject: [PATCH 1/2] Update: Tax System

Tax System Feature Added

The Tax System feature allows you to apply taxes to the prices of Internet plans. This feature is useful for businesses that are required to collect taxes on their services. With the Tax System, you can define tax rates based on your local tax regulations.

Enable Tax System: Choose whether to enable or disable the Tax System. When enabled, taxes will be calculated and added to the prices of Internet plans.

Tax Rate: Select from predefined tax rates such as 0.5%, 1%, 1.5%, 2%, 5%, and 10%. These rates are commonly used and can be selected easily.

Custom Tax Rate: If you have a specific tax rate that is not listed, you can enter a custom tax rate. This allows flexibility in configuring the tax rate to match your local tax requirements.
---
 system/controllers/services.php | 217 +++++++++++++++++++++++++++++---
 system/controllers/settings.php |  29 ++++-
 ui/ui/app-settings.tpl          |  85 +++++++++++++
 ui/ui/balance-add.tpl           |  10 ++
 ui/ui/balance-edit.tpl          |  10 ++
 ui/ui/hotspot-add.tpl           |  10 ++
 ui/ui/hotspot-edit.tpl          |  10 ++
 ui/ui/pppoe-add.tpl             |   9 ++
 ui/ui/pppoe-edit.tpl            |  10 ++
 9 files changed, 372 insertions(+), 18 deletions(-)

diff --git a/system/controllers/services.php b/system/controllers/services.php
index 88f4f2d7..20844dc0 100644
--- a/system/controllers/services.php
+++ b/system/controllers/services.php
@@ -60,7 +60,7 @@ switch ($action) {
                     $rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
                     Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
                     $log .= "DONE : $plan[name_plan], $plan[shared_users], $rate<br>";
-                    if (!empty ($plan['pool_expired'])) {
+                    if (!empty($plan['pool_expired'])) {
                         Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired']);
                         $log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
                     }
@@ -105,7 +105,7 @@ switch ($action) {
                     $rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
                     Mikrotik::addPpoePlan($client, $plan['name_plan'], $plan['pool'], $rate);
                     $log .= "DONE : $plan[name_plan], $plan[pool], $rate<br>";
-                    if (!empty ($plan['pool_expired'])) {
+                    if (!empty($plan['pool_expired'])) {
                         Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired'], '512K/512K');
                         $log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
                     }
@@ -120,7 +120,7 @@ switch ($action) {
         $name = _post('name');
         if ($name != '') {
             $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where_like('tbl_plans.name_plan', '%' . $name . '%');
-            $d = Paginator::findMany($query, ['name'=> $name]);
+            $d = Paginator::findMany($query, ['name' => $name]);
         } else {
             $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot');
             $d = Paginator::findMany($query);
@@ -213,7 +213,7 @@ switch ($action) {
         if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
             $msg .= Lang::T('All field is required') . '<br>';
         }
-        if (empty ($radius)) {
+        if (empty($radius)) {
             if ($routers == '') {
                 $msg .= Lang::T('All field is required') . '<br>';
             }
@@ -245,10 +245,41 @@ switch ($action) {
             $radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
             $rate = trim($rate . " " . $b['burst']);
 
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
+
+            // Create new plan
             $d = ORM::for_table('tbl_plans')->create();
             $d->name_plan = $name;
             $d->id_bw = $id_bw;
-            $d->price = $price;
+            $d->price = $price_with_tax; // Set price with or without tax based on configuration
             $d->type = 'Hotspot';
             $d->typebp = $typebp;
             $d->plan_type = $plan_type;
@@ -260,7 +291,7 @@ switch ($action) {
             $d->validity = $validity;
             $d->validity_unit = $validity_unit;
             $d->shared_users = $sharedusers;
-            if (!empty ($radius)) {
+            if (!empty($radius)) {
                 $d->is_radius = 1;
                 $d->routers = '';
             } else {
@@ -280,7 +311,7 @@ switch ($action) {
                 $mikrotik = Mikrotik::info($routers);
                 $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
                 Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
-                if (!empty ($pool_expired)) {
+                if (!empty($pool_expired)) {
                     Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
                 }
             }
@@ -356,14 +387,44 @@ switch ($action) {
                 $mikrotik = Mikrotik::info($routers);
                 $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
                 Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
-                if (!empty ($pool_expired)) {
+                if (!empty($pool_expired)) {
                     Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
                 }
             }
 
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
+
             $d->name_plan = $name;
             $d->id_bw = $id_bw;
-            $d->price = $price;
+            $d->price = $price_with_tax; // Set price with or without tax based on configuration
             $d->typebp = $typebp;
             $d->limit_type = $limit_type;
             $d->time_limit = $time_limit;
@@ -487,7 +548,7 @@ switch ($action) {
         if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
             $msg .= Lang::T('All field is required') . '<br>';
         }
-        if (empty ($radius)) {
+        if (empty($radius)) {
             if ($routers == '') {
                 $msg .= Lang::T('All field is required') . '<br>';
             }
@@ -518,16 +579,47 @@ switch ($action) {
             $radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
             $rate = trim($rate . " " . $b['burst']);
 
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
+
+
             $d = ORM::for_table('tbl_plans')->create();
             $d->type = 'PPPOE';
             $d->name_plan = $name;
             $d->id_bw = $id_bw;
-            $d->price = $price;
+            $d->price = $price_with_tax;
             $d->plan_type = $plan_type;
             $d->validity = $validity;
             $d->validity_unit = $validity_unit;
             $d->pool = $pool;
-            if (!empty ($radius)) {
+            if (!empty($radius)) {
                 $d->is_radius = 1;
                 $d->routers = '';
             } else {
@@ -547,7 +639,7 @@ switch ($action) {
                 $mikrotik = Mikrotik::info($routers);
                 $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
                 Mikrotik::addPpoePlan($client, $name, $pool, $rate);
-                if (!empty ($pool_expired)) {
+                if (!empty($pool_expired)) {
                     Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
                 }
             }
@@ -616,14 +708,44 @@ switch ($action) {
                 $mikrotik = Mikrotik::info($routers);
                 $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
                 Mikrotik::setPpoePlan($client, $name, $pool, $rate);
-                if (!empty ($pool_expired)) {
+                if (!empty($pool_expired)) {
                     Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
                 }
             }
 
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
+
             $d->name_plan = $name;
             $d->id_bw = $id_bw;
-            $d->price = $price;
+            $d->price = $price_with_tax;
             $d->plan_type = $plan_type;
             $d->validity = $validity;
             $d->validity_unit = $validity_unit;
@@ -700,8 +822,37 @@ switch ($action) {
         }
         run_hook('edit_ppoe'); #HOOK
         if ($msg == '') {
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
             $d->name_plan = $name;
-            $d->price = $price;
+            $d->price = $price_with_tax;
             $d->enabled = $enabled;
             $d->prepaid = 'yes';
             $d->save();
@@ -730,11 +881,43 @@ switch ($action) {
         }
         run_hook('add_ppoe'); #HOOK
         if ($msg == '') {
+
+            // Check if tax is enabled in config
+            $tax_enable = isset($config['enable_tax']) ? $config['enable_tax'] : 'no';
+
+            // Default tax rate
+            $default_tax_rate = 0.01; // Default tax rate 1%
+
+            // Check if tax rate is set to custom in config
+            $tax_rate_setting = isset($config['tax_rate']) ? $config['tax_rate'] : $default_tax_rate;
+
+            // Check if tax rate is custom
+            if ($tax_rate_setting === 'custom') {
+                // Check if custom tax rate is set in config
+                $custom_tax_rate = isset($config['custom_tax_rate']) ? (float)$config['custom_tax_rate'] : $default_tax_rate;
+                // Convert custom tax rate to decimal
+                $custom_tax_rate_decimal = $custom_tax_rate / 100;
+                $tax_rate = $custom_tax_rate_decimal;
+            } else {
+                // Use tax rate
+                $tax_rate = $tax_rate_setting;
+            }
+
+
+            // Calculate the new price with tax if tax is enabled
+            if ($tax_enable === 'yes') {
+                $price_with_tax = $price + ($price * $tax_rate);
+            } else {
+                // If tax is not enabled, use the original price
+                $price_with_tax = $price;
+            }
+
+
             $d = ORM::for_table('tbl_plans')->create();
             $d->type = 'Balance';
             $d->name_plan = $name;
             $d->id_bw = 0;
-            $d->price = $price;
+            $d->price = $price_with_tax;
             $d->validity = 0;
             $d->validity_unit = 'Months';
             $d->routers = '';
diff --git a/system/controllers/settings.php b/system/controllers/settings.php
index ad978029..d4ed3ad1 100644
--- a/system/controllers/settings.php
+++ b/system/controllers/settings.php
@@ -119,7 +119,7 @@ switch ($action) {
                     die();
                 }
             }
-            // save all settings
+            // Save all settings including tax system
             foreach ($_POST as $key => $value) {
                 $d = ORM::for_table('tbl_appconfig')->where('setting', $key)->find_one();
                 if ($d) {
@@ -133,6 +133,33 @@ switch ($action) {
                 }
             }
 
+            // Handle tax system separately
+            $enable_tax = isset($_POST['enable_tax']) ? $_POST['enable_tax'] : 'no';
+            $tax_rate = isset($_POST['tax_rate']) ? $_POST['tax_rate'] : '0.01'; // Default tax rate 1%
+
+            // Save or update tax system settings
+            $d_tax_enable = ORM::for_table('tbl_appconfig')->where('setting', 'enable_tax')->find_one();
+            if ($d_tax_enable) {
+                $d_tax_enable->value = $enable_tax;
+                $d_tax_enable->save();
+            } else {
+                $d_tax_enable = ORM::for_table('tbl_appconfig')->create();
+                $d_tax_enable->setting = 'enable_tax';
+                $d_tax_enable->value = $enable_tax;
+                $d_tax_enable->save();
+            }
+
+            $d_tax_rate = ORM::for_table('tbl_appconfig')->where('setting', 'tax_rate')->find_one();
+            if ($d_tax_rate) {
+                $d_tax_rate->value = $tax_rate;
+                $d_tax_rate->save();
+            } else {
+                $d_tax_rate = ORM::for_table('tbl_appconfig')->create();
+                $d_tax_rate->setting = 'tax_rate';
+                $d_tax_rate->value = $tax_rate;
+                $d_tax_rate->save();
+            }
+
             //checkbox
             $checks = ['hide_mrc', 'hide_tms', 'hide_aui', 'hide_al', 'hide_uet', 'hide_vs', 'hide_pg'];
             foreach ($checks as $check) {
diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl
index d0541ae0..e655d039 100644
--- a/ui/ui/app-settings.tpl
+++ b/ui/ui/app-settings.tpl
@@ -553,6 +553,69 @@
                         <p class="help-block col-md-4">{Lang::T('The method which OTP will be sent to user')}</p>
                     </div>
                 </div>
+
+                <div class="panel-heading">
+                    <div class="btn-group pull-right">
+                        <button class="btn btn-primary btn-xs" title="save" type="submit">
+                            <span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>
+                        </button>
+                    </div>
+                    {Lang::T('Tax System')}
+                </div>
+                <div class="panel-body">
+                    <div class="form-group">
+                        <label class="col-md-2 control-label">{Lang::T('Enable Tax System')}</label>
+                        <div class="col-md-6">
+                            <select name="enable_tax" id="enable_tax" class="form-control">
+                                <option value="no" {if $_c['enable_tax']=='no' }selected="selected" {/if}>
+                                    {Lang::T('No')}
+                                </option>
+                                <option value="yes" {if $_c['enable_tax']=='yes' }selected="selected" {/if}>
+                                    {Lang::T('Yes')}
+                                </option>
+                            </select>
+                        </div>
+                        <p class="help-block col-md-4">{Lang::T('Tax will be calculated in Internet Plan Price')}</p>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-md-2 control-label">{Lang::T('Tax Rate')}</label>
+                        <div class="col-md-6">
+                            <select name="tax_rate" id="tax_rate" class="form-control">
+                                <option value="0.005" {if $_c['tax_rate']=='0.005' }selected="selected" {/if}>
+                                    {Lang::T('0.5%')}
+                                </option>
+                                <option value="0.01" {if $_c['tax_rate']=='0.01' }selected="selected" {/if}>
+                                    {Lang::T('1%')}
+                                </option>
+                                <option value="0.015" {if $_c['tax_rate']=='0.015' }selected="selected" {/if}>
+                                    {Lang::T('1.5%')}
+                                </option>
+                                <option value="0.02" {if $_c['tax_rate']=='0.02' }selected="selected" {/if}>
+                                    {Lang::T('2%')}
+                                </option>
+                                <option value="0.05" {if $_c['tax_rate']=='0.05' }selected="selected" {/if}>
+                                    {Lang::T('5%')}
+                                </option>
+                                <option value="0.1" {if $_c['tax_rate']=='0.1' }selected="selected" {/if}>
+                                    {Lang::T('10%')}
+                                </option>
+                                <!-- Custom tax rate option -->
+                                <option value="custom" {if $_c['tax_rate']=='custom' }selected="selected" {/if}>{Lang::T('Custom')}</option>
+                            </select>
+                        </div>
+                        <p class="help-block col-md-4">{Lang::T('Tax Rates in percentage')}</p>
+                    </div>
+                    <!-- Custom tax rate input field (initially hidden) -->
+                    <div class="form-group" id="customTaxRate" style="display: none;">
+                        <label class="col-md-2 control-label">{Lang::T('Custom Tax Rate')}</label>
+                        <div class="col-md-6">
+                            <input type="text" value="{$_c['custom_tax_rate']}" class="form-control" name="custom_tax_rate" id="custom_tax_rate"
+                                   placeholder="{Lang::T('Enter Custom Tax Rate')}">
+                        </div>
+                        <p class="help-block col-md-4">{Lang::T('Enter the custom tax rate (e.g., 3.75 for 3.75%)')}</p>
+                    </div>
+                </div>
+                
                 {* <div class="panel-heading" id="envato">
                     <div class="btn-group pull-right">
                         <button class="btn btn-primary btn-xs" title="save" type="submit"><span
@@ -635,4 +698,26 @@ add dst-host=*.{$_domain}</pre>
         window.location.href = '{$_url}settings/app&testTg=test';
     }
 </script>
+
+<script>
+    document.addEventListener("DOMContentLoaded", function() {
+        // Function to toggle visibility of custom tax rate input field
+        function toggleCustomTaxRate() {
+            var taxRateSelect = document.getElementById("tax_rate");
+            var customTaxRateInput = document.getElementById("customTaxRate");
+
+            if (taxRateSelect.value === "custom") {
+                customTaxRateInput.style.display = "block";
+            } else {
+                customTaxRateInput.style.display = "none";
+            }
+        }
+
+        // Call the function when the page loads
+        toggleCustomTaxRate();
+
+        // Call the function whenever the tax rate dropdown value changes
+        document.getElementById("tax_rate").addEventListener("change", toggleCustomTaxRate);
+    });
+</script>
 {include file="sections/footer.tpl"}
\ No newline at end of file
diff --git a/ui/ui/balance-add.tpl b/ui/ui/balance-add.tpl
index d2116352..d74efbfb 100644
--- a/ui/ui/balance-add.tpl
+++ b/ui/ui/balance-add.tpl
@@ -32,6 +32,16 @@
                                 <input type="number" class="form-control" name="price" required>
                             </div>
                         </div>
+                        {if $_c['enable_tax'] == 'yes'}
+                        {if $_c['tax_rate'] == 'custom'}
+                        <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {else}
+                        <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {/if}
+                        {/if}
+
                     </div>
 
                     <div class="form-group">
diff --git a/ui/ui/balance-edit.tpl b/ui/ui/balance-edit.tpl
index 4ca8bd8e..a8bc0ecf 100644
--- a/ui/ui/balance-edit.tpl
+++ b/ui/ui/balance-edit.tpl
@@ -32,6 +32,16 @@
                                         <input type="number" class="form-control" name="price" value="{$d['price']}" required>
                                     </div>
                                 </div>
+                                {if $_c['enable_tax'] == 'yes'}
+                                {if $_c['tax_rate'] == 'custom'}
+                                <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                                    will be added')}</p>
+                                {else}
+                                <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                                    will be added')}</p>
+                                {/if}
+                                {/if}
+        
                             </div>
 
                             <div class="form-group">
diff --git a/ui/ui/hotspot-add.tpl b/ui/ui/hotspot-add.tpl
index f09ab264..cccb342c 100644
--- a/ui/ui/hotspot-add.tpl
+++ b/ui/ui/hotspot-add.tpl
@@ -114,6 +114,16 @@
                                 <input type="number" class="form-control" name="price" required>
                             </div>
                         </div>
+                        {if $_c['enable_tax'] == 'yes'}
+                        {if $_c['tax_rate'] == 'custom'}
+                        <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {else}
+                        <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {/if}
+                        {/if}
+
                     </div>
                     <div class="form-group">
                         <label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
diff --git a/ui/ui/hotspot-edit.tpl b/ui/ui/hotspot-edit.tpl
index 1e502239..4ce93f3d 100644
--- a/ui/ui/hotspot-edit.tpl
+++ b/ui/ui/hotspot-edit.tpl
@@ -133,6 +133,16 @@
                                 <input type="number" class="form-control" name="price" value="{$d['price']}" required>
                             </div>
                         </div>
+                        {if $_c['enable_tax'] == 'yes'}
+                        {if $_c['tax_rate'] == 'custom'}
+                        <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {else}
+                        <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {/if}
+                        {/if}
+
                     </div>
                     <div class="form-group">
                         <label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
diff --git a/ui/ui/pppoe-add.tpl b/ui/ui/pppoe-add.tpl
index ea5a9c52..110d6e09 100644
--- a/ui/ui/pppoe-add.tpl
+++ b/ui/ui/pppoe-add.tpl
@@ -64,6 +64,15 @@
                                 <input type="number" class="form-control" name="price" required>
                             </div>
                         </div>
+                        {if $_c['enable_tax'] == 'yes'}
+                        {if $_c['tax_rate'] == 'custom'}
+                        <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {else}
+                        <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {/if}
+                        {/if}
                     </div>
                     <div class="form-group">
                         <label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
diff --git a/ui/ui/pppoe-edit.tpl b/ui/ui/pppoe-edit.tpl
index 8edd5753..c3e423bf 100644
--- a/ui/ui/pppoe-edit.tpl
+++ b/ui/ui/pppoe-edit.tpl
@@ -68,6 +68,16 @@
                                 <input type="number" class="form-control" name="price" required value="{$d['price']}">
                             </div>
                         </div>
+                        {if $_c['enable_tax'] == 'yes'}
+                        {if $_c['tax_rate'] == 'custom'}
+                        <p class="help-block col-md-4">{number_format($_c['custom_tax_rate'], 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {else}
+                        <p class="help-block col-md-4">{number_format($_c['tax_rate'] * 100, 2)} % {Lang::T('Tax Rates
+                            will be added')}</p>
+                        {/if}
+                        {/if}
+
                     </div>
                     <div class="form-group">
                         <label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>

From eff79df39a5a4b47a4545a78e5cb8765aa3fdb50 Mon Sep 17 00:00:00 2001
From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com>
Date: Sat, 13 Apr 2024 18:19:09 +0100
Subject: [PATCH 2/2] Update customers.tpl

add length Menu  5, 10, 25, 50, 100 and All, as suggested by one of our member and also use 5 as default page length to make the page fit the screen when loaded
---
 ui/ui/customers.tpl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl
index 4926ee92..fd4d6c76 100644
--- a/ui/ui/customers.tpl
+++ b/ui/ui/customers.tpl
@@ -106,7 +106,9 @@
 
     $j(document).ready(function () {
         $j('#customerTable').DataTable({
-            "pagingType": "full_numbers"
+            "pagingType": "full_numbers",
+            "lengthMenu": [ [5, 10, 25, 50, 100, -1], [5, 10, 25, 50, 100, "All"] ],
+            "pageLength": 5
         });
     });
 </script>