ria/application/views/Report_consolidate.php
2018-01-22 19:54:59 +05:30

677 lines
24 KiB
PHP

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<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">
<!-- Content Header (Page header) -->
<section class="content"><br/>
<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>Report - Consolidate</b><br><br>
<?php
if($this->input->post('client_name')){
$cl=$this->input->post('client_name');
echo $cl;
}
if($this->input->post('financialyear')){
$ab=$this->input->post('financialyear');
echo '('.$ab.')';
}
?></p></h3></center>
</div>
<!-- /.box-header -->
<div class="panel-body">
<form method="post" action="<?php echo base_url($this->uri->uri_string()); ?>">
<div class="form-group has-feedback">
<div class="col-md-3">
<label for="client_name">
<?php echo 'Supplier'; ?>
</label>
<div class="input-group">
<select class="form-control" id="client_name" name="client_name">
<option value="">Select Supplier</option>
<?php
foreach($cust as $item):
{?>
<option value="<?php echo $item->SupplierName;?>"><?php echo $item->SupplierName ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php echo 'year'; ?>
</label>
<div class="input-group">
<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>
<div class="col-md-2"><br>
<label><input type="radio" name="colorRadio" id="value" onclick="toggleTables('2')" value="tab"> Value</label>
<label><input type="radio" name="colorRadio" id="qty" onclick="toggleTables('1')" value="ta" checked> Quantity</label>
</div>
<div class="col-md-2"><br>
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report">
</div>
</div>
</for m>
</div>
<div class="box-body" style="display:block" id="a">
<table class="table table-bordered table-hover" id="tab" style="font-size:10.4px;">
<thead>
<tr>
<th style="text-align:center;">Supplier</th>
<th style="text-align:center;">Product</th>
<th style="text-align:center;">April</th>
<th style="text-align:center;">May</th>
<th style="text-align:center;">June</th>
<th style="text-align:center;">July</th>
<th style="text-align:center;">August</th>
<th style="text-align:center;">September</th>
<th style="text-align:center;">October</th>
<th style="text-align:center;">November</th>
<th style="text-align:center;">December</th>
<th style="text-align:center;">January</th>
<th style="text-align: center;">February</th>
<th style="text-align: center;">March</th>
<th style="text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($spurchse)){
$apr = 0;
$may = 0;
$jun = 0;
$jul = 0;
$aug = 0;
$sep = 0;
$oct = 0;
$nov = 0;
$dec = 0;
$jan = 0;
$feb = 0;
$mar = 0;
$tot = 0;
$ab=$this->input->post('financialyear');
foreach ($spurchse as $result) { ?>
<tr>
<td style="text-align:left;">
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&ab=<?php echo $ab;?>"><?php echo $result->supplier_name;?> </a>
</td>
<td style="text-align:left;"><?php
if(!empty($result->material_name)) { echo $result->material_name ; } else {echo "-";}
?></td>
<td style="text-align:right;"><?php $apr= $apr + round($result->April); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'April';?>"><?php echo round($result->April);?> </a>
</td>
<td style="text-align:right;"><?php $may= $may + round($result->May);?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'May';?>"><?php echo round($result->May);?> </a></td>
<td style="text-align:right;"><?php $jun= $jun + round($result->June);?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'June';?>"><?php echo round($result->June);?> </a>
</td>
<td style="text-align:right;"><?php $jul= $jul + round($result->July);?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'July';?>"><?php echo round($result->July);?> </a>
</td>
<td style="text-align:right;"><?php $aug= $aug + round($result->August); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'August';?>"><?php echo round($result->August);?> </a>
</td>
<td style="text-align:right;"><?php $sep= $sep + round($result->September); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'September';?>"><?php echo round($result->September);?> </a>
</td>
<td style="text-align:right;"><?php $oct= $oct + round($result->October); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'October';?>"><?php echo round($result->October);?> </a>
</td>
<td style="text-align:right;"><?php $nov= $nov + round($result->November); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'November';?>"><?php echo round($result->November);?> </a>
</td>
<td style="text-align:right;"><?php $dec= $dec + round($result->December); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'December';?>"><?php echo round($result->December);?> </a>
</td>
<td style="text-align:right;"><?php $jan= $jan + round($result->January); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'January';?>"><?php echo round($result->January);?> </a>
</td>
<td style="text-align:right;"><?php $feb= $feb + round($result->February); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'February';?>"><?php echo round($result->February);?> </a>
</td>
<td style="text-align:right;"><?php $mar= $mar + round($result->March); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'March';?>"><?php echo round($result->March);?> </a>
</td>
<td style="text-align:right;"><?php $tot= $tot + round($result->qtotal); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>"><?php echo round($result->qtotal);?> </a>
</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 '';
}
?>
</strong></td>
<td style="text-align:right;"><strong><?php
{
echo $apr;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $may;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jun;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jul;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $aug;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $sep;
}
?>
</strong>
</td>
<td style="text-align:right;"><strong>
<?php
{
echo $oct;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $nov;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $dec;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $jan;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $feb;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $mar;
}
?>
</strong></td>
<td style="text-align:right;">
<strong>
<?php
{
echo $tot;
}
?>
</strong></td>
</tr>
</tfoot>
<?php } ?>
</table>
</div>
<div class="box-body" id="b" style="display:none">
<table class="table table-bordered table-hover" style="font-size:10.4px;" id="ta">
<thead>
<tr>
<th style="text-align:center;">Supplier</th>
<th style="text-align:center;">Product</th>
<th style="text-align:center;">April</th>
<th style="text-align:center;">May</th>
<th style="text-align:center;">June</th>
<th style="text-align:center;">July</th>
<th style="text-align:center;">August</th>
<th style="text-align:center;">September</th>
<th style="text-align:center;">October</th>
<th style="text-align:center;">November</th>
<th style="text-align:center;">December</th>
<th style="text-align:center;">January</th>
<th style="text-align: center;">February</th>
<th style="text-align: center;">March</th>
<th style="text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($spurchse)){
$apr = 0;
$may = 0;
$jun = 0;
$jul = 0;
$aug = 0;
$sep = 0;
$oct = 0;
$nov = 0;
$dec = 0;
$jan = 0;
$feb = 0;
$mar = 0;
$tot = 0;
foreach ($spurchse as $result) { ?>
<tr>
<td style="text-align:left;">
<a href="<?= base_url() ?>report/link_purchase?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>"><?php echo $result->supplier_name;?> </a>
</td>
<td style="text-align:left;"><?php
if(!empty($result->material_name)) { echo $result->material_name ; } else {echo "-";}
?></td>
<td style="text-align:right;"><?php $apr= $apr + number_format($result->vApril,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'April';?>"><?php echo number_format($result->vApril,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $may= $may + number_format($result->vMay,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'May';?>"><?php echo number_format($result->vMay,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $jun= $jun + number_format($result->vJune,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'June';?>"><?php echo number_format($result->vJune,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $jul= $jul + number_format($result->vJuly,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'July';?>"><?php echo number_format($result->vJuly,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $aug= $aug + number_format($result->vAugust,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'August';?>"><?php echo number_format($result->vAugust,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $sep= $sep + number_format($result->vSeptember,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'September';?>"><?php echo number_format($result->vSeptember,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $oct= $oct + number_format($result->vOctober,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'October';?>"><?php echo number_format($result->vOctober,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $nov= $nov + number_format($result->vNovember,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'November';?>"><?php echo number_format($result->vNovember,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $dec= $dec + number_format($result->vDecember,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'December';?>"><?php echo number_format($result->vDecember,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $jan= $jan + number_format($result->vJanuary,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'January';?>"><?php echo number_format($result->vJanuary,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $feb= $feb + number_format($result->vFebruary,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'February';?>"><?php echo number_format($result->vFebruary,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $mar= $mar + number_format($result->vMarch,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>&m=<?php echo 'March';?>"><?php echo number_format($result->vMarch,2,'.','');?> </a>
</td>
<td style="text-align:right;"><?php $tot= $tot + number_format($result->vtotal,2,'.',''); ?>
<a href="<?= base_url() ?>report/consolidate_month?ab=<?php echo $ab;?>&sid=<?php echo $result->sid;?>&mid=<?php echo $result->mid;?>"><?php echo number_format($result->vtotal,2,'.','');?> </a>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong><?php
{
echo '';
}
?>
</strong></td>
<td style="text-align:right;"><strong><?php
{
echo number_format($apr,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($may,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($jun,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($jul,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($aug,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($sep,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;"><strong>
<?php
{
echo number_format($oct,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($nov,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($dec,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($jan,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($feb,2,'.','');
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($mar,2,'.','');
}
?>
</strong></td>
<td style="text-align:right;">
<strong>
<?php
{
echo number_format($tot,2,'.','');
}
?>
</strong></td>
</tr>
</tfoot>
<?php } ?>
</table>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<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 = $('#tab').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'table-responsive'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
//messageTop: $('h3').text(),
//title: 'REPORT-Consolidate(Quantity)',
title: $('h3').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
$(document).ready(function() {
table = $('#ta').DataTable( {
"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: 'REPORT-Consolidate(Value)',
title: $('h3').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
function toggleTables(which)
{
if(which == "1") {
document.getElementById('a').style.display = "block";
document.getElementById('b').style.display = "none";
}
if(which == "2") {
document.getElementById('b').style.display = "block";
document.getElementById('a').style.display = "none";
}
}
</script>