siddharth_application/application/views/Report_consolidate.php
2017-11-29 14:06:35 +05:30

679 lines
20 KiB
PHP

<script>
$(document).ready(function () {
$("#client_name").select2();
});
</script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.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="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 - Consolidate</b></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-4">
<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>
</form>
</div>
<div class="box-body" style="display:block" id="a">
<table class="table table-bordered table-hover" id="tab" style="font-size:14px;">
<thead>
<tr>
<th style="text-align:center;">Supplier Name</th>
<th style="text-align:center;">Material Name</th>
<th style="text-align:center;">Apr</th>
<th style="text-align:center;">May</th>
<th style="text-align:center;">Jun</th>
<th style="text-align:center;">Jul</th>
<th style="text-align:center;">Aug</th>
<th style="text-align:center;">Sep</th>
<th style="text-align:center;">Oct</th>
<th style="text-align:center;">Nov</th>
<th style="text-align:center;">Dec</th>
<th style="text-align:center;">Jan</th>
<th style="text-align: center;">Feb</th>
<th style="text-align: center;">Mar</th>
<th style="text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<?php
$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;?>&ab=<?php echo $ab;?>&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 + round($result->April);
if(!empty($result->April)) { echo round($result->April); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$may= $may + round($result->May);
if(!empty($result->May)) { echo round($result->May); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jun= $jun + round($result->June);
if(!empty($result->June)) { echo round($result->June); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jul= $jul + round($result->July);
if(!empty($result->July)) { echo round($result->July); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$aug= $aug + round($result->August);
if(!empty($result->August)) { echo round($result->August); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$sep= $sep + $result->September;
if(!empty($result->September)) { echo round($result->September); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$oct= $oct + round($result->October);
if(!empty($result->October)) { echo round($result->October); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$nov= $nov + round($result->November);
if(!empty($result->November)) { echo round($result->November); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$dec= $dec + round($result->December);
if(!empty($result->December)) { echo round($result->December); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jan= $jan + round($result->January);
if(!empty($result->January)) { echo round($result->January); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$feb= $feb + round($result->February);
if(!empty($result->February)) { echo round($result->February); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$mar= $mar + round($result->March);
if(!empty($result->March)) { echo round($result->March); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$tot= $tot + round($result->qtotal);
if(!empty($result->qtotal)) { echo round($result->qtotal); } else {echo "-";}
?></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>
</table>
</div>
<div class="box-body" id="b" style="display:none">
<table class="table table-bordered table-hover" style="font-size:14px;" id="ta">
<thead>
<tr>
<th style="text-align:center;">Supplier Name</th>
<th style="text-align:center;">Material Name</th>
<th style="text-align:center;">Apr &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">May &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Jun &nbsp;(<i class="fa fa-rupee "></i>)</th>
<th style="text-align:center;">Jul &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Aug &nbsp;(<i class="fa fa-rupee "></i>)</th>
<th style="text-align:center;">Sep &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Oct &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Nov &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Dec &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center;">Jan &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align: center;">Feb &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align: center;">Mar &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align: center;">Total &nbsp;(<i class="fa fa-rupee " ></i>)</th>
</tr>
</thead>
<tbody>
<?php
$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;"><?php
if(!empty($result->supplier_name)) { echo $result->supplier_name; } else {echo "-";}
?></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->vApril);
if(!empty($result->vApril)) { echo round($result->vApril); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$may= $may + round($result->vMay);
if(!empty($result->vMay)) { echo round($result->vMay); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jun= $jun + round($result->vJune);
if(!empty($result->vJune)) { echo round($result->vJune); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jul= $jul + round($result->vJuly);
if(!empty($result->vJuly)) { echo round($result->vJuly); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$aug= $aug + round($result->vAugust);
if(!empty($result->vAugust)) { echo round($result->vAugust); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$sep= $sep + $result->vSeptember;
if(!empty($result->vSeptember)) { echo round($result->vSeptember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$oct= $oct + round($result->vOctober);
if(!empty($result->vOctober)) { echo round($result->vOctober); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$nov= $nov + round($result->vNovember);
if(!empty($result->vNovember)) { echo round($result->vNovember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$dec= $dec + round($result->vDecember);
if(!empty($result->vDecember)) { echo round($result->vDecember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jan= $jan + round($result->vJanuary);
if(!empty($result->vJanuary)) { echo round($result->vJanuary); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$feb= $feb + round($result->vFebruary);
if(!empty($result->vFebruary)) { echo round($result->vFebruary); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$mar= $mar + round($result->vMarch);
if(!empty($result->vMarch)) { echo round($result->vMarch); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$tot= $tot + round($result->vtotal);
if(!empty($result->vtotal)) { echo round($result->vtotal); } else {echo "-";}
?></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 $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>
</table>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.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'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export Purchase Report',
buttons: [
'excel'
]
}
]
} );
} );
$(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: 'collection',
text: 'Export Purchase Report',
buttons: [
'excel'
]
}
]
} );
} );
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>