Savings history
This commit is contained in:
parent
1ea5ef2f7b
commit
12536cfcca
|
@ -5,10 +5,11 @@ use Spatie\Async\Pool;
|
||||||
class Gestion extends CI_Controller
|
class Gestion extends CI_Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function _contruct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::_contruct();
|
parent::__construct();
|
||||||
$this->load->model('user_model');
|
$this->load->model('wallet_model');
|
||||||
|
$this->load->model('nano_credit_model');
|
||||||
date_default_timezone_set ($this->session->userdata('timezone'));
|
date_default_timezone_set ($this->session->userdata('timezone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1578,7 +1579,7 @@ class Gestion extends CI_Controller
|
||||||
$data['plr_agent_depot_autre_wallet_national'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
|
$data['plr_agent_depot_autre_wallet_national'] = $this->user_model->getPalierConfigWallet("agent_depot_autre_wallet_national" , $data['idConfig']);
|
||||||
$data['plr_agent_cash_cash_national'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
|
$data['plr_agent_cash_cash_national'] = $this->user_model->getPalierConfigWallet("agent_cash_cash_national", $data['idConfig']);
|
||||||
|
|
||||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig']);
|
||||||
|
|
||||||
$data['taux_u_w_cart'] = $taux->taux_com_user_wallet_carte;
|
$data['taux_u_w_cart'] = $taux->taux_com_user_wallet_carte;
|
||||||
$data['taux_u_c_w'] = $taux->taux_com_user_carte_wallet;
|
$data['taux_u_c_w'] = $taux->taux_com_user_carte_wallet;
|
||||||
|
@ -1897,7 +1898,7 @@ class Gestion extends CI_Controller
|
||||||
private function historique($network_id ,$startDate ,$endDate, $type)
|
private function historique($network_id ,$startDate ,$endDate, $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
$data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ;
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d' ;
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null ;
|
||||||
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ;
|
$data['endDate'] = $endDate ?date($format, strtotime($endDate)): null ;
|
||||||
|
@ -2080,7 +2081,7 @@ class Gestion extends CI_Controller
|
||||||
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
|
$this->historique_nano_credit($data['network_id'], $this->input->get('d'), $this->input->get('f'), $this->input->get('history'));
|
||||||
} else {
|
} else {
|
||||||
$data['groups'] = $this->user_model->getUsersGroups($data['network_id']);
|
$data['groups'] = $this->user_model->getUsersGroups($data['network_id']);
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($data['network_id'])->first_row();
|
$data['configWallet'] = $this->wallet_model->getConfigWallet($data['network_id'])->first_row();
|
||||||
$networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
|
$networkDetails = $this->user_model->getNetworkDetails($data['network_id']);
|
||||||
if ($networkDetails) {
|
if ($networkDetails) {
|
||||||
$data['network'] = $networkDetails->first_row()->network;
|
$data['network'] = $networkDetails->first_row()->network;
|
||||||
|
@ -2110,7 +2111,7 @@ class Gestion extends CI_Controller
|
||||||
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
$data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
|
|
@ -17,10 +17,11 @@ use Brick\Money\Context\AutoContext;
|
||||||
*/
|
*/
|
||||||
class Hyperviseur_dash extends CI_Controller
|
class Hyperviseur_dash extends CI_Controller
|
||||||
{
|
{
|
||||||
public function _contruct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::_contruct();
|
parent::__construct();
|
||||||
$this->load->model('user_model');
|
$this->load->model('wallet_model');
|
||||||
|
$this->load->model('nano_credit_model');
|
||||||
date_default_timezone_set($this->session->userdata('timezone'));
|
date_default_timezone_set($this->session->userdata('timezone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['count_d_no_traite'] = $count_d_no_traite;
|
$data['count_d_no_traite'] = $count_d_no_traite;
|
||||||
$data['count_d_users'] = $count_d;
|
$data['count_d_users'] = $count_d;
|
||||||
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('hyperviseur_dash');
|
$this->load->view('hyperviseur_dash');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -104,7 +105,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('listeadmin');
|
$this->load->view('listeadmin');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -159,7 +160,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('listeadmin');
|
$this->load->view('listeadmin');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -225,7 +226,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['list'] = $this->user_model->getDemandesBySuper($debut, $fin, $this->session->userdata('member_code'));
|
$data['list'] = $this->user_model->getDemandesBySuper($debut, $fin, $this->session->userdata('member_code'));
|
||||||
$data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'), $this->session->userdata('network'));
|
$data['temp_moyen'] = $this->user_model->getTempsMoyenByVille($this->session->userdata('member_code'), $this->session->userdata('network'));
|
||||||
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('demande_credit');
|
$this->load->view('demande_credit');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -287,7 +288,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
$data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
|
||||||
$data['type'] = $this->lang->line('Adhésion');
|
$data['type'] = $this->lang->line('Adhésion');
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('demande_adhesion');
|
$this->load->view('demande_adhesion');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -305,7 +306,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$this->load->view('login', $data);
|
$this->load->view('login', $data);
|
||||||
} else {
|
} else {
|
||||||
$id_network = $this->session->userdata('network_id');
|
$id_network = $this->session->userdata('network_id');
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
if ($data['hasWallet']) {
|
if ($data['hasWallet']) {
|
||||||
|
|
||||||
if ($this->input->get('history')) {
|
if ($this->input->get('history')) {
|
||||||
|
@ -433,7 +434,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function historique($network_id, $startDate, $endDate, $type)
|
private function historique($network_id, $startDate, $endDate, $type)
|
||||||
{
|
{
|
||||||
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
// $data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
@ -463,7 +464,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getActiveNetwork();
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
|
|
||||||
|
@ -495,7 +496,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getActiveNetwork();
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['network_id'] = $this->session->userdata('network_id');
|
$data['network_id'] = $this->session->userdata('network_id');
|
||||||
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
|
$res = $this->user_model->getWalletPassword($this->session->userdata('network_id'));
|
||||||
|
@ -674,7 +675,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getActiveNetwork();
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['network_id'] = $this->session->userdata('network_id');
|
$data['network_id'] = $this->session->userdata('network_id');
|
||||||
|
@ -1009,7 +1010,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function config_wallet($config , $country)
|
private function config_wallet($config , $country)
|
||||||
{
|
{
|
||||||
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
// $data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$data['active'] = "wallet_wallet";
|
$data['active'] = "wallet_wallet";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
|
@ -1018,7 +1019,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
|
@ -1135,7 +1136,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$this->load->view('config_wallet_ilink_hyp/agent_send_cash_canal');
|
$this->load->view('config_wallet_ilink_hyp/agent_send_cash_canal');
|
||||||
break;
|
break;
|
||||||
case 'taxes':
|
case 'taxes':
|
||||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig']);
|
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig']);
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('config_wallet_ilink_hyp/taxes');
|
$this->load->view('config_wallet_ilink_hyp/taxes');
|
||||||
break;
|
break;
|
||||||
|
@ -1154,7 +1155,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
|
@ -1195,11 +1196,11 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
} elseif ($this->input->get('config')) {
|
} elseif ($this->input->get('config')) {
|
||||||
$this->config_nano_credit($this->input->get('config'));
|
$this->config_nano_credit($this->input->get('config'));
|
||||||
} else {
|
} else {
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
|
$data['groups'] = $this->user_model->getUsersGroups($this->session->userdata('network_id'));
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
||||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
|
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig'], 'nano_credit');
|
||||||
$data['active'] = "nano_credit";
|
$data['active'] = "nano_credit";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['game_pays'] = $this->user_model->getGameCountry();
|
$data['game_pays'] = $this->user_model->getGameCountry();
|
||||||
|
@ -1221,7 +1222,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function config_nano_credit($config)
|
private function config_nano_credit($config)
|
||||||
{
|
{
|
||||||
// $data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
// $data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$data['active'] = "nano_credit";
|
$data['active'] = "nano_credit";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['firstname'] = $this->session->userdata('firstname');
|
$data['firstname'] = $this->session->userdata('firstname');
|
||||||
|
@ -1229,7 +1230,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['email'] = $this->session->userdata('email');
|
$data['email'] = $this->session->userdata('email');
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
$data['idConfig'] = $data['hasWallet']->first_row()->id;
|
||||||
|
@ -1237,15 +1238,19 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
switch ($config) {
|
switch ($config) {
|
||||||
case 'nano_credit':
|
case 'nano_credit':
|
||||||
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig']);
|
$taux = $data['hasWallet']->first_row();
|
||||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'nano_credit');
|
$data['taux_ag_nano_credit'] = $taux->taux_com_ag_nano_credit;
|
||||||
|
$data['taux_sup_nano_credit'] = $taux->taux_com_sup_nano_credit;
|
||||||
|
$data['taux_hyp_nano_credit'] = $taux->taux_com_hyp_nano_credit;
|
||||||
|
$data['rates'] = $this->nano_credit_model->getNanoCreditRates($data['idConfig']);
|
||||||
|
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig'], 'nano_credit');
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('nano_credit/config_nano_credit');
|
$this->load->view('nano_credit/config_nano_credit');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'epargne':
|
case 'epargne':
|
||||||
$data['rates'] = $this->user_model->getNanoCreditRates($data['idConfig'], 'epargne');
|
$data['rates'] = $this->nano_credit_model->getNanoCreditRates($data['idConfig'], 'epargne');
|
||||||
$data['taxes'] = $this->user_model->getTaxes($data['idConfig'], 'epargne');
|
$data['taxes'] = $this->wallet_model->getTaxes($data['idConfig'], 'epargne');
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
$this->load->view('nano_credit/config_savings');
|
$this->load->view('nano_credit/config_savings');
|
||||||
break;
|
break;
|
||||||
|
@ -1255,7 +1260,8 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
private function historique_nano_credit($network_id, $startDate, $endDate, $type)
|
||||||
{
|
{
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
|
||||||
|
$data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
@ -1263,10 +1269,10 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['currency_code'] = $this->session->userdata('currency_code');
|
$data['currency_code'] = $this->session->userdata('currency_code');
|
||||||
|
|
||||||
if ($type == 'nano_credit') {
|
if ($type == 'nano_credit') {
|
||||||
$data['transactions'] = $this->user_model->getUserDemandesCredit($startDate, $endDate, $network_id);
|
$data['transactions'] = $this->nano_credit_model->getUserDemandesCredit($startDate, $endDate, $network_id);
|
||||||
|
|
||||||
} else if ($type == 'savings') {
|
} else if ($type == 'savings') {
|
||||||
$data['transactions'] = $this->user_model->getIlinkTransactions($startDate, $endDate, $network_id);
|
$data['transactions'] = $this->nano_credit_model->getUsersSavings($startDate, $endDate, $network_id);
|
||||||
}
|
}
|
||||||
$data['active'] = "nano_credit";
|
$data['active'] = "nano_credit";
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
|
@ -1277,12 +1283,12 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getActiveNetwork();
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
|
|
||||||
$this->load->view('header_hyp', $data);
|
$this->load->view('header_hyp', $data);
|
||||||
if ($type == 'epargne')
|
if ($type == 'savings')
|
||||||
$this->load->view('nano_credit/historique_savings');
|
$this->load->view('nano_credit/historique_savings');
|
||||||
else
|
else
|
||||||
$this->load->view('nano_credit/historique_nano_credit');
|
$this->load->view('nano_credit/historique_nano_credit');
|
||||||
|
@ -1297,7 +1303,28 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
$limit_max = $_POST['limit_max'];
|
$limit_max = $_POST['limit_max'];
|
||||||
$id_network = $_POST['id_network'];
|
$id_network = $_POST['id_network'];
|
||||||
|
|
||||||
$this->user_model->insertCreditLimit($limit_min, $limit_max, '1', $id_network);
|
$this->nano_credit_model->insertCreditLimit($limit_min, $limit_max, '1', $id_network);
|
||||||
|
$res = true;
|
||||||
|
|
||||||
|
if ($res) {
|
||||||
|
echo json_encode("200");
|
||||||
|
} else {
|
||||||
|
echo json_encode("500");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveNanoCreditSharedRates()
|
||||||
|
{
|
||||||
|
if ($this->isLogged()) {
|
||||||
|
if (isset($_POST)) {
|
||||||
|
$taux_ag = $_POST['taux_ag'];
|
||||||
|
$taux_sup = $_POST['taux_sup'];
|
||||||
|
$taux_hyp = $_POST['taux_hyp'];
|
||||||
|
$id_network = $_POST['id_network'];
|
||||||
|
|
||||||
|
$this->nano_credit_model->insertNanoCreditSharedRates($taux_ag, $taux_sup, $taux_hyp, $id_network);
|
||||||
$res = true;
|
$res = true;
|
||||||
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
|
@ -1332,9 +1359,9 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
private function insertNanoCreditRates($palier, $idConfig, $type)
|
private function insertNanoCreditRates($palier, $idConfig, $type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$exist = $this->user_model->getNanoCreditRates($idConfig, $type);
|
$exist = $this->nano_credit_model->getNanoCreditRates($idConfig, $type);
|
||||||
if ($exist) {
|
if ($exist) {
|
||||||
$this->user_model->deleteNanoCreditRates($idConfig, $type);
|
$this->nano_credit_model->deleteNanoCreditRates($idConfig, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($palier) {
|
if ($palier) {
|
||||||
|
@ -1344,7 +1371,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
$row[] = $value;
|
$row[] = $value;
|
||||||
}
|
}
|
||||||
$this->user_model->addNanoCreditRates($idConfig, $row[0], $row[1], $type);
|
$this->nano_credit_model->addNanoCreditRates($idConfig, $row[0], $row[1], $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ class Superviseur_dash extends CI_Controller
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('Users_simple');
|
$this->load->model('wallet_model');
|
||||||
$this->load->model('User_model');
|
$this->load->model('nano_credit_model');
|
||||||
date_default_timezone_set ($this->session->userdata('timezone'));
|
date_default_timezone_set ($this->session->userdata('timezone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
$data['count_d_users'] = $count_d;
|
$data['count_d_users'] = $count_d;
|
||||||
$data['count_d_traite'] = $count_d_traite;
|
$data['count_d_traite'] = $count_d_traite;
|
||||||
$data['count_d_no_traite'] = $count_d_no_traite;
|
$data['count_d_no_traite'] = $count_d_no_traite;
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_sup', $data);
|
$this->load->view('header_sup', $data);
|
||||||
$this->load->view('superviseur_dash');
|
$this->load->view('superviseur_dash');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -99,7 +99,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
$data['network'] = $this->session->userdata('network');
|
$data['network'] = $this->session->userdata('network');
|
||||||
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
||||||
$data['alert'] = "";
|
$data['alert'] = "";
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_sup', $data);
|
$this->load->view('header_sup', $data);
|
||||||
$this->load->view('listeadmin');
|
$this->load->view('listeadmin');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -156,7 +156,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$this->load->view('header_sup', $data);
|
$this->load->view('header_sup', $data);
|
||||||
$this->load->view('demande_credit');
|
$this->load->view('demande_credit');
|
||||||
$this->load->view('footer');
|
$this->load->view('footer');
|
||||||
|
@ -199,7 +199,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin ,$this->session->userdata('member_code'));
|
$data['temp_moyen'] = $this->user_model->getTempsMoyenAd($debut, $fin ,$this->session->userdata('member_code'));
|
||||||
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin ,$this->session->userdata('member_code'));
|
$data['list'] = $this->user_model->getDemandesAdForSuper($debut, $fin ,$this->session->userdata('member_code'));
|
||||||
$data['type'] = $this->lang->line('Adhésion');
|
$data['type'] = $this->lang->line('Adhésion');
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
||||||
$this->load->view('header_sup', $data);
|
$this->load->view('header_sup', $data);
|
||||||
$this->load->view('demande_adhesion');
|
$this->load->view('demande_adhesion');
|
||||||
|
@ -221,7 +221,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
$data["principal"] = "";
|
$data["principal"] = "";
|
||||||
$data["transactions"] = "";
|
$data["transactions"] = "";
|
||||||
$agent_id = $this->session->userdata('agent_id');
|
$agent_id = $this->session->userdata('agent_id');
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
|
|
||||||
if ($this->input->get('history')) {
|
if ($this->input->get('history')) {
|
||||||
$this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->session->userdata('member_code'),
|
$this->historique($id_network, $this->input->get('d'), $this->input->get('f'), $this->session->userdata('member_code'),
|
||||||
|
@ -303,7 +303,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
|
|
||||||
private function historique($network_id, $startDate, $endDate, $codeMembre, $type)
|
private function historique($network_id, $startDate, $endDate, $codeMembre, $type)
|
||||||
{
|
{
|
||||||
$data['configWallet'] = $this->user_model->getConfigWallet($network_id);
|
$data['configWallet'] = $this->wallet_model->getConfigWallet($network_id);
|
||||||
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
$format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
|
||||||
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
$data['startDate'] = $startDate ? date($format, strtotime($startDate)) : null;
|
||||||
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
$data['endDate'] = $endDate ? date($format, strtotime($endDate)) : null;
|
||||||
|
@ -326,7 +326,7 @@ class Superviseur_dash extends CI_Controller
|
||||||
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
$data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
|
||||||
$data['networks'] = $this->user_model->getActiveNetwork();
|
$data['networks'] = $this->user_model->getActiveNetwork();
|
||||||
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
$data['superviseurs'] = $this->user_model->getSuperNameAndCodeForHyp($this->session->userdata('member_code'));
|
||||||
$data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id'));
|
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
|
||||||
$data['country'] = $this->session->userdata('current_pays');
|
$data['country'] = $this->session->userdata('current_pays');
|
||||||
$data['category'] = $this->session->userdata('category');
|
$data['category'] = $this->session->userdata('category');
|
||||||
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
$data['geolocated_user'] = $this->user_model->getSuperNameAndCodeForSup($this->session->userdata('member_code'));
|
||||||
|
|
|
@ -477,4 +477,12 @@ $lang['interest'] = "Interest";
|
||||||
$lang['duration'] = "Duration (in months)";
|
$lang['duration'] = "Duration (in months)";
|
||||||
$lang['state'] = "State";
|
$lang['state'] = "State";
|
||||||
$lang['caution_type'] = "Type of deposit";
|
$lang['caution_type'] = "Type of deposit";
|
||||||
|
$lang['nano_credit_rule'] = 'The sum of the commission distributions on the nano credit must be equal to 100%';
|
||||||
|
$lang['nano_credit_rate_com_agent'] = 'Commission rate of the agent geolocated on the nano credit';
|
||||||
|
$lang['nano_credit_rate_com_sup'] = 'Supervisor commission rate on the nano credit';
|
||||||
|
$lang['nano_credit_rate_com_hyp'] = 'Hypervisor commission rate on the nano credit';
|
||||||
|
$lang['savings_history'] = 'Savings history';
|
||||||
|
$lang['export_savings_demands_history'] = "Export savings requests";
|
||||||
|
$lang['modify_sharing_rates'] = 'Modify sharing rates';
|
||||||
|
$lang['nano_credit_configuration'] = 'Nano Credit configuration';
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -488,5 +488,14 @@ $lang['savings_tax'] = 'Taxes sur l\'epargne';
|
||||||
$lang['interest'] = "Intérêt";
|
$lang['interest'] = "Intérêt";
|
||||||
$lang['duration'] = "Duree (en mois)";
|
$lang['duration'] = "Duree (en mois)";
|
||||||
$lang['state'] = "Etat";
|
$lang['state'] = "Etat";
|
||||||
$lang['caution_type'] = "Type de caution"
|
$lang['caution_type'] = "Type de caution";
|
||||||
|
$lang['nano_credit_rule'] = 'La somme des répartitions de commission sur le nano crédit doit etre égale à 100 %';
|
||||||
|
$lang['nano_credit_rate_com_agent'] = 'Taux de commission de l\'agent géolocalisé sur le nano crédit';
|
||||||
|
$lang['nano_credit_rate_com_sup'] = 'Taux de commission superviseur sur le nano crédit';
|
||||||
|
$lang['nano_credit_rate_com_hyp'] = 'Taux de commission hyperviseur sur le nano crédit';
|
||||||
|
$lang['savings_history'] = 'Historique des épargnes';
|
||||||
|
$lang['export_savings_demands_history'] = "Exporter les demandes d'épargne";
|
||||||
|
$lang['modify_sharing_rates'] = 'Modifier les taux de partage';
|
||||||
|
$lang['nano_credit_configuration'] = 'Configuration du Nano Crédit';
|
||||||
|
$lang['cassation_date'] = 'Date de cassation'
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: capp
|
||||||
|
* Date: 29/05/2018
|
||||||
|
* Time: 15:49
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class Nano_Credit_Model extends CI_Model
|
||||||
|
{
|
||||||
|
|
||||||
|
// Nano credit
|
||||||
|
public function insertCreditLimit($limit_min, $limit_max, $has_nano_credit, $id_network)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE `configWallet` SET `has_nano_credit` = ?, `limite_credit_min` = ? , `limite_credit_max` = ? WHERE (`id_network` = ? );";
|
||||||
|
return $this->db->query($sql, array($has_nano_credit, $limit_min, $limit_max, $id_network));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertNanoCreditSharedRates($taux_ag, $taux_sup, $taux_hyp, $id_network)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_ag_nano_credit` = ?, `taux_com_sup_nano_credit` = ? , `taux_com_hyp_nano_credit` = ? WHERE (`id_network` = ? );";
|
||||||
|
return $this->db->query($sql, array($taux_ag, $taux_sup, $taux_hyp, $id_network));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllIlinkWorldNetworks()
|
||||||
|
{
|
||||||
|
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
|
||||||
|
configWallet.limite_credit_min , configWallet.limite_credit_max , configWallet.has_nano_credit FROM `networks`
|
||||||
|
INNER JOIN countries_currencies cc ON networks.country_id=cc.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND configWallet.type = 'ilink'");
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsersGroups($id_network)
|
||||||
|
{
|
||||||
|
$query = $this->db->query("SELECT * FROM infos_users_groups WHERE id_network = '" . $id_network . "'");
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNanoCreditRates($idConfig, $type = 'nano_credit')
|
||||||
|
{
|
||||||
|
$sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );";
|
||||||
|
$query = $this->db->query($sql, array($idConfig, $type));
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteNanoCreditRates($idConfig, $type = 'nano_credit')
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );";
|
||||||
|
$query = $this->db->query($sql, array($idConfig, $type));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addNanoCreditRates($idConfig, $duree, $valeur, $type = 'nano_credit')
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO `paliersConfigNanoCredit` (`duree_mois`, `taux`, `idConfig` ,`type`) VALUES (?,?,?,?);";
|
||||||
|
$query = $this->db->query($sql, array($duree, $valeur, $idConfig, $type));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserDemandesCredit($debut, $fin, $id_network)
|
||||||
|
{
|
||||||
|
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_users_demandes_credits
|
||||||
|
WHERE `id_network`='" . $id_network . "'" . $chain);
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsersSavings($debut, $fin, $id_network)
|
||||||
|
{
|
||||||
|
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_users_epargnes
|
||||||
|
WHERE `id_network`='" . $id_network . "'" . $chain);
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2682,6 +2682,12 @@ class User_model extends CI_Model
|
||||||
return $this->db->query($sql, array($has_nano_credit, $limit_min, $limit_max, $id_network));
|
return $this->db->query($sql, array($has_nano_credit, $limit_min, $limit_max, $id_network));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function insertNanoCreditSharedRates($taux_ag, $taux_sup, $taux_hyp, $id_network)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_ag_nano_credit` = ?, `taux_com_sup_nano_credit` = ? , `taux_com_hyp_nano_credit` = ? WHERE (`id_network` = ? );";
|
||||||
|
return $this->db->query($sql, array($taux_ag, $taux_sup, $taux_hyp, $id_network));
|
||||||
|
}
|
||||||
|
|
||||||
public function getAllIlinkWorldNetworks()
|
public function getAllIlinkWorldNetworks()
|
||||||
{
|
{
|
||||||
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
|
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
|
||||||
|
@ -2741,4 +2747,17 @@ class User_model extends CI_Model
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUsersSavings($debut, $fin, $id_network)
|
||||||
|
{
|
||||||
|
$chain = $debut ? " AND date_creation BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_users_epargnes
|
||||||
|
WHERE `id_network`='" . $id_network . "'" . $chain);
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,828 @@
|
||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: capp
|
||||||
|
* Date: 29/05/2018
|
||||||
|
* Time: 15:49
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class Wallet_model extends CI_Model
|
||||||
|
{
|
||||||
|
|
||||||
|
//wallet
|
||||||
|
public function getActiveNetwork(){
|
||||||
|
$query = $this->db->query("SELECT networks.id,networks.name,countries.name AS country
|
||||||
|
FROM networks
|
||||||
|
INNER JOIN countries ON networks.country_id=countries.id
|
||||||
|
WHERE `status`=1");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function getTaux($id_network){
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM configWallet
|
||||||
|
WHERE `id_network`=".$id_network);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNetworkDetails($id_network){
|
||||||
|
$query = $this->db->query("SELECT n.name AS network , c.name AS country , c.currency_name_fr , c.currency_code , c.currency_name_en FROM networks n INNER JOIN countries_currencies c ON n.country_id = c.id WHERE n.id = ".$id_network);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactions($debut , $fin , $id_network){
|
||||||
|
$chain = $debut ? " AND date_created BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_transaction
|
||||||
|
WHERE `network_id`=".$id_network.$chain);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionsSup($debut , $fin , $codeMembre){
|
||||||
|
$chain = $debut ? " AND date_created BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_transaction
|
||||||
|
WHERE `codeParrain`='".$codeMembre."'".$chain);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInfosWalletAgentForHyper($id_network){
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM wallet_agent
|
||||||
|
WHERE `network_id`=".$id_network);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $where_clause
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function get_user($where_clause){
|
||||||
|
$query = $this->db->query("SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
||||||
|
codeGenerer.category,
|
||||||
|
networks.name AS network_name,towns.name AS town_name,
|
||||||
|
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
||||||
|
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
||||||
|
FROM agents
|
||||||
|
INNER JOIN networks_agents ON agents.id=networks_agents.agent_id
|
||||||
|
INNER JOIN codeGenerer ON codeGenerer.id=networks_agents.codeGenerer_id
|
||||||
|
INNER JOIN networks ON networks.id =networks_agents.network_id
|
||||||
|
INNER JOIN towns ON towns.id=agents.town_id
|
||||||
|
".$where_clause);
|
||||||
|
$statement = "SELECT agents.lastname, agents.adresse,agents.email,agents.date_created,agents.id AS userID,
|
||||||
|
codeGenerer.category,
|
||||||
|
networks.name AS network_name,towns.name AS town_name,
|
||||||
|
codeGenerer.code_parrain AS parrain,codeGenerer.code_membre AS code,
|
||||||
|
networks_agents.id AS networkAgent_id,networks_agents.phone,networks_agents.transactionNumber AS transac
|
||||||
|
FROM agents
|
||||||
|
INNER JOIN networks_agents ON agents.id=networks_agents.agent_id
|
||||||
|
INNER JOIN codeGenerer ON codeGenerer.id=networks_agents.codeGenerer_id
|
||||||
|
INNER JOIN networks ON networks.id =networks_agents.network_id
|
||||||
|
INNER JOIN towns ON towns.id=agents.town_id
|
||||||
|
".$where_clause;
|
||||||
|
//var_dump($statement);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $phone
|
||||||
|
* @param $name
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
|
public function get_simple_user($phone, $name){
|
||||||
|
$query = $this->db->query("SELECT users.id AS id_user,users.active AS etat,users.lastname,users.phone,users.email,users.adresse,users.date_created,
|
||||||
|
networks.name AS network,countries.name AS country
|
||||||
|
FROM users
|
||||||
|
INNER JOIN networks ON networks.id=users.network_id
|
||||||
|
INNER JOIN countries ON countries.id=networks.country_id
|
||||||
|
WHERE phone LIKE '".$phone."%' AND lastname LIKE '".$name."%'");
|
||||||
|
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $nom
|
||||||
|
* @param $adresse
|
||||||
|
* @param $email
|
||||||
|
* @param $phone
|
||||||
|
* @param int $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function update_user_infos($nom, $adresse, $email, $phone, $id){
|
||||||
|
$query = $this->db->query("UPDATE `users` SET `lastname`='".$nom."',`phone`='".$phone."',`email`='".$email."',`adresse`='".$adresse."' WHERE users.id=".$id);
|
||||||
|
$sql = "UPDATE `users` SET `lastname`='".$nom."',`phone`='".$phone."',`email`='".$email."',`adresse`='".$adresse."' WHERE users.id=".$id;
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $nom
|
||||||
|
* @param $adresse
|
||||||
|
* @param $email
|
||||||
|
* @param int $id_agent
|
||||||
|
* @param $transac
|
||||||
|
* @param $phone
|
||||||
|
* @param int $id_netAg
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function update_geolocated_infos($nom, $adresse, $email, $id_agent, $transac, $phone, $id_netAg){
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$this->db->query("UPDATE `agents` SET `lastname`='".$nom."',`email`='".$email."',`adresse`='".$adresse."' WHERE `id`=".$id_agent);
|
||||||
|
$this->db->query("UPDATE `networks_agents` SET `phone`='".$phone."',`transactionNumber`='".$transac."' WHERE `id`=".$id_netAg);
|
||||||
|
$this->db->trans_complete();
|
||||||
|
if ($this->db->trans_status() === FALSE)
|
||||||
|
{
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->trans_commit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getPubCountries(){
|
||||||
|
$query = $this->db->query("SELECT countries.id AS id_country,countries.name AS pays,publiciteConfig.id,publiciteConfig.date_update AS maj ,publiciteConfig.partenariat,publiciteConfig.valeur_bool AS etat
|
||||||
|
FROM countries
|
||||||
|
INNER JOIN towns ON countries.id = towns.country_id
|
||||||
|
LEFT JOIN publiciteConfig ON countries.id=publiciteConfig.id_country AND publiciteConfig.id_config=2
|
||||||
|
WHERE towns.status=1
|
||||||
|
GROUP BY countries.id");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Met a jour l'etat de la publicite
|
||||||
|
* @param int $id ID de la configuration
|
||||||
|
* @param $newState Nouvel etat
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function updateStatePub($id, $newState){
|
||||||
|
$query = $this->db->query("UPDATE publiciteConfig SET date_update = NOW(),valeur_bool = ".$newState." WHERE id =".$id);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute une nouvelle ligne de publicite
|
||||||
|
* @param int $id_country ID du pays
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function createPubRow($id_country){
|
||||||
|
$query = $this->db->query("INSERT INTO publiciteConfig(id_config,id_country, valeur_bool) VALUE (2,".$id_country.",1)");
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSuperNameAndCodeForSup($codeSup){
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT child.lastname AS lastname, child.code_membre AS member_code
|
||||||
|
FROM super_infos AS child
|
||||||
|
INNER JOIN super_infos AS dad
|
||||||
|
ON child.code_parrain='".$codeSup."'
|
||||||
|
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."'
|
||||||
|
");
|
||||||
|
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nameOfCurrentGeolocatedUser_forSuper($geolocatedUser_memberCode){
|
||||||
|
$query = $this->db->query("SELECT lastname FROM `super_infos` WHERE `code_membre`='".$geolocatedUser_memberCode."' ");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query->row()->lastname;
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wallet
|
||||||
|
|
||||||
|
public function getAllActivatedNetworks(){
|
||||||
|
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network , configWallet.type FROM `networks`
|
||||||
|
INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfigWallet($id_network){
|
||||||
|
$sql = "SELECT * FROM `configWallet` WHERE id_network = ?";
|
||||||
|
$query = $this->db->query($sql , array($id_network));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addConfigWallet($network_id , $type){
|
||||||
|
$sql='INSERT INTO `configWallet` (`id_network`, `type`) VALUES (?,?);' ;
|
||||||
|
$query = $this->db->query($sql , array($network_id, $type));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWallet($network_id , $taux_client_r , $taux_client_d, $taux_ag_r , $taux_ag_d , $taux_sup_r , $taux_sup_d , $taux_bq_r , $taux_bq_d , $frais_d ){
|
||||||
|
$sql= 'UPDATE `configWallet` SET `taux_com_client_retrait` = ?, `taux_com_client_depot` = ?, `taux_com_ag_retrait` = ?, `taux_com_ag_depot` = ?, `taux_com_sup_retrait` = ? , `taux_com_sup_depot` = ?, `part_banque_retrait` = ?, `part_banque_depot` = ?, `frais_min_banque_depot` = ? WHERE (`id_network` = ?);';
|
||||||
|
$query = $this->db->query($sql , array($taux_client_r,$taux_client_d,$taux_ag_r,$taux_ag_d,$taux_sup_r,$taux_sup_d, $taux_bq_r , $taux_bq_d , $frais_d , $network_id));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteConfigWallet($network_id){
|
||||||
|
$query = $this->db->query("DELETE FROM `configWallet` WHERE `configWallet`.`id_network` = '".$network_id."'");
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWallet($id_agent){
|
||||||
|
$sql = "SELECT * FROM `wallet_agent` WHERE agent_id = ?";
|
||||||
|
$query = $this->db->query($sql , array($id_agent));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWallet($id_agent){
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM `networks_agents` WHERE agent_id = ?";
|
||||||
|
$query = $this->db->query($sql , array($id_agent));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
$id_networkAgent = $query->first_row()->id;
|
||||||
|
$sql = "INSERT INTO `wallets` (`id_networkAgent`) VALUES (?);";
|
||||||
|
$query = $this->db->query($sql , array($id_networkAgent));
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAgentTransactions($id_wallet){
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM wallet_transaction
|
||||||
|
WHERE `id_wallet`= '".$id_wallet."'");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAgentiLinkTransactions($id_wallet){
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_ilink_transaction
|
||||||
|
WHERE `id_wallet_ag`= '".$id_wallet."'");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNetworkHyper($id_network){
|
||||||
|
$sql = "SELECT * FROM `hyper_infos` WHERE network_id = ?";
|
||||||
|
$query = $this->db->query($sql , array($id_network));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllAgentsForNetwork($id_network){
|
||||||
|
$sql = "SELECT * FROM super_infos WHERE network_id = ?";
|
||||||
|
$query = $this->db->query($sql , array($id_network));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reinitializeWallet($id_wallet){
|
||||||
|
$sql = "UPDATE `wallets` SET `balance_princ` = '0', `balance_com` = '0', `created_date` = ? WHERE (`id` = ?)";
|
||||||
|
$query = $this->db->query($sql , array(new DateTime(),$id_wallet));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mot de passe du wallet
|
||||||
|
public function getAllActivatedWalletNetworks(){
|
||||||
|
$query = $this->db->query("SELECT n.id AS id_network , n.name AS network,n.status AS status,c.name AS country,c.currency_name_fr, c.currency_name_en , c.currency_code, wp.id AS wallet_password FROM networks n
|
||||||
|
INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id
|
||||||
|
LEFT JOIN walletsPassword wp ON wp.network_id = n.id WHERE status = 1;");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWalletPassword($network_id, $encrypted_password, $salt, $email)
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO `walletsPassword` (`network_id`, `encrypted_password`, `salt`, `email`) VALUES ( ?, ?, ?, ?);";
|
||||||
|
$query = $this->db->query($sql, array($network_id, $encrypted_password, $salt, $email));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateWalletPassword($wallet_password_id, $encrypted_password, $salt)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE `walletsPassword` SET `encrypted_password` = ? , `salt` = ? WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql, array($encrypted_password, $salt, $wallet_password_id));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWalletPassword($network_id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT * FROM walletsPassword WHERE network_id = ?";
|
||||||
|
$query = $this->db->query($sql, array($network_id));
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecharges($debut , $fin , $id_network){
|
||||||
|
$chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_recharges
|
||||||
|
WHERE `network_id`=".$id_network.$chain);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWalletRecharge($montant,$wallet_id){
|
||||||
|
$sql = "INSERT INTO `wallet_recharge` (`montant`, `wallet_id`) VALUES (?, ?);";
|
||||||
|
$query = $this->db->query($sql , array($montant,$wallet_id));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateWalletBalance($montant,$wallet_id){
|
||||||
|
$sql = "UPDATE `wallets` SET balance_princ = balance_princ + ? WHERE (`id` = ? );";
|
||||||
|
$query = $this->db->query($sql , array($montant,$wallet_id));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wallet ilink
|
||||||
|
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, $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));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOnePalierConfigWallet($id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql, array($id));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePalierConfigWallet($type, $idConfig)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM `paliersConfigWallet` WHERE (`type` = ? AND `idConfig` = ? );";
|
||||||
|
$query = $this->db->query($sql, array($type, $idConfig));
|
||||||
|
return $query;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
$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));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWalletIlink_u_w_cart($taux_u_w_cart,$taux_hyp_s_wallet_cart_ilink,$taux_bq_s_wallet_cart_ilink, $idConfig){
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_user_wallet_carte` = ?,
|
||||||
|
`taux_com_hyp_envoi_wallet_carte_ilink` = ?, `taux_com_banque_envoi_wallet_carte_ilink` = ? WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($taux_u_w_cart,$taux_hyp_s_wallet_cart_ilink,$taux_bq_s_wallet_cart_ilink,$idConfig));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWalletIlink_u_c_w($taux_u_c_w,$taux_u_c_c,$taux_hyp_r_cart_ilink,$taux_bq_r_cart_ilink , $idConfig){
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_user_carte_wallet` = ?, `taux_com_user_carte_cash` = ?, `taux_com_hyp_retrait_carte_cash_ilink` = ?, `taux_com_banque_retrait_carte_cash_ilink` = ?
|
||||||
|
WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($taux_u_c_w,$taux_u_c_c,$taux_hyp_r_cart_ilink,$taux_bq_r_cart_ilink,$idConfig));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWalletIlink_a_r_c($taux_ag_r_c,$taux_sup_r_c,$taux_hyp_r_c,$idConfig){
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_ag_retrait_cash` = ?, `taux_com_sup_retrait_cash` = ?, `taux_com_hyp_retrait_cash` = ? WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($taux_ag_r_c,$taux_sup_r_c,$taux_hyp_r_c,$idConfig));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWalletIlink_a_r_cart($taux_ag_cart_c,$taux_ag_r_cart,$taux_sup_r_cart,$taux_hyp_r_cart,$taux_bq_r_cart ,$idConfig){
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_wallet_ag_carte_cash` = ?, `taux_com_ag_retrait_carte_cash` = ?, `taux_com_sup_retrait_carte_cash` = ?,
|
||||||
|
`taux_com_hyp_retrait_carte_cash` = ?, `taux_com_banque_retrait_carte_cash` = ? WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($taux_ag_cart_c,$taux_ag_r_cart,$taux_sup_r_cart,$taux_hyp_r_cart, $taux_bq_r_cart ,$idConfig));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateConfigWalletIlink_a_s_cc($taux_ag_d_c_c,$taux_ag_d_c,$taux_sup_d_c,$taux_hyp_d_c,$taux_bq_d_c , $idConfig){
|
||||||
|
$sql = "UPDATE `configWallet` SET `taux_com_wallet_ag_envoi_cash_carte` = ?,
|
||||||
|
`taux_com_ag_depot_cash_carte` = ?, `taux_com_sup_depot_cash_carte` = ?, `taux_com_hyp_depot_cash_carte` = ?, `taux_com_banque_depot_cash_carte` = ?
|
||||||
|
WHERE (`id` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($taux_ag_d_c_c, $taux_ag_d_c,$taux_sup_d_c,$taux_hyp_d_c,$taux_bq_d_c ,$idConfig));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
// La liste des monnaies pour les pays actifs
|
||||||
|
public function getCurrencies($code){
|
||||||
|
$sql= "SELECT * FROM currencies WHERE id IN(
|
||||||
|
SELECT idCurrency FROM countries WHERE id IN (
|
||||||
|
SELECT distinct country_id FROM networks WHERE status = 1
|
||||||
|
)
|
||||||
|
) AND code <> ? ;";
|
||||||
|
$query = $this->db->query($sql, array($code));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Liste des monnaies pour les pays dont un wallet est actif
|
||||||
|
public function getWalletsCountriesCurrencies($code){
|
||||||
|
$sql= "SELECT * FROM currencies WHERE id IN(
|
||||||
|
SELECT idCurrency FROM countries WHERE id IN (
|
||||||
|
SELECT distinct c.id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id WHERE status = 1
|
||||||
|
)
|
||||||
|
) AND code <> ? ;";
|
||||||
|
$query = $this->db->query($sql, array($code));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertExchangeRate($currency ,$rate){
|
||||||
|
$sql = "INSERT INTO `exchange_rate` (`target_currency`, `exchange_rate`) VALUES ( ?, ?);";
|
||||||
|
$query = $this->db->query($sql , array($currency,$rate));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExchangeRate($currency){
|
||||||
|
$sql = "SELECT * FROM `exchange_rate` WHERE `target_currency` = ?;";
|
||||||
|
$query = $this->db->query($sql , array($currency));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateExchangeRate($currency,$rate){
|
||||||
|
$sql = "UPDATE `exchange_rate` SET `exchange_rate` = ? WHERE (`target_currency` = ?);";
|
||||||
|
$query = $this->db->query($sql , array($currency,$rate));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Liste des pays dont un wallet est actif
|
||||||
|
public function getWalletsCountries(){
|
||||||
|
$sql= "SELECT id , name , currency_code FROM countries_currencies WHERE id IN (
|
||||||
|
SELECT distinct c.id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id WHERE status = 1
|
||||||
|
);";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActiveCountries(){
|
||||||
|
$sql= "SELECT id , name FROM countries WHERE id IN (
|
||||||
|
SELECT distinct n.country_id FROM networks n WHERE n.status = 1
|
||||||
|
);";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCountry($id){
|
||||||
|
$sql= "SELECT name FROM countries WHERE id = $id";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelCreditRequest($id_demand){
|
||||||
|
$sql = "SELECT * FROM `info_demandeCredits` WHERE `demande_id` = ?;";
|
||||||
|
$query = $this->db->query($sql , array($id_demand));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
$demand = $query->first_row();
|
||||||
|
$sql = "SELECT * FROM `wallet_agent` WHERE `codeMembre` = ?;";
|
||||||
|
$query = $this->db->query($sql , array($demand->codeMembre));
|
||||||
|
$query2 = $this->db->query($sql , array($demand->codeParrain));
|
||||||
|
$result = $query->num_rows()>0;
|
||||||
|
if($result){
|
||||||
|
$result =$query2->num_rows()>0;
|
||||||
|
if($result){
|
||||||
|
$sql = "UPDATE wallets SET balance_princ = ? WHERE (`id` = ?);";
|
||||||
|
$montant = $demand->montant;
|
||||||
|
$montantAgent = $query->first_row()->balance_princ - $montant;
|
||||||
|
$montantParrain = $query2->first_row()->balance_princ + $montant;
|
||||||
|
|
||||||
|
$this->db->query($sql , array($montantAgent , $query->first_row()->wallet_id ));
|
||||||
|
$this->db->query($sql , array($montantParrain , $query2->first_row()->wallet_id));
|
||||||
|
|
||||||
|
$sql = "UPDATE `demandeCredits` SET `status` = '2' WHERE (`id` = ?);";
|
||||||
|
$this->db->query($sql , array($demand->demande_id));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertSimulateur($frais , $montant ,$code , $montant_init){
|
||||||
|
$sql = "INSERT INTO `simulateur` (`com_hyp` , `montant_retrait`, `code` ,`montant` ) VALUES ( ?, ?, ? , ?);";
|
||||||
|
$query = $this->db->query($sql , array($frais,$montant,$code,$montant_init));
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSimulateur($code){
|
||||||
|
$sql = "SELECT * FROM `simulateur` WHERE `code` = ?;";
|
||||||
|
$query = $this->db->query($sql , array($code));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSharingRate($network_id,$config_id,$rate, $url){
|
||||||
|
$sql = "SELECT * FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
|
||||||
|
$query = $this->db->query($sql , array($network_id,$config_id));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
$sql = "UPDATE `paying_networks` SET `taux_partage` = ? ,`url` = ? WHERE `id_network` = ? AND id_configWallet = ? ;";
|
||||||
|
$this->db->query($sql , array($rate, $url, $network_id,$config_id));
|
||||||
|
}else{
|
||||||
|
$sql = "INSERT INTO `paying_networks` (`id_network`, `taux_partage`, `url`, `id_configWallet`) VALUES ( ?, ?, ? ,?); ;";
|
||||||
|
$this->db->query($sql , array($network_id,$rate,$url,$config_id));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSharingRate($id_network ,$idConfig){
|
||||||
|
$sql = "SELECT taux_partage , url FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
|
||||||
|
$query = $this->db->query($sql , array($id_network,$idConfig));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSharingRateByNetwork($id_network){
|
||||||
|
$sql = "SELECT balance_com FROM `paying_networks` WHERE `id_network` = ? ;";
|
||||||
|
$query = $this->db->query($sql , array($id_network));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function countPayingNetworks($id_country ,$idConfig){
|
||||||
|
$sql = "SELECT count(id) as total FROM `paying_networks` WHERE `id_network` IN (SELECT distinct n.id FROM countries c INNER JOIN
|
||||||
|
networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ?
|
||||||
|
) AND id_configWallet = ? ;";
|
||||||
|
$query = $this->db->query($sql , array($id_country, $idConfig));
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActiveNetworksByCountry($country_id , $network_id){
|
||||||
|
$query = $this->db->query("SELECT networks.name , networks.id , configWallet.type FROM `networks` INNER JOIN countries ON networks.country_id=countries.id
|
||||||
|
INNER JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND networks.id <> $network_id AND countries.id = $country_id");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPayingNetworksByConfigWallet($id_config)
|
||||||
|
{
|
||||||
|
$query = $this->db->query("SELECT n.name , n.id , cw.type , c.name as country ,c.currency_code, pw.taux_partage as rate , pw.balance_com , pw.balance_compensation, pw.id_configWallet as config_id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id
|
||||||
|
INNER JOIN configWallet cw ON cw.id_network = n.id INNER JOIN paying_networks pw ON pw.id_network = n.id WHERE pw.id_configWallet = $id_config ");
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIlinkTransactions($debut , $fin , $id_network){
|
||||||
|
$chain = $debut ? " AND date BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_ilink_transaction
|
||||||
|
WHERE `network_emetteur`=" . $id_network . $chain);
|
||||||
|
//var_dump($query->result_array());
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNetworkIlinTransactions($id_network){
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_ilink_transaction
|
||||||
|
WHERE `network_emetteur`= '".$id_network."'");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrency($id_network){
|
||||||
|
$query = $this->db->query("SELECT cc.currency_code as code FROM networks n INNER JOIN countries_currencies cc ON cc.id = n.country_id
|
||||||
|
WHERE n.id = '".$id_network."'");
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query->first_row();
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCommissionTransfers($debut , $fin , $codeMembre){
|
||||||
|
$chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_transferts_commission
|
||||||
|
WHERE `codeParrain`='".$codeMembre."'".$chain);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIlinkTransactionsSup($debut , $fin , $codeMembre){
|
||||||
|
$chain = $debut ? " AND date BETWEEN '".$debut."' AND '".$fin."'" : "";
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM infos_ilink_transaction
|
||||||
|
WHERE `code_parrain`='".$codeMembre."'".$chain);
|
||||||
|
if($query->num_rows()>0){
|
||||||
|
return $query;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInfosWalletAgentForSuper($codeMembre)
|
||||||
|
{
|
||||||
|
$query = $this->db->query("SELECT *
|
||||||
|
FROM wallet_agent
|
||||||
|
WHERE `codeParrain`='" . $codeMembre . "'");
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertRembourssementCompensation($montant, $id_network, $id_config)
|
||||||
|
{
|
||||||
|
$sql = "SELECT * FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
|
||||||
|
$query = $this->db->query($sql, array($id_network, $id_config));
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
$montant_init = $query->first_row()->balance_compensation;
|
||||||
|
if (($montant_init - $montant) < 0)
|
||||||
|
return false;
|
||||||
|
$sql = "UPDATE `paying_networks` SET balance_compensation = ? WHERE `id_network` = ? AND id_configWallet = ?;";
|
||||||
|
$this->db->query($sql, array($montant_init - $montant, $id_network, $id_config));
|
||||||
|
$sql = "INSERT INTO `remboursemment_compensation` (`montant` , `montant_restant`,`id_paying_network` , `id_network`) VALUES ( ?, ?, ? ,?);";
|
||||||
|
$this->db->query($sql, array($montant, $montant_init - $montant, $id_network, $this->session->userdata('network_id')));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRefunds($debut, $fin, $id_network)
|
||||||
|
{
|
||||||
|
$chain = $debut ? " AND date BETWEEN '" . $debut . "' AND '" . $fin . "'" : "";
|
||||||
|
$query = $this->db->query("SELECT rp.* , n.name as network , cc.name as country , cc.currency_code FROM remboursemment_compensation rp
|
||||||
|
INNER JOIN networks n ON n.id = id_paying_network INNER JOIN countries_currencies cc ON cc.id = n.country_id
|
||||||
|
WHERE rp.id_network =" . $id_network . $chain);
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
return $query;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -153,6 +153,14 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="content">
|
<section class="content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="margin">
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-update"
|
||||||
|
style="width: 100%"><?php echo $this->lang->line('modify_sharing_rates') ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="margin">
|
<div class="margin">
|
||||||
|
@ -168,6 +176,46 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<!--Taux commission sur le nano credit-->
|
||||||
|
<div class="col-lg-4 col-xs-6">
|
||||||
|
<div class="small-box bg-red">
|
||||||
|
<div class="inner">
|
||||||
|
<h3><?php echo $taux_ag_nano_credit; ?><sup style="font-size: 20px">%</sup></h3>
|
||||||
|
<p><?php echo $this->lang->line('nano_credit_rate_com_agent') ?> </p>
|
||||||
|
</div>
|
||||||
|
<div class="icon">
|
||||||
|
<i class="ion ion-android-arrow-up"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-4 col-xs-6">
|
||||||
|
<div class="small-box bg-red">
|
||||||
|
<div class="inner">
|
||||||
|
<h3><?php echo $taux_sup_nano_credit; ?><sup style="font-size: 20px">%</sup></h3>
|
||||||
|
<p><?php echo $this->lang->line('nano_credit_rate_com_sup') ?> </p>
|
||||||
|
</div>
|
||||||
|
<div class="icon">
|
||||||
|
<i class="ion ion-android-arrow-up"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-lg-4 col-xs-6">
|
||||||
|
<div class="small-box bg-red">
|
||||||
|
<div class="inner">
|
||||||
|
<h3><?php echo $taux_hyp_nano_credit; ?><sup style="font-size: 20px">%</sup></h3>
|
||||||
|
<p><?php echo $this->lang->line('nano_credit_rate_com_hyp') ?> </p>
|
||||||
|
</div>
|
||||||
|
<div class="icon">
|
||||||
|
<i class="ion ion-android-arrow-up"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row centered">
|
<div class="row centered">
|
||||||
<div class="col-lg-3 col-lg-offset-2 col-xs-12">
|
<div class="col-lg-3 col-lg-offset-2 col-xs-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
@ -364,6 +412,49 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal fade" id="modal-update">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h3 class="modal-title"><?php echo $this->lang->line('nano_credit_configuration'); ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="walletForm">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="taux_ag_nano_credit"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('nano_credit_rate_com_agent') . ' (%)'; ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control"
|
||||||
|
name="taux_ag_nano_credit" id="taux_ag_nano_credit" value="<?= $taux_ag_nano_credit ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="taux_sup_nano_credit"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('nano_credit_rate_com_sup') . ' (%)'; ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control"
|
||||||
|
name="taux_sup_nano_credit" id="taux_sup_nano_credit" value="<?= $taux_sup_nano_credit ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="taux_hyp_nano_credit"
|
||||||
|
class="col-form-label"><?php echo $this->lang->line('nano_credit_rate_com_hyp') . ' (%)'; ?></label>
|
||||||
|
<input type="number" min="0" step=".01" required class="form-control"
|
||||||
|
name="taux_hyp_nano_credit" id="taux_hyp_nano_credit" value="<?= $taux_hyp_nano_credit ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-left"
|
||||||
|
data-dismiss="modal"><?php echo $this->lang->line('Fermer'); ?></button>
|
||||||
|
<button type="button" id="updateWallet" data-network-id="<?= $network_id ?>"
|
||||||
|
data-id-config="<?= $idConfig ?>"
|
||||||
|
class="btn btn-primary"><?php echo $this->lang->line('Continuer'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<!-- jQuery 3 -->
|
<!-- jQuery 3 -->
|
||||||
|
@ -408,7 +499,6 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
toastr.options.closeDuration = 5000;
|
toastr.options.closeDuration = 5000;
|
||||||
toastr.options.closeEasing = 'swing';
|
toastr.options.closeEasing = 'swing';
|
||||||
|
|
||||||
|
|
||||||
$('#saveRates').click(function () {
|
$('#saveRates').click(function () {
|
||||||
const network_id = $(this).data('network-id');
|
const network_id = $(this).data('network-id');
|
||||||
const id_config = $(this).data('id-config');
|
const id_config = $(this).data('id-config');
|
||||||
|
@ -522,6 +612,61 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#updateWallet').click(function () {
|
||||||
|
|
||||||
|
const taux_ag = parseFloat($('#taux_ag_nano_credit').val());
|
||||||
|
const taux_sup = parseFloat($('#taux_sup_nano_credit').val());
|
||||||
|
const taux_hyp = parseFloat($('#taux_hyp_nano_credit').val());
|
||||||
|
|
||||||
|
const id_network = $(this).data('network-id');
|
||||||
|
// const id_config = $(this).data('id-config');
|
||||||
|
|
||||||
|
// total répartition commission réseau retrait carte-cash chez agent (retrait)
|
||||||
|
const total4 = parseFloat($('#taux_ag_nano_credit').val()) + parseFloat($('#taux_sup_nano_credit').val()) + parseFloat($('#taux_hyp_nano_credit').val());
|
||||||
|
|
||||||
|
if (total4 != 100) {
|
||||||
|
toastr.error("<?php echo $this->lang->line('nano_credit_rule')?>", "<?php echo $this->lang->line('management_rule')?>");
|
||||||
|
}else {
|
||||||
|
if ($('#walletForm')[0].checkValidity()) {
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url('index.php/Hyperviseur_dash/saveNanoCreditSharedRates')?>',
|
||||||
|
type: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
"taux_sup": taux_sup, "taux_hyp": taux_hyp,
|
||||||
|
"taux_ag": taux_ag,
|
||||||
|
"id_network": id_network
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
if (data == '200') {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'success',
|
||||||
|
title: "<?php echo $this->lang->line('nano_credit_update')?>",
|
||||||
|
text: "<?php echo $this->lang->line('informations_updated')?>",
|
||||||
|
timer: 3000
|
||||||
|
}).then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
// alert("Les informations ont été mises à jour.") ? "" :
|
||||||
|
} else {
|
||||||
|
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
error: function (resultat, statut, error) {
|
||||||
|
console.log(resultat + " " + error);
|
||||||
|
toastr.error("<?php echo $this->lang->line('error_message')?>", "<?php echo $this->lang->line('request_error')?>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#walletForm')[0].reportValidity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
// Interets nano credits
|
// Interets nano credits
|
||||||
|
|
|
@ -109,6 +109,10 @@ $context = new \Brick\Money\Context\AutoContext();
|
||||||
<h3 class="box-title">
|
<h3 class="box-title">
|
||||||
<?php echo $this->lang->line('users_groups') ?></h3>
|
<?php echo $this->lang->line('users_groups') ?></h3>
|
||||||
<div class="box-tools">
|
<div class="box-tools">
|
||||||
|
<a class="btn btn-success" href="
|
||||||
|
<?php echo current_url() . ($network_id ? '?history=savings' : '') ?>">
|
||||||
|
<?php echo $this->lang->line('savings_history'); ?>
|
||||||
|
</a>
|
||||||
<a class="btn btn-primary" href="
|
<a class="btn btn-primary" href="
|
||||||
<?php echo current_url() . ($network_id ? '?history=nano_credit' : '') ?>">
|
<?php echo current_url() . ($network_id ? '?history=nano_credit' : '') ?>">
|
||||||
<?php echo $this->lang->line('nano_credit_history'); ?>
|
<?php echo $this->lang->line('nano_credit_history'); ?>
|
||||||
|
|
|
@ -0,0 +1,309 @@
|
||||||
|
<!-- DataTables -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="<?php echo base_url('bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css') ?>">
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('bower_components/toastr/toastr.css') ?>">
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Brick\Money\Context\AutoContext;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Brick\Money\CurrencyConverter;
|
||||||
|
use Brick\Money\ExchangeRateProvider\PDOProvider;
|
||||||
|
use Brick\Money\ExchangeRateProvider\PDOProviderConfiguration;
|
||||||
|
use Brick\Money\ExchangeRateProvider\BaseCurrencyProvider;
|
||||||
|
use Brick\Math\RoundingMode;
|
||||||
|
use Brick\Money\Money;
|
||||||
|
|
||||||
|
function toLocateDate($date, $timezone)
|
||||||
|
{
|
||||||
|
if ($date) {
|
||||||
|
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
|
||||||
|
$carbon->setTimezone($timezone);
|
||||||
|
return $carbon->toDateTimeString();
|
||||||
|
}
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
|
||||||
|
<h1>
|
||||||
|
<?php echo isset($category) ? 'Nano credit' : $this->lang->line('nano_credit_management');
|
||||||
|
echo ' ' . $network . ' - ' . $country
|
||||||
|
. ' :: ' . $this->lang->line('savings_history'); ?>
|
||||||
|
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
|
||||||
|
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
|
||||||
|
</h1>
|
||||||
|
<?php
|
||||||
|
$site_url = base_url();
|
||||||
|
|
||||||
|
if ($alert == "ok") {
|
||||||
|
|
||||||
|
if (!$success == "ok") {
|
||||||
|
?>
|
||||||
|
<div class='alert alert-danger alert-dismissible col-xs-6'>
|
||||||
|
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
|
||||||
|
<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div class="alert alert-success alert-dismissible col-xs-6">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
|
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||||
|
<?php echo $message; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// set to whatever your rates are relative to
|
||||||
|
$baseCurrency = 'USD';
|
||||||
|
|
||||||
|
// use your own credentials, or re-use your existing PDO connection
|
||||||
|
$pdo = new PDO('mysql:host=' . $this->db->hostname . ';dbname=' . $this->db->database, $this->db->username, $this->db->password);
|
||||||
|
|
||||||
|
$configuration = new PDOProviderConfiguration();
|
||||||
|
|
||||||
|
$configuration->tableName = 'exchange_rate';
|
||||||
|
$configuration->exchangeRateColumnName = 'exchange_rate';
|
||||||
|
$configuration->targetCurrencyColumnName = 'target_currency';
|
||||||
|
$configuration->sourceCurrencyCode = $baseCurrency;
|
||||||
|
|
||||||
|
// this provider loads exchange rates from your database
|
||||||
|
$provider = new PDOProvider($pdo, $configuration);
|
||||||
|
|
||||||
|
// this provider calculates exchange rates relative to the base currency
|
||||||
|
$provider = new BaseCurrencyProvider($provider, $baseCurrency);
|
||||||
|
|
||||||
|
// this currency converter can now handle any currency pair
|
||||||
|
$converter = new CurrencyConverter($provider);
|
||||||
|
$context = new AutoContext();
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
<section class="content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-sm-6 col-xs-12">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-aqua"><i class="ion ion-android-time"></i></span>
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text"><?php echo $this->lang->line('Période') ?> </span>
|
||||||
|
<span class="info-box-number">
|
||||||
|
<input id="picker"
|
||||||
|
style="background: #fff; cursor: pointer; padding: 1px 1px; border: 1px solid #ccc; width: 100%"
|
||||||
|
data-category="<?php echo isset($category) ? $category : null ?>"
|
||||||
|
type="text" name="daterange"
|
||||||
|
data-lang="<?php echo $this->session->userdata('site_lang') ?>"
|
||||||
|
value="<?php echo ($startDate != null & $endDate != null) ? $startDate . ' - ' . $endDate : '' ?>"/>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
<span> Format : <?php echo $this->session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?> </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title"><?php echo $this->lang->line('export_savings_demands_history') ?></h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body" style="overflow-x:auto;">
|
||||||
|
<?php
|
||||||
|
if ($transactions){
|
||||||
|
$numrows = $transactions->num_rows();
|
||||||
|
$num = 0;
|
||||||
|
if ($numrows > 0) {
|
||||||
|
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table id="transactions" class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align='center'>ID</th>
|
||||||
|
<th align='center'><?php echo $this->lang->line('state') ?></th>
|
||||||
|
<th align='center'><?php echo $this->lang->line('duration') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('Montant') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('interest') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('tax') ?></th>
|
||||||
|
<th><?php echo $this->lang->line('issuer_id') ?></th>
|
||||||
|
<th>Date de creation</th>
|
||||||
|
<th><?php echo $this->lang->line('cassation_date') ?></th>
|
||||||
|
<th align='center'>Date de fin</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
foreach ($transactions->result() as $row) {
|
||||||
|
$num++;
|
||||||
|
if ($row->user_phone) {
|
||||||
|
$emetteur = $row->user_phone . ' | ' . $row->user;
|
||||||
|
} else {
|
||||||
|
$emetteur = ($row->nom_emetteur ? $row->nom_emetteur : '') . (' ' . $row->prenom_emetteur ? $row->prenom_emetteur : '');
|
||||||
|
}
|
||||||
|
$moneyNet = Money::of(round($row->montant, 2), $currency_code, $context);
|
||||||
|
echo "<tr>
|
||||||
|
<td align='center' >$row->id_epargne</td>
|
||||||
|
<td>" . strtoupper($row->etat) . "</td>
|
||||||
|
<td>" . strtoupper($row->duree_mois) . "</td>
|
||||||
|
<td>" . $moneyNet->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . Money::of(round($row->interet, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . Money::of(round($row->taxe, 2), $currency_code, $context)->formatTo('fr_FR') . "</td>
|
||||||
|
<td>" . $emetteur . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_creation, $this->session->userdata('timezone')) . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_cassation, $this->session->userdata('timezone')) . "</td>
|
||||||
|
<td>" . toLocateDate($row->date_fin, $this->session->userdata('timezone')) . "</td>";
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo $this->lang->line('Aucune demande');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo $this->lang->line('Aucune demande');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- jQuery 3 -->
|
||||||
|
<script src="<?php echo base_url('bower_components/jquery/dist/jquery.min.js') ?>"></script>
|
||||||
|
<!-- Bootstrap 3.3.7 -->
|
||||||
|
<script src="<?php echo base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
|
||||||
|
<!-- DataTables -->
|
||||||
|
<script src="<?php echo base_url('bower_components/datatables.net/js/jquery.dataTables.min.js') ?>"></script>
|
||||||
|
<script src="<?php echo base_url('bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js') ?>"></script>
|
||||||
|
<!-- SlimScroll -->
|
||||||
|
<script src="<?php echo base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
|
||||||
|
<!-- FastClick -->
|
||||||
|
<script src="<?php echo base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
|
||||||
|
<!-- AdminLTE App -->
|
||||||
|
<script src="<?php echo base_url('dist/js/adminlte.min.js') ?>"></script>
|
||||||
|
<!-- AdminLTE for demo purposes -->
|
||||||
|
<script src="<?php echo base_url('dist/js/demo.js') ?>"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment-with-locales.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.min.js"></script>
|
||||||
|
<script src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
||||||
|
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
const lang = $('#picker').data('lang');
|
||||||
|
const format = lang === 'french' ? 'fr' : 'en';
|
||||||
|
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
||||||
|
var table = $('#transactions').DataTable({
|
||||||
|
"aaSorting": [[7, "desc"]],
|
||||||
|
"columnDefs": [{
|
||||||
|
targets: [7,8,9],
|
||||||
|
render: $.fn.dataTable.render.moment('YYYY-MM-DD HH:mm:ss', 'D MMMM YYYY HH:mm:ss', format)
|
||||||
|
}],
|
||||||
|
dom: 'Bfrtip',
|
||||||
|
"buttons": [
|
||||||
|
'pageLength',
|
||||||
|
{
|
||||||
|
extend: 'excelHtml5',
|
||||||
|
title: 'Historique des épargnes',
|
||||||
|
customizeData: function (data) {
|
||||||
|
for (var i = 0; i < data.body.length; i++) {
|
||||||
|
for (var j = 0; j < data.body[i].length; j++) {
|
||||||
|
// data.body[i][j] = '\u200C' + data.body[i][j];
|
||||||
|
if ([3,4, 5,].includes(j)) {
|
||||||
|
// Get the value and strip the non numeric characters
|
||||||
|
// var value = $(this).text();
|
||||||
|
value = data.body[i][j].replace(',', ".")
|
||||||
|
data.body[i][j] = Number(value.replace(/[^0-9\.-]+/g, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'csvHtml5',
|
||||||
|
title: 'Historique des épargnes',
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'pdfHtml5',
|
||||||
|
orientation: 'landscape',
|
||||||
|
pageSize: 'LEGAL',
|
||||||
|
title: 'Historique des épargnes',
|
||||||
|
trim: false
|
||||||
|
},
|
||||||
|
// 'colvis'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
table.buttons().container()
|
||||||
|
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var startDate;
|
||||||
|
var endDate;
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
const lang = $('#picker').data('lang');
|
||||||
|
const category = $('#picker').data('category');
|
||||||
|
$('input[name="daterange"]').daterangepicker({
|
||||||
|
opens: 'left',
|
||||||
|
autoUpdateInput: false,
|
||||||
|
locale: {
|
||||||
|
format: lang === 'french' ? 'DD-MM-YYYY' : 'YYYY-MM-DD',
|
||||||
|
cancelLabel: 'Clear'
|
||||||
|
}
|
||||||
|
}, function (start, end, label) {
|
||||||
|
const debut = start.format('YYYY-MM-DD');
|
||||||
|
const fin = end.format('YYYY-MM-DD');
|
||||||
|
if (category)
|
||||||
|
window.location = "<?php echo current_url()?>" + "?history=savings" + "&d=" + debut + "&f=" + fin;
|
||||||
|
else
|
||||||
|
window.location = "<?php echo current_url()?>" + "?id=118&history=savings" + "&d=" + debut + "&f=" + fin;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
|
||||||
|
//do something, like clearing an input
|
||||||
|
$('#daterange').val('');
|
||||||
|
if (category)
|
||||||
|
window.location = "<?php echo current_url()?>" + "?history=savings";
|
||||||
|
else
|
||||||
|
window.location = "<?php echo current_url()?>" + "?id=118&history=savings";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
Loading…
Reference in New Issue