<link rel="stylesheet"
	  href="<?= base_url('bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') ?>">
<link rel="stylesheet" href="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.css') ?>">
<link rel="stylesheet"
	  href="<?= base_url('<link rel="stylesheet" 
	href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap.min.css">') ?>">

<?php

use Brick\Money\Context\CustomContext;
use Brick\Money\Money;
$context = new \Brick\Money\Context\AutoContext();
$month = time();
$months[] = convertDate(date("M"));
$label_months [] = date("M") . " " . date("Y");
$years[] = date("Y");
for ($i = 1; $i <= 11; $i++) {
	$month = strtotime('last month', $month);
	$months [] = convertDate(date("M", $month));
	$years[] = date("Y", $month);
	$label_months [] = date("M", $month) . " " . date("Y", $month);
}

/**
 ** Retraits
 **/
$date = date("Y");

$retraits_data[] = '';
$retraits_data = array();
for ($i = 1; $i <= 12; $i++) {
	$retraits_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction
                      WHERE network_emetteur='" . $network_id . "' 
                        AND MONTH(date) = '" . $months[$i - 1] . "' 
                        AND YEAR(date) = '" . $years[$i - 1] . "'
                        AND type_transaction='retrait'");
	$retraits_data[] = $retraits_query_mounth->num_rows();
}

$startDate = (new DateTime('01-' . $months[11] . '-' . $years[11]))->format('Y-m-d H:i:s');
$endDate = date_create_from_format('m/Y', $months[0] . '/' . $years[0])->format('Y-m-d H:i:s');

