+ Add total commission and total principal balance while export etats des soldes
This commit is contained in:
parent
9f2e7ffff3
commit
89e9f5d503
|
@ -5,35 +5,38 @@
|
|||
<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">
|
||||
<?php
|
||||
<?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;
|
||||
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){
|
||||
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;
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
|
||||
<h1>
|
||||
<?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)" />-->
|
||||
<?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)" />-->
|
||||
</h1>
|
||||
<?php
|
||||
$site_url = base_url();
|
||||
|
@ -93,53 +96,56 @@ use Brick\Money\Money;
|
|||
</div>
|
||||
<div class="box-body" style="overflow-x:auto;">
|
||||
<?php
|
||||
if($wallets){
|
||||
$numrows = $wallets->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
|
||||
?>
|
||||
|
||||
<table id="transactions" class="table table-bordered table-striped" data-lang="<?php echo $this->session->userdata('site_lang') ?>">
|
||||
<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>
|
||||
|
||||
<?php
|
||||
foreach ($wallets->result() as $row) {
|
||||
$num++;
|
||||
echo "<tr>
|
||||
<td align='center' >$num</td>
|
||||
<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>";
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
}else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
if ($wallets){
|
||||
$numrows = $wallets->num_rows();
|
||||
$num = 0;
|
||||
if ($numrows > 0) {
|
||||
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
|
||||
?>
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
foreach ($wallets->result() as $row) {
|
||||
$num++;
|
||||
echo "<tr>
|
||||
<td align='center' >$num</td>
|
||||
<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>";
|
||||
?>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
} else {
|
||||
echo $this->lang->line('Aucune transaction');
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
@ -182,31 +188,97 @@ use Brick\Money\Money;
|
|||
|
||||
<script>
|
||||
$(function () {
|
||||
const lang = $('table').data('lang');
|
||||
const lang = $('table').data('lang');
|
||||
var rows = $('table').data('rows');
|
||||
var currency = $('table').data('currency');
|
||||
const format = lang === 'french' ? 'fr' : 'en';
|
||||
moment.updateLocale(moment.locale(format), { invalidDate: "" }); // Blank text when is invalid date
|
||||
moment.updateLocale(moment.locale(format), {invalidDate: ""}); // Blank text when is invalid date
|
||||
var table = $('#transactions').DataTable({
|
||||
"aaSorting": [[ 0, "asc" ]],
|
||||
"aaSorting": [[0, "asc"]],
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
'pageLength',
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
title: 'Etat des soldes - Date : '+moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
||||
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")
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
title: 'Etat des soldes - Date : '+moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
||||
title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'portrait',
|
||||
pageSize: 'LEGAL',
|
||||
title: 'Etat des soldes - Date : '+moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
||||
title: 'Etat des soldes - Date : ' + moment().format("dddd, Do MMMM YYYY, h:mm:ss")
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
table.buttons().container()
|
||||
.appendTo( '#example_wrapper .col-sm-6:eq(0)' );
|
||||
.appendTo('#example_wrapper .col-sm-6:eq(0)');
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -252,6 +252,7 @@ use Brick\Money\Money;
|
|||
<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 type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.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>
|
||||
|
||||
|
@ -269,20 +270,31 @@ use Brick\Money\Money;
|
|||
}],
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
'pageLength',
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
title: 'Histrotique des transactions'
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csvHtml5',
|
||||
title: 'Histrotique des transactions'
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'LEGAL',
|
||||
title: 'Histrotique des transactions'
|
||||
}
|
||||
title: 'Histrotique des transactions',
|
||||
exportOptions: {
|
||||
columns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
|
||||
}
|
||||
},
|
||||
// 'colvis'
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -214,6 +214,7 @@ use Brick\Money\Money;
|
|||
}],
|
||||
dom: 'Bfrtip',
|
||||
"buttons": [
|
||||
'pageLength',
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
title: 'Histrotique des transferts de commission'
|
||||
|
|
Loading…
Reference in New Issue