auto search box in add and edit material screen
This commit is contained in:
parent
c2e8210213
commit
69b87bddf9
@ -116,6 +116,9 @@ class rawmaterialdetails extends BaseController
|
||||
|
||||
function addNewRawMaterial()
|
||||
{
|
||||
|
||||
//echo "HI";die();
|
||||
$TempArr = [];
|
||||
|
||||
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|');
|
||||
$this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate');
|
||||
@ -128,16 +131,34 @@ class rawmaterialdetails extends BaseController
|
||||
}
|
||||
else
|
||||
{
|
||||
$MaterialName = $this->input->post('MaterialName');//print_r($MaterialName);
|
||||
$MaterialName = $this->input->post('MaterialName');
|
||||
$MaterialType = $this->input->post('MaterialType');
|
||||
$UOM = $this->input->post('UOM');
|
||||
$MaterialCategory = $this->input->post('MaterialCategory');
|
||||
$MaterialCategory = $this->input->post('MatCate');
|
||||
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
|
||||
|
||||
foreach($materialcategoryarray as $mc){
|
||||
$TempArr[] = $mc->ConfigValue;
|
||||
|
||||
}
|
||||
//print_r($TempArr);
|
||||
if (in_array($MaterialCategory, $TempArr))
|
||||
{
|
||||
//echo "Match found";
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "Match not found";
|
||||
$configcode = 'C023';
|
||||
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory);
|
||||
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||
}
|
||||
$Remarks = $this->input->post('remarks');
|
||||
$asset = $this->input->post('Assetcode');//print_r($AssetCode);
|
||||
$costcentercode = $this->input->post('Costcenter');//print_r($CostCenterCode);
|
||||
$asset = $this->input->post('Assetcode');
|
||||
$costcentercode = $this->input->post('Costcenter');
|
||||
$ConversionFactor = $this->input->post('conversionfactor');
|
||||
$cfuom = $this->input->post('conversionfactorUOM');//print_r( $ConversionFactorUOM);
|
||||
$HSN = $this->input->post('HSNcode');//print_r($HSNcode);
|
||||
$cfuom = $this->input->post('conversionfactorUOM');
|
||||
$HSN = $this->input->post('HSNcode');
|
||||
$CreatedBy = $this->session->userdata('userId');
|
||||
|
||||
$chked = $this->input->post('isactive');
|
||||
@ -241,6 +262,7 @@ class rawmaterialdetails extends BaseController
|
||||
*/
|
||||
function editRawmaterial()
|
||||
{
|
||||
|
||||
// if($this->isAdmin() == TRUE)
|
||||
// {
|
||||
// $this->loadThis();
|
||||
@ -264,6 +286,24 @@ class rawmaterialdetails extends BaseController
|
||||
$MaterialName = $this->input->post('MaterialName');
|
||||
$MaterialType = $this->input->post('MaterialType');
|
||||
$MaterialCategory =$this->input->post('MaterialCategory');
|
||||
$materialcategoryarray = $this->rawmaterialdetails_model->getmaterialCategory();
|
||||
|
||||
foreach($materialcategoryarray as $mc){
|
||||
$TempArr[] = $mc->ConfigValue;
|
||||
|
||||
}
|
||||
//print_r($TempArr);
|
||||
if (in_array($MaterialCategory, $TempArr))
|
||||
{
|
||||
//echo "Match found";
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "Match not found";
|
||||
$configcode = 'C023';
|
||||
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$MaterialCategory);
|
||||
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||
}
|
||||
$UOM = $this->input->post('UOM');
|
||||
$rmcode = $this->input->post('RMcode');
|
||||
$Remarks = $this->input->post('remarks');
|
||||
@ -318,7 +358,7 @@ class rawmaterialdetails extends BaseController
|
||||
|
||||
$RawMaterial = array();
|
||||
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'HSNCODE'=>$HSNcode);//,'RMCode'=>$rmcode);
|
||||
//print_r($RawMaterial);//die();
|
||||
|
||||
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
|
||||
|
||||
if($result == true)
|
||||
@ -336,7 +376,32 @@ class rawmaterialdetails extends BaseController
|
||||
}
|
||||
//}
|
||||
}
|
||||
function autocomplete()
|
||||
{
|
||||
$this->load->model('model','rawmaterialdetails_model');
|
||||
|
||||
$mc = $this->input->get('query');
|
||||
//echo $mc;die;
|
||||
$query= $this->rawmaterialdetails_model->checkMaterialCategory($mc);
|
||||
|
||||
echo json_encode($query);
|
||||
// foreach($query->result() as $row):
|
||||
// echo "<li id='$row->id'>".$row->Category."</li>";
|
||||
// endforeach;
|
||||
}
|
||||
|
||||
function insertvalueintoconfig(){
|
||||
$this->load->model('model','rawmaterialdetails_model');
|
||||
$mc = $this->input->post('id');
|
||||
$configcode = 'C023';
|
||||
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$mc);
|
||||
|
||||
$query= $this->rawmaterialdetails_model->insertvalueintoconfig($config);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/** this function can be use for excel report **/
|
||||
|
||||
function export_material(){
|
||||
|
||||
@ -96,6 +96,12 @@ class rawmaterialdetails_model extends CI_Model
|
||||
$this->db->insert('T_MaterialMaster', $RawMaterial);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function insertvalueintoconfig($config){
|
||||
|
||||
$this->db->insert('T_ConfigDetails', $config);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function used to get user information by id
|
||||
@ -189,5 +195,35 @@ class rawmaterialdetails_model extends CI_Model
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
function checkMaterialCategory($mc){
|
||||
|
||||
// $this->db->select('ConfigValue');
|
||||
// $this->db->from('T_ConfigDetails');
|
||||
// $this->db->where(Config_ID,'C023');
|
||||
// $this->db->like('ConfigValue',$mc);
|
||||
// $query = $this->db->get();
|
||||
// //print_r($query->result());
|
||||
// return $query->result();
|
||||
|
||||
// //return $this->db->get('T_MaterialMaster');
|
||||
// }
|
||||
$temp[] = '' ;
|
||||
echo $materialcategory;
|
||||
$this->db->distinct();
|
||||
$this->db->select('ConfigValue');
|
||||
$this->db->from('T_ConfigDetails');
|
||||
$this->db->where('Config_ID','C023');
|
||||
$this->db->like('ConfigValue',$mc);
|
||||
$query = $this->db->get();
|
||||
//print_r($query->result());die;
|
||||
$temparr[] = '' ;
|
||||
foreach($query->result() as $arr){
|
||||
$temparr[] = $arr->ConfigValue ;
|
||||
}
|
||||
$temp['suggestions'] = $temparr;
|
||||
//print_r($temp);
|
||||
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -1,59 +1,17 @@
|
||||
<script>
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// function BlockSpecial(evt) {
|
||||
// var charCode;
|
||||
// if (window.event
|
||||
// charCode = window.event.keyCode; //for IE
|
||||
// else
|
||||
// charCode = evt.which; //for firefox
|
||||
|
||||
// if (charCode >= 91 && charCode <= 96)
|
||||
// return false;
|
||||
// if (charCode >= 123 && charCode <= 126)
|
||||
// return false;
|
||||
// if (charCode >= 33 && charCode <= 47)
|
||||
// return false;
|
||||
// if (charCode >= 58&& charCode <= 64)
|
||||
// return false;
|
||||
|
||||
// else
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.autocomplete-suggestion{
|
||||
cursor:pointer;
|
||||
background-color:skyblue;
|
||||
/* background-color: darkgrey; */
|
||||
outline: 1px solid slategrey;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
|
||||
<div class="content-wrapper" style="min-height: 537px;">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
|
||||
<center>Siddharth Industries - Add New Material </center>
|
||||
|
||||
</h1>
|
||||
@ -74,12 +32,14 @@ function isNumberKey(evt)
|
||||
<!-- form start -->
|
||||
|
||||
<form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form">
|
||||
|
||||
|
||||
<div class="box-body">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="MaterialName">Material Name</label><font color="Red">*</font>
|
||||
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" onchange="hello()" required id="MaterialName" name="MaterialName" maxlength="255">
|
||||
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -103,31 +63,21 @@ function isNumberKey(evt)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="MaterialCategory">Material Category</label><font color="Red">*</font>
|
||||
<select class="form-control required select2" id="MaterialCategory" name="MaterialCategory" onchange="changeTextBox()">
|
||||
<option value="" requried>Select Material Category</option>
|
||||
<?php
|
||||
if(!empty($materialcategory))
|
||||
{
|
||||
foreach ($materialcategory as $MC)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $MC->ConfigValue ?>"><?php echo $MC->ConfigValue ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3" >
|
||||
<div class="form-group autoSearch" id="mc">
|
||||
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
|
||||
<input type="text" class="form-control required " required id="MatCate" name="MatCate" maxlength="255">
|
||||
<!-- <div id="tagsname"></div> -->
|
||||
<!-- <input type="text" class="form-control" id="HideMatCate" name="HideMatCate" readonly> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||
<select class="form-control required select2" id="UOM" name="UOM">
|
||||
<select class="form-control required select2" id="UOM" name="UOM" onchange="changeTextBox();" >
|
||||
<option value="" required>Select UOM</option>
|
||||
<?php
|
||||
if(!empty($UOM))
|
||||
@ -278,6 +228,71 @@ function isNumberKey(evt)
|
||||
</div>
|
||||
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
|
||||
//var tempARRAY = [];
|
||||
$(document).ready(function(){
|
||||
$("#MaterialType").select2();
|
||||
|
||||
// $("#MaterialCategory").select2();
|
||||
$("#UOM").select2();
|
||||
$("#Assetcode").select2();
|
||||
$("#Costcenter").select2();
|
||||
$("#conversionfactorUOM").select2();
|
||||
|
||||
$('#MatCate').autocomplete({
|
||||
|
||||
onSearchStart: function (query) {
|
||||
//alert(query);
|
||||
$('#MatCate').autocomplete("option", "minLength", 0);
|
||||
},
|
||||
|
||||
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||
onSelect: function (suggestion) {
|
||||
|
||||
var data = suggestion.ConfigValue;
|
||||
//var str = data.split('-');
|
||||
|
||||
//console.log(data);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#MaterialName').change(function() {
|
||||
|
||||
var materialname = $('#MaterialName').val();
|
||||
@ -345,35 +360,16 @@ function Validate()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//corrected
|
||||
$(document).ready(function(){
|
||||
// $("#MaterialType").select2();
|
||||
|
||||
// $("#MaterialCategory").select2();
|
||||
// $("#UOM").select2();
|
||||
// $("#Assetcode").select2();
|
||||
// $("#Costcenter").select2();
|
||||
// $("#conversionfactorUOM").select2();
|
||||
|
||||
|
||||
});
|
||||
function changeTextBox() {
|
||||
var x = document.getElementById("MaterialCategory");
|
||||
if(x.value=='Spares')
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true; }
|
||||
}
|
||||
</script>
|
||||
var x = document.getElementById("MatCate");
|
||||
if(x.value=='Spares')
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true; }
|
||||
}
|
||||
</script>
|
||||
@ -46,100 +46,15 @@ if(!empty($materialDetails))
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
//$("#MaterialType").select2();
|
||||
//$("#MaterialCategory").select2();
|
||||
// $("#UOM").select2();
|
||||
// $("#Assetcode").select2();
|
||||
// $("#Costcenter").select2();
|
||||
// $("#conversionfactorUOM").select2();
|
||||
|
||||
var x = $("#MaterialCategory").val() == 'Spares';
|
||||
if(x)
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert('i am a else part');
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
// $(function() {
|
||||
// $('#MaterialCategory').change(function() {
|
||||
// var x = $(this).val();
|
||||
// alert(x);
|
||||
// $('#mchiddenfield').val(x);
|
||||
// });
|
||||
// });
|
||||
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function changeTextBox() {
|
||||
//alert('changeTextBox entered');
|
||||
var x = document.getElementById("MaterialCategory");
|
||||
if(x.value=='Spares')
|
||||
{
|
||||
//alert('i am an if part');
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;}
|
||||
else
|
||||
{
|
||||
//alert('i am a else part');
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true;}
|
||||
<style>
|
||||
.autocomplete-suggestion{
|
||||
cursor:pointer;
|
||||
background-color:skyblue;
|
||||
/* background-color: darkgrey; */
|
||||
outline: 1px solid slategrey;
|
||||
}
|
||||
</script>
|
||||
|
||||
</style>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
|
||||
<div class="content-wrapper" style="min-height: 537px;">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
@ -208,11 +123,19 @@ function changeTextBox() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="MaterialCategory">Material Category</label>
|
||||
<input type="text" class="form-control" readonly id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" onChange="changeTextBox();">
|
||||
<!-- <select class="form-control readonly select2" id="MaterialCategory" name="MaterialCategory" onChange="changeTextBox();">
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="form-group autoSearch" id="mc">
|
||||
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
|
||||
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" maxlength="255">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<label for="MaterialCategory">Material Category</label><font color="Red">*</font>
|
||||
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" onChange="changeTextBox();" maxlength="255">
|
||||
|
||||
< <select class="form-control readonly select2" id="MaterialCategory" name="MaterialCategory" onChange="changeTextBox();">
|
||||
<option value="<?php echo $MaterialCategory;?> "><?php echo $MaterialCategory;?></option>
|
||||
<?php
|
||||
if(!empty($materialCategory))
|
||||
@ -226,15 +149,15 @@ function changeTextBox() {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
--> <!-- <input type='hidden' id='mchiddenfield' name='mchiddenfield' value=''> -->
|
||||
</div>
|
||||
</div>
|
||||
-> <!- <input type='hidden' id='mchiddenfield' name='mchiddenfield' value=''> ->
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||
<select class="form-control required select2" id="UOM" name="UOM">
|
||||
<select class="form-control required select2" id="UOM" name="UOM" onchange="changeTextBox();" >
|
||||
<option value="<?php echo $UOM;?>"><?php echo $UOM;?></option>
|
||||
<?php
|
||||
if(!empty($UOMList))
|
||||
@ -389,6 +312,115 @@ function changeTextBox() {
|
||||
|
||||
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
//$("#MaterialType").select2();
|
||||
//$("#MaterialCategory").select2();
|
||||
$("#UOM").select2();
|
||||
$("#Assetcode").select2();
|
||||
$("#Costcenter").select2();
|
||||
$("#conversionfactorUOM").select2();
|
||||
|
||||
$('#MaterialCategory').autocomplete({
|
||||
|
||||
onSearchStart: function (query) {
|
||||
//alert(query);
|
||||
$('#MatCate').autocomplete("option", "minLength", 0);
|
||||
},
|
||||
|
||||
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||
onSelect: function (suggestion) {
|
||||
|
||||
var data = suggestion.ConfigValue;
|
||||
//var str = data.split('-');
|
||||
|
||||
//console.log(data);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var x = $("#MaterialCategory").val() == 'Spares';
|
||||
if(x)
|
||||
{
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert('i am a else part');
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
function isNumberKey(evt)
|
||||
{
|
||||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||||
if (charCode != 46 && charCode > 31
|
||||
&& (charCode < 48 || charCode > 57))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
// $(function() {
|
||||
// $('#MaterialCategory').change(function() {
|
||||
// var x = $(this).val();
|
||||
// alert(x);
|
||||
// $('#mchiddenfield').val(x);
|
||||
// });
|
||||
// });
|
||||
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
if (window.event)
|
||||
charCode = window.event.keyCode; //for IE
|
||||
else
|
||||
charCode = evt.which; //for firefox
|
||||
if (charCode == 32) //for <space> symbol
|
||||
return true;
|
||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||||
return false;
|
||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function changeTextBox() {
|
||||
//alert('changeTextBox entered');
|
||||
var x = document.getElementById("MaterialCategory");
|
||||
if(x.value=='Spares')
|
||||
{
|
||||
//alert('i am an if part');
|
||||
document.getElementById("Assetcode").disabled=false;
|
||||
document.getElementById("Costcenter").disabled=false;}
|
||||
else
|
||||
{
|
||||
//alert('i am a else part');
|
||||
document.getElementById("Assetcode").disabled=true;
|
||||
document.getElementById("Costcenter").disabled=true;}
|
||||
}
|
||||
|
||||
$('#MaterialName').change(function() {
|
||||
|
||||
var materialname = $('#MaterialName').val();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user