340 lines
16 KiB
PHP
Executable File
340 lines
16 KiB
PHP
Executable File
<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>
|
||
<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>
|
||
|
||
</section>
|
||
|
||
<section class="content">
|
||
<div style="text-align:right;">
|
||
<a href="<?php echo base_url() ?>rawmaterialdetails/rawmaterialListing" class="btn btn-primary" value="Back"/>Back</a>
|
||
</div>
|
||
<br/>
|
||
<div class="row">
|
||
<!-- left column -->
|
||
<div class="col-md-12">
|
||
<!-- general form elements -->
|
||
<div class="box box-primary">
|
||
|
||
<!-- 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">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="MaterialType">Material Type</label><font color="Red">*</font>
|
||
<select class="form-control select2" required id="MaterialType" name="MaterialType">
|
||
<option value="" required>Select Material Type</option>
|
||
<?php
|
||
if(!empty($material))
|
||
{
|
||
foreach ($material as $SID)
|
||
{
|
||
?>
|
||
<option value="<?php echo $SID->ConfigValue ?>"><?php echo $SID->ConfigValue ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</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>
|
||
|
||
<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">
|
||
<option value="" required>Select UOM</option>
|
||
<?php
|
||
if(!empty($UOM))
|
||
{
|
||
foreach ($UOM as $SID)
|
||
{
|
||
?>
|
||
<option value="<?php echo $SID->ConfigValue; ?>"><?php echo $SID->ConfigValue ?>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-12">
|
||
|
||
<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="true">
|
||
<option value="0">Select Asset Code</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>
|
||
</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="true">
|
||
<option value="0">Select Cost Center</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>
|
||
</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" onkeypress="return onlyAlphabets(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="0">Select Conversion Factor UOM</option>
|
||
<?php
|
||
if(!empty($cfUOM))
|
||
{
|
||
foreach ($cfUOM as $cfuom)
|
||
{
|
||
?>
|
||
<option value="<?php echo $cfuom->ConfigValue; ?>"><?php echo $cfuom->ConfigValue ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-12">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="HSNcode">HSN code</label>
|
||
<input type="text" class="form-control" id="HSNcode" onkeypress="return isNumberKey(event)" name="HSNcode" maxlength="8">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<div class="form-group">
|
||
<label for="remarks">Remarks</label>
|
||
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="Active">IsActive</label> <br>
|
||
<input type="checkbox" id="isactive" name="isactive" >
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div><!-- /.box-body -->
|
||
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="reset" class="btn btn-primary" value="Reset" />
|
||
<input type="submit" onclick="Validate();" value="Submit" class="btn btn-primary">
|
||
|
||
</div>
|
||
</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>
|
||
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
|
||
<script>
|
||
function Validate()
|
||
{
|
||
if($("#MaterialName").val().length < 1)
|
||
{
|
||
alert('Please Enter MaterialName');
|
||
$("#MaterialName").focus();
|
||
return false;
|
||
}
|
||
|
||
if($("option:selected", $("#UOM")).val() == "")
|
||
{
|
||
alert('Please Select UOM ');
|
||
$("#UOM").focus();
|
||
return false;
|
||
}
|
||
if($("option:selected", $("#MaterialCategory")).val() == "")
|
||
{
|
||
alert('Please Select Material Category');
|
||
$("#MaterialCategory").focus();
|
||
return false;
|
||
}
|
||
if($("option:selected", $("#MaterialType")).val() == "")
|
||
{
|
||
alert('Please Select Material Type');
|
||
$("#MaterialType").focus();
|
||
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>
|