load->model('pagination/WalletTransaction_model', 'wt_model'); $this->load->model('wallet_model'); } function getLists() { $data = $row = array(); // Fetch member's records $wtData = $this->wt_model->getRows($_POST); $i = $_POST['start']; $fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL ); $config = $this->wallet_model->getConfigWallet($_POST['id_network'])->first_row(); foreach ($wtData as $row) { $type = $row->type_transac == 'credit' ? $this->lang->line('DEPOT') : $this->lang->line('RETRAIT'); $banque = 0; if($row->type_transac == 'credit'){ if($row->montant < 0){ $commission = (-$row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot; $net = $row->montant + $commission; }else{ $commission = ( $row->montant * $config->taux_com_client_depot / 100 ) + $config->frais_min_banque_depot; $net = $row->montant - $commission; } $banque = $row->montant * (1 - ($config->taux_com_client_depot / 100)); }else{ $net = $row->montant ; } $disabled = $row->canceled ? "disabled" : ""; $disabled1 = $row->deleted ? "disabled" : ""; $data[] = array($row->id,strtoupper($type), join(" ", str_split($row->numCarte, 4)), $fmt->format($net), ($row->type_transac == 'credit' ? $fmt->format($banque) : ""), $fmt->format( $row->commission_banque), $fmt->format( $row->commission_hyp), $fmt->format( $row->commission_sup), $fmt->format( $row->commission_ag), $row->agent ,$row->parrain, $row->date_created, ' '); } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->wt_model->countAll($_POST), "recordsFiltered" => $this->wt_model->countFiltered($_POST), "data" => $data, ); // Output to JSON format echo json_encode($output); } }