diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index ff436426..d82e7a9a 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -2378,8 +2378,9 @@ class Gestion extends CI_Controller $id_country = $this->input->post('id_country'); $name = $this->input->post('name'); $address = $this->input->post('address'); + $code = $this->input->post('code'); - $res = $this->wallet_model->updateBank($id_bank, $id_country ,$name , $address); + $res = $this->wallet_model->updateBank($id_bank, $id_country ,$name , $address , $code); if ($res == true) { echo json_encode("completed"); diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index f107ceb5..bb2a6dee 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -441,7 +441,7 @@ class Hyperviseur_dash extends CI_Controller $networkDetails = $this->user_model->getNetworkDetails($network_id); $data['currency_name_fr'] = $networkDetails->first_row()->currency_name_fr; $data['currency_name_en'] = $networkDetails->first_row()->currency_name_en; - $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id); +// $data['transactions'] = $this->wallet_model->getIlinkTransactions($startDate, $endDate, $network_id); } else if ($type == 'commission_transfer') $data['transactions'] = $this->wallet_model->getCommissionTransfers($startDate, $endDate, $this->session->userdata('member_code')); else if ($type == 'balance_statement') diff --git a/application/controllers/pagination/WalletIlinkTransaction.php b/application/controllers/pagination/WalletIlinkTransaction.php new file mode 100755 index 00000000..6f87dfb9 --- /dev/null +++ b/application/controllers/pagination/WalletIlinkTransaction.php @@ -0,0 +1,108 @@ +load->model('pagination/WalletIlinkTransaction_model', 'wit_model'); + + // 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 + $this->converter = new CurrencyConverter($provider); + $this->context = new AutoContext(); + + } + + 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; + } + + function getLists() + { + $data = $row = array(); + + // Fetch member's records + $witData = $this->wit_model->getRows($_POST); + + $i = $_POST['start']; + foreach ($witData as $row) { + $i++; + $created = $this->toLocateDate($row->date,$this->session->userdata('timezone')) ; //date('jS M Y', strtotime($row->date)); +// $status = ($row->status == 1)?'Active':'Inactive'; + $operation = strtoupper($row->acteur) . ' - ' . ($this->session->userdata('site_lang') === 'french' ? $row->operation_fr : $row->operation_en); + $numero_carte = join(" ", str_split($row->numero_carte, 4)); + + + $moneyNetInit = Money::of(round($row->montant_net, 2), $row->init_currency, $this->context); + $agent = $row->agent ? ($row->agent . " | " . $row->code_agent . " | " . $row->phone_agent) : ""; + if ($row->destinataire_phone) { + $destinataire = $row->destinataire_phone . ' | ' . $row->destinataire_name; + } else { + $destinataire = ($row->id_destinataire ? $row->id_destinataire . ' | ' : '') . ($row->nom_destinataire ? $row->nom_destinataire : '') . (' ' . $row->prenom_destinataire ? $row->prenom_destinataire : ''); + + } + if ($row->user_phone) { + $emetteur = $row->user_phone . ' | ' . $row->user; + } else { + $emetteur = ($row->nom_emetteur ? $row->nom_emetteur : '') . (' ' . $row->prenom_emetteur ? $row->prenom_emetteur : ''); + } + $moneyNetFinal = Money::of(round($row->montant_net_final_country, 2), $row->final_currency ? $row->final_currency : 'XAF', $this->context); + + $data[] = array($row->id_transaction, $operation, $numero_carte, $moneyNetInit->formatTo('fr_FR'), $moneyNetFinal->formatTo('fr_FR'), + Money::of(round($row->part_reseau_payeur_final_country ? $row->part_reseau_payeur_final_country : 0, 2), $row->final_currency ? $row->final_currency : 'XAF', $this->context)->formatTo('fr_FR'), + str_replace('_', ' ', $row->status_reseau_payeur), $row->final_currency, $row->pays_init,$row->pays_final, Money::of(round($row->frais,2), $row->init_currency,$this->context)->formatTo('fr_FR'), + Money::of(round($row->taxe, 2),$row->init_currency,$this->context)->formatTo('fr_FR'),Money::of(round($row->commission_banque ? $row->commission_banque : 0, 2),$row->init_currency,$this->context)->formatTo('fr_FR'), + Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 2),$row->init_currency,$this->context)->formatTo('fr_FR'),Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 2),$row->init_currency,$this->context)->formatTo('fr_FR'), + Money::of(round($row->commission_ag ? $row->commission_ag : 0, 2),$row->init_currency,$this->context)->formatTo('fr_FR'), $agent , $emetteur, $destinataire, $created); + } + + $output = array( + "draw" => $_POST['draw'], + "recordsTotal" => $this->wit_model->countAll($_POST), + "recordsFiltered" => $this->wit_model->countFiltered($_POST), + "data" => $data, + ); + + // Output to JSON format + echo json_encode($output); + } + +} diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 5dea6000..7cd692d4 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -537,4 +537,5 @@ $lang['paying_networks'] = 'Paying networks'; $lang['configure_transmitter_network'] = 'Configure the sending network'; $lang['paying_and_transmitting_networks_accounts'] = "Accounts of paying and issuing networks"; $lang['transmitting_networks_accounts'] = 'Accounts of transmitting networks'; +$lang['bank_code'] = "Bank code"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 7af8d917..179fcdc9 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -549,5 +549,6 @@ $lang['paying_networks'] = 'Réseaux payeurs'; $lang['configure_transmitter_network'] = 'Configurer le réseau émetteur'; $lang['paying_and_transmitting_networks_accounts'] = "Comptes des reseaux payeurs et émetteurs"; $lang['transmitting_networks_accounts'] = 'Comptes des reseaux émetteurs'; +$lang['bank_code'] = "Code banque"; ?> diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php index 95cda339..22375624 100644 --- a/application/models/Wallet_model.php +++ b/application/models/Wallet_model.php @@ -864,7 +864,7 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle // Banques public function getAllBanksCountries(){ - $query = $this->db->query("SELECT b.id, b.nom as bank_name , bc.adresse as bank_address , bc.status, c.name as country , c.id as country_id FROM banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country"); + $query = $this->db->query("SELECT b.id, b.nom as bank_name , bc.adresse as bank_address , bc.code_banque as bank_code , bc.status, c.name as country , c.id as country_id FROM banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country"); return $query->num_rows() > 0 ? $query : false ; } @@ -883,12 +883,12 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle return $query->num_rows() > 0 ? $query : false ; } - public function updateBank($id_bank,$id_country, $name , $address){ + public function updateBank($id_bank,$id_country, $name , $address , $code){ $sql = "UPDATE `banks` SET `nom` = ? WHERE (`id` = ?);"; $this->db->query($sql , array($name,$id_bank)); - $sql = "UPDATE `banks_countries` SET `adresse` = ? WHERE (`id_bank` = ? AND `id_country` = ?);"; - return $this->db->query($sql , array($address,$id_bank,$id_country)); + $sql = "UPDATE `banks_countries` SET `adresse` = ? , `code_banque` = ? WHERE (`id_bank` = ? AND `id_country` = ?);"; + return $this->db->query($sql , array($address,$code,$id_bank,$id_country)); } public function deleteBankCountry($id_bank, $id_country){ @@ -898,7 +898,7 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle } public function getBanksForNetwork($id_network){ - $sql = "SELECT bc.id, b.nom as bank_name , bc.adresse as bank_address, c.name as country , c.id as country_id , nb.id_network FROM networks n + $sql = "SELECT bc.id, b.nom as bank_name , bc.adresse as bank_address, bc.code_banque as bank_code , c.name as country , c.id as country_id , nb.id_network FROM networks n CROSS JOIN banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country LEFT JOIn networks_banks nb ON nb.id_bank_country = bc.id AND nb.id_network = n.id WHERE bc.status = 1 AND n.id = ?"; $query = $this->db->query($sql , array($id_network)); diff --git a/application/models/pagination/WalletIlinkTransaction_model.php b/application/models/pagination/WalletIlinkTransaction_model.php new file mode 100644 index 00000000..a55bd54c --- /dev/null +++ b/application/models/pagination/WalletIlinkTransaction_model.php @@ -0,0 +1,101 @@ +table = 'infos_ilink_transaction'; + // Set orderable column fields + $this->column_order = array('id_transaction', 'operation_fr', 'numero_carte', 'montant_net', 'montant_net_final_country', + 'part_reseau_payeur_final_country', 'status_reseau_payeur','final_currency', 'pays_init', 'pays_final', 'frais', 'taxe', 'commission_banque', + 'commission_hyp', 'commission_sup', 'commission_ag', 'agent', null, null,'date'); + // Set searchable column fields + $this->column_search = array('id_transaction', 'operation_fr', 'numero_carte', 'montant_net', 'montant_net_final_country', + 'part_reseau_payeur_final_country', 'status_reseau_payeur','final_currency', 'pays_init', 'pays_final', 'frais', 'taxe', 'commission_banque', + 'commission_hyp', 'commission_sup', 'commission_ag', 'agent','date'); + // Set default order + $this->order = array('date' => 'desc'); + } + + /* + * Fetch members data from the database + * @param $_POST filter data based on the posted parameters + */ + public function getRows($postData) + { + $this->_get_datatables_query($postData); + if ($postData['length'] != -1) { + $this->db->limit($postData['length'], $postData['start']); + } + $query = $this->db->get(); + return $query->result(); + } + + /* + * Count all records + */ + public function countAll($postData) + { + $this->db->from($this->table); + $this->db->where('network_emetteur', $postData['id_network']); + return $this->db->count_all_results(); + } + + /* + * Count records based on the filter params + * @param $_POST filter data based on the posted parameters + */ + public function countFiltered($postData) + { + $this->_get_datatables_query($postData); + $query = $this->db->get(); + return $query->num_rows(); + } + + /* + * Perform the SQL queries needed for an server-side processing requested + * @param $_POST filter data based on the posted parameters + */ + private function _get_datatables_query($postData) + { + + $this->db->from($this->table); + $this->db->where('network_emetteur', $postData['id_network']); + if (strlen($postData['startDate']) > 0 && strlen($postData['endDate']) > 0) { + $this->db->where('date >=', date('Y-m-d h:i:s', strtotime($postData['startDate']))); + $this->db->where('date <=', date('Y-m-d h:i:s', strtotime($postData['endDate']))); + } + + $i = 0; + // loop searchable columns + foreach ($this->column_search as $item) { + // if datatable send POST for search + if ($postData['search']['value']) { + // first loop + if ($i === 0) { + // open bracket + $this->db->group_start(); + $this->db->like($item, $postData['search']['value']); + } else { + $this->db->or_like($item, $postData['search']['value']); + } + + // last loop + if (count($this->column_search) - 1 == $i) { + // close bracket + $this->db->group_end(); + } + } + $i++; + } + + if (isset($postData['order'])) { + $this->db->order_by($this->column_order[$postData['order']['0']['column']], $postData['order']['0']['dir']); + } else if (isset($this->order)) { + $order = $this->order; + $this->db->order_by(key($order), $order[key($order)]); + } + } +} diff --git a/application/views/gestion_banques_admin.php b/application/views/gestion_banques_admin.php index e5d371b7..f3210f3a 100755 --- a/application/views/gestion_banques_admin.php +++ b/application/views/gestion_banques_admin.php @@ -59,6 +59,7 @@
lang->line('Commission de l\'agent') ?> | lang->line('agent_name') ?> | lang->line('issuer_id') ?> | -lang->line('recipient_id')?> | -Date | - session->userdata('category') != 'super') { ?> - - - - - - - result() as $row) { - $num++; - - $net = 0; - $banque = 0; - $moneyNetInit = Money::of(round($row->montant_net ,2), $row->init_currency,$context); - $agent = $row->agent ? ( $row->agent." | ".$row->code_agent." | ".$row->phone_agent ) : ""; - if($row->destinataire_phone){ - $destinataire = $row->destinataire_phone.' | '.$row->destinataire_name; - }else{ - $destinataire = ($row->id_destinataire ? $row->id_destinataire.' | ' : '').($row->nom_destinataire ? $row->nom_destinataire : '').(' '.$row->prenom_destinataire? $row->prenom_destinataire : ''); - - } - if($row->user_phone){ - $emetteur = $row->user_phone.' | '.$row->user; - }else{ - $emetteur = ($row->nom_emetteur? $row->nom_emetteur : '').(' '.$row->prenom_emetteur ? $row->prenom_emetteur : ''); - } - $moneyNetFinal =Money::of(round($row->montant_net_final_country,2),$row->final_currency ? $row->final_currency : 'XAF',$context); - echo "|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$row->id_transaction | -" . strtoupper($row->acteur) . ' - ' .($this->session->userdata('site_lang') === 'french' ? $row->operation_fr : $row->operation_en). " | -" . join(" ", str_split($row->numero_carte, 4)) . " | -" . $moneyNetInit->formatTo('fr_FR') . " | -" . $moneyNetFinal->formatTo('fr_FR') . " | -" . Money::of(round($row->part_reseau_payeur_final_country ? $row->part_reseau_payeur_final_country : 0, 2), $row->final_currency ? $row->final_currency : 'XAF', $context)->formatTo('fr_FR') . " | -" . str_replace('_',' ',$row->status_reseau_payeur). " | -" . $row->final_currency . " | -".$row->pays_init." | -".$row->pays_final." | -".Money::of(round($row->frais,2), $row->init_currency,$context)->formatTo('fr_FR')." | -".Money::of(round($row->taxe, 2),$row->init_currency,$context)->formatTo('fr_FR')." | -".Money::of(round($row->commission_banque ? $row->commission_banque : 0, 2),$row->init_currency,$context)->formatTo('fr_FR')." | -".Money::of(round($row->commission_hyp ? $row->commission_hyp : 0, 2),$row->init_currency,$context)->formatTo('fr_FR')." | -".Money::of(round($row->commission_sup ? $row->commission_sup : 0 , 2),$row->init_currency,$context)->formatTo('fr_FR')." | -".Money::of(round($row->commission_ag ? $row->commission_ag : 0, 2),$row->init_currency,$context)->formatTo('fr_FR')." | -".$agent." | -".$emetteur." | -".$destinataire." | -".toLocateDate($row->date,$this->session->userdata('timezone'))." | "; - ?> - session->userdata('category') != 'super') { ?> - -id_transaction ?> -canceled) echo "disabled" ?> -lang->line('cancel') ?> - - - -lang->line('recipient_id')?> | +Date | + +