1661 lines
52 KiB
PHP
Executable File
1661 lines
52 KiB
PHP
Executable File
<style>
|
|
.edit{
|
|
|
|
background-color:#eeffcc;
|
|
|
|
}
|
|
.editrst{
|
|
|
|
background-color:#b9b5b5 ;
|
|
|
|
}
|
|
.editcst{
|
|
|
|
background-color:#ada5d2 ;
|
|
|
|
}
|
|
|
|
|
|
.loader ,.loader-overlay ,.overlay{
|
|
height: 4000px !important;
|
|
}
|
|
</style>
|
|
<?php
|
|
//color:red ! important;
|
|
//print_r($reportdata['masterreportafs']);
|
|
// foreach($reportdata['masterreportafs'] as $mas)
|
|
// {
|
|
// print_r($mas);
|
|
// echo "<br>";
|
|
// }
|
|
// $d = base_url().'uploads/INPROCESS'.$reportdata['master'][0]->document;
|
|
// echo $d;
|
|
|
|
$approvedby = array(-1=>'Select Approver Name');
|
|
foreach($emplist as $r)
|
|
{
|
|
$approvedby[$r->FirstName.' '.$r->LastName] = $r->FirstName.' '.$r->LastName.'-'.$r->shortName;
|
|
}
|
|
|
|
?>
|
|
<style>
|
|
th{
|
|
text-align:center !important;
|
|
}
|
|
|
|
|
|
</style>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
<script src="<?php echo base_url().'assets/jquery.plugin.js'?>"></script>
|
|
<script src="<?php echo base_url().'assets/jquery.timeentry.js'?>"></script>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Edit In Process Inspection Report Screen</center>
|
|
</h1>
|
|
</section>
|
|
<section class="content">
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools">
|
|
<div class="row">
|
|
<div class="col-md-3" id="savebutton">
|
|
<input type="button" id="submit" target="_blank" value = "Print" class="btn btn-primary" onclick="PrintFunction();">
|
|
</div>
|
|
</div>
|
|
</div><!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
|
|
|
|
<div class="box-body">
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label>Product</label>
|
|
<input type="text" class="form-control" value="<?php echo $reportdata['master'][0]->product_name .'-'.$reportdata['master'][0]->product_description;?>"><input type="hidden" id="productid" value="<?php echo $reportdata['master'][0]->productid;?>">
|
|
<form id="printPDF">
|
|
<input type="hidden" id="masterreportid" name="masterreportid" value="<?php echo $reportdata['master'][0]->masterreport_id;?>">
|
|
</form>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Customer</label>
|
|
<input type="text" class="form-control" value="<?php echo $reportdata['master'][0]->client_name;?>"><input type="hidden" id="customerid" value="<?php echo $reportdata['master'][0]->customerid;?>">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Batch No</label>
|
|
<input type="text" id="batchno" name="batchno" class="form-control" value="<?php echo $reportdata['master'][0]->batchno;?>">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Batch Date</label>
|
|
<input type="text" id="batchdate" name="batchdate" class="form-control" value="<?php echo date_format(date_create($reportdata['master'][0]->batchdate),'d-m-Y');?>">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-3">
|
|
<label>Plant Name</label>
|
|
<input type="text" id="plantname" name="plantname" class="form-control" value="<?php echo $reportdata['master'][0]->plantname;?>">
|
|
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label>Sand Description</label>
|
|
<input type="text" id="sanddesc" name="sanddesc" class="form-control" value="<?php echo $reportdata['master'][0]->sand_description;?>">
|
|
</div>
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label>Resin Description</label>
|
|
<input type="text" id="resindesc" name="resindesc" class="form-control" value="<?php echo $reportdata['master'][0]->resin_description;?>">
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label>Qty</label>
|
|
<input type="text" id="qty" name="qty" class="form-control ;" onkeypress="return keyValidate(event);" value="<?php echo $reportdata['master'][0]->qty;?>">
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<br/>
|
|
<table id="testreport" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
|
|
<thead style="background-color:#ddf;">
|
|
<tr>
|
|
|
|
<th width="3px">SNO</th>
|
|
<th>Description</th>
|
|
<th width="5px">Specification</br>Min</th>
|
|
<th width="5px">Specification</br>Max</th>
|
|
<th width="5px">Specification</br>UOM</th>
|
|
<th style="text-align:center;">ACT X1<input type="text" name="time1" id="time1" style="width:60px;" value="<?php echo $timearray[0];?>"></th>
|
|
<th style="text-align:center;">ACT X2<input type="text" name="time2" id="time2" style="width:60px;" value="<?php echo $timearray[1];?>"></th>
|
|
<th style="text-align:center;">ACT X3<input type="text" name="time3" id="time3" style="width:60px;" value="<?php echo $timearray[2];?>"></th>
|
|
<th style="text-align:center;">ACT X4<input type="text" name="time4" id="time4" style="width:60px;" value="<?php echo $timearray[3];?>"></th>
|
|
<th style="text-align:center;">ACT X5<input type="text" name="time5" id="time5" style="width:60px;" value="<?php echo $timearray[4];?>"></th>
|
|
<th style="text-align:center;">ACT X6<input type="text" name="time6" id="time6" style="width:60px;" value="<?php echo $timearray[5];?>"></th>
|
|
<th style="text-align:center;">ACT X7<input type="text" name="time7" id="time7" style="width:60px;" value="<?php echo $timearray[6];?>"></th>
|
|
<th style="text-align:center;">ACT X8<input type="text" name="time8" id="time8" style="width:60px;" value="<?php echo $timearray[7];?>"></th>
|
|
<th style="text-align:center;">SPECID</th>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="specAppend">
|
|
|
|
<?php
|
|
|
|
foreach($reportdata['masterreport'] as $key => $mas)
|
|
{
|
|
if($mas['stype'] == 0 )
|
|
{
|
|
$id = strtolower($mas['specname']);
|
|
$id = str_replace(' ', '', $id);
|
|
|
|
?>
|
|
<tr id="<?php echo ($key);?>"> <td><?php echo($key); ?></td> <td><?php echo $mas['specname'];?></td> <td><?php echo $mas['smin'];?></td> <td><?php echo $mas['smax'];?></td> <td><?php echo $mas['suom'];?></td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'1'?>"><?php echo $mas['0']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'2'?>"><?php echo $mas['1']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'3'?>"><?php echo $mas['2']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'4'?>"><?php echo $mas['3']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'5'?>"><?php echo $mas['4']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'6'?>"><?php echo $mas['5']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'7'?>"><?php echo $mas['6']?> </td>
|
|
|
|
<td class="edit" contenteditable="true" onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);" id="<?php echo $id.'8'?>"><?php echo $mas['7']?> </td>
|
|
|
|
<td><?php echo $mas['specid'];?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
</tbody>
|
|
</table>
|
|
<!-- <p> </p> -->
|
|
<hr>
|
|
|
|
|
|
|
|
</div>
|
|
<table id="testreport2" class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr><th>SNO</th>
|
|
<th style="width:30px">Description</th>
|
|
<th >Spec</br>Min</th>
|
|
<th >Spec</br>Max</th>
|
|
<th >Spec</br>UOM</th>
|
|
<th style="background:#b9b5b5;">RST Y1</th><th style="background:#b9b5b5;">RST Y2</th><th style="background:#b9b5b5;">RST Y3</th><th style="background:#ada5d2;">CST X1</th><th style="background:#ada5d2;">CST X2</th><th style="background:#ada5d2;">CST X3</th><th style="background:#ada5d2;">CST X4</th><th style="background:#ada5d2;">CST X5</th><th style="background:#ada5d2;">CST X6</th><th style="background:#ada5d2;">CST X7</th><th style="background:#ada5d2;">CST X8</th><th>SPECID</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="specAppend2">
|
|
|
|
<?php
|
|
$index = 0;
|
|
foreach($reportdata['masterreport'] as $key => $mas)
|
|
{
|
|
if($mas['stype'] == 1 )
|
|
{
|
|
$id = strtolower($mas['specname']);
|
|
$id = str_replace(' ', '', $id);
|
|
$index++;
|
|
|
|
|
|
?>
|
|
<tr id="<?php echo ($index);?>"> <td><?php echo($index); ?></td> <td><?php echo $mas['specname'];?></td> <td><?php echo $mas['smin'];?></td> <td><?php echo $mas['smax'];?></td> <td><?php echo $mas['suom'];?></td>
|
|
|
|
<td id="<?php echo $id.'rst1'?>"><?php echo $mas['0']?> </td>
|
|
|
|
<td id="<?php echo $id.'rst2'?>"><?php echo $mas['1']?> </td>
|
|
|
|
<td id="<?php echo $id.'rst3'?>"><?php echo $mas['2']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst1'?>"><?php echo $mas['3']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst2'?>"><?php echo $mas['4']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst3'?>"><?php echo $mas['5']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst4'?>"><?php echo $mas['6']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst5'?>"><?php echo $mas['7']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst6'?>"><?php echo $mas['8']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst7'?>"><?php echo $mas['9']?> </td>
|
|
|
|
<td id="<?php echo $id.'cst8'?>"><?php echo $mas['10']?> </td>
|
|
|
|
<td><?php echo $mas['specid'];?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
</tbody>
|
|
</table>
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-3"><b> AFS Details </b></div>
|
|
|
|
</div>
|
|
<div class="col-md-12"><div class="col-md-offset-3 col-md-2" style="margin-left:29%"><center><b>Raw Sand Tests</b></center></div>
|
|
<div class="col-md-6" style="text-align:center;"><center><b>Coated Sand Tests</b></center></div><div class="col-md-1" style="margin-left:-4%;"> </div></div>
|
|
|
|
<table id="afstable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
|
|
<th>NO</th><th>Factor</th><th>Sieve Size µm</th><th>Spec</th><th style="background:#b9b5b5;">RST Y1</th><th style="background:#b9b5b5;">RST Y2</th><th style="background:#b9b5b5;">RST Y3</th><th style="background:#ada5d2;">CST X1</th><th style="background:#ada5d2;">CST X2</th><th style="background:#ada5d2;">CST X3</th><th style="background:#ada5d2;">CST X4</th><th style="background:#ada5d2;">CST X5</th><th style="background:#ada5d2;">CST X6</th><th style="background:#ada5d2;">CST X7</th><th style="background:#ada5d2;">CST X8</th>
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="afsAppend">
|
|
<?php
|
|
$rst1total = 0;$rst2total = 0;$rst3total = 0;$cst1total = 0;$cst2total = 0;$cst3total = 0;$cst4total = 0;$cst5total = 0;$cst6total = 0;$cst7total = 0;$cst8total = 0;
|
|
foreach($reportdata['masterreportafs'] as $key => $afs)
|
|
{
|
|
|
|
$rst1total += $afs->rst1;$rst2total += $afs->rst2;$rst3total += $afs->rst3;
|
|
$cst1total += $afs->cst1;$cst2total += $afs->cst2;$cst3total += $afs->cst3;$cst4total += $afs->cst4;$cst5total += $afs->cst5;$cst6total += $afs->cst6;$cst7total += $afs->cst7;$cst8total += $afs->cst8;
|
|
|
|
?>
|
|
|
|
<tr id="<?php echo ($key+1);?>"> <td><?php echo ($key+1);?></td> <td id="<?php echo ($key+1).'factor';?>"> <?php echo $afs->factor; ?></td> <td><?php echo $afs->sieve_size;?></td> <td id="<?php echo ($key+1).'spec';?>" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
|
|
<!-- raw test sand -->
|
|
<td id="<?php echo ($key+1).'rst1'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->rst1;?></td>
|
|
<td id="<?php echo ($key+1).'rst2'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->rst2;?></td>
|
|
<td id="<?php echo ($key+1).'rst3'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->rst3;?></td>
|
|
<!-- coated test sand calculateAFS(this.parentNode.id,this.textContent,this.id);"-->
|
|
<td id="<?php echo ($key+1).'cst1'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst1;?></td>
|
|
<td id="<?php echo ($key+1).'cst2'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)"onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst2;?></td>
|
|
<td id="<?php echo ($key+1).'cst3'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst3;?></td>
|
|
<td id="<?php echo ($key+1).'cst4'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst4;?></td>
|
|
<td id="<?php echo ($key+1).'cst5'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst5;?></td>
|
|
<td id="<?php echo ($key+1).'cst6'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst6;?></td>
|
|
<td id="<?php echo ($key+1).'cst7'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst7;?></td>
|
|
<td id="<?php echo ($key+1).'cst8'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst8;?></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr id="12"> <td colspan="4">Total</td><td id="rst1total"><?php echo $rst1total;?></td><td id="rst2total"><?php echo $rst2total;?></td><td id="rst3total"><?php echo $rst3total;?></td><td id="cst1total"><?php echo $cst1total;?></td><td id="cst2total"><?php echo $cst2total;?></td><td id="cst3total"><?php echo $cst3total;?></td><td id="cst4total"><?php echo $cst4total;?></td><td id="cst5total"><?php echo $cst5total;?></td><td id="cst6total"><?php echo $cst6total;?></td><td id="cst7total"><?php echo $cst7total;?></td><td id="cst8total"><?php echo $cst8total;?></td> </tr>
|
|
|
|
</tfoot>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-3"><b> L.O.I Details </b></div>
|
|
|
|
</div>
|
|
<div id="loiarea">
|
|
<table id="loitable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
|
|
<thead style="background-color:#ddf">
|
|
<tr>
|
|
|
|
<th style="width:50px;">NO</th><th style="width:200px;">Description</th><th>Spec</th><th style="background:#b9b5b5;">RST Y1</th><th style="background:#b9b5b5;">RST Y2</th><th style="background:#b9b5b5;">RST Y3</th><th style="background:#ada5d2;">CST X1</th><th style="background:#ada5d2;">CST X2</th><th style="background:#ada5d2;">CST X3</th><th style="background:#ada5d2;">CST X4</th><th style="background:#ada5d2;">CST X5</th><th style="background:#ada5d2;">CST X6</th><th style="background:#ada5d2;">CST X7</th><th style="background:#ada5d2;">CST X8</th>
|
|
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
<tbody id="loiAppend">
|
|
|
|
<?php
|
|
$loitableids = array('fit','fot','ct','w1','w2','w3');
|
|
//echo $loitableids[0];
|
|
foreach($reportdata['masterreportloi'] as $key => $loi)
|
|
{
|
|
?>
|
|
|
|
|
|
<tr>
|
|
<td><?php echo ($key+1)?></td> <td><?php echo $loi->loidetails?></td>
|
|
<td class="edit" id="<?php echo $loitableids[$key].'spec';?>" contenteditable="true"><?php echo $loi->spec;?></td>
|
|
<td id="<?php echo $loitableids[$key].'rst1'?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->rst1;?></td>
|
|
<td id="<?php echo $loitableids[$key].'rst2'?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->rst2;?></td>
|
|
<td id="<?php echo $loitableids[$key].'rst3'?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->rst3;?></td>
|
|
|
|
<td id="<?php echo $loitableids[$key].'cst1'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst1;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst2'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst2;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst3'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst3;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst4'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst4;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst5'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst5;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst6'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst6;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst7'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst7;?></td>
|
|
<td id="<?php echo $loitableids[$key].'cst8'?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateLOI(this.parentNode.id,this.id,this.textContent)"><?php echo $loi->cst8;?></td>
|
|
</tr>
|
|
|
|
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <div class="row"> </div> -->
|
|
<div class="col-md-12">
|
|
<div class="col-md-3">
|
|
<label>File Upload:</label>
|
|
<form id="report_file" name="report_file" enctype="multipart/form-data" accept-charset="utf-8" method="POST" action="">
|
|
<input type="file" id="reportfile" onchange="readURL(this);" name="reportfile">
|
|
<input type="hidden" id="olddoc" value="<?php echo $reportdata['master'][0]->document;?>">
|
|
</form>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<img id="image" src="<?php echo base_url().'uploads/INPROCESS/'.$reportdata['master'][0]->document;?>" height="100px" width="100px" alt="NO IMAGE AVAILABLE"/>
|
|
</div>
|
|
<div class="col-md-7">
|
|
<label>Remarks:</label>
|
|
|
|
<textarea id="remarks" class="form-control" rows="1"><?php echo $reportdata['master'][0]->remarks; ?></textarea>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-md-12">
|
|
|
|
<div class="col-md-3">
|
|
<label>Inspected By :</label>
|
|
<input type="text" id="inspector" class="form-control" value="<?php echo $this->session->userdata ( 'name' );?>" readonly>
|
|
<input type="hidden" value="<?php echo $this->session->userdata ( 'userId' );?>">
|
|
</div>
|
|
|
|
<div class="col-md-3 col-md-offset-6 ">
|
|
<label>Approved By :</label>
|
|
<?php echo form_dropdown('name="approvedby"',$approvedby,set_value('approvedby',$approvedby[-1]),'id="approvedby"' ,'class="form-control select2', 'style="text-align:center;"');?>
|
|
<!-- <input type="text" id="approvedby" class="form-control"> -->
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div class="row"> </div> -->
|
|
<div>
|
|
<!-- <div class="row"> </div> -->
|
|
<div class="row">
|
|
<div class="col-md-3" id="savebutton">
|
|
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
|
|
</div>
|
|
</div>
|
|
</div><!-- /.box-body -->
|
|
<!-- <div class="box-footer clearfix">
|
|
|
|
</div> -->
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
|
|
$('#monthlylisting').DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"aaSorting": [[ 0, "asc" ]],
|
|
"info": true,
|
|
"autoWidth": true
|
|
|
|
});
|
|
});
|
|
//onkeypress="return keyValidate(event)" onkeyup="calculateAFS(this.parentNode.id,this.id,this.textContent)"
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
$("#loibutton").click(function(){
|
|
$("#loiarea").toggle("slow");
|
|
});
|
|
$("#afsbutton").click(function(){
|
|
$("#afsarea").toggle("slow");
|
|
});
|
|
$("#chartbutton").click(function(){
|
|
$("#chartarea").toggle("slow");
|
|
});
|
|
|
|
$('#batchdate').datepicker({
|
|
//minDate : 'year+16',
|
|
maxDate : 'now',
|
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
|
|
|
|
});
|
|
|
|
$('#customer').select2();
|
|
$('#product').select2();
|
|
$('#time1').timeEntry({show24Hours: true});
|
|
$('#time2').timeEntry({show24Hours: true});
|
|
$('#time3').timeEntry({show24Hours: true});
|
|
$('#time4').timeEntry({show24Hours: true});
|
|
$('#time5').timeEntry({show24Hours: true});
|
|
$('#time6').timeEntry({show24Hours: true});
|
|
$('#time7').timeEntry({show24Hours: true});
|
|
$('#time8').timeEntry({show24Hours: true});
|
|
|
|
//show_hide_column(13,false);
|
|
$('#approvedby').val('<?php echo $reportdata['master'][0]->approvedby?>');
|
|
show_hide_column(13,false,'testreport');
|
|
show_hide_column(16,false,'testreport2');
|
|
|
|
firstTimeValidateMastertable();
|
|
firstTimeValidateAFStable();
|
|
firstTimeValidateMastertable2();
|
|
|
|
}); // End of document on ready funciton
|
|
|
|
|
|
function keyValidate(e)
|
|
{
|
|
|
|
|
|
if(((e.which || e.keyCode) == 8) || ((e.which || e.keyCode) == 9) || ((e.which || e.keyCode) == 46) || ((e.which || e.keyCode) == 37) || ((e.which || e.keyCode) == 39) || ((e.which || e.keyCode) == 45))
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
if(e.keyCode == 13)
|
|
{
|
|
|
|
return false;
|
|
}
|
|
if(((e.which || e.keyCode) < 48) || ((e.which || e.keyCode) > 57))
|
|
{
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function calculateMaster1(id,pid)
|
|
{
|
|
var id = id;
|
|
var val = document.getElementById(id).textContent;
|
|
if(val == '0.00')
|
|
{
|
|
document.getElementById(id).textContent = '';
|
|
}
|
|
|
|
var ROW = $('#testreport').find('tr').eq(pid).find('td');
|
|
var min = '';
|
|
var max = '';
|
|
var curval = val;
|
|
//console.log(ROW);
|
|
$.each(ROW,function(i,item){
|
|
if(i == 2)
|
|
{
|
|
min = item.innerHTML;
|
|
}
|
|
else if(i == 3)
|
|
{
|
|
max = item.innerHTML;
|
|
}
|
|
});
|
|
min = parseFloat(min);
|
|
max = parseFloat(max);
|
|
curval = parseFloat(curval);
|
|
//console.log(min+'-'+max+'-'+curval);
|
|
id = '#'+id;
|
|
//console.log(id);
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(curval >= min && curval <= max)
|
|
{
|
|
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(curval >= min)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(curval <= max)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function getAllData()
|
|
{
|
|
|
|
|
|
if($('#customer').val() == -1 || $('#product').val() == -1)
|
|
{
|
|
alert('Please Select Product and Customer');
|
|
return false;
|
|
}
|
|
if($('#batchno').val() == '' || $('#batchdate').val() == '' || $('#plantname').val() == '' || $('#resindesc').val() == '' ||$('#sanddesc').val() == '' ||$('#qty').val() == '' || $('#approvedby').val() == -1)
|
|
{
|
|
alert('Please Provide all Master details like BatchNo, ApprovedBy,etc');
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
var testreportdata = $("#testreport").tableToJSON();
|
|
var testloidata = $("#loitable").tableToJSON();
|
|
var testafsdata = $("#afstable").tableToJSON();
|
|
var testreportdata2 = $("#testreport2").tableToJSON();
|
|
|
|
testreportdata=JSON.stringify(testreportdata);
|
|
//alert(testreportdata);
|
|
testreportdata2=JSON.stringify(testreportdata2);
|
|
//alert(testreportdata2);exit();
|
|
testloidata=JSON.stringify(testloidata);
|
|
testafsdata=JSON.stringify(testafsdata);
|
|
|
|
|
|
var productid = $('#productid').val();
|
|
var customerid = $('#customerid').val();
|
|
var approvedby = $('#approvedby').val();
|
|
var batchno = $('#batchno').val();
|
|
var batchdate = $('#batchdate').val();
|
|
var plantname = $('#plantname').val();
|
|
var sanddesc = $('#sanddesc').val();
|
|
var resindesc = $('#resindesc').val();
|
|
var qty = $('#qty').val();
|
|
var remarks = $('#remarks').val();
|
|
var masterid = $('#masterreportid').val();
|
|
var olddoc = $('#olddoc').val();
|
|
|
|
var times = new Array($('#time1').val(),$('#time2').val(),$('#time3').val(),$('#time4').val(),$('#time5').val(),$('#time6').val(),$('#time7').val(),$('#time8').val());
|
|
|
|
|
|
var formData = new FormData();
|
|
var reportfile = $("#reportfile").prop('files')[0];
|
|
formData.append('rfile',reportfile);
|
|
|
|
var param1 = testreportdata;
|
|
var param2 = testreportdata2;
|
|
var param3= testafsdata;
|
|
var param4 = testloidata;
|
|
var param5 = productid;
|
|
var param6 = customerid;
|
|
var param7 = batchno;
|
|
var param8 = batchdate;
|
|
var param9 = plantname;
|
|
var param10 = sanddesc;
|
|
var param11 = resindesc;
|
|
var param12 = qty;
|
|
var param13 = times;
|
|
var param14 = approvedby;
|
|
var param15 = remarks;
|
|
var param16 = masterid;
|
|
var param17 = olddoc;
|
|
|
|
formData.append('param1',param1);
|
|
formData.append('param2',param2);
|
|
formData.append('param3',param3);
|
|
formData.append('param4',param4);
|
|
formData.append('param5',param5);
|
|
formData.append('param6',param6);
|
|
formData.append('param7',param7);
|
|
formData.append('param8',param8);
|
|
formData.append('param9',param9);
|
|
formData.append('param10',param10);
|
|
formData.append('param11',param11);
|
|
formData.append('param12',param12);
|
|
formData.append('param13',param13);
|
|
formData.append('param14',param14);
|
|
formData.append('param15',param15);
|
|
formData.append('param16',param16);
|
|
formData.append('param17',param17);
|
|
|
|
$('.content').loader('show');
|
|
$.ajax({
|
|
data:formData,
|
|
//dataType:"json",{param1:testreportdata,param2:testloidata,param3:testafsdata,param4:invoiceno,param5:batchno,param6:approvedby,param7:fullQuality}
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>inprocess/updateTestReportData",
|
|
//async : false,
|
|
cache : false,
|
|
contentType : false,
|
|
processData : false,
|
|
success:function(data) {
|
|
if(data){
|
|
alert(data);
|
|
$('.content').loader('hide');
|
|
|
|
window.location = "<?php echo base_url().'inprocess';?>";
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
//
|
|
}
|
|
|
|
|
|
|
|
var firsttimecallingloi = 0;
|
|
function calculateLOI(pid,cid,cvalue)
|
|
{
|
|
|
|
var cid = cid;
|
|
var cvalue = cvalue;
|
|
var pid = pid;
|
|
// console.log(pid+'-'+cid+'-'+cvalue);
|
|
if($('#customer').val() == -1 || $('#product').val() == -1)
|
|
{
|
|
alert('Please Select Product and Customer');
|
|
document.getElementById(cid).textContent = '0.00';
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
// LOI CALCULAITON FORMULA ((w2-w3)/(w2-w1))*100
|
|
|
|
var typeid = cid.substr(-4);
|
|
// alert(typeid);
|
|
var w1id = 'w1'+typeid;
|
|
var w2id = 'w2'+typeid;
|
|
var w3id = 'w3'+typeid;
|
|
var w1value = parseFloat(document.getElementById(w1id).textContent);
|
|
var w2value = parseFloat(document.getElementById(w2id).textContent);
|
|
var w3value = parseFloat(document.getElementById(w3id).textContent);
|
|
// console.log(w1value+'-'+w2value+'-'+w3value);
|
|
if(isNaN(w1value)){ w1value = 0.00;}
|
|
if(isNaN(w2value)){ w2value = 0.00;}
|
|
if(isNaN(w3value)){ w3value = 0.00;}
|
|
|
|
var finalloivalue = parseFloat(( (w2value - w3value) / (w2value - w1value) ) * 100 ).toFixed(2);
|
|
if(isNaN(finalloivalue)){ finalloivalue = 0.00; }
|
|
var finalid = '';
|
|
// alert(typeid.substr(0,3));exit();
|
|
if(typeid.substr(0,3) == 'rst')
|
|
{
|
|
finalid = 'loirawsand'+typeid;
|
|
}
|
|
else if(typeid.substr(0,3) == 'cst')
|
|
{
|
|
var num = typeid.substr(-1);
|
|
finalid = 'loicoatedsand'+num;
|
|
}
|
|
|
|
if(document.getElementById(finalid))
|
|
{
|
|
document.getElementById(finalid).textContent = finalloivalue;
|
|
}
|
|
|
|
for(var i=1;i<=8;i++)
|
|
{
|
|
var id = 'loirawsandcst'+ i;
|
|
document.getElementById(id).textContent = 'NA';
|
|
document.getElementById(id).style.backgroundColor = '#5a5757';
|
|
document.getElementById(id).style.color = 'white';
|
|
}
|
|
|
|
for(var i=1;i<=8;i++)
|
|
{
|
|
var id = 'loicoatedsand'+ i;
|
|
if(firsttimecallingloi == 0)
|
|
{
|
|
document.getElementById(id).style.backgroundColor = 'white';
|
|
}
|
|
document.getElementById(id).contentEditable = "false";
|
|
}
|
|
|
|
//FOR BACKGROUND COLOR CHANGE IN TESTREPORT2 TABLE RAW SAND LOI FNAL RESULT
|
|
var masterrowid = document.getElementById(finalid).parentNode.id
|
|
//alert(masterrowid);exit();
|
|
var masterRow = 0;
|
|
if(typeid.substr(0,3) == 'rst')
|
|
{
|
|
var masterRow = $('#testreport2').find('tr').eq(masterrowid).find('td');
|
|
}
|
|
else
|
|
{
|
|
var masterRow = $('#testreport').find('tr').eq(masterrowid).find('td');
|
|
}
|
|
|
|
var min = '';
|
|
var max = '';
|
|
//var curval = val;
|
|
//console.log(ROW);
|
|
$.each(masterRow,function(i,item){
|
|
if(i == 2)
|
|
{
|
|
min = item.innerHTML;
|
|
}
|
|
else if(i == 3)
|
|
{
|
|
max = item.innerHTML;
|
|
}
|
|
});
|
|
min = parseFloat(min);
|
|
max = parseFloat(max);
|
|
curval = parseFloat(finalloivalue);
|
|
//console.log(min+'-'+max+'-'+curval);
|
|
afsid = '#'+finalid;
|
|
//console.log(id);
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(curval >= min && curval <= max)
|
|
{
|
|
|
|
$(afsid).css("background-color", "#fffff");
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(curval >= min)
|
|
{
|
|
$(afsid).css("background-color", "#fffff");
|
|
}
|
|
else
|
|
{
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(curval <= max)
|
|
{
|
|
$(afsid).css("background-color", "#fffff");
|
|
}
|
|
else
|
|
{
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//FOR BACKGROUND COLOR CHANGE IN TESTREPORT1 TABLE COATED SAND LOI FINAL VALUE
|
|
}
|
|
firsttimecallingloi++;
|
|
}
|
|
|
|
|
|
function calculateAFS(pid,cid,cvalue)
|
|
{
|
|
|
|
var cid = cid;
|
|
var cvalue = cvalue;
|
|
var pid = pid;
|
|
if($('#customer').val() == -1 || $('#product').val() == -1)
|
|
{
|
|
alert('Please Select Product and Customer');
|
|
document.getElementById(cid).textContent = '0.00';
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
|
|
// console.log(pid+'-'+cid+'-'+cvalue);
|
|
var Row = $('#afstable').find('tr').eq(pid).find('td');
|
|
//console.log(Row);
|
|
var tempcid = cid.substr(-4);
|
|
// console.log(tempcid);
|
|
if(tempcid != 'spec')
|
|
{
|
|
// FOR background change
|
|
|
|
|
|
|
|
$.each(Row,function(i,item){
|
|
if(i == 3)
|
|
{
|
|
var spec = item.innerHTML;
|
|
//spec = parseFloat(spec);
|
|
//alert(spec);
|
|
cvalue = parseFloat(cvalue);
|
|
var id = '#'+cid;
|
|
//console.log(spec+'-'+cvalue+id);
|
|
if(!isNaN(spec))
|
|
{
|
|
//console.log('inside if');
|
|
|
|
if(cvalue != spec)
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
//console.log('red');
|
|
}
|
|
else
|
|
{
|
|
if(id.includes('rst'))
|
|
{
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
else if(id.includes('cst'))
|
|
{
|
|
$(id).css("background-color", "#ada5d2");
|
|
}
|
|
//console.log('green');ada5d2 - blue
|
|
}
|
|
}
|
|
else if(isNaN(spec))
|
|
{
|
|
var min = '';
|
|
var max = '';
|
|
spec = spec.split('-');
|
|
min = parseFloat(spec[0]);
|
|
max = parseFloat(spec[1]);
|
|
//console.log(min+'-'+max);
|
|
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(cvalue >= min && cvalue <= max)
|
|
{
|
|
|
|
$(id).css("background-color", "#b9b5b5");
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(cvalue >= min)
|
|
{
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(cvalue <= max)
|
|
{
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}); // FOR background change
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
// console.log('inside spec');
|
|
if(!isNaN(cvalue))
|
|
{
|
|
for(var i = 1;i<=3;i++)
|
|
{
|
|
var id = pid+'rst'+i;
|
|
//console.log(id);
|
|
var val = document.getElementById(id).textContent;
|
|
val = parseFloat(val);
|
|
// console.log(val+'-'+cvalue);
|
|
id = '#'+id;
|
|
if(cvalue != val)
|
|
{
|
|
// console.log('red');
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
else
|
|
{
|
|
// console.log('normel');
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
}
|
|
for(var i = 1;i<=8;i++)
|
|
{
|
|
var id = pid+'cst'+i;
|
|
// console.log(id);
|
|
var val = document.getElementById(id).textContent;
|
|
val = parseFloat(val);
|
|
// console.log(val+'-'+cvalue);
|
|
id = '#'+id;
|
|
if(cvalue != val)
|
|
{
|
|
// console.log('red');
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
else
|
|
{
|
|
// console.log('normel');
|
|
$(id).css("background-color", "#ada5d2");
|
|
}
|
|
}
|
|
}
|
|
else if(isNaN(cvalue))
|
|
{
|
|
var min = '';
|
|
var max = '';
|
|
cvalue = cvalue.split('-');
|
|
min = parseFloat(cvalue[0]);
|
|
max = parseFloat(cvalue[1]);
|
|
//console.log('spec edit'+min+'-'+max);
|
|
//console.log('spec split'+cvalue[0]+'-'+cvalue[1]);
|
|
for(var i = 1;i<=3;i++)
|
|
{
|
|
var id = pid+'rst'+i;
|
|
|
|
var val = document.getElementById(id).textContent;
|
|
id = '#'+id;
|
|
|
|
|
|
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(val >= min && val <= max)
|
|
{
|
|
//console.log('normal');
|
|
$(id).css("background-color", "#b9b5b5");
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
//console.log('red');
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(val >= min)
|
|
{
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(val <= max)
|
|
{
|
|
$(id).css("background-color", "#b9b5b5");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
}
|
|
|
|
for(var i = 1;i<=8;i++)
|
|
{
|
|
var id = pid+'cst'+i;
|
|
|
|
var val = document.getElementById(id).textContent;
|
|
id = '#'+id;
|
|
|
|
|
|
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(val >= min && val <= max)
|
|
{
|
|
//console.log('normal');
|
|
$(id).css("background-color", "#ada5d2");
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
//console.log('red');
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(val >= min)
|
|
{
|
|
$(id).css("background-color", "#ada5d2");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(val <= max)
|
|
{
|
|
$(id).css("background-color", "#ada5d2");
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} //End of All background Color change
|
|
|
|
|
|
// Total and AFS Calculation
|
|
if(tempcid != 'spec')
|
|
{
|
|
var totalid = tempcid+'total';
|
|
// console.log('AFS Calculation');
|
|
var total = 0.00;
|
|
var product = 0.00;
|
|
var factor = [0,5,10,20,30,40,50,70,100,140,200,300];
|
|
var finalafsvalue= 0;
|
|
for(var i=1;i<=11;i++)
|
|
{
|
|
|
|
var id = i+tempcid;
|
|
var eachval = document.getElementById(id).textContent;
|
|
if(!isNaN(eachval))
|
|
{
|
|
total += parseFloat(eachval);
|
|
product += (parseFloat(eachval) * factor[i]);
|
|
}
|
|
}
|
|
|
|
if(isNaN(total)){total = 0.00;}
|
|
document.getElementById(totalid).textContent = parseFloat(total).toFixed(2);
|
|
totalid = '#'+totalid;
|
|
if(total != 100)
|
|
{
|
|
$(totalid).css("background-color", "#ffcccc");
|
|
}
|
|
else
|
|
{
|
|
$(totalid).css("background-color", "#fffff");
|
|
}
|
|
finalafsvalue = parseFloat(product/total).toFixed(2);
|
|
if(isNaN(finalafsvalue)){ finalafsvalue = '0.00'; }
|
|
//console.log(finalafsvalue);
|
|
var afsid = 'afs'+tempcid;
|
|
if(document.getElementById(afsid))
|
|
{
|
|
document.getElementById(afsid).textContent = finalafsvalue;
|
|
var masterrowid = document.getElementById(afsid).parentNode.id
|
|
// console.log('master row id' + masterrowid);
|
|
var masterRow = $('#testreport2').find('tr').eq(masterrowid).find('td');
|
|
var min = '';
|
|
var max = '';
|
|
var curval = val;
|
|
//console.log(ROW);
|
|
$.each(masterRow,function(i,item){
|
|
if(i == 2)
|
|
{
|
|
min = item.innerHTML;
|
|
}
|
|
else if(i == 3)
|
|
{
|
|
max = item.innerHTML;
|
|
}
|
|
});
|
|
min = parseFloat(min);
|
|
max = parseFloat(max);
|
|
curval = parseFloat(curval);
|
|
//console.log(min+'-'+max+'-'+curval);
|
|
afsid = '#'+afsid;
|
|
//console.log(id);
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(finalafsvalue >= min && finalafsvalue <= max)
|
|
{
|
|
|
|
$(afsid).css("background-color", "#fffff");
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(finalafsvalue >= min)
|
|
{
|
|
$(afsid).css("background-color", "#fffff");
|
|
}
|
|
else
|
|
{
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(finalafsvalue <= max)
|
|
{
|
|
$(afsid).css("background-color", "#fffff");
|
|
}
|
|
else
|
|
{
|
|
$(afsid).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // END OF FIRST IF ELSE
|
|
} //END OF CALCULAITON AFS
|
|
|
|
|
|
$('td').focusin(function(e){
|
|
|
|
|
|
var id = e.target.id;
|
|
var value = document.getElementById(id).textContent;
|
|
if(value == 0 )
|
|
{
|
|
document.getElementById(id).textContent = '';
|
|
}
|
|
});
|
|
|
|
$('td').focusout(function(e){
|
|
|
|
var id = e.target.id;
|
|
|
|
var value = document.getElementById(id).textContent;
|
|
|
|
if(value == '' )
|
|
{
|
|
document.getElementById(id).textContent = parseFloat(0.00).toFixed(2);
|
|
}
|
|
});
|
|
|
|
function show_hide_column(col_no, do_show, tableid) {
|
|
var rows = document.getElementById(tableid).rows;
|
|
|
|
for (var row = 0; row < rows.length; row++) {
|
|
var cols = rows[row].cells;
|
|
if (col_no >= 0 && col_no < cols.length) {
|
|
cols[col_no].style.display = do_show ? '' : 'none';
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function readURL(input) {
|
|
if (input.files && input.files[0]) {
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = function (e) {
|
|
$('#image')
|
|
.attr('src', e.target.result)
|
|
.width(150)
|
|
.height(200);
|
|
};
|
|
|
|
reader.readAsDataURL(input.files[0]);
|
|
}
|
|
}
|
|
|
|
|
|
//Funciton for validate all values while data first time loading
|
|
function firstTimeValidateMastertable()
|
|
{
|
|
|
|
// VALIDATE testreport Values
|
|
var ROWCOUNT = $('#testreport tr').length;
|
|
//alert(ROWCOUNT);
|
|
for (x=1;x<14;x++){
|
|
|
|
|
|
var ROW = document.getElementById("testreport").rows[x].getElementsByTagName("td");
|
|
|
|
|
|
|
|
min = parseFloat(ROW[2].innerText);
|
|
max = parseFloat(ROW[3].innerText);
|
|
var X1 = parseFloat(ROW[5].innerText);
|
|
var X1id = ROW[5].id;
|
|
|
|
var X2 = parseFloat(ROW[6].innerText);
|
|
var X2id = ROW[6].id;
|
|
|
|
var X3 = parseFloat(ROW[7].innerText);
|
|
var X3id = ROW[7].id;
|
|
|
|
var X4 = parseFloat(ROW[8].innerText);
|
|
var X4id = ROW[8].id;
|
|
|
|
var X5 = parseFloat(ROW[9].innerText);
|
|
var X5id = ROW[9].id;
|
|
|
|
var X6 = parseFloat(ROW[10].innerText);
|
|
var X6id = ROW[10].id;
|
|
|
|
var X7 = parseFloat(ROW[11].innerText);
|
|
var X7id = ROW[11].id;
|
|
|
|
var X8 = parseFloat(ROW[12].innerText);
|
|
var X8id = ROW[12].id;
|
|
|
|
|
|
for(j=1;j<=8;j++)
|
|
{
|
|
|
|
var id = eval('X'+j+'id');
|
|
id = '#'+id;
|
|
var curval = 'X'+j;
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) >= min && eval(curval) <= max)
|
|
{
|
|
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(eval(curval) >= min)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) <= max)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
} //END OF SECOND LOOP
|
|
}// END OF FOR LOOP
|
|
|
|
|
|
}
|
|
|
|
|
|
// VALIDATE afstable reports Values
|
|
function firstTimeValidateAFStable()
|
|
{
|
|
|
|
|
|
var ROWCOUNT = $('#afstable tr').length;
|
|
//alert(ROWCOUNT);
|
|
for (x=1;x<=11;x++){
|
|
|
|
|
|
var ROW = document.getElementById("afstable").rows[x].getElementsByTagName("td");
|
|
|
|
|
|
|
|
var spec = ROW[3].innerText;
|
|
|
|
|
|
var X1 = parseFloat(ROW[4].innerText);
|
|
var X1id = ROW[4].id;
|
|
|
|
var X2 = parseFloat(ROW[5].innerText);
|
|
var X2id = ROW[5].id;
|
|
|
|
var X3 = parseFloat(ROW[6].innerText);
|
|
var X3id = ROW[6].id;
|
|
|
|
var X4 = parseFloat(ROW[7].innerText);
|
|
var X4id = ROW[7].id;
|
|
|
|
var X5 = parseFloat(ROW[8].innerText);
|
|
var X5id = ROW[8].id;
|
|
|
|
var X6 = parseFloat(ROW[9].innerText);
|
|
var X6id = ROW[9].id;
|
|
|
|
var X7 = parseFloat(ROW[10].innerText);
|
|
var X7id = ROW[10].id;
|
|
|
|
var X8 = parseFloat(ROW[11].innerText);
|
|
var X8id = ROW[11].id;
|
|
|
|
var X9 = parseFloat(ROW[12].innerText);
|
|
var X9id = ROW[12].id;
|
|
|
|
var X10 = parseFloat(ROW[13].innerText);
|
|
var X10id = ROW[13].id;
|
|
|
|
var X11 = parseFloat(ROW[14].innerText);
|
|
var X11id = ROW[14].id;
|
|
//console.log(X1+'-'+X2+'-'+X3+'-'+X4+'-'+X5+'-'+X6+'-'+X7+'-'+X8+'-'+X9+'-'+X10+'-'+X11);
|
|
if(!isNaN(spec))
|
|
{
|
|
//console.log("NUMBER");
|
|
for(j=1;j<=11;j++)
|
|
{
|
|
|
|
var id = eval('X'+j+'id');
|
|
id = '#'+id;
|
|
var curval = 'X'+j;
|
|
|
|
if(eval(curval) == spec)
|
|
{
|
|
if(j<=3){
|
|
$(id).css("background-color", "#b9b5b5");}
|
|
else { $(id).css("background-color", "#ada5d2"); }
|
|
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
|
|
}
|
|
}
|
|
else if(isNaN(spec))
|
|
{
|
|
//console.log("NOT A NUMBER");
|
|
spec = spec.split('-');
|
|
|
|
var min = parseFloat(spec[0]);var max = parseFloat(spec[1]);
|
|
//console.log(min+'-'+max);
|
|
if(!isNaN(spec[0]) && !isNaN(spec[1]))
|
|
{
|
|
|
|
// console.log('BOTH GOOD');
|
|
|
|
|
|
for(j=1;j<=11;j++)
|
|
{
|
|
//console.log('11 Loop');
|
|
var id = eval('X'+j+'id');
|
|
id = '#'+id;
|
|
var curval = 'X'+j;
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) >= min && eval(curval) <= max)
|
|
{
|
|
|
|
if(j<=3){
|
|
$(id).css("background-color", "#b9b5b5");}
|
|
else { $(id).css("background-color", "#ada5d2"); }
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(eval(curval) >= min)
|
|
{
|
|
if(j<=3){
|
|
$(id).css("background-color", "#b9b5b5");}
|
|
else { $(id).css("background-color", "#ada5d2"); }
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) <= max)
|
|
{
|
|
if(j<=3){
|
|
$(id).css("background-color", "#b9b5b5");}
|
|
else { $(id).css("background-color", "#ada5d2"); }
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
} //END OF SECOND LOOP
|
|
|
|
}
|
|
}// END OF isNaN ELSE PART
|
|
}// END OF FOR LOOP
|
|
|
|
var ROWS = document.getElementById("afstable").rows[12].getElementsByTagName("td");
|
|
|
|
for(a=1;a<=11;a++)
|
|
{
|
|
if( parseFloat(ROWS[a].innerText) != 100)
|
|
{
|
|
var id = '#'+ROWS[a].id;
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//VALIDATE Master TABLE 2
|
|
|
|
function firstTimeValidateMastertable2()
|
|
{
|
|
|
|
// VALIDATE testreport Values
|
|
var ROWCOUNT = $('#testreport2 tr').length;
|
|
//alert(ROWCOUNT);
|
|
for (x=1;x<ROWCOUNT;x++){
|
|
|
|
|
|
var ROW = document.getElementById("testreport2").rows[x].getElementsByTagName("td");
|
|
|
|
|
|
|
|
min = parseFloat(ROW[2].innerText);
|
|
max = parseFloat(ROW[3].innerText);
|
|
var X1 = parseFloat(ROW[5].innerText);
|
|
var X1id = ROW[5].id;
|
|
|
|
var X2 = parseFloat(ROW[6].innerText);
|
|
var X2id = ROW[6].id;
|
|
|
|
var X3 = parseFloat(ROW[7].innerText);
|
|
var X3id = ROW[7].id;
|
|
|
|
var X4 = parseFloat(ROW[8].innerText);
|
|
var X4id = ROW[8].id;
|
|
|
|
var X5 = parseFloat(ROW[9].innerText);
|
|
var X5id = ROW[9].id;
|
|
|
|
var X6 = parseFloat(ROW[10].innerText);
|
|
var X6id = ROW[10].id;
|
|
|
|
var X7 = parseFloat(ROW[11].innerText);
|
|
var X7id = ROW[11].id;
|
|
|
|
var X8 = parseFloat(ROW[12].innerText);
|
|
var X8id = ROW[12].id;
|
|
|
|
var X9 = parseFloat(ROW[13].innerText);
|
|
var X9id = ROW[13].id;
|
|
|
|
var X10 = parseFloat(ROW[14].innerText);
|
|
var X10id = ROW[14].id;
|
|
|
|
var X11 = parseFloat(ROW[15].innerText);
|
|
var X11id = ROW[15].id;
|
|
|
|
|
|
for(j=1;j<=11;j++)
|
|
{
|
|
|
|
var id = eval('X'+j+'id');
|
|
id = '#'+id;
|
|
// console.log(id);
|
|
var curval = 'X'+j;
|
|
if($.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) >= min && eval(curval) <= max)
|
|
{
|
|
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$(id).css("background-color", "#ffcccc");
|
|
|
|
}
|
|
}
|
|
else if($.isNumeric(min) && !($.isNumeric(max)))
|
|
{
|
|
if(eval(curval) >= min)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
else if(!$.isNumeric(min) && $.isNumeric(max))
|
|
{
|
|
if(eval(curval) <= max)
|
|
{
|
|
$(id).css("background-color", "#eeffcc");//green color
|
|
}
|
|
else
|
|
{
|
|
$(id).css("background-color", "#ffcccc");
|
|
}
|
|
}
|
|
|
|
} //END OF SECOND LOOP
|
|
}// END OF FOR LOOP
|
|
|
|
|
|
}
|
|
|
|
|
|
function PrintFunction()
|
|
{
|
|
$('#printPDF').attr('action', '<?php echo base_url() ?>inprocess/printIndInprocessReport');
|
|
$('#printPDF').attr('method', 'post');
|
|
$('#printPDF').submit();
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|