Filters added in material history
This commit is contained in:
parent
0182669da8
commit
e11ac51e19
@ -1823,8 +1823,13 @@ class batchcard extends BaseController
|
||||
function material_history()
|
||||
{
|
||||
$this->global['pageTitle'] = 'Siddharth : Material History';
|
||||
|
||||
$data['material']=$this->batchcard_model->getMaterial_history();
|
||||
if ($this->input->post('btn_submit')) {
|
||||
$prod = $this->input->post('item_name');
|
||||
$frm = $this->input->post('from_date');
|
||||
$t = $this->input->post('to_date');
|
||||
$data['material']=$this->batchcard_model->getMaterial_history($prod,$frm,$t);
|
||||
}
|
||||
$data['material_name']=$this->batchcard_model->material_name();
|
||||
|
||||
$this->loadviews("MaterialHistory",$this->global,$data,NULL);
|
||||
|
||||
|
||||
@ -1052,11 +1052,33 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty';
|
||||
$res = $this->db->get();
|
||||
return $res->result();
|
||||
}
|
||||
function getMaterial_history()
|
||||
function material_name(){
|
||||
$sql="SELECT distinct MaterialName FROM T_MaterialMaster;";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
}
|
||||
function getMaterial_history($prod,$frm,$t)
|
||||
{
|
||||
$sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,msh.CreatedOn FROM T_Material_stock_history as msh
|
||||
$sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,date_format(msh.UpdatedOn,'%d-%m-%Y') as updatedOn FROM T_Material_stock_history as msh
|
||||
left join T_SupplierDetailsN as sd on sd.SupplierID=msh.SupplierID
|
||||
left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode";
|
||||
left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode
|
||||
where msh.StockId != 'null' ";
|
||||
if ($prod!= ''){
|
||||
|
||||
$sql.=" and mm.MaterialName = '".$prod."' ";
|
||||
|
||||
}
|
||||
if ($frm and $t != ''){
|
||||
$fromd= date("Y-m-d",strtotime($frm));
|
||||
$tod=date("Y-m-d",strtotime($t));
|
||||
|
||||
|
||||
$sql.="and date(msh.UpdatedOn) >= '".$fromd."'
|
||||
and date(msh.UpdatedOn) <= '".$tod."'";
|
||||
|
||||
}
|
||||
|
||||
|
||||
$query =$this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
|
||||
@ -1,35 +1,155 @@
|
||||
<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: #3c8dbc;
|
||||
border-color: #3c8dbc;
|
||||
}
|
||||
th, td { white-space: nowrap; }
|
||||
|
||||
|
||||
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">
|
||||
<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>Siddharth Industries - Material History</b><br><br>
|
||||
<?php
|
||||
|
||||
if($this->input->post('item_name')){
|
||||
$it=$this->input->post('item_name');
|
||||
echo $it;
|
||||
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-3">
|
||||
<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_name as $it):
|
||||
|
||||
{?>
|
||||
|
||||
<option value="<?php echo $it->MaterialName;?>"><?php echo $it->MaterialName ; ?></option>
|
||||
|
||||
|
||||
<?php } endforeach; ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<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-3">
|
||||
<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-3" style="margin-top: 4px;"> <br>
|
||||
<input type="submit" class="btn btn-success" name="btn_submit"
|
||||
value="View Report">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.pagination {
|
||||
margin:0px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<center><h3 class="box-title">Siddharth Industries - Material History</h3></center>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
<table class="table table-bordered" id="cc" style="font-size:11px !important;">
|
||||
|
||||
<div class="box-body">
|
||||
<table class="table table-bordered" id="cc" style="font-size:12px !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:center">Stock ID</th>
|
||||
<th style="text-align:center">Supplier Name</th>
|
||||
<th style="text-align:center">Material Name</th>
|
||||
<th style="text-align:center">UpdatedON</th>
|
||||
<th style="text-align:center">Transaction Type</th>
|
||||
<th style="text-align:center">Ref Type</th>
|
||||
<th style="text-align:center">Ref NO</th>
|
||||
<th style="text-align:center">Quantity</th>
|
||||
<th style="text-align:center">Item Value</th>
|
||||
<th style="text-align:center">CreatedON</th>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
@ -46,6 +166,8 @@
|
||||
<td style="text-align:center"><span><?php echo $rel->StockId;?></span></td>
|
||||
<td><span><?php echo $rel->SupplierName;?></span></td>
|
||||
<td><span><?php echo $rel->MaterialName;?></span></td>
|
||||
<td style="text-align:right"><span><?php
|
||||
echo $rel->updatedOn;?></span></td>
|
||||
<td><span><?php
|
||||
echo $rel->Transaction_type;?></span></td>
|
||||
<td><span><?php
|
||||
@ -56,8 +178,7 @@
|
||||
echo $rel->Quantity;?></span></td>
|
||||
<td style="text-align:right"><span><?php
|
||||
echo $rel->ItemValue;?></span></td>
|
||||
<td style="text-align:right"><span><?php
|
||||
echo $rel->CreatedOn;?></span></td>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -75,31 +196,107 @@
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
|
||||
|
||||
<script>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
$(function () {
|
||||
<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() {
|
||||
|
||||
|
||||
$.fn.dataTable.moment( 'DD-MM-YYYY' );
|
||||
table = $('#cc').DataTable( {
|
||||
|
||||
|
||||
|
||||
$('#cc').DataTable({
|
||||
"paging" : true,
|
||||
"ordering" : true,
|
||||
"scrollCollapse" : true,
|
||||
"searching" : true,
|
||||
"columnDefs" : [{"targets":3, "type":"date-eu"}],
|
||||
"bInfo": 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: 'Material History',
|
||||
title: $('h3').text(),
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
'colvis'
|
||||
]
|
||||
|
||||
} );
|
||||
} );
|
||||
$('#mySelect').on('change',function(){
|
||||
|
||||
table
|
||||
.column(4)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
});
|
||||
|
||||
$( 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;
|
||||
}
|
||||
} );
|
||||
|
||||
function Reset()
|
||||
{
|
||||
$('#mySelect').val('');
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user