634 lines
21 KiB
PHP
Executable File
634 lines
21 KiB
PHP
Executable File
<script>
|
|
$(document).ready(function () {
|
|
|
|
$("#client_name").select2();
|
|
$("#item_name").select2();
|
|
|
|
});
|
|
</script>
|
|
|
|
<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;
|
|
}
|
|
th, td { white-space: nowrap; }
|
|
.dataTable > thead > tr > th[class*="sort"]:after{
|
|
content: "" !important;
|
|
}
|
|
|
|
table.dataTable thead > tr > th.sorting_asc,
|
|
table.dataTable thead > tr > th.sorting_desc,
|
|
table.dataTable thead > tr > th.sorting,
|
|
table.dataTable thead > tr > td.sorting_asc,
|
|
table.dataTable thead > tr > td.sorting_desc,
|
|
table.dataTable thead > tr > td.sorting {
|
|
padding-right: inherit;
|
|
}
|
|
|
|
|
|
</style>
|
|
<div class="content-wrapper">
|
|
<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>Inward Details</b><br><br>
|
|
<?php
|
|
if($this->input->post('client_name')){
|
|
$cl=$this->input->post('client_name');
|
|
echo $cl;
|
|
echo ' '.' ';
|
|
}
|
|
if($this->input->post('item_name')){
|
|
$it=$this->input->post('item_name');
|
|
echo $it;
|
|
echo ' '.' ';
|
|
}
|
|
|
|
if($this->input->post('financialyear')){
|
|
$ab=$this->input->post('financialyear');
|
|
echo '('.$ab.')';
|
|
echo ' ';
|
|
|
|
}
|
|
if($this->input->post('month')){
|
|
$m=$this->input->post('month');
|
|
echo '('.$m.')';
|
|
echo ' ';
|
|
}
|
|
if($this->input->post('from_date') && $this->input->post('to_date')){
|
|
$frm = $this->input->post('from_date');
|
|
$t = $this->input->post('to_date');
|
|
echo $frm.'-to-'.$t;
|
|
}
|
|
|
|
?></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-4">
|
|
<label for="client_name">
|
|
<?php echo'Material'; ?>
|
|
</label>
|
|
<div class="input-group">
|
|
<select class="form-control" id="item_name" name="item_name">
|
|
<option value="">Select Material</option>
|
|
<?php
|
|
|
|
|
|
foreach($material as $it):
|
|
|
|
{?>
|
|
|
|
<option value="<?php echo $it->MaterialName;?>"><?php echo $it->MaterialName ; ?></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">
|
|
<label for="to_date">
|
|
<?php echo '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>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label for="from_date">
|
|
<?php echo 'From Date'; ?>
|
|
</label>
|
|
<div class="input-group">
|
|
<input name="from_date" id="max-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 echo 'To Date'; ?>
|
|
</label>
|
|
<div class="input-group">
|
|
<input name="to_date" id="min-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-2 col-md-offset-2"> <br>
|
|
<input type="submit" class="btn btn-success" name="btn_submit"
|
|
value="View Report">
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="modal fade" id="Fileshow" role="dialog">
|
|
<div class="modal-dialog">
|
|
<!-- Modal content-->
|
|
<form>
|
|
<div class="modal-content" style="width:800px;">
|
|
|
|
|
|
|
|
|
|
<!-- Table to show the line item of po -->
|
|
<div id="content" > </div>
|
|
<table class="table table-bordered" id="Inwardgateregistertable1" style="font-size:12px;">
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
<th>SNo</th>
|
|
<th>BillNO</th>
|
|
<th>PONO</th>
|
|
<th>FileName</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="tbleAppend1">
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary" data-dismiss="modal" value="Cancel">Cancel</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<span style="color:red;">*Insurance field not included </span>
|
|
|
|
<div class="box-body">
|
|
<div class = "table-responsive">
|
|
<table id="cc" class="table table-bordered" cellspacing="0" style="font-size:12px !important;">
|
|
<thead>
|
|
<tr>
|
|
<th>PO No</th>
|
|
<th>IGR Created Date</th>
|
|
<th>Time</th>
|
|
<th>Material Received Date</th>
|
|
<th>Material Name</th>
|
|
<th>Category</th>
|
|
<th>Supplier Name</th>
|
|
<th>Qty</th>
|
|
<th>UOM</th>
|
|
<th>Rate (₹)</th>
|
|
<th>Value (₹)</th>
|
|
<th>Exchange Rate</th>
|
|
<th>SGST (₹)</th>
|
|
<th>CGST (₹)</th>
|
|
<th>IGST (₹)</th>
|
|
<th>Discount (₹)</th>
|
|
<th>Freight (₹)</th>
|
|
<th>Package (₹)</th>
|
|
<th>Total (₹)</th>
|
|
<th>Attachments</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$tot_qty = 0;
|
|
$tot_rate = 0;
|
|
$tot_value = 0;
|
|
$tot_ex = 0;
|
|
$tot_CGST = 0;
|
|
$tot_SCGT = 0.0000;
|
|
$tot_ICGT = 0;
|
|
$tot_dis = 0;
|
|
$tot_frg = 0;
|
|
$tot_pac = 0;
|
|
//$tot_inc = 0;
|
|
$tot_tot = 0;
|
|
if(!empty($purchase)){
|
|
foreach($purchase as $key => $rel)
|
|
{
|
|
?>
|
|
<tr id="lastvalue">
|
|
<td id="pono<?php echo $key?>"><span>
|
|
<a href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$rel->pono.'&ReqType='.$rel->potype; ?>"><?php echo $rel->pono;?></a>
|
|
</span></td>
|
|
<td style="text-align:center"><span><?php echo $rel->created_date;?></span></td>
|
|
<td style="text-align:right"><span><?php echo $rel->created_time;?></span></td>
|
|
<td style="text-align:center"><span><?php echo $rel->materialrcvddate;?></span></td>
|
|
<td><span><?php echo $rel->material_name;?></span></td>
|
|
<td><span><?php echo $rel->category;?></span></td>
|
|
<td><span><?php echo $rel->supplier_name;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_qty= $tot_qty + round($rel->quantity);
|
|
echo round($rel->quantity);?></span></td>
|
|
<td style="text-align:left"><span><?php
|
|
echo $rel->UOM;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_rate= $tot_rate + $rel->rate;
|
|
echo $rel->rate;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_value= $tot_value + $rel->value;
|
|
echo $rel->value;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_ex= $tot_ex + $rel->exchange_rate;
|
|
echo $rel->exchange_rate;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_SCGT= $tot_SCGT + $rel->sgst;
|
|
echo $rel->sgst;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_CGST= $tot_CGST + $rel->cgst;
|
|
echo $rel->cgst;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_ICGT= $tot_ICGT + $rel->igst;
|
|
echo $rel->igst;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_dis= $tot_dis + $rel->discount;
|
|
echo $rel->discount;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_frg= $tot_frg + $rel->freight;
|
|
echo $rel->freight;?></span></td>
|
|
<td style="text-align:right"><span><?php
|
|
$tot_pac= $tot_pac + $rel->Package;
|
|
echo $rel->Package;?></span></td>
|
|
|
|
<td style="text-align:right"><span><?php
|
|
$tot_tot= $tot_tot + round($rel->total,2);
|
|
echo number_format($rel->total,2,'.','');
|
|
?></span></td>
|
|
|
|
|
|
<td id="download<?php echo $key?>" style="text-align:center"><span>
|
|
<?php
|
|
if(!empty($rel->file)){ ?><!-- if for Inward po file -->
|
|
<a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="files<?php echo $rel->pono;?>">Download</button></a>
|
|
<?php }else if(!empty($rel->ifile)) { ?><!-- else if for igr file -->
|
|
<a target="_blank" href="<?php echo base_url().''.$rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View">
|
|
<button class="btn btn-info btn-sm">Download</button>
|
|
</a>
|
|
<?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means -->
|
|
|
|
</span></td>
|
|
|
|
</tr>
|
|
<?php
|
|
}}
|
|
?>
|
|
</tbody>
|
|
<tfoot width="100%">
|
|
<tr>
|
|
<td style="text-align:center;"><strong>Total</strong></td>
|
|
<td><strong> </strong></td>
|
|
<td><strong> </strong></td>
|
|
<td><strong> </strong></td>
|
|
<td><strong> </strong></td>
|
|
<td><strong> </strong></td>
|
|
<td><strong> </strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo $tot_qty; ?> </strong></td>
|
|
|
|
<td class="amount"><strong><?php //echo format_currency($tot_rate,2,'.',''); ?> </strong></td>
|
|
|
|
<td class="amount"><strong><?php //echo format_currency($tot_rate,2,'.',''); ?> </strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_value,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo $tot_ex; ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_SCGT,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_CGST,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_ICGT,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_dis,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_frg,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_pac,2,'.',''); ?></strong></td>
|
|
|
|
<td class="amount" style="text-align:right"><strong><?php echo number_format($tot_tot,2,'.',''); ?></strong></td>
|
|
<td><strong> </strong></td>
|
|
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.box -->
|
|
</div>
|
|
<!-- /.col -->
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<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/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
|
|
<script>
|
|
|
|
|
|
// Bootstrap datepicker
|
|
// Set up your table
|
|
$(document).ready(function() {
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
/** On click for Displaying File MOdal***/
|
|
$('.splpofile').click(function() {
|
|
var id = $(this).attr('id');
|
|
$("#Fileshow").modal("show");
|
|
$.ajax({
|
|
data:{id:id},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>report/Viewfiles",
|
|
success: function(data){
|
|
|
|
var trHTML = '';
|
|
|
|
$.each($.parseJSON(data), function (i, item) {
|
|
|
|
i=i+1;
|
|
trHTML += '<tr>' +
|
|
'<td align="right">' + i + '</td>' +
|
|
'<td>' + item.BillNo+ '</td>' +
|
|
'<td>' + item.PONO+ '</td>' +
|
|
'<td><a target="_blank" href = <?php echo base_url()?>uploads/BillFiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
|
|
'</tr>';
|
|
|
|
});
|
|
|
|
$("#tbleAppend1").empty();
|
|
$('#Inwardgateregistertable1 > tbody').append(trHTML);
|
|
}
|
|
});
|
|
|
|
});//onclick function closed
|
|
|
|
/******************** Datatable codes starts here **************************/
|
|
$.fn.dataTable.moment( 'DD-MM-YYYY' );
|
|
table = $('#cc').DataTable( {
|
|
"language": {
|
|
"emptyTable": "<center> Data Not Found ! </center>"
|
|
},
|
|
"aaSorting": [[ 3, "desc" ]],
|
|
"autoWidth": false,
|
|
orderCellsTop: true,
|
|
"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-2'i><'col-md-10'p>>",
|
|
buttons: [
|
|
{
|
|
extend: 'excelHtml5',
|
|
footer: 'true',
|
|
messageTop: 'Report Purchase-Inward',
|
|
title: $('h3').text(),
|
|
exportOptions: {
|
|
columns: ':visible'
|
|
|
|
}
|
|
},
|
|
|
|
'colvis'
|
|
],
|
|
"footerCallback": function ( row, data, start, end, display ) {
|
|
var api = this.api(), data;
|
|
|
|
// Remove the formatting to get integer data for summation
|
|
var intVal = function ( i ) {
|
|
return typeof i === 'string' ?
|
|
parseFloat(i.replace(/[^0.00-9.00]+/g,"")*1) :
|
|
typeof i === 'number' ?
|
|
parseFloat(i) : 0;
|
|
};
|
|
|
|
TotalQTY = api
|
|
.column( 7, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 7 ).footer() ).html( TotalQTY );
|
|
|
|
TotalVALUE = api
|
|
.column( 10, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 10 ).footer() ).html( TotalVALUE.toFixed(2) );
|
|
|
|
TotalExRATE = api
|
|
.column( 11, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 11 ).footer() ).html( TotalExRATE.toFixed(2) );
|
|
|
|
TotalSGST = api
|
|
.column( 12, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 12 ).footer() ).html( TotalSGST.toFixed(2) );
|
|
|
|
TotalCGST = api
|
|
.column( 13, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 13 ).footer() ).html( TotalCGST.toFixed(2) );
|
|
|
|
TotalIGST = api
|
|
.column( 14, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 14 ).footer() ).html( TotalIGST.toFixed(2) );
|
|
|
|
TotalDISCOUNT = api
|
|
.column( 15, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 15 ).footer() ).html( TotalDISCOUNT.toFixed(2) );
|
|
|
|
TotalFRIGEHT = api
|
|
.column( 16, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 16 ).footer() ).html( TotalFRIGEHT.toFixed(2) );
|
|
|
|
TotalPACKAGE = api
|
|
.column( 17, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 17 ).footer() ).html( TotalPACKAGE.toFixed(2) );
|
|
|
|
FinalTotal = api
|
|
.column( 18, { search:'applied' } )
|
|
.data()
|
|
.reduce( function (a, b) {
|
|
return intVal(a) + intVal(b);
|
|
}, 0 );
|
|
|
|
$( api.column( 18 ).footer() ).html( FinalTotal.toFixed(2) );
|
|
}
|
|
|
|
} );
|
|
|
|
} ); //on ready function Closed
|
|
|
|
/** jquery on ready for DataPicker. */
|
|
$( function() {
|
|
//var dateFormat = "mm/dd/yy",
|
|
from = $( "#min-date" )
|
|
.datepicker({
|
|
dateFormat: "dd-mm-yy",
|
|
defaultDate: "+0d",
|
|
changeMonth: true,
|
|
//numberOfMonths: 1
|
|
|
|
})
|
|
.on( "change", function() {
|
|
to.datepicker("option", "minDate", getDate( this ) );
|
|
}),
|
|
to = $( "#max-date" ).datepicker({
|
|
dateFormat: "dd-mm-yy",
|
|
defaultDate: "+0d",
|
|
changeMonth: true,
|
|
//numberOfMonths: 1
|
|
|
|
})
|
|
.on( "change", function() {
|
|
from.datepicker( "option", "maxDate", getDate( this ) );
|
|
});
|
|
|
|
function getDate( element ) {
|
|
var date;
|
|
|
|
try {
|
|
date = $.datepicker.parseDate( dateFormat, element.value );
|
|
|
|
} catch( error ) {
|
|
date = null;
|
|
}
|
|
|
|
return date;
|
|
}
|
|
} );
|
|
|
|
</script>
|