machine master screen

This commit is contained in:
venbatechnologies@gmail.com 2018-03-19 12:36:14 +05:30
parent a1acf8316d
commit e3137a1275
8 changed files with 1657 additions and 11 deletions

View File

@ -694,14 +694,16 @@ class batchcard extends BaseController
}
function addMaint(){
$data['MachineList'] = $this->batchcard_model->getmachine_codename();
$this->global['pageTitle'] = 'Siddharth : Add Maintenance/Breakdown';
$this->loadViews("BatchcardMaintAdd", $this->global,NULL,NULL);
$this->loadViews("BatchcardMaintAdd", $this->global,$data,NULL);
}
function editMaint(){
$MntID = $_GET['MntID'];
//echo $MntID;
$data['MachineList'] = $this->batchcard_model->getmachine_codename();
$data['MaintEdit'] = $this->batchcard_model->getmaint_dtl_MntID($MntID);
//print_r($data);
@ -712,6 +714,9 @@ class batchcard extends BaseController
$type = $this->input->post('radiobtn');
$maintenance_date = $this->input->post('maintenance_date');
$machinecode = $this->input->post('machine');
if($type == '0'){ $maintenance_subtype = $this->input->post('maintenance_subtype');}
else{ $maintenance_subtype = NULL; }
$maintenance_time= $this->input->post('maintenance_time');
$location = $this->input->post('location');
$maintenance_description = $this->input->post('maintenance_description');
@ -723,7 +728,7 @@ class batchcard extends BaseController
$cost_labour = $this->input->post('cost_labour');
$createdby = $this->session->userdata ( 'userId' );
$addmntbr = array('Type'=>$type,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'CreatedBy'=>$createdby);
$addmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'CreatedBy'=>$createdby);
$added = $this->batchcard_model->addmaint_dtl($addmntbr);
if($added == 1)
@ -738,6 +743,9 @@ class batchcard extends BaseController
$type = $this->input->post('radiobtn');
$mntid = $this->input->post('mntid');
$machinecode = $this->input->post('machine');
if($type == '0'){ $maintenance_subtype = $this->input->post('maintenance_subtype'); }
else{ $maintenance_subtype = NULL; }
$maintenance_date = $this->input->post('maintenance_date');
$maintenance_time= $this->input->post('maintenance_time');
$location = $this->input->post('location');
@ -752,7 +760,7 @@ class batchcard extends BaseController
// $date = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
// $updatedon = $date->format('d-m-Y H:i:s');
$editmntbr = array('Type'=>$type,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'UpdatedBy'=>$updatedby);
$editmntbr = array('Type'=>$type,'Machine_Code'=>$machinecode,'Maint_Subtype'=>$maintenance_subtype,'Maint_Date'=>$maintenance_date,'Maint_Time'=>$maintenance_time, 'Maint_Location'=>$location, 'Maint_Description'=>$maintenance_description, 'Maint_Reason'=>$maintenance_reason, 'Maint_Time_from'=>$maintenance_time_from, 'Maint_Time_to'=>$maintenance_time_to, 'Maint_Total_hrs'=>$maintenance_total_hrs, 'Cost_Material'=>$cost_material, 'Cost_Labour'=>$cost_labour, 'UpdatedBy'=>$updatedby);
//print_r($editmntbr);
//die();
// echo $type;
@ -762,10 +770,338 @@ class batchcard extends BaseController
if($updated == 1)
{
echo "<script>alert('Saved Successfully!');window.location.href='getMaintListing';</script>";
echo "<script>alert('Saved Successfully!');window.location.href='HourlyListing';</script>";
}
}
function getHistListing()
{
$data['HistListing'] = $this->batchcard_model->getHist_mstr();
$this->global['pageTitle'] = 'Siddharth : Machine Master/History Listing';
$this->loadViews("BatchcardHistListing", $this->global,$data,NULL);
}
function getPODtls(){
$pono = $this->input->post('id');
$podtls = $this->batchcard_model->getpo_dtls($pono);
echo json_encode($podtls);
}
function addHist(){
$data['HistDeptList'] = $this->batchcard_model->getdept_dtls();
$data['HistPONOList'] = $this->batchcard_model->getpono();
$this->global['pageTitle'] = 'Siddharth : Add Machine Master/History ';
$this->loadViews("BatchcardHistAdd", $this->global,$data,NULL);
}
function autocomplete()
{
$mc = $this->input->get('query');
$query= $this->batchcard_model->checkMachineCategory($mc);
echo json_encode($query);
}
function add($pathname)
{
// echo "add files";
// die();
// echo $pathname;
$picture = '';
if(!empty($_FILES[$pathname]['name']))
{
$config['upload_path'] = 'uploads/images/';
$config['allowed_types'] = '*';
//$config['allowed_types'] = 'jpg|jpeg|png|gif';
$config['file_name'] = $_FILES[$pathname]['name'];
//print_r($config);
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload($pathname))
{
$uploadData = $this->upload->data();
$picture = $uploadData['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
$picture = '';
}
}
else
{
$picture = '';
}
return $picture ;
}
function addHist_mstr(){
$machinename= $this->input->post('mach_name');
$make= $this->input->post('tomake');
$capacity= $this->input->post('machs_capacity');
$category= $this->input->post('machs_category');
$categoryarray = $this->batchcard_model->getmachineCategory();
foreach($categoryarray as $mc){
$TempArr[] = $mc->ConfigValue;
}
if (in_array($category, $TempArr)){}
else
{
$configcode = 'C028';
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$category);
$query= $this->batchcard_model->insertvalueintoconfig($config);
}
$dept= $this->input->post('machs_dept');
$location= $this->input->post('machs_locn');
$PONO= $this->input->post('machs_pono');
$POdate= $this->input->post('machs_podate');
$supplier = $this->input->post('machs_supplier');
$instalizationdate= $this->input->post('install_date');
$machineslifetime = $this->input->post('machs_lifetime');
$commencementdate = $this->input->post('machs_comm_date');
$createdby = $this->session->userdata ('userId');
$add = array(
'Machine_Name' => $machinename,
'Machines_Make' => $make,
'Machines_Capacity' => $capacity,
'Machines_Category' => $category,
'Machines_Dept' => $dept,
'Factory_Loc' => $location,
'Machines_PONO' => $PONO,
'Machines_POdate' => $POdate,
'Machines_Supplier' => $supplier ,
'Instalization_Date' => $instalizationdate,
'Machines_Lifetime' => $machineslifetime ,
'Commencement_Date' => $commencementdate ,
'CreatedBy' => $createdby);
$addedmaster = $this->batchcard_model->addhist_mstr($add);
$mach_code = '';
if(count($addedmaster)>0)
{
foreach ($addedmaster as $key ) {
$mach_code=$key->Machine_Code;
}
}
$count = $this->input->post('hidecounter');
$constant = $this->input->post('hideconstant');
for($i=1;$i<=$constant;$i++){
$varname = 'filename'.$i;
$temp = $this->input->post($varname);
$pathname = 'browseFiles'.$i;
$Picture = $this->add($pathname);
$arr[] = array($temp,$Picture);
}
foreach($arr as $ma){
$index = 0;
foreach($ma as $key=>$value){
$index++;
if($index == 1){
$file_descrpition = $value;
}
if($index == 2){
$filename = $value;
}
}
$addfilelist = array(
'Machine_code'=>$mach_code,
'Machile_filename'=>$filename
);
$this->batchcard_model->addfilelist($addfilelist);
}
$range = $this->input->post('machs_range');
$operatingrange = $this->input->post('machs_operating_range');
$leastcount = $this->input->post('machs_least_count');
$calibrationagency = $this->input->post('machs_calibration_agency');
$Calibrationon = $this->input->post('machs_calibration_on');
$Calibrationdue = $this->input->post('machs_calibration_due');
$Acctcriteria = $this->input->post('machs_acceptence_criteria');
$addchild = array(
'Machine_id' => $mach_code,
'Machine_Name'=> $machinename,
'Range' => $range,
'Operating_Range' => $operatingrange,
'Least_Count' => $leastcount,
'Calibration_Agency' => $calibrationagency,
'Calibration_On' => $Calibrationon,
'Calibration_Due' => $Calibrationdue,
'Acceptence_Criteria'=> $Acctcriteria
);
$addedchild = $this->batchcard_model->addhist_dtl($addchild);
echo "<script>alert('Saved Successfully!');window.location.href='getHistListing';</script>";
}
function editHist(){
//echo 'i am a edit function';
$MachineCode = $_GET['Machcode'];
//echo $MachineCode;
$data['HistMstrEdit'] = $this->batchcard_model->getHist_mstr($MachineCode);
$data['HistDtlsEdit'] = $this->batchcard_model->getHist_dtls($MachineCode);
$data['HistFileEdit'] = $this->batchcard_model->getHist_file($MachineCode);
$data['HistDeptList'] = $this->batchcard_model->getdept_dtls();
$data['HistPONOList'] = $this->batchcard_model->getpono();
//echo count($data['HistFileEdit']);
//echo "<br>";
//echo sizeof($data['HistFileEdit']);
$this->global['pageTitle'] = 'Siddharth : Edit Machine Master/History ';
$this->loadViews("BatchcardHistEdit", $this->global,$data,NULL);
}
function Removefiledetails(){
$id = $this->input->post('id');
$name = $this->input->post('name');
$deletedata = $this->batchcard_model->deletefiledetails($id,$name);
echo $deletedata;
}
function editHist_mstr(){
$code_and_name= $this->input->post('mach_name');
$machcn = explode("-",$code_and_name);
$machinename = $machcn[1];
$machinecode = $machcn[0];
$make= $this->input->post('tomake');
$capacity= $this->input->post('machs_capacity');
$category= $this->input->post('machs_category');
$categoryarray = $this->batchcard_model->getmachineCategory();
foreach($categoryarray as $mc){
$TempArr[] = $mc->ConfigValue;
}
if (in_array($category, $TempArr)){}
else
{
$configcode = 'C028';
$config = array('Config_ID'=>$configcode,'ConfigValue'=>$category);
$query= $this->batchcard_model->insertvalueintoconfig($config);
}
$dept= $this->input->post('machs_dept');
$location= $this->input->post('machs_locn');
$PONO= $this->input->post('machs_pono');
$POdate= $this->input->post('machs_podate');
$supplier = $this->input->post('machs_supplier');
$instalizationdate= $this->input->post('install_date');
$machineslifetime = $this->input->post('machs_lifetime');
$commencementdate = $this->input->post('machs_comm_date');
$updatedby = $this->session->userdata ('userId');
$update = array(
'Machine_Name' => $machinename,
'Machines_Make' => $make,
'Machines_Capacity' => $capacity,
'Machines_Category' => $category,
'Machines_Dept' => $dept,
'Factory_Loc' => $location,
'Machines_PONO' => $PONO,
'Machines_POdate' => $POdate,
'Machines_Supplier' => $supplier ,
'Instalization_Date' => $instalizationdate,
'Machines_Lifetime' => $machineslifetime ,
'Commencement_Date' => $commencementdate ,
'UpdatedBy' => $updatedby);
//--$updatedmaster = $this->batchcard_model->edithist_mstr($update,$machinecode);
$range = $this->input->post('machs_range');
$operatingrange = $this->input->post('machs_operating_range');
$leastcount = $this->input->post('machs_least_count');
$calibrationagency = $this->input->post('machs_calibration_agency');
$Calibrationon = $this->input->post('machs_calibration_on');
$Calibrationdue = $this->input->post('machs_calibration_due');
$Acctcriteria = $this->input->post('machs_acceptence_criteria');
$updatechild = array(
'Machine_id' => $machinecode,
'Machine_Name'=> $machinename,
'Range' => $range,
'Operating_Range' => $operatingrange,
'Least_Count' => $leastcount,
'Calibration_Agency' => $calibrationagency,
'Calibration_On' => $Calibrationon,
'Calibration_Due' => $Calibrationdue,
'Acceptence_Criteria'=> $Acctcriteria
);
//print_r($updatechild);
//die();
$updatedchild = $this->batchcard_model->edithist_dtl($updatechild,$machinecode);
$count = $this->input->post('hidecounter');
$constant = $this->input->post('hideconstant');
for($i=1;$i<=$constant;$i++){
$varname = 'filename'.$i;
$temp = $this->input->post($varname);
$pathname = 'browseFiles'.$i;
$Picture = $this->add($pathname);
$arr[] = array($temp,$Picture);
}
foreach($arr as $ma){
$index = 0;
foreach($ma as $key=>$value){
$index++;
if($index == 1){
$file_descrpition = $value;
}
if($index == 2){
$filename = $value;
}
}
$addfilelist = array(
'Machine_code'=>$machinecode,
'Machile_filename'=>$filename
);
$this->batchcard_model->addfilelist($addfilelist);
//$updatefilelist= array_filter(array_map('array_filter',$updatefilelist ));
}
echo "<script>alert('Saved Successfully!');window.location.href='getHistListing';</script>";
//echo "<script>alert('Saved Successfully); window.location.href='getHistListing';</script>";
}
}
?>

