load->model('pagination/Insurances_model', '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 getLists() { $data = $row = array(); // Fetch member's records $witData = $this->model->getRows($_POST); $i = $_POST['start']; $current_url = $_POST['currentURL']; foreach ($witData as $row) { $i++; $bonus_amount = Money::of(round($row->total_bonus_amount, 2), $row->currency_code, $this->context)->formatTo('fr_FR'); $data[] = array($row->insurance_subscription_id, $row->insured_id , $row->lastname, $row->phone, $row->number_of_months, $row->number_of_beneficiaries, $bonus_amount, mb_strtoupper($this->lang->line($row->state) ,'UTF-8'), $row->created_at, ' '.$this->lang->line('Voir plus...').''); } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->model->countAll($_POST), "recordsFiltered" => $this->model->countFiltered($_POST), "data" => $data, ); // Output to JSON format echo json_encode($output); } }