280 lines
7.8 KiB
PHP
Executable File
280 lines
7.8 KiB
PHP
Executable File
|
|
|
|
|
|
<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: #3c8dbc;
|
|
border-color: #3c8dbc;
|
|
}
|
|
|
|
|
|
</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:#3c8dbc"><b>Report - Year-Wise</b><br><br>
|
|
<?php
|
|
|
|
if($this->input->post('financialyear')){
|
|
$ab=$this->input->post('financialyear');
|
|
echo '('.$ab.')';
|
|
echo ' ';
|
|
|
|
}
|
|
|
|
?></p></h3></center>
|
|
</div>
|
|
<!-- /.box-header -->
|
|
|
|
<div class="col-xs-12 col-md-6 col-md-offset-3">
|
|
|
|
<center>
|
|
<div class="panel-body">
|
|
<form method="post" action=" ">
|
|
<div class="col-md-8">
|
|
<select class="form-control" id="financialyear" name="financialyear">
|
|
<option value="">Select Year</option>
|
|
<?php
|
|
foreach($finyear as $item):
|
|
|
|
{?>
|
|
|
|
<option value="<?php echo $item->financial_year;?>"><?php echo $item->financial_year ; ?></option>
|
|
|
|
|
|
<?php } endforeach; ?>
|
|
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<input type="submit" class="btn btn-success" id="year" name="btn_submit" value="View Report">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</center>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
if(!empty($year)){
|
|
?>
|
|
<div class="box-body">
|
|
<div>
|
|
<table class="table table-bordered table-hover" id="cc" style="font-size:14px;">
|
|
<thead>
|
|
<tr>
|
|
<th style="text-align:center">Month-Year</th>
|
|
<th style="text-align:center">Quantity</th>
|
|
<th style="text-align:center">Total Value (₹)</th>
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$tr3=0;
|
|
$tr4=00;
|
|
foreach($year as $rel)
|
|
{
|
|
?>
|
|
<tr>
|
|
|
|
<td style="text-align:center"><span>
|
|
<?php
|
|
$date = strtotime($rel->created_date);
|
|
$new = date('M-y', $date);
|
|
$pass = date('Y-m-d',$date);
|
|
$ab=$this->input->post('financialyear');
|
|
//echo $new;
|
|
?>
|
|
|
|
<a href="<?= base_url() ?>report/month_wise?ab=<?php echo $ab;?>&dat=<?php echo $pass;?>"><?php echo $new;?></a>
|
|
</span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tr3= $tr3 + $rel->quantity;
|
|
echo round($rel->quantity);?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tr4= $tr4 + number_format($rel->total,2,'.','');
|
|
echo number_format($rel->total,2,'.','');?></span></td>
|
|
|
|
|
|
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
<tfoot width="100%">
|
|
<tr>
|
|
<td style="text-align:center;"><strong><?php
|
|
$ab=$this->input->post('financialyear');
|
|
$Total="Total";
|
|
echo anchor('report/year_wise_total/' . $ab,$Total); ?></strong>
|
|
|
|
</td>
|
|
|
|
|
|
<td style="text-align:right">
|
|
<strong>
|
|
<?php
|
|
{
|
|
echo round($tr3);
|
|
|
|
}
|
|
?>
|
|
</strong>
|
|
</td>
|
|
<td style="text-align:right">
|
|
<strong>
|
|
<?php
|
|
{
|
|
echo number_format($tr4,2,'.','');
|
|
|
|
}
|
|
?>
|
|
</strong>
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
|
|
<!-- /.box -->
|
|
</div>
|
|
<!-- /.col -->
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<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 src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
|
|
<script>
|
|
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
|
|
"date-range-pre": function ( a ) {
|
|
var monthArr = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
return monthArr.indexOf(a);
|
|
},
|
|
"date-range-asc": function ( a, b ) {
|
|
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
|
},
|
|
"date-range-desc": function ( a, b ) {
|
|
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
|
}
|
|
} );
|
|
|
|
// Bootstrap datepicker
|
|
// Set up your table
|
|
$(document).ready(function() {
|
|
$.fn.dataTable.moment( 'DD-MM-YYYY' );
|
|
table = $('#cc').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'
|
|
],
|
|
columnDefs: [
|
|
{ type: 'date-range', targets: 0 }
|
|
],
|
|
"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;
|
|
};
|
|
|
|
TotalQTY = api
|
|
.column( 1, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 1 ).footer() ).html( TotalQTY.toFixed().bold() );
|
|
|
|
TotalVALUE = api
|
|
.column( 2, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
console.log(parseFloat(TotalVALUE));
|
|
$( api.column( 2 ).footer() ).html( TotalVALUE.toFixed(2).bold() );
|
|
|
|
}
|
|
} );
|
|
} );
|
|
$('#mySelect').on('change',function(){
|
|
|
|
table
|
|
.column(4)
|
|
.search(this.value)
|
|
.draw();
|
|
});
|
|
function Reset()
|
|
{
|
|
$('#mySelect').val('');
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|