riainvoice/application/modules/reports/views/consolidate_sales.php
2021-10-01 23:34:16 +05:30

726 lines
21 KiB
PHP

<div id="headerbar">
<h1 class="headerbar-title"><?php _trans('Sales'); ?></h1>
</div>
<div id="content">
<!--<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.css">-->
<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">
<div id="content" class="row">
<div class="col-xs-12 col-md-12">
<?php $this->layout->load_view('layout/alerts'); ?>
<div id="report_options" class="panel panel-default">
<a href="#" style="float:right; font-size:30px; margin-right:17px;" class="show_hide">+</a>
<div class="panel-heading">
<i class="fa fa-print"></i>
<?php _trans('report_options'); ?>
</div>
<div class="slidingDiv">
<div class="panel-body">
<form method="post" action="">
<input type="hidden" name="_ip_csrf" value="<?= $this->security->get_csrf_hash() ?>">
<div class="form-group has-feedback">
<div class="col-md-4">
<label for="client_name">
<?php _trans('client_name'); ?>
</label>
<div class="input-group">
<select class="form-control" id="client_name" name="client_name">
<option value="">Select Customer</option>
<?php
foreach($customer as $item):
{?>
<option value="<?php echo $item->client_name;?>"><?php echo $item->client_name ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php _trans('Year'); ?>
</label>
<div class="input-group">
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach($result 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">
<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>
<div class="col-md-2 col-md-offset-10" style="padding:3%;">
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report" onclick="JavaScript:window.location.hash = '#tabl'">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="tabl">
<?php
if(!empty($results))
{
?>
<center><h3 class="report_title">Consolidated Sales
<?php
if($this->input->post('financialyear')){
$ab=$this->input->post('financialyear');
echo '('.$ab.')';
}
?>
<br/>
<small><?php
$cid=$this->input->post('client_name');
echo $cid; ?></small>
<small>
</h3></center>
<div class="qty" style="display:block" id="a">
<div id="panel-recent-invoices" class="panel panel-default">
<div class="table-responsive">
<table class="table table-bordered table-hover" id="tab" style="font-size:11px;">
<thead>
<tr style="text-align:center;">
<th style="min-width: 35%;text-align:center;"><?php _trans('client'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Product'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('April'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('May'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('June'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('July'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('August'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('September'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('October'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('November'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('December'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('January'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('February'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('March'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('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;
foreach ($results as $result) { ?>
<tr>
<td style="text-align:left;"><?php
if(!empty($result->client_name)) { echo $result->client_name; } else {echo "-";}
?></td>
<td style="text-align:left;"><?php
if(!empty($result->product_description)) { echo $result->product_description ; } else {echo "-";}
?></td>
<td class="amount"><?php
$apr= $apr + round($result->April);
if(!empty($result->April)) { echo round($result->April); } else {echo "-";}
?></td>
<td class="amount"><?php
$may= $may + round($result->May);
if(!empty($result->May)) { echo round($result->May); } else {echo "-";}
?></td>
<td class="amount"><?php
$jun= $jun + round($result->June);
if(!empty($result->June)) { echo round($result->June); } else {echo "-";}
?></td>
<td class="amount"><?php
$jul= $jul + round($result->July);
if(!empty($result->July)) { echo round($result->July); } else {echo "-";}
?></td>
<td class="amount"><?php
$aug= $aug + round($result->August);
if(!empty($result->August)) { echo round($result->August); } else {echo "-";}
?></td>
<td class="amount"><?php
$sep= $sep + $result->September;
if(!empty($result->September)) { echo round($result->September); } else {echo "-";}
?></td>
<td class="amount"><?php
$oct= $oct + round($result->October);
if(!empty($result->October)) { echo round($result->October); } else {echo "-";}
?></td>
<td class="amount"><?php
$nov= $nov + round($result->November);
if(!empty($result->November)) { echo round($result->November); } else {echo "-";}
?></td>
<td class="amount"><?php
$dec= $dec + round($result->December);
if(!empty($result->December)) { echo round($result->December); } else {echo "-";}
?></td>
<td class="amount"><?php
$jan= $jan + round($result->January);
if(!empty($result->January)) { echo round($result->January); } else {echo "-";}
?></td>
<td class="amount"><?php
$feb= $feb + round($result->February);
if(!empty($result->February)) { echo round($result->February); } else {echo "-";}
?></td>
<td class="amount"><?php
$mar= $mar + round($result->March);
if(!empty($result->March)) { echo round($result->March); } else {echo "-";}
?></td>
<td class="amount"><?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><strong><?php
{
echo '';
}
?>
</strong></td>
<td><strong><?php
{
echo $apr;
}
?>
</strong></td>
<td><strong>
<?php
{
echo $may;
}
?>
</strong></td>
<td><strong>
<?php
{
echo $jun;
}
?>
</strong></td>
<td><strong>
<?php
{
echo $jul;
}
?>
</strong></td>
<td><strong>
<?php
{
echo $aug;
}
?>
</strong></td>
<td class="amount"><strong>
<?php
{
echo $sep;
}
?>
</strong>
</td>
<td class="amount"><strong>
<?php
{
echo $oct;
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo $nov;
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo $dec;
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo $jan;
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo $feb;
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo $mar;
}
?>
</strong></td>
<td class="amount">
<strong>
<?php
{
echo $tot;
}
?>
</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="value" id="b" style="display:none">
<div id="panel-recent-invoices" class="panel panel-default" >
<div class="table-responsive" >
<table class="table table-bordered table-hover" style="font-size:10.4px;" id="ta">
<thead>
<tr style="text-align:center;">
<th style="min-width: 35%;text-align:center;"><?php _trans('client'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Product'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('April'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('May'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('June'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('July'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('August'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('September'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('October'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('November'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('December'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('January'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('February'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('March'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('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;
foreach ($results as $result) { ?>
<tr>
<td style="text-align:left;"><?php
if(!empty($result->client_name)) { echo $result->client_name; } else {echo "-";}
?></td>
<td style="text-align:left;"><?php
if(!empty($result->product_description)) { echo $result->product_description ; } else {echo "-";}
?></td>
<td class="amount"><?php
$apr= $apr + round($result->vApril);
if(!empty($result->vApril)) { echo format_currency(round($result->vApril)); } else {echo "-";}
?></td>
<td class="amount"><?php
$may= $may + round($result->vMay);
if(!empty($result->vMay)) { echo format_currency(round($result->vMay)); } else {echo "-";}
?></td>
<td class="amount"><?php
$jun= $jun + round($result->vJune);
if(!empty($result->vJune)) { echo format_currency(round($result->vJune)); } else {echo "-";}
?></td>
<td class="amount"><?php
$jul= $jul + round($result->vJuly);
if(!empty($result->vJuly)) { echo format_currency(round($result->vJuly)); } else {echo "-";}
?></td>
<td class="amount"><?php
$aug= $aug + round($result->vAugust);
if(!empty($result->vAugust)) { echo format_currency(round($result->vAugust)); } else {echo "-";}
?></td>
<td class="amount"><?php
$sep= $sep + $result->vSeptember;
if(!empty($result->vSeptember)) { echo format_currency(round($result->vSeptember)); } else {echo "-";}
?></td>
<td class="amount"><?php
$oct= $oct + round($result->vOctober);
if(!empty($result->vOctober)) { echo format_currency(round($result->vOctober)); } else {echo "-";}
?></td>
<td class="amount"><?php
$nov= $nov + round($result->vNovember);
if(!empty($result->vNovember)) { echo format_currency(round($result->vNovember)); } else {echo "-";}
?></td>
<td class="amount"><?php
$dec= $dec + round($result->vDecember);
if(!empty($result->vDecember)) { echo format_currency(round($result->vDecember)); } else {echo "-";}
?></td>
<td class="amount"><?php
$jan= $jan + round($result->vJanuary);
if(!empty($result->vJanuary)) { echo format_currency(round($result->vJanuary)); } else {echo "-";}
?></td>
<td class="amount"><?php
$feb= $feb + round($result->vFebruary);
if(!empty($result->vFebruary)) { echo format_currency(round($result->vFebruary)); } else {echo "-";}
?></td>
<td class="amount"><?php
$mar= $mar + round($result->vMarch);
if(!empty($result->vMarch)) { echo format_currency(round($result->vMarch)); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot= $tot + round($result->vtotal);
if(!empty($result->vtotal)) { echo format_currency(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><strong><?php
{
echo format_currency($apr);
}
?>
</strong></td>
<td><strong>
<?php
{
echo format_currency($may);
}
?>
</strong></td>
<td><strong>
<?php
{
echo format_currency($jun);
}
?>
</strong></td>
<td><strong>
<?php
{
echo format_currency($jul);
}
?>
</strong></td>
<td><strong>
<?php
{
echo format_currency($aug);
}
?>
</strong></td>
<td class="amount"><strong>
<?php
{
echo format_currency($sep);
}
?>
</strong>
</td>
<td class="amount"><strong>
<?php
{
echo format_currency($oct);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($nov);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($dec);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($jan);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($feb);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($mar);
}
?>
</strong></td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot);
}
?>
</strong></td>
</tr>
</tfoot>
</table>
<?php
}
?>
</div>
</div>
</div>
</div>
</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 src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.js"></script>-->
<script>
$(document).ready(function() {
$('#tab').DataTable( {
"pageLength": 30,
columnDefs: [
{
targets: '_all',
defaultContent: '-'
}
],
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
//messageTop: $('center').text(),
title: $('center').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
$(document).ready(function() {
$('#ta').DataTable( {
"pageLength": 30,
columnDefs: [
{
targets: '_all',
defaultContent: '-'
}
],
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
//messageTop: $('center').text(),
title: $('center').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
$(document).ready(function () {
$(".slidingDiv").show();
$('.show_hide').click(function (e) {
$(".slidingDiv").slideToggle("fast");
var val = $(this).text() == "-" ? "+" : "-";
$(this).hide().text(val).fadeIn("fast");
e.preventDefault();
});
});
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>