View File

@ -5,7 +5,7 @@ class batchcard_model extends CI_Model
function getEmplistforReport()
{
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName,');
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName');
$this->db->from('T_Employee_Details');
$this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode');
//$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number');
@ -245,6 +245,240 @@ class batchcard_model extends CI_Model
$res = $this->db->query($sql);
return $res->result();
}
function getmachine_codename(){
$this->db->select('Machine_Code,Machine_Name');
$this->db->from('T_Machine_Master');
$res = $this->db->get();
return $res->result();
}
/** Machines History/Master */
function getdept_dtls()
{
$this->db->select('T_DepartmentDetails.DEPCode,T_DepartmentDetails.shortName');
$this->db->from('T_DepartmentDetails');
$this->db->where('IsActive',1);
$res = $this->db->get();
return $res->result();
}
function getpono(){
$this->db->select('PONO');
$this->db->from('T_PurchaseOrder_Master');
$this->db->where('Status','ST026');
$res = $this->db->get();
return $res->result();
}
function getpo_dtls($pono){
// $this->db->select('T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,"%d-%m-%Y") as PO_Date');
// $this->db->from('T_PurchaseOrder_Master');
// $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
// $this->db->where('PONO',$pono);
// $res = $this->db->get();
// return $res->result();
$sql = "select T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,'%d-%m-%Y') as PO_Date
from T_PurchaseOrder_Master
join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID
where PONO = ? ";
$res = $this->db->query($sql,array($pono));
return $res->result();
}
function addhist_mstr($array)
{
$this->db->insert('T_Machine_Master',$array);
$mstr = $this->db->affected_rows();
//print_r($this->db->last_query());
//print_r($mstr);
if($mstr>0)
{
$this->db->select('max(Machine_Code) as Machine_Code');
$this->db->from('T_Machine_Master');
$res = $this->db->get();
//print_r($res->result());
return $res->result();
}
}
function addhist_dtl($array){
$this->db->insert('T_Machine_Details',$array);
$child = $this->db->affected_rows();
return $child;
}
function addfilelist($array){
$this->db->insert('T_Machines_file', $array);
$r = $this->db->affected_rows();
return $r;
//return TRUE;
}
function insertvalueintoconfig($config){
$this->db->insert('T_ConfigDetails', $config);
return TRUE;
}
//This function used to get the material category using configdetails table
function getmachineCategory($MaterialCategory = '')
{
$Config_ID = 'C028';
$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();
}
function getHist_dtls($MachineCode = '')
{
$this->db->select('*');
$this->db->from('T_Machine_Details');
if($MachineCode != '')
{
$this->db->where('Machine_id',$MachineCode );
}
$bmd = $this->db->get();
return $bmd->result();
}
function getHist_file($MachineCode = '')
{
$this->db->select('*');
$this->db->from('T_Machines_file');
if($MachineCode != '')
{
$this->db->where('Machine_Code',$MachineCode );
}
$bmd = $this->db->get();
return $bmd->result();
}
function getHist_mstr($MachineCode = '')
{
$this->db->select('*');
$this->db->from('T_Machine_Master');
if($MachineCode != '')
{
$this->db->where('Machine_Code',$MachineCode );
}
$bmd = $this->db->get();
return $bmd->result();
}
// function getHist_dtlsID($MntID)
// {
// $this->db->select('*');
// $this->db->from('T_Batchcard_MaintanceDetails');
// $this->db->where('Maint_ID',$MntID);
// $bmd = $this->db->get();
// return $bmd->result();
// }
// function getHist_dtlsDate($dateval)
// {
// $this->db->select('*');
// $this->db->from('T_Batchcard_MaintanceDetails');
// $this->db->where('Maint_Date',$dateval);
// $bmd = $this->db->get();
// return $bmd->result();
// }
function edithist_mstr($array,$machinecode){
$this->db->where('Machine_Code',$machinecode );
$this->db->update('T_Machine_Master',$array);
$mstr = $this->db->affected_rows();
if($mstr>0)
{
$this->db->select('max(Machine_Code) as Machine_Code');
$this->db->from('T_Machine_Master');
$res = $this->db->get();
return $res->result();
}
}
function edithist_dtl($array,$machinecode){
$this->db->where('Machine_id',$machinecode );
$this->db->update('T_Machine_Details',$array);
$mdtl = $this->db->affected_rows();
return $mdtl;
}
function updatefilelist($array,$fileid){
$this->db->where('File_No',$fileid);
$this->db->update('T_Machines_file', $array);
$ar = $this->db->affected_rows();
return $ar;
}
function checkMachineCategory($mc){
// $this->db->select('ConfigValue');
// $this->db->from('T_ConfigDetails');
// $this->db->where(Config_ID,'C023');
// $this->db->like('ConfigValue',$mc);
// $query = $this->db->get();
// //print_r($query->result());
// return $query->result();
// //return $this->db->get('T_MaterialMaster');
// }
$temp[] = '' ;
$this->db->distinct();
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_ID','C028');
$this->db->like('ConfigValue',$mc);
$query = $this->db->get();
//print_r($query->result());die;
$temparr[] = '' ;
foreach($query->result() as $arr){
$temparr[] = $arr->ConfigValue ;
}
$temp['suggestions'] = $temparr;
//print_r($temp);
return $temp;
}
function deletefiledetails($id,$name){
$sql = "DELETE FROM T_Machines_file WHERE File_No =".$id;
unlink("uploads/images/".$name);//this deletes the file on particular folder too
$query = $this->db->query($sql);
$ar = $this->db->affected_rows();
return $ar;
}
}
?>

