mater master issue fixes
This commit is contained in:
parent
9974c62570
commit
dec9e33cda
@ -14,6 +14,7 @@ class rawmaterialdetails_model extends CI_Model
|
|||||||
{
|
{
|
||||||
$this->db->select('*');
|
$this->db->select('*');
|
||||||
$this->db->from('T_MaterialMaster');
|
$this->db->from('T_MaterialMaster');
|
||||||
|
$this->db->where('IsActive',1 );
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -105,22 +105,6 @@ if(!empty($materialDetails))
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="MaterialType">Material Type</label>
|
<label for="MaterialType">Material Type</label>
|
||||||
<input type="text" class="form-control" readonly id="MaterialType" name="MaterialType" value="<?php echo $MaterialType;?>">
|
<input type="text" class="form-control" readonly id="MaterialType" name="MaterialType" value="<?php echo $MaterialType;?>">
|
||||||
<!-- <select class="form-control select2" id="MaterialType" name="MaterialType" readonly="true">
|
|
||||||
|
|
||||||
<option value="<?php echo $MaterialType;?> "><?php echo $MaterialType;?></option>
|
|
||||||
<?php
|
|
||||||
if(!empty($materialType))
|
|
||||||
{
|
|
||||||
foreach ($materialType as $MID)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $MID->ConfigValue ?>"><?php echo $MID->ConfigValue ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -129,30 +113,9 @@ if(!empty($materialDetails))
|
|||||||
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
|
<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">
|
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" maxlength="255">
|
||||||
</div>
|
</div>
|
||||||
</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();">
|
|
||||||
<option value="<?php echo $MaterialCategory;?> "><?php echo $MaterialCategory;?></option>
|
|
||||||
<?php
|
|
||||||
if(!empty($materialCategory))
|
|
||||||
{
|
|
||||||
foreach ($materialCategory as $MC)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $MC->ConfigValue ?>"><?php echo $MC->ConfigValue ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<!- <input type='hidden' id='mchiddenfield' name='mchiddenfield' value=''>
|
|
||||||
</div>
|
|
||||||
</div>-->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||||
@ -181,41 +144,18 @@ if(!empty($materialDetails))
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="assetcode">Asset Code</label>
|
<label for="assetcode">Asset Code</label>
|
||||||
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="disabled" placeholder="Select ">
|
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="disabled" >
|
||||||
<option value="<?php echo $Assetcode;?>"><?php echo $Assetcode;?></option>
|
<option value=" ">Select Asset Code</option>
|
||||||
<?php
|
</select>
|
||||||
if(!empty($assetcode))
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach($assetcode as $AC)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $AC->AssetCode ?>"><?php echo $AC->AssetCode ?> - <?php echo $AC->AssetName ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="costcenter">Cost Center Code</label>
|
<label for="costcenter">Cost Center Code</label>
|
||||||
<select class="form-control select2" id="Costcenter" name="Costcenter" disabled="disabled">
|
<select class="form-control select2" id="Costcenter" name="Costcenter" disabled="disabled" >
|
||||||
<option><?php echo $costcenter;?></option>
|
<option value=" ">Select Cost Center Code</option>
|
||||||
<?php
|
</select>
|
||||||
if(!empty($costcentercode))
|
|
||||||
{
|
|
||||||
foreach ($costcentercode as $CC)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $CC->CostCenterCode ?>"><?php echo $CC->CostCenterCode ?> - <?php echo $CC->CostCenterName?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@ -227,30 +167,22 @@ if(!empty($materialDetails))
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="conversionfactorUOM">Conversion Factor UOM</label>
|
<label for="conversionfactorUOM">Conversion Factor UOM</label>
|
||||||
<select class="form-control select2" id="conversionfactorUOM" name="conversionfactorUOM">
|
<select class="form-control select2" id="conversionfactorUOM" name="conversionfactorUOM" >
|
||||||
<option value="<?php echo $conversionfactorUOM;?>"><?php echo $conversionfactorUOM;?></option>
|
<option value=" ">Select Conversion Factor UOM</option>
|
||||||
<?php
|
|
||||||
if(!empty($cfUOM))
|
|
||||||
{
|
|
||||||
foreach ($cfUOM as $cfuom)
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $cfuom->ConfigValue; ?>"><?php echo $cfuom->ConfigValue ?>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="HSNcode">HSN code</label>
|
<label for="HSNcode">HSN code</label>
|
||||||
<input type="text" class="form-control" id="HSNcode" name="HSNcode" maxlength="8" value="<?php echo $HSNcode; ?>" onkeypress="return isNumberKey(event)" >
|
<input type="text" class="form-control" id="HSNcode" name="HSNcode" maxlength="8" value="<?php echo $HSNcode; ?>" onkeypress="return isNumberKey(event)" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="remarks">Remarks</label>
|
<label for="remarks">Remarks</label>
|
||||||
@ -286,57 +218,78 @@ if(!empty($materialDetails))
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
//$("#MaterialType").select2();
|
|
||||||
//$("#MaterialCategory").select2();
|
|
||||||
$("#UOM").select2();
|
$("#UOM").select2();
|
||||||
$("#Assetcode").select2();
|
$("#Assetcode").select2();
|
||||||
$("#Costcenter").select2();
|
$("#Costcenter").select2();
|
||||||
$("#conversionfactorUOM").select2();
|
$("#conversionfactorUOM").select2();
|
||||||
|
/** ---- auto search code -------- */
|
||||||
$('#MaterialCategory').autocomplete({
|
$('#MaterialCategory').autocomplete({
|
||||||
|
|
||||||
onSearchStart: function (query) {
|
onSearchStart: function (query) {
|
||||||
//alert(query);
|
//alert(query);
|
||||||
$('#MaterialCategory').autocomplete("option", "minLength", 0);
|
$('#MaterialCategory').autocomplete("option", "minLength", 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||||
onSelect: function (suggestion) {
|
onSelect: function (suggestion) {
|
||||||
|
|
||||||
|
var data = suggestion.ConfigValue;
|
||||||
|
var selectedvalue = $('input[name=MaterialCategory]').val();
|
||||||
|
if(selectedvalue=='Spares')
|
||||||
|
{
|
||||||
|
|
||||||
|
$('#Assetcode').prop('disabled', false);
|
||||||
|
$('#Costcenter').prop('disabled', false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
var data = suggestion.ConfigValue;
|
$('#Assetcode').prop('disabled', 'disabled');
|
||||||
var selectedvalue = $('input[name=MaterialCategory]').val();
|
$('#Costcenter').prop('disabled', 'disabled');
|
||||||
if(selectedvalue=='Spares')
|
}
|
||||||
{
|
|
||||||
//alert('good');
|
}
|
||||||
$('#Assetcode').prop('disabled', false);
|
|
||||||
$('#Costcenter').prop('disabled', false);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// // alert('bad');
|
|
||||||
$('#Assetcode').prop('disabled', 'disabled');
|
|
||||||
$('#Costcenter').prop('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var x = $("#MaterialCategory").val() == 'Spares';
|
var x = $("#MaterialCategory").val() == 'Spares';
|
||||||
if(x)
|
if(x)
|
||||||
{
|
{
|
||||||
document.getElementById("Assetcode").disabled=false;
|
$('#Assetcode').prop('disabled', false);
|
||||||
document.getElementById("Costcenter").disabled=false;
|
$('#Costcenter').prop('disabled', false);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/** ---- Value are append to dropdown -------- */
|
||||||
//alert('i am a else part');
|
|
||||||
document.getElementById("Assetcode").disabled=true;
|
|
||||||
document.getElementById("Costcenter").disabled=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
var ass = [];
|
||||||
|
var cos = [];
|
||||||
|
var con = [];
|
||||||
|
|
||||||
|
|
||||||
|
ass = <?php echo json_encode($assetcode)?>;
|
||||||
|
cos = <?php echo json_encode($costcentercode)?>;
|
||||||
|
con = <?php echo json_encode($cfUOM)?>;
|
||||||
|
|
||||||
|
|
||||||
|
$.each(ass,function(a,as){
|
||||||
|
$("#Assetcode").append( $('<option></option>').val(as.AssetCode).html(as.AssetCode+'-'+as.AssetName));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#Assetcode option[value="<?php echo $Assetcode?>"]').prop('selected', true);
|
||||||
|
|
||||||
|
$.each(cos,function(c,cc){
|
||||||
|
$("#Costcenter").append( $('<option></option>').val(cc.CostCenterCode).html(cc.CostCenterCode+'-'+cc.CostCenterName));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#Costcenter option[value="<?php echo $costcenter?>"]').prop('selected', true);
|
||||||
|
|
||||||
|
$.each(con,function(cn,con){
|
||||||
|
$("#conversionfactorUOM").append( $('<option></option>').val(con.ConfigValue).html(con.ConfigValue));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#conversionfactorUOM option[value="<?php echo $conversionfactorUOM?>"]').prop('selected', true);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onlyAlphabets(evt) {
|
function onlyAlphabets(evt) {
|
||||||
var charCode;
|
var charCode;
|
||||||
if (window.event)
|
if (window.event)
|
||||||
@ -362,13 +315,6 @@ function isNumberKey(evt)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// $(function() {
|
|
||||||
// $('#MaterialCategory').change(function() {
|
|
||||||
// var x = $(this).val();
|
|
||||||
// alert(x);
|
|
||||||
// $('#mchiddenfield').val(x);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
function onlyAlphabets(evt) {
|
function onlyAlphabets(evt) {
|
||||||
var charCode;
|
var charCode;
|
||||||
@ -387,22 +333,6 @@ function onlyAlphabets(evt) {
|
|||||||
return true;
|
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() {
|
$('#MaterialName').change(function() {
|
||||||
|
|
||||||
var materialname = $('#MaterialName').val();
|
var materialname = $('#MaterialName').val();
|
||||||
@ -421,7 +351,7 @@ $('#MaterialName').change(function() {
|
|||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
swal({
|
swal({
|
||||||
title: "'" + materialname + " already existed ! ",
|
title: "'" + materialname + " already existed ! ",
|
||||||
// type: "info",
|
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonClass: "btn-danger",
|
confirmButtonClass: "btn-danger",
|
||||||
confirmButtonText: "Material Details!",
|
confirmButtonText: "Material Details!",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user