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

301 lines
9.6 KiB
PHP

<script>
$(document).ready(function(){
var today=new Date();
var F_Year = today.getFullYear();
var month = today.getMonth();
month++;
if(month > 4)
{
var finyear = F_Year+"-"+(F_Year+1);
}
else
{
var finyear = (F_Year-1)+"-"+(F_Year);
}
document.getElementById("fyear").innerHTML=finyear;
//alert(F_Year);
//alert(month);
//alert(finyear);
});
</script>
<!--<div id="headerbar">
<h1 class="headerbar-title"><?php _trans('sales_by_client'); ?></h1>
</div> -->
<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">
<!-- <div class="row">
<div class="col-xs-12 col-md-6 col-md-offset-3">
<?php $this->layout->load_view('layout/alerts'); ?>
<div id="report_options" class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-print"></i>
<?php _trans('report_options'); ?>
</div>
<div class="panel-body">
<form method="post" action="<?php echo site_url($this->uri->uri_string()); ?>"
<?php echo get_setting('reports_in_new_tab', false) ? 'target="_blank"' : ''; ?>>
<input type="hidden" name="_ip_csrf" value="<?= $this->security->get_csrf_hash() ?>">
<div class="form-group has-feedback">
<label for="from_date">
<?php _trans('from_date'); ?>
</label>
<div class="input-group">
<input name="from_date" id="from_date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<div class="form-group has-feedback">
<label for="to_date">
<?php _trans('to_date'); ?>
</label>
<div class="input-group">
<input name="to_date" id="to_date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<input type="submit" class="btn btn-success" name="btn_submit"
value="<?php _trans('Generate PDF'); ?>">
<input type="submit" class="btn btn-success" name="btn_subm"
value="<?php _trans('View Report'); ?>" id="button">
</form>
</div>
</div>
</div>
</div> -->
<center><h3 class="report_title">
<?php echo trans('Cumulative Sales Reports'); ?>
(
<?php
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
echo $yearl;
?>
)<br/>
</h3></center>
<div class="table-responsive">
<div id="panel-recent-invoices" class="panel panel-default">
<body>
<table class="table table-striped table-condensed table-bordered" id="tab">
<thead>
<tr>
<th rowspan="2"><?php echo trans('client'); ?></th>
<th rowspan="2"><?php echo trans('Product'); ?></th>
<th colspan="2"><?php echo date('d-m-Y'); ?></th>
<th colspan="2"><?php echo date('M-Y'); ?></th>
<th colspan="2"><?php if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
echo $yearl;?></th>
</tr>
<tr>
<th><?php echo trans('Qty'); ?>(kgs)</th>
<th><?php echo trans('Value'); ?></th>
<th><?php echo trans('Qty'); ?>(kgs)</th>
<th><?php echo trans('Value'); ?></th>
<th><?php echo trans('Qty'); ?>(kgs)</th>
<th><?php echo trans('Value'); ?></th>
</tr>
</thead>
<tbody>
<?php
$yqt=0;
$yvt=0;
$mqt=0;
$mvt=0;
$tqt=0;
$tvt=0;
// <?php
if(!empty($year))
{
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
foreach ($year as $result) { ?>
<tr>
<td >
<a href="<?= site_url() ?>/reports/link_sales?client_id=<?php echo $result->client_id;?>&ab=<?php echo $ab;?>"><?php echo $result->client_name;?></a>
</td>
<td><?php if(!empty($result->product_description)) { echo $result->product_description ; } else {echo "-";}?></td>
<td ><?php if(!empty($result->TQty)) { echo anchor('reports/cumulative_report_day/'.$result->client_id . '/' . $result->product_id,number_format(round($result->TQty),2,'.','')); $tqt += round($result->TQty); } else {echo "0.00";$tqt += 0.00; }?></td>
<td><?php if(!empty($result->TValue)) { echo anchor('reports/cumulative_report_day/'.$result->client_id . '/' . $result->product_id,format_currency(round($result->TValue),2,'.','')); $tvt += round($result->TValue); } else {echo "0.00"; $tvt += 0.00;}?></td>
<td ><?php if(!empty($result->MQty)) { echo anchor('reports/cumulative_report_month/'.$result->client_id . '/' . $result->product_id,number_format(round($result->MQty),2,'.','')); $mqt += round($result->MQty); } else {echo "0.00"; $mqt += 0.00;}
?></td>
<td><?php if(!empty($result->MValue)) { echo anchor('reports/cumulative_report_month/'.$result->client_id . '/' . $result->product_id,format_currency(round($result->MValue),2,'.','')); $mvt += round($result->MValue); } else {echo "0.00"; $mvt += 0.00;}?></td>
<td ><?php if(!empty($result->Qty)){echo anchor('reports/cumulative_report_year/'.$result->client_id . '/' . $result->product_id,number_format(round($result->Qty),2,'.',''));} else { echo "0.00";}
$yqt += round($result->Qty);
?></td>
<td><?php if(!empty($result->Value)) {echo anchor('reports/cumulative_report_year/'.$result->client_id . '/' . $result->product_id,format_currency(round($result->Value),2,'.',''));} else {echo "0.00";}
$yvt += round($result->Value);
?></td>
<!-- <td class="amount"><?php?>-</td>
<td class="amount"><?php?>-</td>
<td class="amount"><?php?>-</td>
<td class="amount"><?php?>-</td> -->
</tr>
<?php } ?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;" ><strong>Total</strong></td>
<td ><strong>&nbsp;</strong></td>
<td class="amount"><strong>
<?php
{
echo number_format(round($tqt),2,'.','');
}
?>
</strong>
</td>
<td class="amount"><strong>
<?php
{
echo format_currency(round($tvt),2,'.','');
}
?>
</strong>
</td>
<td class="amount"><strong>
<?php
{
echo number_format(round($mqt),2,'.','');
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency(round($mvt),2,'.','');
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo number_format(round($yqt),2,'.','');
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency(round($yvt),2,'.','');
}
?>
</strong>
</td>
</tr>
</tfoot>
</table>
<?php } ?>
</body>
</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>
$(document).ready(function() {
$('#tab').DataTable( {
"pageLength": 30,
dom: 'Bfrtip',
buttons: [
{
extend: 'excelHtml5',
footer: 'true',
//messageTop: $('h3').text(),
title: $('center').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
</script>