ria/application/views/Report_monthly_gst_table.php
2018-07-02 17:21:33 +05:30

618 lines
18 KiB
PHP

<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: #5d0411;
border-color: #5d0411;
}
</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:#5d0411"><b>Monthly GST Summary Report</b><br><br>
<div>
<br>
<label><input type="radio" name="colorRadio" id="value" onclick="toggleTables('2')" value="tab" checked> Sales</label>
<label><input type="radio" name="colorRadio" id="qty" onclick="toggleTables('1')" value="ta"> Purchase</label>
</div>
</p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="box-body" style="display:block" id="a">
<table class="table table-bordered table-hover" id="cc" >
<thead>
<tr>
<th style="text-align:center">Date</th>
<th style="text-align:center">Document Number</th>
<th style="text-align:center">Document Type</th>
<th style="text-align:center">HSN CODE</th>
<th style="text-align:center">Value &nbsp;(&#8377;)</th>
<th style="text-align:center">Others &nbsp;(&#8377;)</th>
<th style="text-align:center">SGST &nbsp;(&#8377;)</th>
<th style="text-align:center">CGST &nbsp;(&#8377;)</th>
<th style="text-align:center">IGST &nbsp;(&#8377;)</th>
<th style="text-align:center">Total &nbsp;(&#8377;)</th>
</tr>
</thead>
<tbody>
<?php
$tot_val = 0;
$tot_oth = 0;
$tot_sgst = 0;
$tot_cgst = 0;
$tot_igst = 0;
$tot_tot = 0;
?>
<?php
if(!empty($monthly_gst_sales)){
foreach($monthly_gst_sales as $rel)
{
?>
<tr>
<td style="text-align:center"><span><?php echo $rel->date;?></span></td>
<td style="text-align:center"><span><?php echo $rel->doc_no;?></span></td>
<td style="text-align:center"><span><?php echo $rel->doc_type;?></span></td>
<td style="text-align:center"><span><?php echo $rel->hsn_code;?></span></td>
<td style="text-align:right"><span><?php
$tot_val= $tot_val + round($rel->value,2);
echo round($rel->value,2);
?></span></td>
<td></td>
<td style="text-align:right"><span><?php
$tot_sgst= $tot_sgst + round($rel->sgst,2);
echo round($rel->sgst,2);
?></span></td>
<td style="text-align:right"><span><?php
$tot_cgst= $tot_cgst + round($rel->cgst,2);
echo round($rel->cgst,2);
?></span></td>
<td style="text-align:right"><span><?php
$tot_igst= $tot_igst + round($rel->igst,2);
echo round($rel->igst,2);
?></span></td>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2);
echo round($rel->total,2);
?></span></td>
</tr>
<?php
}
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_val,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_oth,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_sgst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_cgst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_igst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_tot,2,'.','');
}
?>
</strong></td>
</tr>
</tfoot>
</table>
</div>
<!-- second table -->
<div class="box-body" style="display:none" id="b">
<table class="table table-bordered table-hover" id="cc1" >
<thead>
<tr>
<th style="text-align:center">Date</th>
<th style="text-align:center">Document Number</th>
<th style="text-align:center">Document Type</th>
<th style="text-align:center">HSN CODE</th>
<th style="text-align:center">Value &nbsp;(&#8377;)</th>
<th style="text-align:center">Others &nbsp;(&#8377;)</th>
<th style="text-align:center">SGST &nbsp;(&#8377;)</th>
<th style="text-align:center">CGST &nbsp;(&#8377;)</th>
<th style="text-align:center">IGST &nbsp;(&#8377;)</th>
<th style="text-align:center">Total &nbsp;(&#8377;)</th>
</tr>
</thead>
<tbody>
<?php
$tot_val = 0;
$tot_oth = 0;
$tot_sgst = 0;
$tot_cgst = 0;
$tot_igst = 0;
$tot_tot = 0;
if(!empty($monthly_gst_purchase)){
foreach($monthly_gst_purchase as $rel)
{
?>
<tr>
<td style="text-align:center"><span><?php echo $rel->date;?></span></td>
<td style="text-align:center"><span><?php echo $rel->doc_no;?></span></td>
<td style="text-align:center"><span><?php echo $rel->doc_type;?></span></td>
<td style="text-align:center"><span><?php echo $rel->hsn_code;?></span></td>
<td style="text-align:right"><span><?php
$tot_val= $tot_val + round($rel->value,2);
echo $rel->value;
?></span></td>
<td style="text-align:right"><span><?php
$tot_oth= $tot_oth + round($rel->others,2);
echo $rel->others;
?></span></td>
<td style="text-align:right"><span><?php
$tot_sgst= $tot_sgst + round($rel->sgst,2);
echo $rel->sgst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_cgst= $tot_cgst + round($rel->cgst,2);
echo $rel->cgst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_igst= $tot_igst + round($rel->igst,2);
echo $rel->igst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2);
echo $rel->total;
?></span></td>
</tr>
<?php
}
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_val,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_oth,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_sgst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_cgst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_igst,2,'.','');
}
?>
</strong></td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo number_format($tot_tot,2,'.','');
}
?>
</strong></td>
</tr>
</tfoot>
</table>
</div>
</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 src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
// 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>"
},
"aaSorting": [[ 0, "desc" ]],
"autoWidth": false,
orderCellsTop: true,
"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',
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;
};
TotalVALUE = api
.column( 4, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 4 ).footer() ).html( TotalVALUE.toFixed(2).bold() );
TotalOTHERS = api
.column( 5, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 5 ).footer() ).html( TotalOTHERS.toFixed(2).bold() );
TotalSGST = api
.column( 6, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 6 ).footer() ).html( TotalSGST.toFixed(2).bold() );
TotalCGST = api
.column( 7, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 7 ).footer() ).html( TotalCGST.toFixed(2).bold() );
TotalIGST = api
.column( 8, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 8 ).footer() ).html( TotalIGST.toFixed(2).bold() );
FinalTotal = api
.column( 9, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 9 ).footer() ).html( FinalTotal.toFixed(2).bold() );
}
} );
} );
//second table
$(document).ready(function() {
$.fn.dataTable.moment( 'DD-MM-YYYY' );
table = $('#cc1').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',
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;
};
TotalVALUE = api
.column( 4, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 4 ).footer() ).html( TotalVALUE.toFixed(2).bold() );
TotalOTHERS = api
.column( 5, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 5 ).footer() ).html( TotalOTHERS.toFixed(2).bold() );
TotalSGST = api
.column( 6, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 6 ).footer() ).html( TotalSGST.toFixed(2).bold() );
TotalCGST = api
.column( 7, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 7 ).footer() ).html( TotalCGST.toFixed(2).bold() );
TotalIGST = api
.column( 8, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 8 ).footer() ).html( TotalIGST.toFixed(2).bold() );
FinalTotal = api
.column( 9, { search:'applied' } )
.data()
.reduce( function (a, b) {
return intVal(a) + intVal(b);
}, 0 );
$( api.column( 9 ).footer() ).html( FinalTotal.toFixed(2).bold() );
}
} );
} );
$( function() {
//var dateFormat = "mm/dd/yy",
from = $( "#min-date" )
.datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on( "change", function() {
to.datepicker("option", "minDate", getDate( this ) );
}),
to = $( "#max-date" ).datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
} );
function Reset()
{
$('#mySelect').val('');
}
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
function toggleTables(which)
{
if(which == "2") {
document.getElementById('a').style.display = "block";
document.getElementById('b').style.display = "none";
}
if(which == "1") {
document.getElementById('b').style.display = "block";
document.getElementById('a').style.display = "none";
}
}
</script>