ria/app/Views/Report_cumulative_raw.php

335 lines
11 KiB
PHP
Executable File

<!-- Report_cumulative_raw -->
<?php
if (date('m') >= 4) {
$yearl = date('Y') . '-' . (date('Y') + 1);
} else {
$yearl = (date('Y') - 1) . '-' . date('Y');
}
?>
<style>
table {
width: auto;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Report</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title"><b> Cumulative-Category-Wise (<?php echo $yearl; ?>) </b></h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<!-- <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> -->
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover" id="cc" style="font-size:14px;">
<thead>
<tr>
<thead>
<tr>
<?php
if (date('m') >= 4) {
$yearl = date('Y') . '-' . (date('Y') + 1);
} else {
$yearl = (date('Y') - 1) . '-' . date('Y');
}
$ab = $yearl;
?>
<th style="text-align:center" rowspan="2">Category</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">Quantity</th>
<th style="text-align:center">Value &nbsp;(&#8377;)</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value &nbsp;(&#8377;)</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value &nbsp;(&#8377;)</th>
</tr>
</thead>
<tbody>
<?php if (!empty($cum)) {
$yqt = 0.00;
$yvt = 0.00;
$mqt = 0.00;
$mvt = 0.00;
$tqt = 0.00;
$tvt = 0.00;
if (date('m') >= 4) {
$yearl = date('Y') . '-' . (date('Y') + 1);
} else {
$yearl = (date('Y') - 1) . '-' . date('Y');
}
$ab = $yearl;
foreach ($cum as $index => $rel) {
$cat = $rel->category;
?>
<tr>
<!-- <td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php //echo $rel->sid;
?>&ab=<?php //echo $ab;
?>&mid=<?php //echo $rel->mid;
?>"><?php //echo $rel->supplier_name;
?></a>
</span></td>-->
<td><span>
<a href="<?= base_url() ?>report/ilink_purchase?ab=<?php echo $ab; ?>&cat=<?php echo $rel->category; ?>"><?php echo $rel->category_name; ?></a>
</span></td>
<td style="text-align:right"><span id="d_qty<?php echo $index; ?>">
<?php
$tqt = $tqt + round($rel->tquantity);
?>
<a href="<?= base_url() ?>report/rawi_cum_day?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo round($rel->tquantity); ?></a>
</span></td>
<td style="text-align:right"><span id="d_value<?php echo $index ?>"><?php
$tvt = $tvt + number_format($rel->ttotal, 2, '.', '');
?>
<a href="<?= base_url() ?>report/rawi_cum_day?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo number_format($rel->ttotal, 2, '.', ''); ?></a>
</span></td>
<td style="text-align:right"><span id="m_quty<?php echo $index ?>"><?php
$mqt = $mqt + round($rel->mquantity);
?>
<a href="<?= base_url() ?>report/rawi_cum_month?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo round($rel->mquantity); ?></a>
</span></td>
<td style="text-align:right"><span id="m_value<?php echo $index ?>"><?php
$mvt = $mvt + number_format($rel->mtotal, 2, '.', '');
?>
<a href="<?= base_url() ?>report/rawi_cum_month?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo number_format($rel->mtotal, 2, '.', ''); ?></a>
</span></td>
<td style="text-align:right"><span id="y_qty<?php echo $index ?>"><?php
$yqt = $yqt + round($rel->quantity);
?>
<a href="<?= base_url() ?>report/rawi_cum_year?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo round($rel->quantity); ?></a>
</span></td>
<td style="text-align:right"><span id="y_value<?php echo $index; ?>"><?php
$yvt = $yvt + number_format($rel->total, 2, '.', '');
?>
<a href="<?= base_url() ?>report/rawi_cum_year?cat=<?php echo $rel->category; ?>&ab=<?php echo $ab; ?>"><?php echo number_format($rel->total, 2, '.', ''); ?></a>
</span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right">
<strong>
<?php {
echo $tqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo number_format($tvt, 2, '.', '');
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo $mqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo number_format($mvt, 2, '.', '');
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo $yqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php {
echo number_format($yvt, 2, '.', '');
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
<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>
$(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY');
// Initialize the DataTable
var table = $('#cc').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'excel' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
ordering: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
},
emptyTable: '<div style="text-align:center;">Data Not Found!</div>'
}
});
});
</script>
<!--
"footerCallback": function ( row, data, start, end, display )
{
var table = $('#cc').DataTable();
var m_qsum =0;
var d_qsum= 0;
var d_valuesum= 0;
var m_valuesum= 0;
var y_quty=0;
var year_value = 0;
if(vtxt_count !=0)
{
//console.log(vtxt_count);
//console.log(Fm_qsum);
for(var j = 0;j<=display.length-1;j++)
{
var count = display[j];
var te= $('#m_quty'+count).text();
var dte= $('#d_qty'+count).text();
var dvte= $('#d_value'+count).text();
var m_value= $('#m_value'+count).text();
var y_qty= $('#y_qty'+count).text();
var y_value = $('#y_value'+count).text();
m_qsum += +te;
d_qsum += +dte;
d_valuesum += +dvte;
m_valuesum += +m_value;
y_quty += +y_qty;
year_value += +y_value;
}
var api = this.api(), data;
var FinalTotal =parseInt(m_qsum);
var DailyFinalToatal=parseInt(d_qsum);
var DailyvalueFinalTotal=parseInt(d_valuesum);
var MonthlyValueFinal = parseInt(m_valuesum);
var yearlyFinalQty = parseInt(y_quty);
var yearlyValueFinal = parseInt(year_value);
$( api.column( 3 ).footer() ).html( FinalTotal.toFixed(2).bold() );
$( api.column( 1 ).footer() ).html( DailyFinalToatal.toFixed(2).bold() );
$( api.column( 2 ).footer() ).html( DailyvalueFinalTotal.toFixed(2).bold() );
$( api.column( 4 ).footer() ).html( MonthlyValueFinal.toFixed(2).bold() );
$( api.column( 5 ).footer() ).html( yearlyFinalQty.toFixed(2).bold() );
$( api.column( 6 ).footer() ).html( yearlyValueFinal.toFixed(2).bold() );
}
else
{
console.log(Fm_qsum);
var FinalTotal =parseInt(Fm_qsum);
var DailyFinalToatal=parseInt(Fd_qsum);
var DailyvalueFinalTotal=parseInt(Fd_valuesum);
var MonthlyValueFinal = parseInt(Fm_valuesum);
var yearlyFinalQty = parseInt(Fy_quty);
var yearlyValueFinal = parseInt(Fyear_value);
var api = this.api(), data;
$( api.column( 3 ).footer() ).html( FinalTotal.toFixed(2).bold() );
$( api.column( 1 ).footer() ).html( DailyFinalToatal.toFixed(2).bold() );
$( api.column( 2 ).footer() ).html( DailyvalueFinalTotal.toFixed(2).bold() );
$( api.column( 4 ).footer() ).html( MonthlyValueFinal.toFixed(2).bold() );
$( api.column( 5 ).footer() ).html( yearlyFinalQty.toFixed(2).bold() );
$( api.column( 6 ).footer() ).html( yearlyValueFinal.toFixed(2).bold() );
}
}
-->