Merge pull request #173 from Focuslinkstech/Development
Update: Tax System
This commit is contained in:
commit
6955d3fd8b
@ -60,7 +60,7 @@ switch ($action) {
|
|||||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||||
Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
|
Mikrotik::addHotspotPlan($client, $plan['name_plan'], $plan['shared_users'], $rate);
|
||||||
$log .= "DONE : $plan[name_plan], $plan[shared_users], $rate<br>";
|
$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']);
|
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired']);
|
||||||
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ switch ($action) {
|
|||||||
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
$rate = $plan['rate_up'] . $unitup . "/" . $plan['rate_down'] . $unitdown;
|
||||||
Mikrotik::addPpoePlan($client, $plan['name_plan'], $plan['pool'], $rate);
|
Mikrotik::addPpoePlan($client, $plan['name_plan'], $plan['pool'], $rate);
|
||||||
$log .= "DONE : $plan[name_plan], $plan[pool], $rate<br>";
|
$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');
|
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $plan['pool_expired'], $plan['pool_expired'], '512K/512K');
|
||||||
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
$log .= "DONE Expired : EXPIRED NUXBILL $plan[pool_expired]<br>";
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ switch ($action) {
|
|||||||
$name = _post('name');
|
$name = _post('name');
|
||||||
if ($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 . '%');
|
$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 {
|
} else {
|
||||||
$query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot');
|
$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);
|
$d = Paginator::findMany($query);
|
||||||
@ -213,7 +213,7 @@ switch ($action) {
|
|||||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '') {
|
||||||
$msg .= Lang::T('All field is required') . '<br>';
|
$msg .= Lang::T('All field is required') . '<br>';
|
||||||
}
|
}
|
||||||
if (empty ($radius)) {
|
if (empty($radius)) {
|
||||||
if ($routers == '') {
|
if ($routers == '') {
|
||||||
$msg .= Lang::T('All field is required') . '<br>';
|
$msg .= Lang::T('All field is required') . '<br>';
|
||||||
}
|
}
|
||||||
@ -245,10 +245,41 @@ switch ($action) {
|
|||||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||||
$rate = trim($rate . " " . $b['burst']);
|
$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 = ORM::for_table('tbl_plans')->create();
|
||||||
$d->name_plan = $name;
|
$d->name_plan = $name;
|
||||||
$d->id_bw = $id_bw;
|
$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->type = 'Hotspot';
|
||||||
$d->typebp = $typebp;
|
$d->typebp = $typebp;
|
||||||
$d->plan_type = $plan_type;
|
$d->plan_type = $plan_type;
|
||||||
@ -260,7 +291,7 @@ switch ($action) {
|
|||||||
$d->validity = $validity;
|
$d->validity = $validity;
|
||||||
$d->validity_unit = $validity_unit;
|
$d->validity_unit = $validity_unit;
|
||||||
$d->shared_users = $sharedusers;
|
$d->shared_users = $sharedusers;
|
||||||
if (!empty ($radius)) {
|
if (!empty($radius)) {
|
||||||
$d->is_radius = 1;
|
$d->is_radius = 1;
|
||||||
$d->routers = '';
|
$d->routers = '';
|
||||||
} else {
|
} else {
|
||||||
@ -280,7 +311,7 @@ switch ($action) {
|
|||||||
$mikrotik = Mikrotik::info($routers);
|
$mikrotik = Mikrotik::info($routers);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
|
Mikrotik::addHotspotPlan($client, $name, $sharedusers, $rate);
|
||||||
if (!empty ($pool_expired)) {
|
if (!empty($pool_expired)) {
|
||||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
|
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,14 +387,44 @@ switch ($action) {
|
|||||||
$mikrotik = Mikrotik::info($routers);
|
$mikrotik = Mikrotik::info($routers);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
|
Mikrotik::setHotspotPlan($client, $name, $sharedusers, $rate);
|
||||||
if (!empty ($pool_expired)) {
|
if (!empty($pool_expired)) {
|
||||||
Mikrotik::setHotspotExpiredPlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $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->name_plan = $name;
|
||||||
$d->id_bw = $id_bw;
|
$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->typebp = $typebp;
|
||||||
$d->limit_type = $limit_type;
|
$d->limit_type = $limit_type;
|
||||||
$d->time_limit = $time_limit;
|
$d->time_limit = $time_limit;
|
||||||
@ -487,7 +548,7 @@ switch ($action) {
|
|||||||
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $pool == '') {
|
||||||
$msg .= Lang::T('All field is required') . '<br>';
|
$msg .= Lang::T('All field is required') . '<br>';
|
||||||
}
|
}
|
||||||
if (empty ($radius)) {
|
if (empty($radius)) {
|
||||||
if ($routers == '') {
|
if ($routers == '') {
|
||||||
$msg .= Lang::T('All field is required') . '<br>';
|
$msg .= Lang::T('All field is required') . '<br>';
|
||||||
}
|
}
|
||||||
@ -518,16 +579,47 @@ switch ($action) {
|
|||||||
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
$radiusRate = $b['rate_up'] . $radup . '/' . $b['rate_down'] . $raddown;
|
||||||
$rate = trim($rate . " " . $b['burst']);
|
$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 = ORM::for_table('tbl_plans')->create();
|
||||||
$d->type = 'PPPOE';
|
$d->type = 'PPPOE';
|
||||||
$d->name_plan = $name;
|
$d->name_plan = $name;
|
||||||
$d->id_bw = $id_bw;
|
$d->id_bw = $id_bw;
|
||||||
$d->price = $price;
|
$d->price = $price_with_tax;
|
||||||
$d->plan_type = $plan_type;
|
$d->plan_type = $plan_type;
|
||||||
$d->validity = $validity;
|
$d->validity = $validity;
|
||||||
$d->validity_unit = $validity_unit;
|
$d->validity_unit = $validity_unit;
|
||||||
$d->pool = $pool;
|
$d->pool = $pool;
|
||||||
if (!empty ($radius)) {
|
if (!empty($radius)) {
|
||||||
$d->is_radius = 1;
|
$d->is_radius = 1;
|
||||||
$d->routers = '';
|
$d->routers = '';
|
||||||
} else {
|
} else {
|
||||||
@ -547,7 +639,7 @@ switch ($action) {
|
|||||||
$mikrotik = Mikrotik::info($routers);
|
$mikrotik = Mikrotik::info($routers);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::addPpoePlan($client, $name, $pool, $rate);
|
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');
|
Mikrotik::setPpoePlan($client, 'EXPIRED NUXBILL ' . $pool_expired, $pool_expired, '512K/512K');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,14 +708,44 @@ switch ($action) {
|
|||||||
$mikrotik = Mikrotik::info($routers);
|
$mikrotik = Mikrotik::info($routers);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
Mikrotik::setPpoePlan($client, $name, $pool, $rate);
|
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');
|
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->name_plan = $name;
|
||||||
$d->id_bw = $id_bw;
|
$d->id_bw = $id_bw;
|
||||||
$d->price = $price;
|
$d->price = $price_with_tax;
|
||||||
$d->plan_type = $plan_type;
|
$d->plan_type = $plan_type;
|
||||||
$d->validity = $validity;
|
$d->validity = $validity;
|
||||||
$d->validity_unit = $validity_unit;
|
$d->validity_unit = $validity_unit;
|
||||||
@ -700,8 +822,37 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
run_hook('edit_ppoe'); #HOOK
|
run_hook('edit_ppoe'); #HOOK
|
||||||
if ($msg == '') {
|
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->name_plan = $name;
|
||||||
$d->price = $price;
|
$d->price = $price_with_tax;
|
||||||
$d->enabled = $enabled;
|
$d->enabled = $enabled;
|
||||||
$d->prepaid = 'yes';
|
$d->prepaid = 'yes';
|
||||||
$d->save();
|
$d->save();
|
||||||
@ -730,11 +881,43 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
run_hook('add_ppoe'); #HOOK
|
run_hook('add_ppoe'); #HOOK
|
||||||
if ($msg == '') {
|
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 = ORM::for_table('tbl_plans')->create();
|
||||||
$d->type = 'Balance';
|
$d->type = 'Balance';
|
||||||
$d->name_plan = $name;
|
$d->name_plan = $name;
|
||||||
$d->id_bw = 0;
|
$d->id_bw = 0;
|
||||||
$d->price = $price;
|
$d->price = $price_with_tax;
|
||||||
$d->validity = 0;
|
$d->validity = 0;
|
||||||
$d->validity_unit = 'Months';
|
$d->validity_unit = 'Months';
|
||||||
$d->routers = '';
|
$d->routers = '';
|
||||||
|
@ -119,7 +119,7 @@ switch ($action) {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// save all settings
|
// Save all settings including tax system
|
||||||
foreach ($_POST as $key => $value) {
|
foreach ($_POST as $key => $value) {
|
||||||
$d = ORM::for_table('tbl_appconfig')->where('setting', $key)->find_one();
|
$d = ORM::for_table('tbl_appconfig')->where('setting', $key)->find_one();
|
||||||
if ($d) {
|
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
|
//checkbox
|
||||||
$checks = ['hide_mrc', 'hide_tms', 'hide_aui', 'hide_al', 'hide_uet', 'hide_vs', 'hide_pg'];
|
$checks = ['hide_mrc', 'hide_tms', 'hide_aui', 'hide_al', 'hide_uet', 'hide_vs', 'hide_pg'];
|
||||||
foreach ($checks as $check) {
|
foreach ($checks as $check) {
|
||||||
|
@ -553,6 +553,69 @@
|
|||||||
<p class="help-block col-md-4">{Lang::T('The method which OTP will be sent to user')}</p>
|
<p class="help-block col-md-4">{Lang::T('The method which OTP will be sent to user')}</p>
|
||||||
</div>
|
</div>
|
||||||
</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="panel-heading" id="envato">
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
|
<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';
|
window.location.href = '{$_url}settings/app&testTg=test';
|
||||||
}
|
}
|
||||||
</script>
|
</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"}
|
{include file="sections/footer.tpl"}
|
@ -32,6 +32,16 @@
|
|||||||
<input type="number" class="form-control" name="price" required>
|
<input type="number" class="form-control" name="price" required>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -32,6 +32,16 @@
|
|||||||
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -106,7 +106,9 @@
|
|||||||
|
|
||||||
$j(document).ready(function () {
|
$j(document).ready(function () {
|
||||||
$j('#customerTable').DataTable({
|
$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>
|
</script>
|
||||||
|
@ -114,6 +114,16 @@
|
|||||||
<input type="number" class="form-control" name="price" required>
|
<input type="number" class="form-control" name="price" required>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
|
<label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
|
||||||
|
@ -133,6 +133,16 @@
|
|||||||
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
<input type="number" class="form-control" name="price" value="{$d['price']}" required>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
|
<label class="col-md-2 control-label">{Lang::T('Shared Users')}</label>
|
||||||
|
@ -64,6 +64,15 @@
|
|||||||
<input type="number" class="form-control" name="price" required>
|
<input type="number" class="form-control" name="price" required>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
|
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
|
||||||
|
@ -68,6 +68,16 @@
|
|||||||
<input type="number" class="form-control" name="price" required value="{$d['price']}">
|
<input type="number" class="form-control" name="price" required value="{$d['price']}">
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
|
<label class="col-md-2 control-label">{Lang::T('Plan Validity')}</label>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user