$retraits = $this->db->query("SELECT * FROM infos_ilink_transaction
                      WHERE network_emetteur='" . $network_id . "'
                        AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "'
                        AND type_transaction='retrait'");

/**
 ** Dépots
 **/
$date = date("Y");

$depots_data[] = '';
$depots_data = array();
for ($i = 1; $i <= 12; $i++) {
	$depots_query_mounth = $this->db->query("SELECT id FROM infos_ilink_transaction
                      WHERE network_emetteur='" . $network_id . "' 
                        AND MONTH(date) = '" . $months[$i - 1] . "' 
                        AND YEAR(date) = '" . $years[$i - 1] . "'
                        AND type_transaction='depot'");
	$depots_data[] = $depots_query_mounth->num_rows();
}
$depots = $this->db->query("SELECT * FROM infos_ilink_transaction
						  WHERE network_emetteur='" . $network_id . "'
						   AND date BETWEEN '" . $startDate . "' AND '" . $endDate . "'
							AND type_transaction='depot'");
if ($transactions) {
	$transac = $transactions->num_rows();
	$array_transac = array();
	$num = 0;
	if ($transac > 0) {
		foreach ($transactions->result() as $row) {
			$num++;
			$array_transac[] = $row->type_transaction;
		}
		$vals_transac = array_count_values($array_transac);
		$pieChart = array();
		foreach (array_keys($vals_transac) as $paramName) {
			$color = dechex(rand(0x000000, 0xFFFFFF));
			$trash = array("value" => $vals_transac[$paramName],
				"color" => "#" . $color,
				"highlight" => "#" . $color,
				"label" => $paramName);

			$pieChart[] = $trash;
		}
	}
} else {
	$pieChart = array();
}
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
?>

<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">

		<h1>
			<?= $this->lang->line('Gestion des wallets'). ' '. $network .' - '.$country; ?>
			<span class="label label-success pull-right"><?= mb_strtoupper(str_replace('_',' ',$type),'UTF-8') ?></span>
		</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>
					<?= $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">&times;</button>
					<h4><i class="icon fa fa-check"></i> Success!</h4>
					<?= $message; ?>
				</div>

				<?php
			}
		}
		?>

	</section>

	<section class="content">
		<div class="row centered">
			<div class="col-lg-2 col-lg-offset-2 col-xs-6">
				<div class="small-box bg-aqua-active">
					<div class="inner">
						<h3><?= $taux_u_w_cart; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_user_wallet_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a> -->
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-aqua-active">
					<div class="inner">
						<h3><?= $taux_u_c_w; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_user_cart_wallet') ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a> -->
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-aqua-active">
					<div class="inner">
						<h3><?= $taux_u_c_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_user_cart_cash') ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a> -->
				</div>
			</div>
			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-aqua-active">
					<div class="inner">
						<h3><?= $taux_ag_d_c_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_depot_cash_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<!-- <a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a> -->
				</div>
			</div>
		</div>
		<div class="row">
			<!--			répartition commission du réseau opération envoi et retrait de cash-->
			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-yellow-active">
					<div class="inner">
						<h3><?= $taux_ag_s_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_send_cash') ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
						<a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_client_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-yellow-active">
					<div class="inner">
						<h3><?= $taux_sup_s_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_sup_send_cash') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
						<a href="#" data-toggle="modal" data-target="#modal-update" data-type="frais_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-yellow-active">
					<div class="inner">
						<h3><?= $taux_hyp_s_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_hyp_send_cash') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_ag_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-red-active">
					<div class="inner">
						<h3><?= $taux_ag_r_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_remove_cash') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
					<a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_sup_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>


			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-red-active">
					<div class="inner">
						<h3><?= $taux_sup_r_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_sup_remove_cash') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-red-active">
					<div class="inner">
						<h3><?= $taux_hyp_r_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_bq_remove_cash') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
				</div>
			</div>

		</div>
		<div class="row">
			<!--Taux  commission wallet agent carte client et Taux  commission wallet agent carte client-->
			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-green">
					<div class="inner">
						<h3><?= $taux_ag_cart_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_cart_cash') ?></p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-green">
					<div class="inner">
						<h3><?= $taux_ag_cash_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_cash_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
					<a href="#" data-toggle="modal" data-target="#modal-update" data-type="frais_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-olive-active">
					<div class="inner">
						<h3><?= $taux_ag_d_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_depot_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-olive-active">
					<div class="inner">
						<h3><?= $taux_sup_d_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_sup_depot_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
					<a href="#" data-toggle="modal" data-target="#modal-update" data-type="taux_sup_d" class="small-box-footer openModal">Modifier <i class="fa fa-arrow-circle-right"></i></a>
				</div>
			</div>


			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-olive-active">
					<div class="inner">
						<h3><?= $taux_hyp_d_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_hyp_depot_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-olive-active">
					<div class="inner">
						<h3><?= $taux_bq_d_c; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_bq_depot_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-down"></i>
					</div>
				</div>
			</div>

		</div>
		<div class="row">
			<!--Taux  commission wallet agent carte client et Taux  commission wallet agent carte client-->
			<div class="col-lg-2 col-lg-offset-2 col-xs-6">
				<div class="small-box bg-orange">
					<div class="inner">
						<h3><?= $taux_ag_r_cart; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_agent_remove_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-orange">
					<div class="inner">
						<h3><?= $taux_sup_r_cart; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_sup_remove_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
				</div>
			</div>


			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-orange">
					<div class="inner">
						<h3><?= $taux_hyp_r_cart; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_hyp_remove_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
				</div>
			</div>

			<div class="col-lg-2 col-xs-6">
				<div class="small-box bg-orange">
					<div class="inner">
						<h3><?= $taux_bq_r_cart; ?><sup style="font-size: 20px">%</sup></h3>
						<p><?= $this->lang->line('rate_com_bq_remove_cart') ?> </p>
					</div>
					<div class="icon">
						<i class="ion ion-android-arrow-up"></i>
					</div>
				</div>
			</div>

		</div>

		
		<div class="row centered">
			<div class="col-lg-3  col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_user_wallet_wallet_international'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_user_wallet_wallet!=false){
								foreach($plr_user_wallet_wallet->result() as $row) {
									echo "<tr>
																	<td>".$fmt->format($row->min)."</td>
																	<td>".$fmt->format($row->max)."</td>
																	  <td>".$row->taux."</td>".'
																	 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>


				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_user_wallet_wallet_national'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_user_wallet_wallet_national!=false){
								foreach($plr_user_wallet_wallet_national->result() as $row) {
									echo "<tr>
																	<td>".$fmt->format($row->min)."</td>
																	<td>".$fmt->format($row->max)."</td>
																	  <td>".$row->taux."</td>".'
																	 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
			<div class="col-lg-3  col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_user_wallet_cash_international'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_user_wallet_cash!=false){
								foreach($plr_user_wallet_cash->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_user_wallet_cash_national'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_user_wallet_cash_national!=false){
								foreach($plr_user_wallet_cash_national->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
			<div class="col-lg-3  col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_depot_wallet_international'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_depot_wallet_ilink!=false){
								foreach($plr_agent_depot_wallet_ilink->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_depot_wallet_national'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_depot_wallet_ilink_national!=false){
								foreach($plr_agent_depot_wallet_ilink_national->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
			<div class="col-lg-3  col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_depot_autre_wallet_international'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_depot_autre_wallet!=false){
								foreach($plr_agent_depot_autre_wallet->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_depot_autre_wallet_national'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_depot_autre_wallet_national!=false){
								foreach($plr_agent_depot_autre_wallet_national->result() as $row) {
									echo "<tr>
																		<td>".$fmt->format($row->min)."</td>
																		<td>".$fmt->format($row->max)."</td>
																		  <td>".$row->taux."</td>".'
																		 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
		</div>
		<div class="row centered">
			<div class="col-lg-4 col-lg-offset-2 col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_cash_cash_international'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_cash_cash!=false){
								foreach($plr_agent_cash_cash->result() as $row) {
									echo "<tr>
																			<td>".$fmt->format($row->min)."</td>
																			<td>".$fmt->format($row->max)."</td>
																			  <td>".$row->taux."</td>".'
																			 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('rate_com_agent_cash_cash_national'); ?></h3>
					</div>
					<!-- /.box-header -->
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover">
							<tbody>
							<tr>
								<th>Min</th>
								<th>Max</th>
								<th>Taux (%)</th>
							</tr>
							<?php
							if($plr_agent_cash_cash_national!=false){
								foreach($plr_agent_cash_cash_national->result() as $row) {
									echo "<tr>
																			<td>".$fmt->format($row->min)."</td>
																			<td>".$fmt->format($row->max)."</td>
																			  <td>".$row->taux."</td>".'
																			 </tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
			<div class="col-lg-4 col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('transaction_taxes'); ?></h3>
					</div>
					<div class="box-body table-responsive" style="overflow-x:auto;">
						<table class="table table-hover" >
							<thead>
							<tr>
								<th><?= $this->lang->line('Nom') ; ?> </th>
								<th>Type</th>
								<th>Valeur</th>
								<th>Destination</th>
							</tr>
							</thead>
							<tbody>
							<?php
							if($taxes!=false){
								foreach($taxes->result() as $row) {
									echo "<tr>
										<td>".$row->nom."</td>
										<td>".$row->type."</td>
										<td>".$row->valeur."</td>
										<td>".$row->destination."</td>".'
									</tr>';
								}
							}
							?>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div class="box box-success">
					<div class="box-header with-border">
						<h3 class="box-title">
							<?= $this->lang->line('Historique des 12 derniers mois'); ?></h3>
						<div class="box-tools">
							<a class="btn btn-primary" href="<?= current_url().($network_id ? '?id='.$network_id . '&history=transaction_ilink' : '')?>">
								<?= $this->lang->line('transactions_historic'); ?>
							</a>
							<a class="btn btn-info" href="<?= current_url().($network_id ? '?id='.$network_id . '&history=recharge' : '')?>">
								<?= $this->lang->line('recharge_historic'); ?>
							</a>
						</div>
					</div>
					<div class="box-body">
						<div class="chart" id="chart">
							<canvas id="barChart" style="height:230px"></canvas>
						</div>
					</div>
				</div>
			</div>
			<div class="col-xs-6">
				<div class="box box-danger">
					<div class="box-header with-border">
						<h3 class="box-title">
							<?= $this->lang->line("Parts dépots & retraits"); ?></h3>
					</div>
					<div class="box-body" id="chart2">
						<canvas id="pieChart" style="height:250px"></canvas>
					</div>
				</div>
			</div>

			<div class="col-xs-6">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('Commission Hyperviseur') ?></h3>
					</div>
					<div class="box-body" style="overflow-x:auto;">
						<table id="example1" class="table table-bordered table-hover">
							<thead>
							<tr>
								<?php
									echo "<th>".$this->lang->line('Nom')."</th>
									<th>".$this->lang->line('Solde Principal')."</th>
									<th>".$this->lang->line('Solde Commission')."</th>
									<th>".$this->lang->line('Commission banque')."</th>
									<th>".$this->lang->line('DEPOT'). 's'."</th>
									<th>".$this->lang->line('RETRAIT').'s'."</th>";
									?>
							</tr>
							</thead>
							<tbody>
							<?php
							if ($walletHyper) {
								$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
								echo "<tr>
                                                    <td>" . $walletHyper->first_row()->lastname . "</td>
                                                    <td>" . Money::of(round($walletHyper->first_row()->balance_princ, 2),$currency ? $currency->code : 'XAF',$context)->formatTo('fr_FR'). "</td>
                                                     <td>" .Money::of(round($walletHyper->first_row()->balance_com, 2), $currency ? $currency->code : 'XAF',$context)->formatTo('fr_FR'). "</td>
													<td>" .Money::of(round($totalCommissionBanque,2), $currency ? $currency->code : 'XAF',$context)->formatTo('fr_FR') . "</td>";

								echo "<td>" . $depots->num_rows() . "</td>
                                				  <td>" . $retraits->num_rows() . "</td>
                                                 </tr>";

							}
							?>
							</tbody>
						</table>
					</div>
				</div>
			</div>

		</div>

	</section>
</div>
<!-- jQuery 2.2.4 -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap.min.js"></script>
<!-- Slimscroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>

<script src="<?= base_url('bower_components/moment/min/moment.min.js') ?>"></script>
<script src="<?= base_url('bower_components/bootstrap-daterangepicker/daterangepicker.js') ?>"></script>
<script
	src="<?= base_url('bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') ?>"></script>
<scriptf
	src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></scriptf>
<!-- ChartJS -->
<script src="<?= base_url('bower_components/chart.js/Chart.js') ?>"></script>




<script>
	$(function () {
		$('#example1').DataTable();
		
	})
</script>

<script>
	var areaChartData = {
		labels: <?= json_encode($label_months) ?>,
		datasets: [
			{
				label: 'Electronics',
				fillColor: 'rgba(255, 162, 0, 1)',
				strokeColor: 'rgba(255, 162, 0, 1)',
				pointColor: 'rgba(255, 162, 0, 1)',
				pointStrokeColor: '#ffa200',
				pointHighlightFill: '#fff',
				pointHighlightStroke: 'rgba(220,220,220,1)',
				data: <?= json_encode($depots_data) ?>
			},
			{
				label: 'Digital Goods',
				fillColor: 'rgba(0, 187, 255, 1)',
				strokeColor: 'rgba(0, 187, 255, 1)',
				pointColor: '#00bbff',
				pointStrokeColor: 'rgba(0, 187, 255, 1)',
				pointHighlightFill: '#fff',
				pointHighlightStroke: 'rgba(0, 187, 255, 1)',
				data: <?= json_encode($retraits_data) ?>
			}
		]
	};


	var Pie = '<?= json_encode($pieChart) ?>';
	if (Pie === '[]') {
		var select = document.getElementById('chart2');
		$(select.children).hide();
		$(select).append("<p>Aucune transaction</p>");
	} else {
		Pie = JSON.parse(Pie);
	}
</script>
<!-- Page script -->
<script src="<?= base_url('dist/js/custom.js') ?>"></script>
