2020-07-10 18:19:15 +00:00
|
|
|
|
<!-- 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">
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use Brick\Money\Context\AutoContext;
|
|
|
|
|
use Brick\Money\Context\CustomContext;
|
|
|
|
|
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) {
|
2020-07-10 18:19:15 +00:00
|
|
|
|
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
|
|
|
|
|
$carbon->setTimezone($timezone);
|
|
|
|
|
return $carbon->toDateTimeString();
|
|
|
|
|
}
|
|
|
|
|
return $date;
|
|
|
|
|
}
|
2020-07-16 16:27:32 +00:00
|
|
|
|
|
|
|
|
|
?>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
|
<section class="content-header">
|
|
|
|
|
|
|
|
|
|
<h1>
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<?php echo isset($category) ? 'Wallet' : $this->lang->line('Gestion des wallets');
|
|
|
|
|
echo ' ' . $network . ' - ' . $country
|
|
|
|
|
. ' :: ' . $this->lang->line('balance_statement'); ?>
|
|
|
|
|
<!-- <input type="button" class="btn btn-primary pull-right" id="Bactiver"-->
|
|
|
|
|
<!-- value="Activer/Désactiver le(s) réseau(x)" />-->
|
2020-07-10 18:19:15 +00:00
|
|
|
|
</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-xs-12">
|
|
|
|
|
<div class="box">
|
|
|
|
|
<div class="box-header">
|
|
|
|
|
<h3 class="box-title"><?php echo $this->lang->line('export_balance_statement') ?></h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="box-body" style="overflow-x:auto;">
|
|
|
|
|
<?php
|
2020-07-16 16:27:32 +00:00
|
|
|
|
if ($wallets){
|
|
|
|
|
$numrows = $wallets->num_rows();
|
|
|
|
|
$num = 0;
|
|
|
|
|
if ($numrows > 0) {
|
|
|
|
|
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
|
|
|
|
?>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<table id="transactions" class="table table-bordered table-striped"
|
|
|
|
|
data-lang="<?php echo $this->session->userdata('site_lang') ?>"
|
|
|
|
|
data-rows="<?= $numrows ?>"
|
|
|
|
|
data-currency="<?= $this->session->userdata('currency_code') ?>">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th align='center'>ID</th>
|
|
|
|
|
<th><?= $this->lang->line('Solde Principal') ?></th>
|
|
|
|
|
<th><?= $this->lang->line('Solde Commission') ?></th>
|
|
|
|
|
<th><?= $this->lang->line('Telephone') ?></th>
|
|
|
|
|
<th><?= $this->lang->line('code membre') ?></th>
|
|
|
|
|
<th>Agent</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<?php
|
|
|
|
|
foreach ($wallets->result() as $row) {
|
|
|
|
|
$num++;
|
|
|
|
|
echo "<tr>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
<td align='center' >$num</td>
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<td>" . Money::of(round($row->balance_princ, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
|
|
|
|
|
<td>" . Money::of(round($row->balance_com, 2), $row->currency_code, $context)->formatTo('fr_FR') . "</td>
|
|
|
|
|
<td>" . $row->transactionNumber . "</td>
|
|
|
|
|
<td>" . $row->codeMembre . "</td>
|
|
|
|
|
<td>" . $row->lastname . "</td>";
|
2020-07-10 18:19:15 +00:00
|
|
|
|
?>
|
2020-07-16 16:27:32 +00:00
|
|
|
|
</tr>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
|
|
|
|
|
<?php
|
2020-07-16 16:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tbody>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
|
2020-07-16 16:27:32 +00:00
|
|
|
|
<?php
|
|
|
|
|
} else {
|
|
|
|
|
echo $this->lang->line('Aucune transaction');
|
2020-07-10 18:19:15 +00:00
|
|
|
|
}
|
2020-07-16 16:27:32 +00:00
|
|
|
|
} else {
|
|
|
|
|
echo $this->lang->line('Aucune transaction');
|
|
|
|
|
}
|
|
|
|
|
?>
|
2020-07-10 18:19:15 +00:00
|
|
|
|
|
|
|
|
|
</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 src="<?php echo base_url('dist/js/sweetalert2.js') ?>"></script>
|
|
|
|
|
<script src="<?php echo base_url('bower_components/toastr/toastr.js') ?>"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(function () {
|
2020-07-16 16:27:32 +00:00
|
|
|
|
const lang = $('table').data('lang');
|
|
|
|
|
var rows = $('table').data('rows');
|
|
|
|
|
var currency = $('table').data('currency');
|
2020-07-10 18:19:15 +00:00
|
|
|
|
const format = lang === 'french' ? 'fr' : 'en';
|
2020-07-16 16:27:32 +00:00
|
|
|
|
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
2020-07-10 18:19:15 +00:00
|
|
|
|
var table = $('#transactions').DataTable({
|
2020-07-16 16:27:32 +00:00
|
|
|
|
"aaSorting": [[0, "asc"]],
|
2020-07-10 18:19:15 +00:00
|
|
|
|
dom: 'Bfrtip',
|
|
|
|
|
"buttons": [
|
2020-07-16 16:27:32 +00:00
|
|
|
|
'pageLength',
|
2020-07-10 18:19:15 +00:00
|
|
|
|
{
|
|
|
|
|
extend: 'excelHtml5',
|
2020-07-29 13:40:25 +00:00
|
|
|
|
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 ([1, 2].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, ""));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-07-16 16:27:32 +00:00
|
|
|
|
customize: function (xlsx) {
|
|
|
|
|
var sheet = xlsx.xl.worksheets['sheet1.xml'],
|
|
|
|
|
sum = 0;
|
|
|
|
|
var sumCom = 0;
|
|
|
|
|
|
|
|
|
|
// read each row
|
|
|
|
|
// Loop over the cells in column `B`
|
|
|
|
|
$('row c[r^="B"]', sheet).each(function () {
|
|
|
|
|
|
|
|
|
|
// Get the value and strip the non numeric characters
|
|
|
|
|
var value = $(this).text();
|
|
|
|
|
value = value.replace(',', ".")
|
|
|
|
|
sum += Number(value.replace(/[^0-9\.-]+/g, ""));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Total commission
|
|
|
|
|
$('row c[r^="C"]', sheet).each(function () {
|
|
|
|
|
|
|
|
|
|
// Get the value and strip the non numeric characters
|
|
|
|
|
var value = $(this).text();
|
|
|
|
|
value = value.replace(',', ".")
|
|
|
|
|
sumCom += Number(value.replace(/[^0-9\.-]+/g, ""));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Create our number formatter.
|
|
|
|
|
var formatter = new Intl.NumberFormat('en-US', {
|
|
|
|
|
style: 'currency',
|
|
|
|
|
currency: currency,
|
|
|
|
|
|
|
|
|
|
// the default value for minimumFractionDigits depends on the currency
|
|
|
|
|
// and is usually already 2
|
|
|
|
|
minimumFractionDigits: 2,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function addTotal(index, data , sum , column) {
|
|
|
|
|
msg = '<row r="' + index + '">';
|
|
|
|
|
for (i = 0; i < data.length; i++) {
|
|
|
|
|
var key = data[i].k;
|
|
|
|
|
var value = data[i].v;
|
|
|
|
|
msg += '<c t="inlineStr" r="' + column + (rows + 3) + '" s="42">';
|
|
|
|
|
msg += '<is>';
|
|
|
|
|
msg += '<t>' + formatter.format(sum) + '</t>';
|
|
|
|
|
msg += '</is>';
|
|
|
|
|
msg += '</c>';
|
|
|
|
|
}
|
|
|
|
|
msg += '</row>';
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//insert
|
|
|
|
|
var r1 = addTotal(1, [{
|
|
|
|
|
k: 'A',
|
|
|
|
|
v: 'ColA'
|
|
|
|
|
}],sum ,'B');
|
|
|
|
|
|
|
|
|
|
var r2 = addTotal(1, [{
|
|
|
|
|
k: 'A',
|
|
|
|
|
v: 'ColA'
|
|
|
|
|
}],sumCom,'C');
|
|
|
|
|
|
|
|
|
|
sheet.childNodes[0].childNodes[1].innerHTML = r1 + r2+ sheet.childNodes[0].childNodes[1].innerHTML;
|
|
|
|
|
},
|
|
|
|
|
title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
2020-07-10 18:19:15 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'csvHtml5',
|
2020-07-16 16:27:32 +00:00
|
|
|
|
title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
2020-07-10 18:19:15 +00:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'pdfHtml5',
|
|
|
|
|
orientation: 'portrait',
|
|
|
|
|
pageSize: 'LEGAL',
|
2020-07-16 16:27:32 +00:00
|
|
|
|
title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
2020-07-10 18:19:15 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
table.buttons().container()
|
2020-07-16 16:27:32 +00:00
|
|
|
|
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
2020-07-10 18:19:15 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|