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

@ -42,8 +42,6 @@ class rawmaterialdetails extends BaseController
$this->load->model('rawmaterialdetails_model'); $this->load->model('rawmaterialdetails_model');
$data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing(); $data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing();
$this->global['pageTitle'] = 'Siddharth : RawMaterial Listing'; $this->global['pageTitle'] = 'Siddharth : RawMaterial Listing';
@ -58,20 +56,21 @@ class rawmaterialdetails extends BaseController
$this->load->model('rawmaterialdetails_model'); $this->load->model('rawmaterialdetails_model');
$data['material'] = $this->rawmaterialdetails_model->getmaterialType(); $data['material'] = $this->rawmaterialdetails_model->getmaterialType();
$data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory();
$data['UOM'] = $this->rawmaterialdetails_model->getUOM(); $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->global['pageTitle'] = 'siddharth : AddNew RawMaterial';
$this->loadViews("addRawMaterial", $this->global, $data, NULL); $this->loadViews("addRawMaterial", $this->global, $data, NULL);
} }
/*
Validation for Material Type Dropdown /* Validation for Material Type Dropdown */
*/
function MaterialType_validate($selectValue) function MaterialType_validate($selectValue)
{ {
//echo 'select_validate method called'; //echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-" //'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1') if($selectValue == '-1')
{ {
$this->form_validation->set_message('MaterialType_validate', 'Please Select Material Type.'); $this->form_validation->set_message('MaterialType_validate', 'Please Select Material Type.');
@ -81,12 +80,11 @@ class rawmaterialdetails extends BaseController
{ {
return true; return true;
} }
} }
/*
Validation for Material Type Dropdown /* Validation for Material Type Dropdown */
*/
function UOM_validate($selectValue) function UOM_validate($selectValue)
{ {
//echo 'select_validate method called'; //echo 'select_validate method called';
// 'none' is the first option and the text says something like "-Choose one-" // 'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1') if($selectValue == '-1')
@ -98,15 +96,31 @@ class rawmaterialdetails extends BaseController
{ {
return true; 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() function addNewRawMaterial()
{ {
$this->form_validation->set_rules('MaterialName','Material Name','trim|required|'); $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('MaterialType','MaterialType','trim|callback_MaterialType_validate');
$this->form_validation->set_rules('UOM','UOM','trim|callback_UOM_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) if($this->form_validation->run() == FALSE)
{ {
@ -117,6 +131,12 @@ class rawmaterialdetails extends BaseController
$MaterialName = $this->input->post('MaterialName'); $MaterialName = $this->input->post('MaterialName');
$MaterialType = $this->input->post('MaterialType'); $MaterialType = $this->input->post('MaterialType');
$UOM = $this->input->post('UOM'); $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'); $CreatedBy = $this->session->userdata('userId');
$chked = $this->input->post('isactive'); $chked = $this->input->post('isactive');
@ -130,8 +150,7 @@ class rawmaterialdetails extends BaseController
$IsActive = '0'; $IsActive = '0';
} }
$RawMaterial = array('MaterialName'=>$MaterialName, 'MaterialType'=>$MaterialType, 'UOM'=>$UOM,'CreatedBy'=>$CreatedBy,'IsActive' => $IsActive); $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); $result = $this->rawmaterialdetails_model->addNewRawMaterial($RawMaterial);
if($result > 0) if($result > 0)
@ -150,10 +169,14 @@ class rawmaterialdetails extends BaseController
} }
} }
function viewRawmaterial($RID= '') function viewRawmaterial($RID= '')
{ {
$MaterialType = ''; $MaterialType = '';
$UOM = ''; $UOM = '';
$MaterialCategory = '';
if($RID == '') if($RID == '')
{ {
$RawMaterialID = $_GET['RID']; $RawMaterialID = $_GET['RID'];
@ -166,9 +189,12 @@ class rawmaterialdetails extends BaseController
} }
$data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID); $data['materialDetails'] = $this->rawmaterialdetails_model->getMaterialDetails($RawMaterialID);
$data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType ); $data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType );
$data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory);
$data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM); $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->global['pageTitle'] = 'Siddharth : Edit Material Master';
$this->loadViews("editOldRawmaterial", $this->global,$data, NULL); $this->loadViews("editOldRawmaterial", $this->global,$data, NULL);
} }
@ -190,6 +216,7 @@ class rawmaterialdetails extends BaseController
$this->form_validation->set_rules('MaterialType','MaterialType','trim'); $this->form_validation->set_rules('MaterialType','MaterialType','trim');
$this->form_validation->set_rules('UOM','UOM','trim'); $this->form_validation->set_rules('UOM','UOM','trim');
if($this->form_validation->run() == FALSE) if($this->form_validation->run() == FALSE)
{ {
$this->viewRawmaterial($RawmaterialID); $this->viewRawmaterial($RawmaterialID);
@ -200,7 +227,14 @@ class rawmaterialdetails extends BaseController
$MaterialCode = $this->input->post('MaterialCode'); $MaterialCode = $this->input->post('MaterialCode');
$MaterialName = $this->input->post('MaterialName'); $MaterialName = $this->input->post('MaterialName');
$MaterialType = $this->input->post('MaterialType'); $MaterialType = $this->input->post('MaterialType');
$MaterialCategory =$this->input->post('MaterialCategory');
$UOM = $this->input->post('UOM'); $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'); $UpdatedBy = $this->session->userdata ('userId');
$chked = $this->input->post('isactive'); $chked = $this->input->post('isactive');
@ -214,8 +248,8 @@ class rawmaterialdetails extends BaseController
} }
$RawMaterial = array(); $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); $result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
if($result == true) if($result == true)
@ -235,6 +269,7 @@ class rawmaterialdetails extends BaseController
} }
} }
} }
/** this function can be use for excel report **/ /** this function can be use for excel report **/
function export_material(){ function export_material(){
@ -250,9 +285,16 @@ class rawmaterialdetails extends BaseController
$this->excel->getActiveSheet()->setCellValue('D5', 'MaterialName'); $this->excel->getActiveSheet()->setCellValue('D5', 'MaterialName');
$this->excel->getActiveSheet()->setCellValue('E5', 'MaterialType'); $this->excel->getActiveSheet()->setCellValue('E5', 'MaterialType');
$this->excel->getActiveSheet()->setCellValue('F5', 'UOM'); $this->excel->getActiveSheet()->setCellValue('F5', 'UOM');
$this->excel->getActiveSheet()->setCellValue('G5', 'Created by'); $this->excel->getActiveSheet()->setCellValue('G5', 'RMCode');
$this->excel->getActiveSheet()->setCellValue('H5', 'Updated By'); $this->excel->getActiveSheet()->setCellValue('H5', 'Category');
$this->excel->getActiveSheet()->setCellValue('I5', 'IsActive'); $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');
@ -273,12 +315,24 @@ class rawmaterialdetails extends BaseController
$this->excel->getActiveSheet()->getStyle('H5')->getFont()->setBold(true); $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('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(); $exportData = $this->rawmaterialdetails_model->export_excel();
// print_r($exportData);die();
if ($exportData) { if ($exportData) {
$i = 6; $i = 6;
$s = 1; $s = 1;
@ -288,13 +342,16 @@ class rawmaterialdetails extends BaseController
$this->excel->getActiveSheet()->setCellValue('D' . $i,$data['MaterialName']); $this->excel->getActiveSheet()->setCellValue('D' . $i,$data['MaterialName']);
$this->excel->getActiveSheet()->setCellValue('E' . $i,$data['MaterialType']); $this->excel->getActiveSheet()->setCellValue('E' . $i,$data['MaterialType']);
$this->excel->getActiveSheet()->setCellValue('F' . $i,$data['UOM']); $this->excel->getActiveSheet()->setCellValue('F' . $i,$data['UOM']);
$this->excel->getActiveSheet()->setCellValue('G' . $i,$data['firstname']); $this->excel->getActiveSheet()->setCellValue('G' . $i,$data['RMCode']);
$this->excel->getActiveSheet()->setCellValue('H' . $i,$data['Updated_By']); $this->excel->getActiveSheet()->setCellValue('H' . $i,$data['Category']);
$this->excel->getActiveSheet()->setCellValue('I' . $i,$data['IsActive']); $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++; $i++;

View File

@ -14,16 +14,11 @@ class rawmaterialdetails_model extends CI_Model
{ {
$this->db->select('*'); $this->db->select('*');
$this->db->from('T_MaterialMaster'); $this->db->from('T_MaterialMaster');
$query = $this->db->get(); $query = $this->db->get();
$result = $query->result(); $result = $query->result();
return $result; return $result;
} }
function getUOM($UOM = '') function getUOM($UOM = '')
{ {
$ConfigID = 'C001'; $ConfigID = 'C001';
@ -42,7 +37,6 @@ class rawmaterialdetails_model extends CI_Model
function getmaterialType($MaterialType = '') function getmaterialType($MaterialType = '')
{ {
$Config_ID = 'C003'; $Config_ID = 'C003';
$this->db->select('Config_ID,ConfigValue'); $this->db->select('Config_ID,ConfigValue');
$this->db->from('T_ConfigDetails'); $this->db->from('T_ConfigDetails');
$this->db->where('Config_id',$Config_ID ); $this->db->where('Config_id',$Config_ID );
@ -54,17 +48,52 @@ class rawmaterialdetails_model extends CI_Model
return $query->result(); 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 * This function used to get user information by id
* @param number $userId : This is user id * @param number $userId : This is user id
* @return array $result : This is user information * @return array $result : This is user information
*/ */
function addNewRawMaterial($RawMaterial='')
function addNewRawMaterial($RawMaterial='')
{ {
$this->db->insert('T_MaterialMaster', $RawMaterial); $this->db->insert('T_MaterialMaster', $RawMaterial);
return TRUE; return TRUE;
} }
@ -77,28 +106,47 @@ function addNewRawMaterial($RawMaterial='')
{ {
$this->db->select('*'); $this->db->select('*');
$this->db->from('T_MaterialMaster'); $this->db->from('T_MaterialMaster');
$this->db->where('MaterialCode', $MaterialCode); $this->db->where('MaterialCode', $MaterialCode);
$query = $this->db->get(); $query = $this->db->get();
//sprint_r($this->db->last_query()); //sprint_r($this->db->last_query());
return $query->result(); return $query->result();
} }
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) function editRawmaterial($RawMaterial, $MaterialCode)
{ {
$this->db->where('MaterialCode', $MaterialCode); $this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_MaterialMaster', $RawMaterial); $this->db->update('T_MaterialMaster', $RawMaterial);
return TRUE; 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->where('MaterialCode', $MaterialCode);
$this->db->update('T_MaterialMaster', $RawMaterial); $this->db->update('T_MaterialMaster', $RawMaterial);
@ -107,24 +155,24 @@ function addNewRawMaterial($RawMaterial='')
function export_excel(){ 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->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('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('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('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_MaterialMaster as det')->result_array(); return $this->db->get('T_MaterialMaster as det')->result_array();
} }
/** /**
* This function is used to delete the user information * This function is used to delete the user information
* @param number $userId : This is user id * @param number $userId : This is user id
* @return boolean $result : TRUE / FALSE * @return boolean $result : TRUE / FALSE*/
function deletePO($PO, $POinfo) // function deletePO($PO, $POinfo)
{ // {
$this->db->where('PO', $PO); // $this->db->where('PO', $PO);
$this->db->update('T_PurchaseOrderDetails', $POInfo); // $this->db->update('T_PurchaseOrderDetails', $POInfo);
// return $this->db->affected_rows();
return $this->db->affected_rows(); // }
}*/
} }
?> ?>

View File

@ -1,7 +1,9 @@
<script> <script>
function BlockSpecial(evt) { function BlockSpecial(evt) {
var charCode; var charCode;
if (window.event) if (window.event
charCode = window.event.keyCode; //for IE charCode = window.event.keyCode; //for IE
else else
charCode = evt.which; //for firefox charCode = evt.which; //for firefox
@ -20,6 +22,7 @@ function BlockSpecial(evt) {
return true; return true;
} }
} }
</script> </script>
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
@ -40,27 +43,24 @@ function BlockSpecial(evt) {
<!-- left column --> <!-- left column -->
<div class="col-md-12"> <div class="col-md-12">
<!-- general form elements --> <!-- general form elements -->
<div class="box box-primary"> <div class="box box-primary">
<!-- form start --> <!-- form start -->
<form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form"> <form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form">
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="col-md-12">
<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 " 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"> <div class="form-group">
<span for="MaterialName">Material Name</span> <span for="MaterialType">Material Type</span><font color="Red">*</font>
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255"> <select class="form-control required select2" id="MaterialType" name="MaterialType">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="MaterialType">Material Type</span>
<select class="form-control required" id="MaterialType" name="MaterialType">
<option value="-1" required>Select Material Type</option> <option value="-1" required>Select Material Type</option>
<?php <?php
if(!empty($material)) if(!empty($material))
@ -78,8 +78,28 @@ function BlockSpecial(evt) {
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="form-group"> <div class="form-group">
<span for="UOM">Unit of Measurement</span> <span for="MaterialCategory">Material Category</span><font color="Red">*</font>
<select class="form-control required" id="UOM" name="UOM"> <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> <option value="-1" required>Select UOM</option>
<?php <?php
if(!empty($UOM)) if(!empty($UOM))
@ -95,17 +115,90 @@ function BlockSpecial(evt) {
</select> </select>
</div> </div>
</div> </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="col-md-3">
<div class="form-group"> <div class="form-group">
<span for="Active">IsActive</span> <br> <span for="Active">IsActive</span> <br>
<input type="checkbox" id="isactive" name="isactive" > <input type="checkbox" id="isactive" name="isactive" >
</div> </div>
</div> </div>
</div> </div>
</div><!-- /.box-body --> </div><!-- /.box-body -->
<div class="box-footer" style="text-align:right"> <div class="box-footer" style="text-align:right">
@ -149,3 +242,28 @@ function BlockSpecial(evt) {
</div> </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 = ''; $MaterialCode = '';
$MaterialName = ''; $MaterialName = '';
$MaterialType = ''; $MaterialType = '';
$MaterialCategory = '';
$UOM = ''; $UOM = '';
$Assetcode ='';
$costcenter='';
$remarks='';
$conversionfactorUOM='';
$conversionactor ='';
$RMCode = '';
$IsActive = ''; $IsActive = '';
if(!empty($materialDetails)) if(!empty($materialDetails))
@ -13,7 +20,14 @@ if(!empty($materialDetails))
$MaterialCode = $MD->MaterialCode; $MaterialCode = $MD->MaterialCode;
$MaterialName = $MD->MaterialName; $MaterialName = $MD->MaterialName;
$MaterialType = $MD->MaterialType; $MaterialType = $MD->MaterialType;
$MaterialCategory = $MD->Category;
$UOM = $MD->UOM; $UOM = $MD->UOM;
$Assetcode = $MD->assetcode;
$costcenter = $MD->CostCenterCode;
$remarks = $MD->Remarks;
$conversionfactor = $MD->ConversionFactorUnit;
$conversionfactorUOM = $MD->ConversionFactorUOM;
$RMCode = $MD->RMCode;
$chk = $MD->IsActive; $chk = $MD->IsActive;
if($chk == 1) if($chk == 1)
@ -30,6 +44,58 @@ 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() {
// $('#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"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
@ -60,17 +126,29 @@ if(!empty($materialDetails))
<form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial" role="form"> <form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial" role="form">
<div class="box-body"> <div class="box-body">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-12">
<div class="col-md-3">
<div class="form-group"> <div class="form-group">
<label for="MaterialName">Material Name</label> <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="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"> <input type="hidden" class="form-control required " id="MaterialCode" value="<?php echo $MaterialCode;?>"name="MaterialCode" maxlength="255">
</div> </div>
</div> </div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="MaterialType">Material Type</label> <span for="MaterialType">Material Type</span>
<select class="form-control required" id="MaterialType" name="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> <option value="<?php echo $MaterialType;?> "><?php echo $MaterialType;?></option>
<?php <?php
if(!empty($materialType)) if(!empty($materialType))
@ -84,13 +162,38 @@ if(!empty($materialDetails))
} }
?> ?>
</select> </select>
-->
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="UOM">Unit of Measurement</label> <span for="MaterialCategory">Material Category</span>
<select class="form-control required" id="UOM" name="UOM"> <input type="text" class="form-control" readonly id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory;?>" onChange="changeTextBox();">
<option value="<?php echo $UOM;?>" ><?php echo $UOM;?></option> <!-- <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">
<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 <?php
if(!empty($UOMList)) if(!empty($UOMList))
{ {
@ -105,12 +208,93 @@ if(!empty($materialDetails))
</select> </select>
</div> </div>
</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 class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<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>

View File

@ -26,9 +26,15 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
<thead> <thead>
<tr> <tr>
<th>Material Code</th> <th>Material Code</th>
<th>Raw Material Code</th>
<th>Material Description</th> <th>Material Description</th>
<th>Type of Material</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> </tr>
</thead> </thead>
@ -41,10 +47,17 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
?> ?>
<tr> <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->MaterialName ?></td>
<td><?php echo $record->MaterialType ?></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> </tr>
<?php <?php
@ -53,7 +66,7 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
?> ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</section> </section>
</div> </div>