diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php
index 053b9471..7fc0db72 100755
--- a/application/controllers/Gestion.php
+++ b/application/controllers/Gestion.php
@@ -1778,8 +1778,9 @@ class Gestion extends CI_Controller
if($this->isLogged()) {
if(isset($_POST)) {
$idConfig = $_POST['id_config'];
- $taxes = isset($_POST['taxes']) ? $_POST['taxes'] : null ;
- $this->insertTaxes($taxes, $idConfig);
+ $taxes = isset($_POST['taxes']) ? $_POST['taxes'] : null;
+ $categorie = isset($_POST['categorie']) ? $_POST['categorie'] : 'wallet';
+ $this->insertTaxes($taxes, $idConfig, $categorie);
$res = true;
if ($res) {
@@ -1802,7 +1803,7 @@ class Gestion extends CI_Controller
foreach ($palier as $p) {
$array = json_decode(json_encode($p), true);
$row = [];
- foreach ($array as $key => $value){
+ foreach ($array as $key => $value) {
$row[] = $value;
}
$this->user_model->addPalierConfigWallet($name, $idConfig, $row[0], $row[1], $row[2]);
@@ -1810,21 +1811,25 @@ class Gestion extends CI_Controller
}
}
- private function insertTaxes($palier , $idConfig){
+ private function insertTaxes($palier, $idConfig, $categorie)
+ {
- $exist = $this->user_model->getTaxes($idConfig);
- if($exist){
- $this->user_model->deleteTaxes($idConfig);
+ $exist = $this->user_model->getTaxes($idConfig, $categorie);
+ if ($exist) {
+ $this->user_model->deleteTaxes($idConfig, $categorie);
}
- if($palier) {
+ if ($palier) {
foreach ($palier as $p) {
$array = json_decode(json_encode($p), true);
$row = [];
- foreach ($array as $key => $value){
+ foreach ($array as $key => $value) {
$row[] = $value;
}
- $this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], $row[3]);
+ if ($categorie == 'wallet')
+ $this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], $row[3]);
+ else
+ $this->user_model->addTaxe($idConfig, $row[0], $row[1], $row[2], 'national', $categorie);
}
}
}
diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php
index 8a3cc412..0a4b86a0 100755
--- a/application/controllers/Hyperviseur_dash.php
+++ b/application/controllers/Hyperviseur_dash.php
@@ -1192,6 +1192,9 @@ class Hyperviseur_dash extends CI_Controller
if ($this->isLogged()) {
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
+ $data['idConfig'] = $data['hasWallet']->first_row()->id;
+ $data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
+ $data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
$data['active'] = "nano_credit";
$data['alert'] = "";
$data['game_pays'] = $this->user_model->getGameCountry();
@@ -1231,6 +1234,44 @@ class Hyperviseur_dash extends CI_Controller
}
}
}
+
+ public function saveNanoCreditRates()
+ {
+ if ($this->isLogged()) {
+ if (isset($_POST)) {
+ $idConfig = $_POST['id_config'];
+ $rates = isset($_POST['rates']) ? $_POST['rates'] : null;
+ $this->insertNanoCreditRates($rates, $idConfig);
+ $res = true;
+
+ if ($res) {
+ echo json_encode("200");
+ } else {
+ echo json_encode("500");
+ }
+ }
+ }
+ }
+
+ private function insertNanoCreditRates($palier, $idConfig)
+ {
+
+ $exist = $this->user_model->getNanoCreditRates($idConfig);
+ if ($exist) {
+ $this->user_model->deleteNanoCreditRates($idConfig);
+ }
+
+ if ($palier) {
+ foreach ($palier as $p) {
+ $array = json_decode(json_encode($p), true);
+ $row = [];
+ foreach ($array as $key => $value) {
+ $row[] = $value;
+ }
+ $this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1]);
+ }
+ }
+ }
}
class Operation
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index a1d89bb5..593c1314 100755
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -456,4 +456,16 @@ $lang['credit_limit'] = 'Credit limit';
$lang['nano_credit_removal'] = 'Removal of nano credit';
$lang['set_credit_limit'] = 'Set the credit limit';
$lang['nano_credit_deleted'] = 'Nano credit deleted';
+$lang['users_groups'] = 'Customer groups';
+$lang['nano_credit_history'] = 'History of nano credits';
+$lang['group_code'] = 'Group code';
+$lang['creator'] = 'Creator';
+$lang['credit_limit'] = 'Credit limit';
+$lang['wallet_management'] = 'Wallet management';
+$lang['nano_credit_management'] = 'Management of nano credit';
+$lang['change_interest_rates'] = 'Change interest rates';
+$lang['interest_rates'] = 'Interest rate';
+$lang['interest_rates_period'] = 'Period (in months)';
+$lang['nano_credit_update'] = 'Update nano credit';
+$lang['transaction_nano_credit'] = 'Taxes on nano credit';
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index 7224cb58..4b0e2d39 100755
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -475,4 +475,9 @@ $lang['creator'] = 'Createur';
$lang['credit_limit'] = 'Limite de credit';
$lang['wallet_management'] = 'Gestion du wallet';
$lang['nano_credit_management'] = 'Gestion du nano credit';
+$lang['change_interest_rates'] = 'Modifier les taux d\'intérêts';
+$lang['interest_rates'] = 'Taux d\'intérêts';
+$lang['interest_rates_period'] = 'Période (en mois)';
+$lang['nano_credit_update'] = 'Mise à jour du nano crédit';
+$lang['transaction_nano_credit'] = 'Taxes sur le nano crédit';
?>
diff --git a/application/models/User_model.php b/application/models/User_model.php
index a20d47af..2f8806a1 100755
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -2263,47 +2263,53 @@ class User_model extends CI_Model
}
// Wallet ilink
- public function addPalierConfigWallet($type , $idConfig ,$min, $max ,$taux){
+ public function addPalierConfigWallet($type, $idConfig, $min, $max, $taux)
+ {
$sql = "INSERT INTO `paliersConfigWallet` (`type`, `min`, `max`, `taux`, `idConfig`) VALUES (?,?,?,?,?);";
- $query = $this->db->query($sql , array($type,$min, $max , $taux ,$idConfig));
- return $query;
- }
-
- public function addTaxe($idConfig ,$nom, $type ,$valeur , $destination){
- $sql = "INSERT INTO `taxes` (`nom`, `type`, `valeur`, `destination`, `idConfig`) VALUES (?,?,?,?,?);";
- $query = $this->db->query($sql , array($nom,$type, $valeur , $destination ,$idConfig));
+ $query = $this->db->query($sql, array($type, $min, $max, $taux, $idConfig));
return $query;
}
- public function updatePalierConfigWallet($id ,$min , $max ,$taux){
+ public function addTaxe($idConfig, $nom, $type, $valeur, $destination, $categorie = 'wallet')
+ {
+ $sql = "INSERT INTO `taxes` (`nom`, `type`, `valeur`, `destination`,`categorie`, `idConfig`) VALUES (?,?,?,?,?,?);";
+ $query = $this->db->query($sql, array($nom, $type, $valeur, $destination, $categorie, $idConfig));
+ return $query;
+ }
+
+ public function updatePalierConfigWallet($id, $min, $max, $taux)
+ {
$sql = "UPDATE `paliersConfigWallet` SET `min` = ? , `max` = ? , `taux` = ? WHERE (`id` = ?);";
- $query = $this->db->query($sql , array($min, $max , $taux , $id));
+ $query = $this->db->query($sql, array($min, $max, $taux, $id));
return $query;
}
- public function getPalierConfigWallet($type , $idConfig){
+ public function getPalierConfigWallet($type, $idConfig)
+ {
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`type` = ? AND `idConfig` = ? );";
- $query = $this->db->query($sql , array($type,$idConfig));
- if($query->num_rows()>0){
+ $query = $this->db->query($sql, array($type, $idConfig));
+ if ($query->num_rows() > 0) {
return $query;
- }else{
+ } else {
return false;
}
}
- public function getTaxes($idConfig){
- $sql = "SELECT * FROM `taxes` WHERE (`idConfig` = ? );";
- $query = $this->db->query($sql , array($idConfig));
- if($query->num_rows()>0){
+ public function getTaxes($idConfig, $categorie = 'wallet')
+ {
+ $sql = "SELECT * FROM `taxes` WHERE (`idConfig` = ? AND `categorie` = ? );";
+ $query = $this->db->query($sql, array($idConfig, $categorie));
+ if ($query->num_rows() > 0) {
return $query;
- }else{
+ } else {
return false;
}
}
- public function getOnePalierConfigWallet($id){
+ public function getOnePalierConfigWallet($id)
+ {
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`id` = ?);";
- $query = $this->db->query($sql , array($id));
+ $query = $this->db->query($sql, array($id));
if($query->num_rows()>0){
return $query;
}else{
@@ -2311,23 +2317,26 @@ class User_model extends CI_Model
}
}
- public function deletePalierConfigWallet($type , $idConfig){
+ public function deletePalierConfigWallet($type, $idConfig)
+ {
$sql = "DELETE FROM `paliersConfigWallet` WHERE (`type` = ? AND `idConfig` = ? );";
- $query = $this->db->query($sql , array($type,$idConfig));
+ $query = $this->db->query($sql, array($type, $idConfig));
return $query;
}
- public function deleteTaxes($idConfig){
- $sql = "DELETE FROM `taxes` WHERE (`idConfig` = ? );";
- $query = $this->db->query($sql , array($idConfig));
+ public function deleteTaxes($idConfig, $categorie = 'wallet')
+ {
+ $sql = "DELETE FROM `taxes` WHERE (`idConfig` = ? AND `categorie` = ? );";
+ $query = $this->db->query($sql, array($idConfig, $categorie));
return $query;
}
- public function updateConfigWalletIlink_a_s_c($taux_ag_s_c,$taux_sup_s_c,$taux_hyp_s_c,$idConfig){
+ public function updateConfigWalletIlink_a_s_c($taux_ag_s_c, $taux_sup_s_c, $taux_hyp_s_c, $idConfig)
+ {
$sql = "UPDATE `configWallet` SET `taux_com_ag_envoi_cash` = ?, `taux_com_sup_envoi_cash` = ?, `taux_com_hyp_envoi_cash` = ? WHERE (`id` = ?);";
- $query = $this->db->query($sql , array($taux_ag_s_c,$taux_sup_s_c,$taux_hyp_s_c,$idConfig));
+ $query = $this->db->query($sql, array($taux_ag_s_c, $taux_sup_s_c, $taux_hyp_s_c, $idConfig));
return $query;
}
@@ -2693,4 +2702,29 @@ class User_model extends CI_Model
return false;
}
}
+
+ public function getNanoCreditRates($idConfig)
+ {
+ $sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );";
+ $query = $this->db->query($sql, array($idConfig));
+ if ($query->num_rows() > 0) {
+ return $query;
+ } else {
+ return false;
+ }
+ }
+
+ public function deleteNanoCreditRates($idConfig)
+ {
+ $sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? );";
+ $query = $this->db->query($sql, array($idConfig));
+ return $query;
+ }
+
+ public function addNanoCreditRates($idConfig, $duree, $valeur)
+ {
+ $sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig`) VALUES (?,?,?);";
+ $query = $this->db->query($sql, array($duree, $valeur, $idConfig));
+ return $query;
+ }
}
diff --git a/application/views/nano_credit/gestion_nano_credit_hyp.php b/application/views/nano_credit/gestion_nano_credit_hyp.php
index 8c28d303..766d4e88 100755
--- a/application/views/nano_credit/gestion_nano_credit_hyp.php
+++ b/application/views/nano_credit/gestion_nano_credit_hyp.php
@@ -6,7 +6,109 @@
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ lang->line('interest_rates_period'); ?> |
+ lang->line('rate'); ?> |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->duree_mois . " |
+ " . $row->taux . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ lang->line('Nom'); ?> |
+ Type |
+ Valeur |
+
+
+
+ result() as $row) {
+ echo "
+ " . $row->nom . " |
+ " . $row->type . " |
+ " . $row->valeur . " | " . '
+
';
+ }
+ }
+ ?>
+
+
+
+
+
@@ -198,6 +375,140 @@ $context = new \Brick\Money\Context\AutoContext();
+
+
@@ -250,43 +561,7 @@ $context = new \Brick\Money\Context\AutoContext();
});
})
-
+
+