View File

@ -0,0 +1,369 @@
<style>
.autocomplete-suggestion{
cursor:pointer;
background-color:skyblue;
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
</style>
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Siddharth Industries - Add Machine Master/History</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>batchcard/getHistListing" class="btn btn-primary" value="Back"/>Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box box-primary">
<!-- form start -->
<form role="form" id="MachHist" action="<?php echo base_url() ?>batchcard/addHist_mstr" enctype="multipart/form-data" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<legend>Machinery Primary Details</legend>
<div class="col-md-12">
<div class="col-md-3">
<label>Machine Name</label>
<input type="text" id="mach_name" name="mach_name" class="form-control" />
</div>
<div class="col-md-3">
<label>Machine Make</label>
<input type="text" id="tomake" name="tomake" class="form-control" />
</div>
<div class="col-md-3">
<label>Mechine's Capacity</label>
<input type="text" id="machs_capacity" name="machs_capacity" class="form-control" />
</div>
<div class="col-md-3">
<label>Machine Category</label>
<input type="text" id="machs_category" name="machs_category" class="form-control" />
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<label>Department</label>
<select class="form-control select2" id="machs_dept" name="machs_dept">
<option value=" ">Select Department</option>
</select>
</div>
<div class="col-md-3">
<label>PONO</label>
<select class="form-control select2" id="machs_pono" name="machs_pono">
<option value=" ">Select PONO</option>
</select>
</div>
<div class="col-md-3">
<label>PO Date</label>
<input type="text" id="machs_podate" name="machs_podate" class="form-control" onkeypress="return false;" style="text-align:right;" readonly/>
</div>
<div class="col-md-3">
<label>Supplier</label>
<input type="text" id="machs_supplier" name="machs_supplier" class="form-control" onkeypress="return false;" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<label>Factory Location</label>
<input type="text" id="machs_locn" name="machs_locn" class="form-control" />
</div>
<div class="col-md-3">
<label>Date Of Instalization</label>
<input type="text" id="install_date" name="install_date" class="form-control datepicker" onkeypress="return false;" style="text-align:right;"/>
</div>
<div class="col-md-3">
<label>Lifetime Of Machine</label>
<input type="text" id="machs_lifetime" name="machs_lifetime" class="form-control" />
</div>
<div class="col-md-3">
<label>Commencement Date</label>
<input type="text" id="machs_comm_date" name="machs_comm_date" class="form-control datepicker" onkeypress="return false;" style="text-align:right;"/>
</div>
</div>
</div>
<br/><br/>
<div class="col-md-12">
<legend>Machinery Specification Details</legend>
<div class="col-md-12">
<div class="col-md-4">
<label>Range</label>
<input type="text" id="machs_range" name="machs_range" class="form-control"/>
</div>
<div class="col-md-4">
<label>Operating Range</label>
<input type="text" id="machs_operating_range" name="machs_operating_range" class="form-control"/>
</div>
<div class="col-md-4">
<label>Least Count</label>
<input type="text" id="machs_least_count" name="machs_least_count" class="form-control"/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<label>Calibration Agency</label>
<input type="text" id="machs_calibration_agency" name="machs_calibration_agency" class="form-control"/>
</div>
<div class="col-md-4">
<label>Calibration On</label>
<input type="text" id="machs_calibration_on" name="machs_calibration_on" class="form-control datepicker" onkeypress="return false;" style="text-align:right;"/>
</div>
<div class="col-md-4">
<label>Calibration Due</label>
<input type="text" id="machs_calibration_due" name="machs_calibration_due" class="form-control datepicker" onkeypress="return false;" style="text-align:right;"/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<div id="lab" style="display: none;">
<label>Acceptence Criteria</label>
<input type="text" id="machs_lab_acceptence_criteria" name="machs_acceptence_criteria" class="form-control"/>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Multiple File</legend>
<div class="col-md-offset-10 col-md-1" >
<input type="button" class="btn btn-primary" id ="addmorebutton" value=" + ADD FILES..">
</div>
</div>
<!-- weight S.No Instrument Make Range Operating Range Machine number Least Count ******************** Calibration Agency calibration on calibration due -->
<!-- lab S.No Instrument Make Range Operating Range ************** Least Count Acceptence Criteria Calibration Agency calibration on calibration due -->
<div id="newdiv"></div><!-- this div for add more section-->
<input type="hidden" name="hidecounter" id="hidecounter" value="0" />
<input type="hidden" name="hideconstant" id="hideconstant" value="0" />
</div>
</div><!-- row -->
</div><!--box body -->
<br/>
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-primary" value="Submit" />
<input type="reset" class="btn btn-primary" value="Reset" />
</div>
</form>
</div><!--box body primary-->
</div>
</div>
</section>
</div>
<script>
// function readURL(input) {
// if (input.files && input.files[0]) {
// var reader = new FileReader();
// reader.onload = function (e) {
// $('#profilepicture')
// .attr('src', e.target.result)
// .width(180)
// .height(180);
// };
// reader.readAsDataURL(input.files[0]);
// }
// }
/** ready function */
$(function() {
var pono_arr = [];
var dept_arr = [];
$("#machs_dept").select2();
$("#machs_pono").select2();
$('.datepicker').datepicker({
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});
dept_arr = <?php echo json_encode($HistDeptList)?>;
pono_arr = <?php echo json_encode($HistPONOList)?>;
$.each(dept_arr,function(d,da){
$("#machs_dept").append( $('<option></option>').val(da.DEPCode).html(da.DEPCode+'-'+da.shortName));
});
$.each(pono_arr,function(p,pa){
$("#machs_pono").append( $('<option></option>').val(pa.PONO).html(pa.PONO));
});
$('#machs_category').autocomplete({
onSearchStart: function (query) {
//alert(query);
$('#machs_category').autocomplete("option", "minLength", 0);
},
serviceUrl: "<?php echo base_url();?>batchcard/autocomplete",
onSelect: function (suggestion) {
var data = suggestion.ConfigValue;
var selectedvalue = $('input[name=machs_category]').val();
if(selectedvalue=='lab')
{
$("#lab").show();
}
else{
// // alert('bad');
$("#lab").hide();
}
}
});
} );
/** on change machines category */
$("#machs_category").change(function(){
var machine_category = $(this).val();
if(machine_category == 'lab'){
$("#lab").show();
}
else {
$("#lab").hide();}
// alert(machine_category);
});
/**on change pono to set supplier and podate */
$("#machs_pono").change(function(){
var machine_category = $(this).val();
//alert(machine_category);
$.ajax({
data:{id:machine_category},
type:"POST",
url:"<?php echo base_url();?>batchcard/getPODtls",
success:function(data) {
//alert(data);
var hist_podate = '';
var hist_supplier = '';
if(data)
{
data = JSON.parse(data);
$.each(data,function(i,arr){
hist_podate = arr.PO_Date;
hist_supplier = arr.SupplierID+'-'+arr.SupplierName;
});
}
$("#machs_podate").val(hist_podate);
$("#machs_supplier").val(hist_supplier);
}
});
});
var counter = 0;
var counterConstant = 0;
$("#addmorebutton").click(function(){
//alert('sda');
// if(counter>4){
// alert(" allow only 5");
// return false;
// }
// else{
counter++;
counterConstant++;
var div = document.createElement('div');
div.id = "divid"+counterConstant;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label>File Name</label>'+
'<input type="text" id="machs_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
'</div>'+
'<div class="col-md-4">'+
'<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstant+'" onchange="Copyfilename(this.name);"><br>'+
'</div>'+
'<div class="col-md-3">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+
'</div>'+
'</div>';
$('#newdiv').append(div);
$('#hidecounter').val(counter);
$('#hideconstant').val(counterConstant);
//}
});
function removeRow(input) {
var number = input.replace(/[^0-9]+/ig,"");
if(counter >= 1){
counter--;
//var r = $('#Paymentaccode'+number).val();
$("#divid"+number).remove();
$('#hidecounter').val(counter);
}
}
function Copyfilename(id)
{
var number = id.replace(/[^0-9]+/ig,"");
// alert(number);
//var name = $('input[type=file]').val();
var name = $('input[name='+id+']')[0].files[0].name;
//var namess = $('input[type=file]')[number].files[number].name;
// alert(name);
// alert(namess);
// alert(id);
$("#machs_filename"+number).val(name);
}
</script>

View File

@ -0,0 +1,510 @@
<?php
$Machine_Code = '';
$Machine_Name ='';
$Machines_Make ='';
$Machines_Capacity ='';
$Machines_Category ='';
$Machines_Dept ='';
$Factory_Loc ='';
$Machines_PONO ='';
$Machines_POdate ='';
$Machines_Supplier ='';
$Instalization_Date ='';
$Machines_Lifetime ='';
$Commencement_Date ='';
$Range ='';
$Operating_Range='';
$Least_Count='';
$Calibration_Agency='';
$Calibration_On='';
$Calibration_Due='';
$Acceptence_Criteria='';
// $Machile_filename = '';
// $Machile_filepath = '';
$filecount = '';
if(!empty($HistMstrEdit)){
foreach($HistMstrEdit as $Mstr)
{
$Machine_Code = $Mstr->Machine_Code;
$Machine_Name = $Mstr->Machine_Name ;
$Machines_Make = $Mstr->Machines_Make ;
$Machines_Capacity = $Mstr->Machines_Capacity;
$Machines_Category = $Mstr->Machines_Category;
$Machines_Dept = $Mstr->Machines_Dept;
$Factory_Loc = $Mstr->Factory_Loc ;
$Machines_PONO = $Mstr->Machines_PONO;
$Machines_POdate = $Mstr->Machines_POdate;
$Machines_Supplier = $Mstr->Machines_Supplier;
$Instalization_Date = $Mstr->Instalization_Date;
$Machines_Lifetime = $Mstr->Machines_Lifetime;
$Commencement_Date = $Mstr->Commencement_Date;
}
}
if(!empty($HistDtlsEdit)){
foreach($HistDtlsEdit as $Dtls)
{
$Range = $Dtls->Range;
$Operating_Range = $Dtls->Operating_Range;
$Least_Count = $Dtls->Least_Count;
$Calibration_Agency = $Dtls->Calibration_Agency;
$Calibration_On = $Dtls->Calibration_On;
$Calibration_Due = $Dtls->Calibration_Due;
$Acceptence_Criteria = $Dtls->Acceptence_Criteria;
}
}
// print_r($HistFileEdit);
// count($HistFileEdit);
// echo "<br>";
// echo sizeof($HistFileEdit);
// die();
if(!empty($HistFileEdit)){
$filecount = count($HistFileEdit);
// foreach($HistFileEdit as $File)
// {
// $Machile_filename = $File->Machile_filename;
// $Machile_filepath = $File->Machile_filepath ;
// }
}
?>
<style>
.autocomplete-suggestion{
cursor:pointer;
background-color:skyblue;
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
</style>
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Siddharth Industries - Edit Machine Master/History</center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>batchcard/getHistListing" class="btn btn-primary" value="Back"/>Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box box-primary">
<!-- form start -->
<form role="form" id="MachHist" action="<?php echo base_url() ?>batchcard/editHist_mstr" enctype="multipart/form-data" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<legend>Machinery Primary Details</legend>
<div class="col-md-12">
<div class="col-md-3">
<label>Machine code and Name</label>
<input type="text" id="mach_name" name="mach_name" class="form-control" readonly value="<?php echo $Machine_Code.' - '.$Machine_Name;?>"/>
</div>
<div class="col-md-3">
<label>Machine Make</label>
<input type="text" id="tomake" name="tomake" class="form-control" value="<?php echo $Machines_Make;?>" />
</div>
<div class="col-md-3">
<label>Mechine's Capacity</label>
<input type="text" id="machs_capacity" name="machs_capacity" class="form-control" value="<?php echo $Machines_Capacity;?>" />
</div>
<div class="col-md-3">
<label>Machine Category</label>
<input type="text" id="machs_category" name="machs_category" class="form-control" value="<?php echo $Machines_Category;?>" />
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<label>Department</label>
<select class="form-control select2" id="machs_dept" name="machs_dept">
<option value=" ">Select Department</option>
</select>
</div>
<div class="col-md-3">
<label>PONO</label>
<select class="form-control select2" id="machs_pono" name="machs_pono">
<option value=" ">Select PONO</option>
</select>
</div>
<div class="col-md-3">
<label>PO Date</label>
<input type="text" id="machs_podate" name="machs_podate" class="form-control" onkeypress="return false;" style="text-align:right;" readonly value="<?php echo $Machines_POdate; ?>"/>
</div>
<div class="col-md-3">
<label>Supplier</label>
<input type="text" id="machs_supplier" name="machs_supplier" class="form-control" readonly value="<?php echo $Machines_Supplier;?>" onkeypress="return false;"/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<label>Factory Location</label>
<input type="text" id="machs_locn" name="machs_locn" class="form-control" value="<?php echo $Factory_Loc;?>"/>
</div>
<div class="col-md-3">
<label>Date Of Instalization</label>
<input type="text" id="install_date" name="install_date" class="form-control datepicker" style="text-align:right;" value="<?php echo $Instalization_Date;?>" onkeypress="return false;" />
</div>
<div class="col-md-3">
<label>Lifetime Of Machine</label>
<input type="text" id="machs_lifetime" name="machs_lifetime" class="form-control" value="<?php echo $Machines_Lifetime;?>"/>
</div>
<div class="col-md-3">
<label>Commencement Date</label>
<input type="text" id="machs_comm_date" name="machs_comm_date" class="form-control datepicker" onkeypress="return false;" style="text-align:right;" value="<?php echo $Commencement_Date;?>"/>
</div>
</div>
</div>
<br/><br/>
<div class="col-md-12">
<legend>Machinery Specification Details</legend>
<div class="col-md-12">
<div class="col-md-4">
<label>Range</label>
<input type="text" id="machs_range" name="machs_range" class="form-control" value="<?php echo $Range;?>"/>
</div>
<div class="col-md-4">
<label>Operating Range</label>
<input type="text" id="machs_operating_range" name="machs_operating_range" class="form-control" value="<?php echo $Operating_Range;?>"/>
</div>
<div class="col-md-4">
<label>Least Count</label>
<input type="text" id="machs_least_count" name="machs_least_count" class="form-control" value="<?php echo $Least_Count;?>"/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<label>Calibration Agency</label>
<input type="text" id="machs_calibration_agency" name="machs_calibration_agency" class="form-control" value="<?php echo $Calibration_Agency;?>"/>
</div>
<div class="col-md-4">
<label>Calibration On</label>
<input type="text" id="machs_calibration_on" name="machs_calibration_on" class="form-control datepicker" onkeypress="return false;" style="text-align:right;" value="<?php echo $Calibration_On;?>"/>
</div>
<div class="col-md-4">
<label>Calibration Due</label>
<input type="text" id="machs_calibration_due" name="machs_calibration_due" class="form-control datepicker" onkeypress="return false;" style="text-align:right;" value="<?php echo $Calibration_Due;?>"/>
</div>
</div>
<div class="col-md-12">
<div class="col-md-4">
<div id="lab" style="display: none;">
<label>Acceptence Criteria</label>
<input type="text" id="machs_lab_acceptence_criteria" name="machs_acceptence_criteria" class="form-control" value="<?php echo $Acceptence_Criteria;?>"/>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Multiple File</legend>
<div class="col-md-offset-10 col-md-1" >
<input type="button" class="btn btn-primary" id ="addmorebutton" value=" + ADD FILES..">
</div>
</div>
<!-- weight S.No Instrument Make Range Operating Range Machine number Least Count ******************** Calibration Agency calibration on calibration due -->
<!-- lab S.No Instrument Make Range Operating Range ************** Least Count Acceptence Criteria Calibration Agency calibration on calibration due -->
<div id="newdiv"></div><!-- this div for add more section-->
<input type="hidden" name="hidecounter" id="hidecounter" value="0" />
<input type="hidden" name="hideconstant" id="hideconstant" value="0" />
</div>
</div><!-- row -->
</div><!--box body -->
<br/>
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-primary" value="Submit" />
<input type="reset" class="btn btn-primary" value="Reset" />
</div>
</form>
</div><!--box body primary-->
</div>
</div>
</section>
</div>
<script>
// function readURL(input) {
// if (input.files && input.files[0]) {
// var reader = new FileReader();
// reader.onload = function (e) {
// $('#profilepicture')
// .attr('src', e.target.result)
// .width(180)
// .height(180);
// };
// reader.readAsDataURL(input.files[0]);
// }
// }
/** ready function */
var index = 0 ;
var counter = 0;
var counterConstant = 0;
$(function() {
var pono_arr = [];
var dept_arr = [];
$("#machs_dept").select2();
$("#machs_pono").select2();
$('.datepicker').datepicker({
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});
dept_arr = <?php echo json_encode($HistDeptList)?>;
pono_arr = <?php echo json_encode($HistPONOList)?>;
file_arr = <?php echo json_encode($HistFileEdit)?>;
$.each(dept_arr,function(d,da){
$("#machs_dept").append( $('<option></option>').val(da.DEPCode).html(da.DEPCode+'-'+da.shortName));
});
$('#machs_dept option[value="<?php echo $Machines_Dept?>"]').prop('selected', true);
$.each(pono_arr,function(p,pa){
$("#machs_pono").append( $('<option></option>').val(pa.PONO).html(pa.PONO));
});
$('#machs_pono option[value="<?php echo $Machines_PONO?>"]').prop('selected', true);
var mybaseurl='<?php echo base_url('uploads/images');?>';
$.each(file_arr,function(f,fa){
var div = document.createElement('div');
div.id = "dbdivid"+index;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label>File Name</label>'+
'<input type="text" id="machs_filename'+index+'" name="dbfilename'+index+'" class="form-control" value="'+fa.Machile_filename+'" onkeypress="return false;" readonly/>'+
'</div>'+
'<div class="col-md-4">'+
'<label><br></label>'+
// '<input type="file" id="filepath'+index+'" name="browseFiles'+index+'" onchange="readURL(this);" placeholder= "'+fa.Machile_filepath+'" ><br>'+
'</div>'+
'<div class="col-md-3">'+
'<label><br><br></label>'+
'<input type="hidden" name="hidefileid'+index+'" id="hidefileid'+index+'" value="'+fa.File_No+'"/>'+
'<a href="'+mybaseurl+'/'+fa.Machile_filename+'" class="btn btn-primary active" target="_blank" role="button"><i class="fa fa-download" ></i>Download</a>'+
'<button class="btn btn-danger" id="delbtn'+index+'" onclick="deleted(this.id)"><i class="fa fa-trash"></i> Remove</button>'+
'</div>'+
'</div>';
$('#newdiv').append(div);
index++;
})
//foreach( as $File)
$('#machs_category').autocomplete({
onSearchStart: function (query) {
//alert(query);
$('#machs_category').autocomplete("option", "minLength", 0);
},
serviceUrl: "<?php echo base_url();?>batchcard/autocomplete",
onSelect: function (suggestion) {
var data = suggestion.ConfigValue;
var selectedvalue = $('input[name=machs_category]').val();
if(selectedvalue=='lab')
{
$("#lab").show();
}
else{
// // alert('bad');
$("#lab").hide();
}
}
});
var lab = "<?php echo $Machines_Category ?>";
if(lab=='lab')
{
$("#lab").show();
}
} );
/** on change machines category */
$("#machs_category").change(function(){
var machine_category = $(this).val();
if(machine_category == 'lab'){
$("#lab").show();
}
else {
$("#lab").hide();}
// alert(machine_category);
});
/**on change pono to set supplier and podate */
$("#machs_pono").change(function(){
var machine_category = $(this).val();
//alert(machine_category);
$.ajax({
data:{id:machine_category},
type:"POST",
url:"<?php echo base_url();?>batchcard/getPODtls",
success:function(data) {
//alert(data);
var hist_podate = '';
var hist_supplier = '';
if(data)
{
data = JSON.parse(data);
$.each(data,function(i,arr){
hist_podate = arr.PO_Date;
hist_supplier = arr.SupplierID+'-'+arr.SupplierName;
});
}
$("#machs_podate").val(hist_podate);
$("#machs_supplier").val(hist_supplier);
}
});
});
$("#addmorebutton").click(function(){
// alert('sda');
// alert(index);
// alert(counter);
// alert(counterConstant);
// var removenum = counterConstant+index;
// if(counter>4){
// alert("allow only 5 files");
// return false;
// }
// else{
counter++;
counterConstant++;
var div = document.createElement('div');
div.id = "divid"+counterConstant;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label>File Name</label>'+
// '<input type="text" id="machs_filename" name="filename'+counterConstant+'" class="form-control"/>'+
'<input type="text" id="machs_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
'</div>'+
'<div class="col-md-4">'+
'<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstant+'" onchange="Copyfilename(this.name);"><br>'+
'</div>'+
'<div class="col-md-3">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button>'+
'</div>'+
'</div>';
$('#newdiv').append(div);
$('#hidecounter').val(counter);
$('#hideconstant').val(counterConstant);
//}
});
function deleted(deleteid) {
var number = deleteid.replace(/[^0-9]+/ig,"");
var fileid = $("#hidefileid"+number).val();
var filename = $("#machs_filename"+number).val();
$.ajax({
data:{id:fileid,name:filename},
type:"POST",
url:"<?php echo base_url() ?>batchcard/Removefiledetails",
success:function(data) {
}
});
$("#dbdivid"+number).remove();
}
function removeRow(input) {
var number = input.replace(/[^0-9]+/ig,"");
//if(counter >= 1){
counter--;
$("#divid"+number).remove();
$('#hidecounter').val(counter);
//}
}
function Copyfilename(id)
{
var number = id.replace(/[^0-9]+/ig,"");
var name = $('input[name='+id+']')[0].files[0].name;
$("#machs_filename"+number).val(name);
}
</script>

View File

@ -0,0 +1,87 @@
<div class="content-wrapper">
<section class="content" id="loadingcontent">
<div>
<CENTER><h3>Siddharth Industries - Machine Master/History Listing</h3></CENTER>
</div>
<div class="box">
<div class="box-header">
<div align="right" style="padding-right:10px">
<a class="btn btn-Primary" style="padding-right:10px" align="right" href="<?php echo base_url(); ?>batchcard/addHist">Add New</a>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-12">
<table id="histtable" class="table table-hover table-bordered" style="background-color:#fff;font-size:12px;" >
<thead style="background-color:#ddf">
<tr>
<th>Machines</th>
<th>Machines Make</th>
<th>Machines Capacity</th>
<th>Category</th>
<th>Department</th>
<th>Location</th>
<th>PONO</th>
<th>Instalization Date</th>
<th>Machines Lifetime</th>
<th>Commencement Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
// print_r($HistListing);
if(!empty($HistListing))
{
foreach($HistListing as $hl)
{
?>
<tr>
<td><?php echo $hl->Machine_Code.'-'.$hl->Machine_Name ?></td>
<td><?php echo $hl->Machines_Make ?></td>
<td><?php echo $hl->Machines_Capacity ?></td>
<td><?php echo $hl->Machines_Category ?></td>
<td><?php echo $hl->Machines_Dept ?></td>
<td><?php echo $hl->Factory_Loc ?></td>
<td><?php echo $hl->Machines_PONO ?></td>
<td><?php echo $hl->Instalization_Date ?></td>
<td><?php echo $hl->Machines_Lifetime ?></td>
<td><?php echo $hl->Commencement_Date; ?></td>
<!-- <td><?php echo $hl->Machine_Code ?></td> -->
<td><a href="<?php echo base_url().'batchcard/editHist?Machcode='.$hl->Machine_Code ?>" data-toggle="tooltip" title="Click here to Edit details"><i class="fa fa-edit" style="font-size:20px;"></i></a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript">
$(function () {
$('#histtable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true
});
});
</script>

View File

@ -32,15 +32,28 @@
<input type="text" id="breakdown" name="breakdown" class="form-control" style="text-align:right;"/>
</div> -->
<div class="col-md-3">
<label>Select Machine:</label>
<select class="form-control select2" id="machine" name="machine">
<option value=" ">Select Machine</option>
</select>
</div>
<div class="col-md-3">
<label>Select option:</label></br>
<input type="radio" id="radiobtn1" name="radiobtn" value="0" checked>Maintenance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
</div>
<div class="col-md-3" id ="subtype" style="display: none;">
<label>Select Maintenance Type:</label></br>
<input type="radio" id="mainttype1" name="maintenance_subtype" value="0" checked>Internal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="mainttype2" name="maintenance_subtype" value="1" >External
</div>
<div class="col-md-3">
<label>Date</label>
<input type="text" id="maintenance_date" name="maintenance_date" class="form-control" style="text-align:right;"/>
<input type="text" id="maintenance_date" name="maintenance_date" class="form-control" style="text-align:right;" onkeypress="return false;"/>
</div>
<div class="col-md-3">
@ -113,6 +126,10 @@
</div>
<script>
$(function() {
var mach_arr = [];
$("#machine").select2();
$('#maintenance_date').datepicker({
//minDate : 'year+16',
maxDate : 'now',
@ -120,7 +137,28 @@ $(function() {
});
mach_arr = <?php echo json_encode($MachineList)?>;
$.each(mach_arr,function(m,ma){
$("#machine").append( $('<option></option>').val(ma.Machine_Code).html(ma.Machine_Code+'-'+ma.Machine_Name));
});
var value = $( 'input[name=radiobtn]:checked' ).val();
if(value == '0'){
$("#subtype").show();}
} );
$('input[name=radiobtn]').change(function(){
var value = $( 'input[name=radiobtn]:checked' ).val();
if(value == '0'){
$("#subtype").show();
}
else{
//alert('br'+value);
$("#subtype").hide();
}
});
function calculateTime()
{

View File

@ -1,6 +1,8 @@
<?php
$Mnt_Id = '';
$Type = '';
$Machinecode = '';
$Mnt_Subtype = '';
$Location = '';
$Mnt_Date ='';
$Mnt_Time = '';
@ -17,6 +19,8 @@ if(!empty($MaintEdit))
foreach($MaintEdit as $Me)
{
$Mnt_Id = $Me->Maint_ID;
$Machinecode = $Me->Machine_Code;
$Mnt_Subtype = $Me->Maint_Subtype;
$Mnt_Date = $Me->Maint_Date;
$Mnt_Time = $Me->Maint_Time;
$Type = $Me->Type;
@ -64,12 +68,25 @@ if(!empty($MaintEdit))
<label>Breakdown/Prevention</label>
<input type="text" id="breakdown" name="breakdown" class="form-control" style="text-align:right;"/>
</div> -->
<div class="col-md-3">
<label>Select Machine:</label>
<select class="form-control select2" id="machine" name="machine">
<option value=" ">Select Machine</option>
</select>
</div>
<div class="col-md-3">
<label>Select option:</label></br>
<input type="radio" id="radiobtn1" name="radiobtn" value="0" >Maintenance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
</div>
<div class="col-md-3" id ="subtype" style="display: none;">
<label>Select Maintenance Type:</label></br>
<input type="radio" id="mainttype1" name="maintenance_subtype" value="0" >Internal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="mainttype2" name="maintenance_subtype" value="1" >External
</div>
<div class="col-md-3">
<label>Date</label>
<input type="text" id="maintenance_date" name="maintenance_date" class="form-control" style="text-align:right;" value="<?php echo $Mnt_Date ?>"/>
@ -145,10 +162,23 @@ if(!empty($MaintEdit))
<script>
$(function() {
var mach_arr = [];
$("#machine").select2();
$('#maintenance_date').datepicker({
//minDate : 'year+16',
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'});
mach_arr = <?php echo json_encode($MachineList)?>;
$.each(mach_arr,function(m,ma){
$("#machine").append( $('<option></option>').val(ma.Machine_Code).html(ma.Machine_Code+'-'+ma.Machine_Name));
});
$('#machine option[value="<?php echo $Machinecode ?>"]').prop('selected', true);
var type = "<?php echo $Type;?>";
@ -156,19 +186,47 @@ $(function() {
if(type == "0")
{
$('#radiobtn1').attr('checked','true');
$("#subtype").show();
}
else
{
$('#radiobtn2').attr('checked','true');
$("#subtype").hide();
}
$('#rdate').datepicker({
//minDate : 'year+16',
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
$('input[name=radiobtn]').change(function(){
var value = $( 'input[name=radiobtn]:checked' ).val();
if(value == '0'){
$("#subtype").show();
}
else{
//alert('br'+value);
$("#subtype").hide();
}
});
var subtype = "<?php echo $Mnt_Subtype;?>";
if(subtype == '0')
{
$('#mainttype1').attr('checked','true');
}
else
{
$('#mainttype2').attr('checked','true');
}
// var value = $( 'input[name=radiobtn]:checked' ).val();
// if(value == '0'){
// $("#subtype").show();}
// $('#rdate').datepicker({
// //minDate : 'year+16',
// maxDate : 'now',
// dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
// });
} );
function calculateTime()

View File

@ -647,6 +647,13 @@ $(function() {
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>batchcard/getHistListing">
<i class="fa fa-history"></i>
<span>Machine History/Master </span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>userListing">
<i class="fa fa-users"></i>
@ -778,6 +785,13 @@ $(function() {
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>batchcard/getHistListing">
<i class="fa fa-history"></i>
<span>Machine History/Master </span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>userListing">
<i class="fa fa-users"></i>