history screen changes

This commit is contained in:
venbatechnologies@gmail.com 2018-03-20 20:03:45 +05:30
parent 099e75dbe9
commit 95cdb6d0d0
8 changed files with 150 additions and 83 deletions

View File

@ -682,7 +682,7 @@ class batchcard extends BaseController
function getMaintenancesDetails(){
$date = $this->input->post('id1');
$arraydata = $this->batchcard_model->maintenancesdata($date,$Autostartstoptime);
$arraydata = $this->batchcard_model->maintenancesdata($date);
if(count($arraydata) != 0){
echo json_encode($arraydata);}
}
@ -850,7 +850,7 @@ class batchcard extends BaseController
$machinename= $this->input->post('mach_name');
$make= $this->input->post('tomake');
$capacity= $this->input->post('machs_capacity');
$category= $this->input->post('machs_category');
$category= strtoupper($this->input->post('machs_category'));
$categoryarray = $this->batchcard_model->getmachineCategory();
foreach($categoryarray as $mc){
@ -931,9 +931,11 @@ class batchcard extends BaseController
}
$addfilelist = array(
'Machine_code'=>$mach_code,
'Machile_filename'=>$filename
'Machine_filename'=>$filename
);
$this->batchcard_model->addfilelist($addfilelist);
//print_r($addfilelist);
//die();
}
@ -943,10 +945,10 @@ class batchcard extends BaseController
$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');
if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); }
else{ $Acctcriteria = NULL; }
$addchild = array(
'Machine_id' => $mach_code,
'Machine_Code' => $mach_code,
'Machine_Name'=> $machinename,
'Range' => $range,
'Operating_Range' => $operatingrange,
@ -969,6 +971,7 @@ class batchcard extends BaseController
//echo 'i am a edit function';
$MachineCode = $_GET['Machcode'];
//echo $MachineCode;
$data['TableDatas'] = $this->batchcard_model->getHist_tbls($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);
@ -994,11 +997,11 @@ class batchcard extends BaseController
$code_and_name= $this->input->post('mach_name');
$machcn = explode("-",$code_and_name);
$machinename = $machcn[1];
//$machinename = $machcn[1];
$machinecode = $machcn[0];
$make= $this->input->post('tomake');
$capacity= $this->input->post('machs_capacity');
$category= $this->input->post('machs_category');
$category= strtoupper($this->input->post('machs_category'));
$categoryarray = $this->batchcard_model->getmachineCategory();
foreach($categoryarray as $mc){
@ -1025,7 +1028,7 @@ class batchcard extends BaseController
$updatedby = $this->session->userdata ('userId');
$update = array(
'Machine_Name' => $machinename,
//'Machine_Name' => $machinename,
'Machines_Make' => $make,
'Machines_Capacity' => $capacity,
'Machines_Category' => $category,
@ -1039,7 +1042,7 @@ class batchcard extends BaseController
'Commencement_Date' => $commencementdate ,
'UpdatedBy' => $updatedby);
//--$updatedmaster = $this->batchcard_model->edithist_mstr($update,$machinecode);
$updatedmaster = $this->batchcard_model->edithist_mstr($update,$machinecode);
$range = $this->input->post('machs_range');
$operatingrange = $this->input->post('machs_operating_range');
@ -1047,11 +1050,13 @@ class batchcard extends BaseController
$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');
if($category == 'LAB'){ $Acctcriteria = $this->input->post('machs_acceptence_criteria'); }
else{ $Acctcriteria = NULL; }
$updatechild = array(
'Machine_id' => $machinecode,
'Machine_Name'=> $machinename,
//'Machine_Code' => $machinecode,
//'Machine_Name'=> $machinename,
'Range' => $range,
'Operating_Range' => $operatingrange,
'Least_Count' => $leastcount,
@ -1093,7 +1098,7 @@ class batchcard extends BaseController
$addfilelist = array(
'Machine_code'=>$machinecode,
'Machile_filename'=>$filename
'Machine_filename'=>$filename
);
$this->batchcard_model->addfilelist($addfilelist);
//$updatefilelist= array_filter(array_map('array_filter',$updatefilelist ));

View File

@ -194,7 +194,6 @@ class batchcard_model extends CI_Model
return $res->result();
}
function addmaint_dtl($array)
{
$this->db->insert('T_Batchcard_MaintanceDetails',$array);
@ -221,8 +220,7 @@ class batchcard_model extends CI_Model
}
function getmaint_dtl_MntDate($dateval)
{
{
$this->db->select('*');
$this->db->from('T_Batchcard_MaintanceDetails');
$this->db->where('Maint_Date',$dateval);
@ -240,10 +238,13 @@ class batchcard_model extends CI_Model
}
function maintenancesdata($date,$Autostartstoptime){
$sql = "SELECT * FROM T_Batchcard_MaintanceDetails
where Maint_Date = '".$date."'";
$sql = "select bm.*,mm.Machine_Name
from T_Batchcard_MaintanceDetails as bm
left join T_Machine_Master as mm on bm.Machine_Code = mm.Machine_Code
where mm.Machines_Category = 'TRP'
and bm.Maint_Date = '".$date."'";
$res = $this->db->query($sql);
return $res->result();
return $res->result();
}
function getmachine_codename(){
$this->db->select('Machine_Code,Machine_Name');
@ -251,7 +252,7 @@ class batchcard_model extends CI_Model
$res = $this->db->get();
return $res->result();
}
/** Machines History/Master */
function getdept_dtls()
{
@ -356,7 +357,7 @@ class batchcard_model extends CI_Model
$this->db->from('T_Machine_Details');
if($MachineCode != '')
{
$this->db->where('Machine_id',$MachineCode );
$this->db->where('Machine_Code',$MachineCode );
}
$bmd = $this->db->get();
return $bmd->result();
@ -368,7 +369,7 @@ class batchcard_model extends CI_Model
$this->db->from('T_Machines_file');
if($MachineCode != '')
{
$this->db->where('Machine_Code',$MachineCode );
$this->db->where('Machine_code',$MachineCode );
}
$bmd = $this->db->get();
return $bmd->result();
@ -424,7 +425,7 @@ class batchcard_model extends CI_Model
}
function edithist_dtl($array,$machinecode){
$this->db->where('Machine_id',$machinecode );
$this->db->where('Machine_Code',$machinecode );
$this->db->update('T_Machine_Details',$array);
$mdtl = $this->db->affected_rows();
return $mdtl;
@ -478,6 +479,17 @@ class batchcard_model extends CI_Model
$ar = $this->db->affected_rows();
return $ar;
}
function getHist_tbls($MachineCode){
$this->db->select('T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,T_DepartmentDetails.DepartmentName');
$this->db->from('T_Machine_Master');
$this->db->join('T_Batchcard_MaintanceDetails','T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code');
$this->db->join('T_DepartmentDetails','T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept');
$this->db->where('T_Machine_Master.Machine_Code',$MachineCode);
$res = $this->db->get();
return $res->result();
}
}

View File

@ -5,6 +5,10 @@
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
#machs_category {
/* text-transform: capitalize; */
text-transform: uppercase;
}
</style>
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
@ -174,7 +178,7 @@
<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" />
<!-- <input type="reset" id='resetbtn' class="btn btn-primary" value="Reset" /> -->
</div>
</form>
</div><!--box body primary-->
@ -197,7 +201,7 @@
// reader.readAsDataURL(input.files[0]);
// }
// }
//$("#machs_pono").select2({ allowClear: true });
/** ready function */
$(function() {
@ -237,7 +241,7 @@ $(function() {
var data = suggestion.ConfigValue;
var selectedvalue = $('input[name=machs_category]').val();
if(selectedvalue=='lab')
if(selectedvalue=='LAB')
{
$("#lab").show();
}
@ -256,25 +260,24 @@ $(function() {
/** on change machines category */
$("#machs_category").change(function(){
var machine_category = $(this).val();
if(machine_category == 'lab'){
$("#lab").show();
}
else {
var machine_category = $(this).val().toUpperCase();
$("#lab").hide();}
// var machine_category = $(this).val().toLowerCase().replace(/\b[a-z]/g, function(letter) {
// return letter.toUpperCase();
// });
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);
var machine_pono = $(this).val();
//alert(machine_pono);
$.ajax({
data:{id:machine_category},
data:{id:machine_pono},
type:"POST",
url:"<?php echo base_url();?>batchcard/getPODtls",
success:function(data) {

View File

@ -1,4 +1,5 @@
<?php
//print_r($TableDatas);
$Machine_Code = '';
$Machine_Name ='';
$Machines_Make ='';
@ -21,8 +22,8 @@
$Calibration_Due='';
$Acceptence_Criteria='';
// $Machile_filename = '';
// $Machile_filepath = '';
// $Machine_filename = '';
// $Machine_filepath = '';
$filecount = '';
if(!empty($HistMstrEdit)){
@ -67,8 +68,8 @@
$filecount = count($HistFileEdit);
// foreach($HistFileEdit as $File)
// {
// $Machile_filename = $File->Machile_filename;
// $Machile_filepath = $File->Machile_filepath ;
// $Machine_filename = $File->Machine_filename;
// $Machine_filepath = $File->Machine_filepath ;
// }
}
@ -81,6 +82,10 @@
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
#machs_category {
/* text-transform: capitalize; */
text-transform: uppercase;
}
</style>
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
@ -113,7 +118,7 @@
<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;?>"/>
<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">
@ -230,6 +235,29 @@
</div>
</div>
<div class="col-md-12">
<legend>History Detail</legend>
<table id="History_Of_Table" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;" >
<thead>
<tr>
<th>S.No</th>
<th>Machine Department</th>
<th>Machine Catagories</th>
<th>Maintenances Types</th>
<th>Maintenances Date and Time </th>
<th>Maintenances Location</th>
<th>Maintenances Description</th>
<th>Maintenances Reason</th>
<th>Total hrs for Maintenances</th>
</tr>
</thead>
<tbody id="Hist_Append">
</tbody>
</table>
</div>
<div class="col-md-12">
<legend>Multiple File</legend>
@ -250,7 +278,7 @@
<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" />
<!-- <input type="reset" id="resetbtn" class="btn btn-primary" value="Reset" /> -->
</div>
</form>
</div><!--box body primary-->
@ -278,10 +306,13 @@
var index = 0 ;
var counter = 0;
var counterConstant = 0;
var sno = 1;
$(function() {
var pono_arr = [];
var dept_arr = [];
var file_arr = [];
var tble_arr = [];
$("#machs_dept").select2();
$("#machs_pono").select2();
@ -315,25 +346,49 @@ $(function() {
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/>'+
'<input type="text" id="db_machs_filename'+index+'" name="dbfilename'+index+'" class="form-control" value="'+fa.Machine_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>'+
// '<input type="file" id="filepath'+index+'" name="browseFiles'+index+'" onchange="readURL(this);" placeholder= "'+fa.Machine_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>'+
'<a href="'+mybaseurl+'/'+fa.Machine_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++;
});
tble_arr = <?php echo json_encode($TableDatas)?>;
//,Type,Maint_Subtype,,Maint_Time_from,Maint_Time_to,Maint_Total_hrs,Cost_Material,Cost_Labour
$.each(tble_arr,function(t,ta){
})
if(ta.Type == '0'){
Type = 'Maintenance';
}
else{
Type = 'Breakdown';
}
var html = '';
html += '<tr><td style="text-align:rignt;">'+sno+'</td>';
html += '<td style="text-align:right;">'+ta.Machines_Dept+' - '+ta.DepartmentName+'</td>';
html += '<td style="text-align:right;">'+ta.Machines_Category+'</td>';
html += '<td style="text-align:rignt;">'+Type+'</td>';
html += '<td style="text-align:right;">'+ta.Maint_Date+' / '+ta.Maint_Time+' hrs '+'</td>';
html += '<td style="text-align:right;">'+ta.Maint_Location+'</td>';
html += '<td style="text-align:right;">'+ta.Maint_Description+'</td>';
html += '<td style="text-align:right;">'+ta.Maint_Reason+'</td>';
html += '<td style="text-align:right;">'+ta.Maint_Total_hrs+'</td></tr>';
$('#Hist_Append').append(html);
sno++;
});
//foreach( as $File)
@ -350,51 +405,38 @@ $(function() {
var data = suggestion.ConfigValue;
var selectedvalue = $('input[name=machs_category]').val();
if(selectedvalue=='lab')
{
$("#lab").show();
}
else{
// // alert('bad');
$("#lab").hide();
}
if(selectedvalue=='LAB') { $("#lab").show(); }
else{ $("#lab").hide(); }
}
});
var lab = "<?php echo $Machines_Category ?>";
if(lab=='lab')
{
$("#lab").show();
}
if(lab == 'LAB') { $("#lab").show(); }
} );
// $("#resetbtn").click(function(){
// alert('0');
// $("#machs_dept").select2("val", "");
// $("#machs_pono").select2("val", "Select PONO");
// });
/** on change machines category */
$("#machs_category").change(function(){
var machine_category = $(this).val();
if(machine_category == 'lab'){
$("#lab").show();
}
else {
var machine_category = $(this).val().toUpperCase();
// var machine_category = $(this).val().toLowerCase().replace(/\b[a-z]/g, function(letter) {
// return letter.toUpperCase();
// });
if(machine_category == 'LAB'){ $("#lab").show(); }
else { $("#lab").hide(); }
$("#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);
var machine_pono = $(this).val();
//alert(machine_pono);
$.ajax({
data:{id:machine_category},
data:{id:machine_pono},
type:"POST",
url:"<?php echo base_url();?>batchcard/getPODtls",
success:function(data) {
@ -503,6 +545,7 @@ function Copyfilename(id)
var number = id.replace(/[^0-9]+/ig,"");
var name = $('input[name='+id+']')[0].files[0].name;
//alert(name);
$("#machs_filename"+number).val(name);
}

View File

@ -116,7 +116,7 @@
</div><!--box body -->
<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" />
<!-- <input type="reset" class="btn btn-primary" value="Reset" /> -->
</div>
</form>
</div><!--box body primary-->

View File

@ -150,7 +150,7 @@ if(!empty($MaintEdit))
</div><!--box body -->
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-primary" value="Update" />
<input type="reset" class="btn btn-primary" value="Reset" />
<!-- <input type="reset" class="btn btn-primary" value="Reset" /> -->
</div>
</form>
</div><!--box body primary-->

View File

@ -368,12 +368,13 @@ foreach($emplist as $r)
<table id="Maint_table" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;" >
<thead>
<tr>
<th colspan="7"><center>Maintenance Details</center></th>
<th colspan="8"><center>Maintenance Details</center></th>
<th colspan="3"><center>Time Taken for Maintenance</center></th>
<th colspan="2"><center>Cost Details</center></th>
</tr>
<tr>
<th>S.No</th>
<th>Machine Code and Name</th>
<th>Date</th>
<th>Time</th>
<th>Type</th>
@ -637,6 +638,7 @@ function keyValidate(e)
Type = 'Breakdown';
}
html += '<tr><td style="text-align:rignt;">'+Index+'</td>';
html += '<td style="text-align:left;">'+arr.Machine_Code+' - '+arr.Machine_Name+'</td>';
html += '<td style="text-align:right;">'+arr.Maint_Date+'</td>';
html += '<td style="text-align:right;">'+arr.Maint_Time+'</td>';
html += '<td style="text-align:left;">'+Type+'</td>';

View File

@ -378,12 +378,13 @@ foreach($emplist as $r)
<table id="Maint_table" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;" >
<thead>
<tr>
<th colspan="7"><center>Maintenance Details</center></th>
<th colspan="8"><center>Maintenance Details</center></th>
<th colspan="3"><center>Time Taken for Maintenance</center></th>
<th colspan="2"><center>Cost Details</center></th>
</tr>
<tr>
<th>S.No</th>
<th>Machine Code and Name</th>
<th>Date</th>
<th>Time</th>
<th>Type</th>
@ -485,6 +486,7 @@ var Index = 1;
Type = 'Breakdown';
}
html += '<tr><td style="text-align:rignt;">'+Index+'</td>';
html += '<td style="text-align:left;">'+arr.Machine_Code+' - '+arr.Machine_Name+'</td>';
html += '<td style="text-align:right;">'+arr.Maint_Date+'</td>';
html += '<td style="text-align:right;">'+arr.Maint_Time+'</td>';
html += '<td style="text-align:left;">'+Type+'</td>';