mater master issue fixes
This commit is contained in:
parent
d39cd272c5
commit
e8efd970e2
@ -14,6 +14,7 @@ class rawmaterialdetails_model extends CI_Model
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('T_MaterialMaster');
|
||||
$this->db->where('IsActive',1 );
|
||||
$query = $this->db->get();
|
||||
$result = $query->result();
|
||||
return $result;
|
||||
|
||||
@ -74,10 +74,7 @@ if(!empty($materialDetails))
|
||||
<div class="col-md-12">
|
||||
<!-- general form elements -->
|
||||
<div class="box box-primary">
|
||||
<!--<div class="box-header">
|
||||
<center> <h3 class="box-title"></h3></center>
|
||||
</div> -->
|
||||
<!-- /.box-header -->
|
||||
|
||||
<!-- form start -->
|
||||
|
||||
<form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial" role="form">
|
||||
@ -104,22 +101,6 @@ if(!empty($materialDetails))
|
||||
<div class="form-group">
|
||||
<label for="MaterialType">Material Type</label>
|
||||
<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>
|
||||
|
||||
@ -129,47 +110,29 @@ if(!empty($materialDetails))
|
||||
<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))
|
||||
{
|
||||
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 class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
|
||||
<!-- <select class="form-control select2 required " required id="UOM" name="UOM">
|
||||
<option value=" ">Select UOM</option>
|
||||
</select> -->
|
||||
<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))
|
||||
<option value="<?php echo $UOM;?>"><?php echo $UOM;?></option>
|
||||
<?php
|
||||
if(!empty($UOMList))
|
||||
{
|
||||
foreach ($UOMList as $UM)
|
||||
{
|
||||
foreach ($UOMList as $UM)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $UM->ConfigValue; ?>"><?php echo $UM->ConfigValue ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $UM->ConfigValue; ?>"><?php echo $UM->ConfigValue ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -182,69 +145,38 @@ if(!empty($materialDetails))
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="assetcode">Asset Code</label>
|
||||
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="disabled" placeholder="Select ">
|
||||
<option value="<?php echo $Assetcode;?>"><?php echo $Assetcode;?></option>
|
||||
<?php
|
||||
if(!empty($assetcode))
|
||||
{
|
||||
|
||||
foreach($assetcode as $AC)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $AC->AssetCode ?>"><?php echo $AC->AssetCode ?> - <?php echo $AC->AssetName ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="disabled" >
|
||||
<option value=" ">Select Asset Code</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="costcenter">Cost Center Code</label>
|
||||
<select class="form-control select2" id="Costcenter" name="Costcenter" disabled="disabled">
|
||||
<option><?php echo $costcenter;?></option>
|
||||
<?php
|
||||
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>
|
||||
<select class="form-control select2" id="Costcenter" name="Costcenter" disabled="disabled" >
|
||||
<option value=" ">Select Cost Center Code</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="conversionfactor">Conversion Factor</label>
|
||||
<input type="text" class="form-control" id="conversionfactor" name="conversionfactor" maxlength="255" value="<?php echo $conversionfactor;?>" onkeypress="return isNumberKey(event);">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="conversionfactorUOM">Conversion Factor UOM</label>
|
||||
<select class="form-control select2" id="conversionfactorUOM" name="conversionfactorUOM">
|
||||
<option value="<?php echo $conversionfactorUOM;?>"><?php echo $conversionfactorUOM;?></option>
|
||||
<?php
|
||||
if(!empty($cfUOM))
|
||||
{
|
||||
foreach ($cfUOM as $cfuom)
|
||||
{
|
||||
?>
|
||||
<option value="<?php echo $cfuom->ConfigValue; ?>"><?php echo $cfuom->ConfigValue ?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select class="form-control select2" id="conversionfactorUOM" name="conversionfactorUOM" >
|
||||
<option value=" ">Select Conversion Factor UOM</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
@ -277,35 +209,7 @@ if(!empty($materialDetails))
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?php
|
||||
$this->load->helper('form');
|
||||
$error = $this->session->flashdata('error');
|
||||
if($error)
|
||||
{
|
||||
?>
|
||||
<div class="alert alert-danger alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<?php echo $this->session->flashdata('error'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$success = $this->session->flashdata('success');
|
||||
if($success)
|
||||
{
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<?php echo $this->session->flashdata('success'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@ -314,55 +218,81 @@ if(!empty($materialDetails))
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
//$("#MaterialType").select2();
|
||||
//$("#MaterialCategory").select2();
|
||||
|
||||
$("#UOM").select2();
|
||||
$("#Assetcode").select2();
|
||||
$("#Costcenter").select2();
|
||||
$("#conversionfactorUOM").select2();
|
||||
|
||||
/** ---- auto search code -------- */
|
||||
$('#MaterialCategory').autocomplete({
|
||||
|
||||
onSearchStart: function (query) {
|
||||
//alert(query);
|
||||
$('#MaterialCategory').autocomplete("option", "minLength", 0);
|
||||
},
|
||||
onSearchStart: function (query) {
|
||||
|
||||
$('#MaterialCategory').autocomplete("option", "minLength", 0);
|
||||
},
|
||||
|
||||
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||
onSelect: function (suggestion) {
|
||||
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
|
||||
onSelect: function (suggestion) {
|
||||
|
||||
var data = suggestion.ConfigValue;
|
||||
var selectedvalue = $('input[name=MaterialCategory]').val();
|
||||
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 data = suggestion.ConfigValue;
|
||||
var selectedvalue = $('input[name=MaterialCategory]').val();
|
||||
if(selectedvalue=='Spares')
|
||||
{
|
||||
|
||||
$('#Assetcode').prop('disabled', false);
|
||||
$('#Costcenter').prop('disabled', false);
|
||||
}
|
||||
else{
|
||||
|
||||
$('#Assetcode').prop('disabled', 'disabled');
|
||||
$('#Costcenter').prop('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
/** ---- Value are append to dropdown -------- */
|
||||
//var uom = [];
|
||||
var ass = [];
|
||||
var cos = [];
|
||||
var con = [];
|
||||
|
||||
//uom = <?php echo json_encode($UOMList) ?>;
|
||||
ass = <?php echo json_encode($assetcode)?>;
|
||||
cos = <?php echo json_encode($costcentercode)?>;
|
||||
con = <?php echo json_encode($cfUOM)?>;
|
||||
|
||||
// $.each(uom,function(u,um){
|
||||
// $("#UOM").append( $('<option></option>').val(um.ConfigValue).html(um.ConfigValue));
|
||||
// });
|
||||
|
||||
// $('#UOM option[value="<?php echo $UOM?>"]').prop('selected', true);
|
||||
|
||||
$.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);
|
||||
|
||||
/** ---- if spares part matereial means -------- */
|
||||
var x = $("#MaterialCategory").val() == 'Spares';
|
||||
if(x)
|
||||
{
|
||||
$('#Assetcode').prop('disabled', false);
|
||||
$('#Costcenter').prop('disabled', false);
|
||||
}
|
||||
|
||||
});
|
||||
function onlyAlphabets(evt) {
|
||||
@ -390,13 +320,6 @@ function isNumberKey(evt)
|
||||
|
||||
return true;
|
||||
}
|
||||
// $(function() {
|
||||
// $('#MaterialCategory').change(function() {
|
||||
// var x = $(this).val();
|
||||
// alert(x);
|
||||
// $('#mchiddenfield').val(x);
|
||||
// });
|
||||
// });
|
||||
|
||||
function onlyAlphabets(evt) {
|
||||
var charCode;
|
||||
@ -415,22 +338,6 @@ function onlyAlphabets(evt) {
|
||||
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();
|
||||
|
||||
@ -367,7 +367,7 @@ th{
|
||||
//alert(first);
|
||||
var second =parseInt(document.getElementById('today_salary'+id).textContent);
|
||||
//alert(second);
|
||||
var cal =first/second;
|
||||
var cal =second/first;
|
||||
|
||||
var cals =(cal).toFixed(0);
|
||||
|
||||
@ -490,7 +490,7 @@ th{
|
||||
function cal(){
|
||||
var a= $("#pton").val();
|
||||
var b= $("#today_salary").val();
|
||||
var calc=Math.round(a/b);
|
||||
var calc=Math.round(b/a);
|
||||
//alert(calc);
|
||||
$("#calc").val(calc) ;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user