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

488 lines
16 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-4">
<label for="client_name">
<?php _trans('Product'); ?>
</label>
<div class="input-group">
<select class="form-control" id="item_name" name="item_name">
<option value="">Select Product</option>
<?php
foreach($item_name as $it):
{?>
<option value="<?php echo $it->item_name;?>"><?php echo $it->item_name ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<br><br><br><br>
<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 for="to_date">
<?php _trans('Month'); ?>
</label>
<div class="input-group">
<select class="form-control" id="month" name="month">
<option value="">Select Month</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
<?php
foreach($months as $m):
{?>
<option value="<?php echo $m->months;?>"><?php echo $m->months ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-4">
<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="col-md-4">
<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>
</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">
<?php echo trans('Sales Report'); ?><br/>
<small>&nbsp;<?php
if($this->input->post('client_name')){
$cid=$this->input->post('client_name');
echo '('.$cid.')';
}
if($this->input->post('item_name')){
$product=$this->input->post('item_name');
echo '('.$product.')';
}
if($this->input->post('financialyear')){
$ab=$this->input->post('financialyear');
echo '('.$ab.')';
}
if($this->input->post('month')){
$month = $this->input->post('month');
echo '('.$month.')';
}
?></small>
<small><?php
// $dmon= date('F-Y');
// echo $dmon;
if (!empty($datec))
{
$d=date("d-m-Y",strtotime($datec));
echo $d;
}
// if (!empty($cname))
// {
// foreach ($results as $result) {
// echo ($result->client_name);
// }
// }
echo $fin,' ', ' ' ,$m,' ',' ',' ',' ', ' ' ,$dmon;?>
</small>
<small><?php echo $frm . ' ' . $t ?></small>
<small><?php echo $from_date . ' ' . $to_date ?></small>
</h3></center>
<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: 15%;text-align:center;"><?php _trans('Inv'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Parent Invoice Number'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Inv Date'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Time'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Vehicle No'); ?></th>
<th style="min-width: 15%;text-align:center;"><?php _trans('Product'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('client'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('Qty'); ?>(kgs)</th>
<th style="min-width: 35%;text-align:center;"><?php _trans('Rate'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('Value'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('CGST'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('SGST'); ?></th>
<th style="min-width: 35%;text-align:center;"><?php _trans('IGST'); ?></th>
<th style="min-width: 35%;text-align: center;"><?php _trans('Total Value'); ?></th>
</tr>
</thead>
<tbody>
<?php
$tot_sum = 0;
$tot_rate = 0;
$tot_value = 0;
$tot_CGST = 0;
$tot_SCGT = 0.0000;
$tot_ICGT = 0;
$tot_tot = 0;
$SCGT = 0.0000;
foreach ($results as $result) { ?>
<tr>
<td><?php
if(!empty($result->invoice_number)) {
echo anchor('invoices/view/' . $result->invoice_id,$result->invoice_number);
}
else {echo "-";}
?></td>
<td><?php
if(!empty($result->parent_invoice_id)) {
echo $result->parent_invoice_id;
}else {echo "-";}
?></td>
<td><?php
$d=date("d-m-Y",strtotime($result->invoice_date_created));
if(!empty($result->invoice_date_created)) {
echo $d;
}else {echo "-";}
?></td>
<td><?php
if(!empty($result->invoice_time_created)) {
echo $result->invoice_time_created;
}else {echo "-";}
?></td>
<td style="text-align:left;"><?php
if(!empty($result->vehicle_no)) {
echo $result->vehicle_no;
}else {echo "-";}
?></td>
<td style="text-align:left;"><?php
if(!empty($result->product_description)) { echo $result->product_description ; } else {echo "-";}
?></td>
<td style="text-align:left;"><?php
if(!empty($result->client_name)) { echo anchor('clients/view/' . $result->client_id,$result->client_name); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_sum= $tot_sum + $result->item_quantity;
if(!empty($result->item_quantity)) { echo $result->item_quantity; } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_rate= $tot_rate + $result->item_price;
if(!empty($result->item_price)) { echo format_currency($result->item_price); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_value= $tot_value + $result->item_subtotal;
if(!empty($result->item_subtotal)) { echo format_currency($result->item_subtotal); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_CGST= $tot_CGST + $result->cgst;
if(!empty($result->cgst)) { echo format_currency($result->cgst); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_SCGT= $tot_SCGT + $result->sgst;
if(!empty($result->sgst)) { echo format_currency($result->sgst); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_ICGT= $tot_ICGT + $result->igst;
if(!empty($result->igst)) { echo format_currency($result->igst); } else {echo "-";}
?></td>
<td class="amount"><?php
$tot_tot= $tot_tot + $result->total;
if(!empty($result->total)) { echo format_currency($result->total); } else {echo "-";}
?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td class="amount"><strong>
<?php
{
echo $tot_sum;
}
?>
</strong>
</td>
<td class="amount"><strong>
<?php
{
//echo format_currency($tot_rate,2,'.','');
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot_value);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot_CGST);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot_SCGT);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot_ICGT);
}
?>
</strong>
</td>
<td class="amount">
<strong>
<?php
{
echo format_currency($tot_tot);
}
?>
</strong></td>
</tr>
</tfoot>
</table>
<?php
}
if(empty($results))
{
echo "<center><h3>No Records Found</h3></center>";
}
?>
</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: $('small').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();
});
});
</script>