materialmaster changes code

This commit is contained in:
venbatechnologies@gmail.com 2017-07-18 13:24:48 +05:30
parent 1047ec0970
commit a665dc58e9
5 changed files with 716 additions and 296 deletions

View File

@ -14,27 +14,27 @@ class rawmaterialdetails extends BaseController
/**
* This is default constructor of the class
*/
public function __construct()
public function __construct()
{
parent::__construct();
$this->load->model('rawmaterialdetails_model');
$this->load->library('pagination');
$this->load->library('form_validation');
$this->load->library('Excel');
$this->load->library('pagination');
$this->load->library('form_validation');
$this->load->library('Excel');
$this->isLoggedIn();
$this->isLoggedIn();
}
/**
/**
* This function used to load the first screen of the user
*/
public function index()
public function index()
{
$this->global['pageTitle'] = 'Siddharth : RawMaterialDetails';
$this->loadViews("rawmaterialListing", $this->global, NULL , NULL);
}
/**
/**
* This function is used to load the RawMaterialDetails list
*/
function rawmaterialListing()
@ -42,8 +42,6 @@ class rawmaterialdetails extends BaseController
$this->load->model('rawmaterialdetails_model');
$data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing();
$this->global['pageTitle'] = 'Siddharth : RawMaterial Listing';
@ -51,62 +49,78 @@ class rawmaterialdetails extends BaseController
$this->loadViews("rawmaterialListing", $this->global, $data, NULL);
}
/**
/**
* This function is used to load the add new cost */
function addRawMaterial()
{
$this->load->model('rawmaterialdetails_model');
$data['material'] = $this->rawmaterialdetails_model->getmaterialType();
$data['UOM'] = $this->rawmaterialdetails_model->getUOM();
$data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory();
$data['UOM'] = $this->rawmaterialdetails_model->getUOM();
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['costcentercode'] =$this->rawmaterialdetails_model->getcostcentercode();
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
$this->global['pageTitle'] = 'siddharth : AddNew RawMaterial';
$this->loadViews("addRawMaterial", $this->global, $data, NULL);
}
/*
Validation for Material Type Dropdown
*/
function MaterialType_validate($selectValue)
{
//echo 'select_validate method called';
/* Validation for Material Type Dropdown */
function MaterialType_validate($selectValue)
{
//echo 'select_validate method called';
//'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1')
{
$this->form_validation->set_message('MaterialType_validate', 'Please Select Material Type.');
return false;
}
else // user picked something
{
return true;
}
}
/* Validation for Material Type Dropdown */
function UOM_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1')
{
$this->form_validation->set_message('MaterialType_validate', 'Please Select Material Type.');
return false;
if($selectValue == '-1')
{
$this->form_validation->set_message('UOM_validate', 'Please Select UOM.');
return false;
}
else // user picked something
{
return true;
}
}
else // user picked something
{
return true;
}
}
/*
Validation for Material Type Dropdown
*/
function UOM_validate($selectValue)
{
//echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1')
{
$this->form_validation->set_message('UOM_validate', 'Please Select UOM.');
return false;
}
else // user picked something
{
return true;
}
}
/* This function is used to add new Cost to the system
*/
/* Validation for Material Category Dropdown */
function materialcategory_validate($selectValue)
{
if($selectValue == '0')
{
$this->form_validation->set_message('materialcategory_validate', 'Please Select Material Category.');
return false;
}
else
{
return true;
}
}
function addNewRawMaterial()
{
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|');
$this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate');
$this->form_validation->set_rules('UOM','UOM','trim|callback_UOM_validate');
$this->form_validation->set_rules('MaterialType','MaterialType','trim|callback_MaterialType_validate');
$this->form_validation->set_rules('UOM','UOM','trim|callback_UOM_validate');
$this->form_validation->set_rules('MaterialCategory','MaterialCategory','trim|callback__validate');
if($this->form_validation->run() == FALSE)
{
@ -117,117 +131,137 @@ class rawmaterialdetails extends BaseController
$MaterialName = $this->input->post('MaterialName');
$MaterialType = $this->input->post('MaterialType');
$UOM = $this->input->post('UOM');
$MaterialCategory = $this->input->post('MaterialCategory');
$Remarks = $this->input->post('remarks');
$AssetCode = $this->input->post('Assetcode');
$CostCenterCode = $this->input->post('Costcenter');
$ConversionFactor = $this->input->post('conversionfactor');
$ConversionFactorUOM = $this->input->post('conversionfactorUOM');
$CreatedBy = $this->session->userdata('userId');
$chked = $this->input->post('isactive');
if( $chked != '')
{
$IsActive = '1';
}
else
{
$IsActive = '0';
}
$RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive);
$chked = $this->input->post('isactive');
if( $chked != '')
{
$IsActive = '1';
}
else
{
$IsActive = '0';
}
$RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'Category'=>$MaterialCategory, 'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks);
$result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial);
if($result > 0)
{
redirect('rawmaterialListing','refresh');
echo "<script>alert('RawMaterial Created successfully!');</script>";
echo "<script>alert('RawMaterial Created successfully!');</script>";
}
else
{
redirect('rawmaterialListing','refresh');
echo "<script>alert('RawMaterial Not Created!');</script>";
echo "<script>alert('RawMaterial Not Created!');</script>";
}
}
}
function viewRawmaterial($RID= '')
function viewRawmaterial($RID= '')
{
$MaterialType = '';
$UOM = '';
if($RID == '')
{
$RawMaterialID = $_GET['RID'];
$MaterialType = $_GET['MType'];
$UOM = $_GET['UOM'];
}
else
{
$RawMaterialID = $RID;
}
$MaterialType = '';
$UOM = '';
$MaterialCategory = '';
if($RID == '')
{
$RawMaterialID = $_GET['RID'];
$MaterialType = $_GET['MType'];
$UOM = $_GET['UOM'];
}
else
{
$RawMaterialID = $RID;
}
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM);
$data['costcentercode'] =$this->rawmaterialdetails_model->getCostCenterCode();
$data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM();
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$this->global['pageTitle'] = 'Siddharth : Edit Material Master';
$this->loadViews("editOldRawmaterial", $this->global,$data, NULL);
}
/**
/**
* This function is used to edit the user information
*/
function editRawmaterial()
{
if($this->isAdmin() == TRUE)
if($this->isAdmin() == TRUE)
{
$this->loadThis();
$this->loadThis();
}
else
{
$RawmaterialID = $this->input->post('MaterialCode');
$RawmaterialID = $this->input->post('MaterialCode');
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|');
$this->form_validation->set_rules('MaterialType','MaterialType','trim');
$this->form_validation->set_rules('UOM','UOM','trim');
if($this->form_validation->run() == FALSE)
{
$this->viewRawmaterial($RawmaterialID);
}
else
{
$MaterialCode = $this->input->post('MaterialCode');
$MaterialCode = $this->input->post('MaterialCode');
$MaterialName = $this->input->post('MaterialName');
$MaterialType = $this->input->post('MaterialType');
$MaterialCategory =$this->input->post('MaterialCategory');
$UOM = $this->input->post('UOM');
$rmcode = $this->input->post('RMcode');
$Remarks = $this->input->post('remarks');
$AssetCode = $this->input->post('Assetcode');
$CostCenterCode = $this->input->post('Costcenter');
$ConversionFactor = $this->input->post('conversionfactor');
$ConversionFactorUOM = $this->input->post('conversionfactorUOM');
$UpdatedBy = $this->session->userdata ('userId');
$chked = $this->input->post('isactive');
if( $chked != '')
{
$IsActive = '1';
}
else
{
$IsActive = '0';
}
$chked = $this->input->post('isactive');
if( $chked != '')
{
$IsActive = '1';
}
else
{
$IsActive = '0';
}
$RawMaterial = array();
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive);
$RawMaterial = array('MaterialName'=>$MaterialName,'MaterialType'=>$MaterialType,'UpdatedBy'=>$UpdatedBy, 'UOM'=>$UOM,'IsActive' => $IsActive,'Category'=>$MaterialCategory,'ConversionFactorUnit'=>$ConversionFactor,'ConversionFactorUOM'=>$ConversionFactorUOM,'Remarks'=>$Remarks,'assetcode'=>$AssetCode,'CostCenterCode'=>$CostCenterCode);//,'RMCode'=>$rmcode);
//print_r($RawMaterial);die();
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
if($result == true)
{
redirect('rawmaterialListing','refresh');
redirect('rawmaterialListing','refresh');
echo "<script>alert('RawMaterial Updated successfully!');</script>";
echo "<script>alert('RawMaterial Updated successfully!');</script>";
}
else
{
redirect('rawmaterialListing','refresh');
echo "<script>alert('RawMaterial Record Not updated!');</script>";
redirect('rawmaterialListing','refresh');
echo "<script>alert('RawMaterial Record Not updated!');</script>";
}
@ -235,24 +269,32 @@ class rawmaterialdetails extends BaseController
}
}
}
/** this function can be use for excel report **/
function export_material(){
$this->load->library('excel');
/** this function can be use for excel report **/
function export_material(){
$this->load->library('excel');
$this->excel->setActiveSheetIndex(0)->mergeCells('D3:J3');
$this->excel->getActiveSheet()->setTitle('Material Master');
$this->excel->getActiveSheet()->setTitle('Material Master');
$this->excel->getActiveSheet()->setCellValue('D3', 'SIDDHARTH INDUSTRIES Raw Material');
$this->excel->getActiveSheet()->setCellValue('C5', 'MaterialCode');
$this->excel->getActiveSheet()->setCellValue('D5', 'MaterialName');
$this->excel->getActiveSheet()->setCellValue('E5', 'MaterialType');
$this->excel->getActiveSheet()->setCellValue('F5', 'UOM');
$this->excel->getActiveSheet()->setCellValue('G5', 'Created by');
$this->excel->getActiveSheet()->setCellValue('H5', 'Updated By');
$this->excel->getActiveSheet()->setCellValue('I5', 'IsActive');
$this->excel->getActiveSheet()->setCellValue('G5', 'RMCode');
$this->excel->getActiveSheet()->setCellValue('H5', 'Category');
$this->excel->getActiveSheet()->setCellValue('I5', 'assetcode');
$this->excel->getActiveSheet()->setCellValue('J5', 'CostCenterCode');
$this->excel->getActiveSheet()->setCellValue('K5', 'ConversionFactorUnit');
$this->excel->getActiveSheet()->setCellValue('L5', 'ConversionFactorUOM');
$this->excel->getActiveSheet()->setCellValue('M5', 'Remarks');
$this->excel->getActiveSheet()->setCellValue('N5', 'Created by');
$this->excel->getActiveSheet()->setCellValue('O5', 'Updated By');
$this->excel->getActiveSheet()->setCellValue('P5', 'IsActive');
@ -263,39 +305,54 @@ class rawmaterialdetails extends BaseController
$this->excel->getActiveSheet()->getStyle('C5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('D5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('D5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('E5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('E5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('E5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('F5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('G5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('I5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('J5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('K5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('L5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('M5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('N5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('N5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('O5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('O5')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('P5')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('P5')->getFont()->setBold(true);
$exportData = $this->rawmaterialdetails_model->export_excel();
// print_r($exportData);die();
if ($exportData) {
$i = 6;
$s = 1;
foreach ($exportData as $data) {
$this->excel->getActiveSheet()->setCellValue('C' . $i,$data['MaterialCode']);
$this->excel->getActiveSheet()->setCellValue('D' . $i,$data['MaterialName']);
$this->excel->getActiveSheet()->setCellValue('E' . $i,$data['MaterialType']);
$this->excel->getActiveSheet()->setCellValue('F' . $i,$data['UOM']);
$this->excel->getActiveSheet()->setCellValue('G' . $i,$data['firstname']);
$this->excel->getActiveSheet()->setCellValue('H' . $i,$data['Updated_By']);
$this->excel->getActiveSheet()->setCellValue('I' . $i,$data['IsActive']);
$this->excel->getActiveSheet()->setCellValue('C' . $i,$data['MaterialCode']);
$this->excel->getActiveSheet()->setCellValue('D' . $i,$data['MaterialName']);
$this->excel->getActiveSheet()->setCellValue('E' . $i,$data['MaterialType']);
$this->excel->getActiveSheet()->setCellValue('F' . $i,$data['UOM']);
$this->excel->getActiveSheet()->setCellValue('G' . $i,$data['RMCode']);
$this->excel->getActiveSheet()->setCellValue('H' . $i,$data['Category']);
$this->excel->getActiveSheet()->setCellValue('I' . $i,$data['assetcode']);
$this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CostCenterCode']);
$this->excel->getActiveSheet()->setCellValue('K' . $i,$data['ConversionFactorUnit']);
$this->excel->getActiveSheet()->setCellValue('L' . $i,$data['ConversionFactorUOM']);
$this->excel->getActiveSheet()->setCellValue('M' . $i,$data['Remarks']);
$this->excel->getActiveSheet()->setCellValue('N' . $i,$data['firstname']);
$this->excel->getActiveSheet()->setCellValue('O' . $i,$data['Updated_By']);
$this->excel->getActiveSheet()->setCellValue('P' . $i,$data['IsActive']);
$i++;
$s++;
@ -313,7 +370,7 @@ class rawmaterialdetails extends BaseController
}
function pageNotFound()
{
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';

View File

@ -3,7 +3,7 @@
class rawmaterialdetails_model extends CI_Model
{
/**
/**
* This function is used to get the user listing count
* @param string $searchText : This is optional search text
* @param number $page : This is pagination offset
@ -14,57 +14,86 @@ class rawmaterialdetails_model extends CI_Model
{
$this->db->select('*');
$this->db->from('T_MaterialMaster');
$query = $this->db->get();
$result = $query->result();
return $result;
}
function getUOM($UOM = '')
function getUOM($UOM = '')
{
$ConfigID = 'C001';
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$ConfigID = 'C001';
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id ',$ConfigID );
if($UOM != '')
{
$this->db->where('ConfigValue !=',$UOM );
}
if($UOM != '')
{
$this->db->where('ConfigValue !=',$UOM );
}
$query = $this->db->get();
return $query->result();
}
function getmaterialType($MaterialType = '')
function getmaterialType($MaterialType = '')
{
$Config_ID = 'C003';
$this->db->select('Config_ID,ConfigValue');
$Config_ID = 'C003';
$this->db->select('Config_ID,ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id',$Config_ID );
if($MaterialType != '')
{
$this->db->where('ConfigValue !=',$MaterialType );
}
$this->db->where('Config_id',$Config_ID );
if($MaterialType != '')
{
$this->db->where('ConfigValue !=',$MaterialType );
}
$query = $this->db->get();
return $query->result();
}
/**
//This function used to get the material category using configdetails table
function getmaterialCategory($MaterialCategory = '')
{
$Config_ID = 'C023';
$this->db->select('Config_ID,ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id',$Config_ID );
if($MaterialCategory != '')
{
$this->db->where('ConfigValue !=',$MaterialCategory );
}
$query = $this->db->get();
return $query->result();
}
//This function used to get the conversionfactor using configdetails table
function getConversionfactorUOM($ConversionFactorUOM ='')
{
$Config_ID = 'C024';
$this->db->select('Config_ID,ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id',$Config_ID );
if($ConversionFactorUOM != '')
{
$this->db->where('ConfigValue !=',$ConversionFactorUOM );
}
$query = $this->db->get();
return $query->result();
}
//AssetCode
/**
* This function used to get user information by id
* @param number $userId : This is user id
* @return array $result : This is user information
*/
function addNewRawMaterial($RawMaterial='')
function addNewRawMaterial($RawMaterial='')
{
$this->db->insert('T_MaterialMaster', $RawMaterial);
return TRUE;
}
@ -73,58 +102,77 @@ function addNewRawMaterial($RawMaterial='')
* @param number $userId : This is user id
* @return array $result : This is user information
*/
function getMaterialDetails($MaterialCode)
function getMaterialDetails($MaterialCode)
{
$this->db->select('*');
$this->db->from('T_MaterialMaster');
$this->db->where('MaterialCode', $MaterialCode);
$query = $this->db->get();
//sprint_r($this->db->last_query());
return $query->result();
}
function editRawmaterial($RawMaterial, $MaterialCode)
function getAssetcode()
{
$this->db->select('AssetCode,AssetName');
$this->db->from('T_Asset_Details');
//$this->db->where('Assetcode',$Assetcode );
//$this->db->where('AssetCode',$Assetcode );
$query = $this->db->get();
return $query->result();
}
function getCostCenterCode()//$CostCenterCode='')
{
$this->db->select('CostCenterCode,CostCenterName');
$this->db->from('T_CostCenter_Master');
//$this->db->where('CostCenterCode', $CostCenterCode);
$query = $this->db->get();
return $query->result();
}
function editRawmaterial($RawMaterial, $MaterialCode)
{
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_MaterialMaster', $RawMaterial);
return TRUE;
}
function viewrawmaterial($RawMaterial, $MaterialCode)
function viewrawmaterial($RawMaterial, $MaterialCode)
{
echo $MaterialCode; //."and".$RawMaterial ;
echo $MaterialCode; //."and".$RawMaterial ;
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_MaterialMaster', $RawMaterial);
return TRUE;
}
function export_excel(){
$this->db->select('det.MaterialCode,det.MaterialName,det.MaterialType,det.UOM,emp.firstname,emp1.firstname as Updated_By,det.IsActive');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
function export_excel(){
$this->db->select('det.*,emp.firstname,emp1.firstname as Updated_By,det.IsActive');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_MaterialMaster as det')->result_array();
}
/**
}
/**
* This function is used to delete the user information
* @param number $userId : This is user id
* @return boolean $result : TRUE / FALSE
* @return boolean $result : TRUE / FALSE*/
function deletePO($PO, $POinfo)
{
$this->db->where('PO', $PO);
$this->db->update('T_PurchaseOrderDetails', $POInfo);
return $this->db->affected_rows();
}*/
// function deletePO($PO, $POinfo)
// {
// $this->db->where('PO', $PO);
// $this->db->update('T_PurchaseOrderDetails', $POInfo);
// return $this->db->affected_rows();
// }
}
?>

View File

@ -1,25 +1,28 @@
<script>
function BlockSpecial(evt) {
var charCode;
if (window.event)
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)
if (charCode >= 91 && charCode <= 96)
return false;
if (charCode >= 58&& charCode <= 64)
if (charCode >= 123 && charCode <= 126)
return false;
if (charCode >= 33 && charCode <= 47)
return false;
if (charCode >= 58&& charCode <= 64)
return false;
else
{
{
return true;
}
}
}
</script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
@ -28,39 +31,36 @@ function BlockSpecial(evt) {
<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-info" value="Back"/>Back</a>
</div>
<br/>
</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="row">
<div class="box-body">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="MaterialName">Material Name</span>
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
<span for="MaterialName">Material Name</span><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="col-md-3">
<div class="form-group">
<span for="MaterialType">Material Type</span>
<select class="form-control required" id="MaterialType" name="MaterialType">
<span for="MaterialType">Material Type</span><font color="Red">*</font>
<select class="form-control required select2" id="MaterialType" name="MaterialType">
<option value="-1" required>Select Material Type</option>
<?php
if(!empty($material))
@ -76,10 +76,30 @@ function BlockSpecial(evt) {
</select>
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<span for="UOM">Unit of Measurement</span>
<select class="form-control required" id="UOM" name="UOM">
<span for="MaterialCategory">Material Category</span><font color="Red">*</font>
<select class="form-control required select2" id="MaterialCategory" name="MaterialCategory" onchange="changeTextBox()">
<option value="0" 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">
<span for="UOM">Unit of Measurement</span><font color="Red">*</font>
<select class="form-control required select2" id="UOM" name="UOM">
<option value="-1" required>Select UOM</option>
<?php
if(!empty($UOM))
@ -94,18 +114,91 @@ function BlockSpecial(evt) {
?>
</select>
</div>
</div>
<div class="col-md-3">
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Assetcode">Asset Code</span>
<select class="form-control required select2" id="Assetcode" name="Assetcode">
<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">
<span for="Costcenter">Cost Center Code</span>
<select class="form-control select2" id="Costcenter" name="Costcenter">
<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">
<span for="conversionfactor">Conversion Factor</span>
<input type="text" class="form-control" id="conversionfactor" name="conversionfactor" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="conversionfactorUOM">Conversion Factor UOM</span>
<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-9">
<div class="form-group">
<span for="remarks">Remarks</span>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Active">IsActive</span> <br>
<input type="checkbox" id="isactive" name="isactive" >
</div>
</div>
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
@ -148,4 +241,29 @@ function BlockSpecial(evt) {
</section>
</div>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
<script>
$(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>

View File

@ -3,7 +3,14 @@
$MaterialCode = '';
$MaterialName = '';
$MaterialType = '';
$MaterialCategory = '';
$UOM = '';
$Assetcode ='';
$costcenter='';
$remarks='';
$conversionfactorUOM='';
$conversionactor ='';
$RMCode = '';
$IsActive = '';
if(!empty($materialDetails))
@ -13,23 +20,82 @@ if(!empty($materialDetails))
$MaterialCode = $MD->MaterialCode;
$MaterialName = $MD->MaterialName;
$MaterialType = $MD->MaterialType;
$UOM = $MD->UOM;
$chk = $MD->IsActive;
if($chk == 1)
{
$IsActive = 'checked';
}
else
{
$IsActive = '';
}
$MaterialCategory = $MD->Category;
$UOM = $MD->UOM;
$Assetcode = $MD->assetcode;
$costcenter = $MD->CostCenterCode;
$remarks = $MD->Remarks;
$conversionfactor = $MD->ConversionFactorUnit;
$conversionfactorUOM = $MD->ConversionFactorUOM;
$RMCode = $MD->RMCode;
$chk = $MD->IsActive;
if($chk == 1)
{
$IsActive = 'checked';
}
else
{
$IsActive = '';
}
}
}
?>
<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() {
// $('#MaterialCategory').change(function() {
// var x = $(this).val();
// alert(x);
// $('#mchiddenfield').val(x);
// });
// });
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;}
}
</script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
@ -42,8 +108,8 @@ if(!empty($materialDetails))
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>rawmaterialdetails/rawmaterialListing" class="btn btn-info" value="Back"/>Back</a>
</div>
<br/>
</div>
<br/>
<div class="row">
<!-- left column -->
<div class="col-md-12">
@ -60,37 +126,74 @@ if(!empty($materialDetails))
<form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial" role="form">
<div class="box-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="MaterialName">Material Name</label>
<input type="text" class="form-control required " id="MaterialName" name="MaterialName" maxlength="255" value="<?php echo $MaterialName;?>">
<input type="hidden" class="form-control required " id="MaterialCode" value="<?php echo $MaterialCode;?>"name="MaterialCode" maxlength="255">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="MaterialType">Material Type</label>
<select class="form-control required" id="MaterialType" name="MaterialType">
<option value="<?php echo $MaterialType;?> "><?php echo $MaterialType;?></option>
<?php
if(!empty($materialType))
{
foreach ($materialType as $MID)
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="RMcode">RM code</span>
<input type="text" class="form-control" readonly id="RMcode" name="RMcode" maxlength="255" value="<?php echo $RMCode;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="MaterialName">Material Name</span><font color="Red">*</font>
<input type="text" class="form-control required " id="MaterialName" name="MaterialName" maxlength="255" value="<?php echo $MaterialName;?>">
<input type="hidden" class="form-control required " id="MaterialCode" value="<?php echo $MaterialCode;?>"name="MaterialCode" maxlength="255">
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<span for="MaterialType">Material Type</span>
<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))
{
?>
<option value="<?php echo $MID->ConfigValue ?>"><?php echo $MID->ConfigValue ?></option>
<?php
foreach ($materialType as $MID)
{
?>
<option value="<?php echo $MID->ConfigValue ?>"><?php echo $MID->ConfigValue ?></option>
<?php
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-6">
?>
</select>
-->
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<span for="MaterialCategory">Material Category</span>
<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 class="col-md-3">
<div class="form-group">
<label for="UOM">Unit of Measurement</label>
<select class="form-control required" id="UOM" name="UOM">
<option value="<?php echo $UOM;?>" ><?php echo $UOM;?></option>
<span for="UOM">Unit of Measurement</span><font color="Red">*</font>
<select class="form-control required select2" id="UOM" name="UOM">
<option value="<?php echo $UOM;?>"><?php echo $UOM;?></option>
<?php
if(!empty($UOMList))
{
@ -104,14 +207,95 @@ if(!empty($materialDetails))
?>
</select>
</div>
</div>
<div class="col-md-3">
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Active">IsActive</span> <br>
<span for="assetcode">Asset Code</span>
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="disabled">
<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>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="costcenter">Cost Center Code</span>
<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>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="conversionfactor">Conversion Factor</span>
<input type="text" class="form-control" id="conversionfactor" name="conversionfactor" maxlength="255" value="<?php echo $conversionfactor;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="conversionfactorUOM">Conversion Factor UOM</span>
<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>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-9">
<div class="form-group">
<span for="remarks">Remarks</span>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255" value="<?php echo $remarks;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Active">IsActive</span> <br/>
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive; ?> >
</div>
</div>
</div>
</div>
</div><!-- /.box-body -->
@ -156,4 +340,4 @@ if(!empty($materialDetails))
</section>
</div>
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>

View File

@ -16,23 +16,29 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-primary" href="<?php echo base_url(); ?>addRawmaterial">Add New Material</a>
<a class="btn btn-primary" href="<?php echo base_url(); ?>rawmaterialdetails/export_material">Export Material Master <i class="fa fa-download"aira-hidden="true"></i></a>
<a class="btn btn-primary" href="<?php echo base_url(); ?>rawmaterialdetails/export_material">Export Material Master <i class="fa fa-download"aira-hidden="true"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead>
<thead>
<tr>
<th>Material Code</th>
<th>Raw Material Code</th>
<th>Material Description</th>
<th>Type of Material</th>
<th>Unit Of Measurement</th>
<th>Unit Of Measurement</th>
<th>Material Category</th>
<th>Conversion Factor</th>
<th>Conversion Factor UOM</th>
<th>Asset Code</th>
<th>Cost Center</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<?php
if(!empty($userRecords))
{
@ -40,27 +46,34 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
{
?>
<tr>
<td><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial/?RID='.$record->MaterialCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM ; ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<td><u><a href="<?php echo base_url().'rawmaterialdetails/viewRawmaterial?RID='.$record->MaterialCode.'&MType='.$record->MaterialType.'&UOM='.$record->UOM ?>" data-toggle="tooltip" title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><?php echo $record->MaterialCode ?> </a></u></td>
<td><?php echo $record->RMCode ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->MaterialType ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->UOM ?></td>
<td><?php echo $record->Category ?></td>
<td><?php echo $record->ConversionFactorUnit ?></td>
<td><?php echo $record->ConversionFactorUOM ?></td>
<td><?php echo $record->assetcode ?></td>
<td><?php echo $record->CostCenterCode ?></td>
</tr>
<?php
}
}
?>
</tbody>
</tbody>
</table>
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$(function () {
$('#datatable').DataTable({
"paging": true,
@ -69,8 +82,8 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>