ria/app/Views/cashbook_cumulative_report.php
2024-09-11 08:54:25 +05:30

227 lines
8.4 KiB
PHP
Executable File

<?php //print_r($datas);
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
.dataTables_filter input {padding: 4px;}
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #00d976;;
border-color: #00d976;;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color: #00d976;"><b>Cashbook - Cumulative Report ( <?php echo $fa.'-'.$aa; ?> )</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<table class="table table-bordered table-hover" id="ccr" style="font-size:14px;">
<thead>
<tr>
<th style="text-align:center" rowspan="2">Account Name</th>
<th style="text-align:center" colspan="2"><?php echo date('d-m-Y'); ?></th>
<th style="text-align:center" colspan="2"><?php echo date('M-Y'); ?></th>
<th style="text-align:center" colspan="2"><?php echo $ab; ?></th>
</tr>
<tr>
<th style="text-align:center">Receipt &nbsp;(&#8377;)</th>
<th style="text-align:center">Payment &nbsp;(&#8377;)</th>
<th style="text-align:center">Receipt &nbsp;(&#8377;)</th>
<th style="text-align:center">Payment &nbsp;(&#8377;)</th>
<th style="text-align:center">Recepit &nbsp;(&#8377;)</th>
<th style="text-align:center">Payment &nbsp;(&#8377;)</th>
</tr>
</thead>
<?php
if(!empty($datas)){
$incdayttl = 0.00;
$expdayttl = 0.00;
$incmthttl = 0.00;
$expmthttl = 0.00;
$incyrttl = 0.00;
$expyrttl = 0.00;
?>
<tbody>
<?php
foreach($datas as $d)
{
?>
<tr>
<td><?php echo $d->name; ?></td>
<td><?php if(empty($d->tinc)){ echo '0';}else{$incdayttl = $incdayttl + round($d->tinc); echo number_format($d->tinc,2,'.','');} ?></td>
<td><?php if(empty($d->texp)){ echo '0';}else{$expdayttl = $expdayttl + round($d->texp); echo number_format($d->texp,2,'.','');} ?></td>
<td><?php $incmthttl = $incmthttl + round($d->minc); echo number_format($d->minc,2,'.',''); ?></td>
<td><?php $expmthttl = $expmthttl + round($d->mexp); echo number_format($d->mexp,2,'.',''); ?></td>
<td><?php $incyrttl = $incyrttl + round($d->yinc); echo number_format($d->yinc,2,'.',''); ?></td>
<td><?php $expyrttl = $expyrttl + round($d->yexp); echo number_format($d->yexp,2,'.',''); ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot width="100%">
<tr>
<td><b><?php echo "TOTAL" ?></b></td>
<td><b><?php echo number_format($incdayttl,2,'.',''); ?></b></td>
<td><b><?php echo number_format($expdayttl,2,'.',''); ?></b></td>
<td><b><?php echo number_format($incmthttl,2,'.',''); ?></b></td>
<td><b><?php echo number_format($expmthttl,2,'.',''); ?></b></td>
<td><b><?php echo number_format($incyrttl,2,'.',''); ?></b></td>
<td><b><?php echo number_format($expyrttl,2,'.',''); ?></b></td>
</tr>
</tfoot>
<?php } ?>
</table>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
</section>
</div>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#ccr').DataTable( {
"language": {
"emptyTable":"<center> Data Not Found ! </center>"
},
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
//messageTop: $('h3').text(),
title: $('h3').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
],
"footerCallback": function ( row, data, start, end, display ) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function ( i ) {
return typeof i === 'string' ?
parseFloat(i.replace(/[^0.00-9.00]+/g,"")*1) :
typeof i === 'number' ?
parseFloat(i) : 0;
};
TotalDailyRcpt = api
.column( 1, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 1 ).footer() ).html( TotalDailyRcpt.toFixed(2).bold() );
TotalDailyPmt = api
.column( 2, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 2 ).footer() ).html( TotalDailyPmt.toFixed(2).bold() );
TotalMthyRcpt = api
.column( 3, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 3 ).footer() ).html( TotalMthyRcpt.toFixed(2).bold() );
TotalMthyPmt = api
.column( 4, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 4 ).footer() ).html( TotalMthyPmt.toFixed(2).bold() );
TotalYrlyRcpt = api
.column( 5, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 5 ).footer() ).html( TotalYrlyRcpt.toFixed(2).bold() );
TotalYrlyPmt = api
.column( 6, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 6 ).footer() ).html( TotalYrlyPmt.toFixed(2).bold() );
}
} );
} );
$('#mySelect').on('change',function(){
table
.column(4)
.search(this.value)
.draw();
});
</script>