ria/app/Views/editNissanInprocessReport.php
2024-09-25 17:45:32 +05:30

3141 lines
100 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['masterreportloi']);
$type = "";
$afsdata5 = array();
$afsdata7 = array();
if ($reportdata['master'][0]->subtype == 0) {
$type = 'Type 5';
$afsdata5 = $reportdata['masterreportafs'];
} else {
$type = 'Type 7';
$afsdata7 = $reportdata['masterreportafs'];
}
// echo "******************Type 5***********************";
// print_r($afsdata5);
// echo "******************Type 7***********************";
// print_r($afsdata7);
$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() ?>public/assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url() ?>public/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" onload="clearItForm.reset();">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Edit/View In Process Inspection(Nissan) Report Screen - <span id="typename"><?php echo $type; ?></span></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-success" onclick="PrintFunction();">
</div>
</div>
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<label>Product</label>
<input type="text" id="productname" class="form-control" value="<?php echo $reportdata['master'][0]->product_name; ?>" readonly>
<input type="hidden" id="product" name="product" value="<?php echo $reportdata['master'][0]->productid; ?>">
<form id="printPDF">
<input type="hidden" id="masterid" name="masterreportid" value="<?php echo $reportdata['master'][0]->masterreport_id; ?>">
</form>
</div>
<div class="col-md-3">
<label>Customer</label>
<input type="text" id="customername" class="form-control" value="<?php echo $reportdata['master'][0]->client_name; ?>" readonly>
<input type="hidden" id="customer" name="customer" 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 format_date($reportdata['master'][0]->batchdate, 0, '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-1">
<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 class="col-md-2">
<label>Type</label>
<input type="text" id="type" name="type" class="form-control" value="<?php echo $type; ?>" readonly />
</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: #00d976;;">
<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>&nbsp;</p>
<hr>
<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>
<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%;">&nbsp;</div>
</div>
<table id="afstabletype7" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
<thead>
<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
$rst1total1 = 0;
$rst2total1 = 0;
$rst3total1 = 0;
$cst1total1 = 0;
$cst2total1 = 0;
$cst3total1 = 0;
$cst4total1 = 0;
$cst5total1 = 0;
$cst6total1 = 0;
$cst7total1 = 0;
$cst8total1 = 0;
$rst1total2 = 0;
$rst2total2 = 0;
$rst3total2 = 0;
$cst1total2 = 0;
$cst2total2 = 0;
$cst3total2 = 0;
$cst4total2 = 0;
$cst5total2 = 0;
$cst6total2 = 0;
$cst7total2 = 0;
$cst8total2 = 0;
$rst1total3 = 0;
$rst2total3 = 0;
$rst3total3 = 0;
$cst1total3 = 0;
$cst2total3 = 0;
$cst3total3 = 0;
$cst4total3 = 0;
$cst5total3 = 0;
$cst6total3 = 0;
$cst7total3 = 0;
$cst8total3 = 0;
$rst1total = 0;
$rst2total = 0;
$rst3total = 0;
$cst1total = 0;
$cst2total = 0;
$cst3total = 0;
$cst4total = 0;
$cst5total = 0;
$cst6total = 0;
$cst7total = 0;
$cst8total = 0;
foreach ($afsdata7 as $key => $afs) {
if ($key == 10) {
$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;
}
if ($key == 9 || $key == 8) {
$rst1total3 += $afs->rst1;
$rst2total3 += $afs->rst2;
$rst3total3 += $afs->rst3;
$cst1total3 += $afs->cst1;
$cst2total3 += $afs->cst2;
$cst3total3 += $afs->cst3;
$cst4total3 += $afs->cst4;
$cst5total3 += $afs->cst5;
$cst6total3 += $afs->cst6;
$cst7total3 += $afs->cst7;
$cst8total3 += $afs->cst8;
}
if ($key == 6 || $key == 7) {
$rst1total2 += $afs->rst1;
$rst2total2 += $afs->rst2;
$rst3total2 += $afs->rst3;
$cst1total2 += $afs->cst1;
$cst2total2 += $afs->cst2;
$cst3total2 += $afs->cst3;
$cst4total2 += $afs->cst4;
$cst5total2 += $afs->cst5;
$cst6total2 += $afs->cst6;
$cst7total2 += $afs->cst7;
$cst8total2 += $afs->cst8;
}
if ($key >= 0 && $key <= 5) {
$rst1total1 += $afs->rst1;
$rst2total1 += $afs->rst2;
$rst3total1 += $afs->rst3;
$cst1total1 += $afs->cst1;
$cst2total1 += $afs->cst2;
$cst3total1 += $afs->cst3;
$cst4total1 += $afs->cst4;
$cst5total1 += $afs->cst5;
$cst6total1 += $afs->cst6;
$cst7total1 += $afs->cst7;
$cst8total1 += $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>
<?php if ($key == 0) { ?>
<td id="1spec" rowspan="6" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype7(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 6) { ?>
<td id="2spec" rowspan="2" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype7(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 8) { ?>
<td id="3spec" rowspan="2" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype7(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 10) { ?>
<td id="4spec" rowspan="1" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype7(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<!-- raw test sand -->
<td id="<?php echo ($key + 1) . 'rst1'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(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="calculateAFStype7(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst8; ?></td>
<?php if ($key == 5) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td style="background-color:#f5e0a5" id="rst1total1"><?php echo $rst1total1; ?></td>
<td style="background-color:#f5e0a5" id="rst2total1"><?php echo $rst2total1; ?></td>
<td style="background-color:#f5e0a5" id="rst3total1"><?php echo $rst3total1; ?></td>
<td style="background-color:#f5e0a5" id="cst1total1"><?php echo $cst1total1; ?></td>
<td style="background-color:#f5e0a5" id="cst2total1"><?php echo $cst2total1; ?></td>
<td style="background-color:#f5e0a5" id="cst3total1"><?php echo $cst3total1; ?></td>
<td id="cst4total1" style="background-color:#f5e0a5"><?php echo $cst4total1; ?></td>
<td id="cst5total1" style="background-color:#f5e0a5"><?php echo $cst5total1; ?></td>
<td id="cst6total1" style="background-color:#f5e0a5"><?php echo $cst6total1; ?></td>
<td id="cst7total1" style="background-color:#f5e0a5"><?php echo $cst7total1; ?></td>
<td id="cst8total1" style="background-color:#f5e0a5"><?php echo $cst8total1; ?></td>
</tr>
<?php } ?>
<?php if ($key == 7) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td style="background-color:#f5e0a5" id="rst1total2"><?php echo $rst1total2; ?></td>
<td style="background-color:#f5e0a5" id="rst2total2"><?php echo $rst2total2; ?></td>
<td style="background-color:#f5e0a5" id="rst3total2"><?php echo $rst3total2; ?></td>
<td id="cst1total2" style="background-color:#f5e0a5"><?php echo $cst1total2; ?></td>
<td id="cst2total2" style="background-color:#f5e0a5"><?php echo $cst2total2; ?></td>
<td id="cst3total2" style="background-color:#f5e0a5"><?php echo $cst3total2; ?></td>
<td id="cst4total2" style="background-color:#f5e0a5"><?php echo $cst4total2; ?></td>
<td id="cst5total2" style="background-color:#f5e0a5"><?php echo $cst5total2; ?></td>
<td id="cst6total2" style="background-color:#f5e0a5"><?php echo $cst6total2; ?></td>
<td id="cst7total2" style="background-color:#f5e0a5"><?php echo $cst7total2; ?></td>
<td id="cst8total2" style="background-color:#f5e0a5"><?php echo $cst8total2; ?></td>
</tr>
<?php } ?>
</tr>
<?php if ($key == 9) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td id="rst1total3" style="background-color:#f5e0a5"><?php echo $rst1total3; ?></td>
<td id="rst2total3" style="background-color:#f5e0a5"><?php echo $rst2total3; ?></td>
<td id="rst3total3" style="background-color:#f5e0a5"><?php echo $rst3total3; ?></td>
<td id="cst1total3" style="background-color:#f5e0a5"><?php echo $cst1total3; ?></td>
<td id="cst2total3" style="background-color:#f5e0a5"><?php echo $cst2total3; ?></td>
<td id="cst3total3" style="background-color:#f5e0a5"><?php echo $cst3total3; ?></td>
<td id="cst4total3" style="background-color:#f5e0a5"><?php echo $cst4total3; ?></td>
<td id="cst5total3" style="background-color:#f5e0a5"><?php echo $cst5total3; ?></td>
<td id="cst6total3" style="background-color:#f5e0a5"><?php echo $cst6total3; ?></td>
<td style="background-color:#f5e0a5" id="cst7total3"><?php echo $cst7total3; ?></td>
<td id="cst8total3" style="background-color:#f5e0a5"><?php echo $cst8total3; ?></td>
</tr>
<?php } ?>
<?php if ($key == 10) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td id="rst1total" style="background-color:#f5e0a5"><?php echo $rst1total; ?></td>
<td id="rst2total" style="background-color:#f5e0a5"><?php echo $rst2total; ?></td>
<td id="rst3total" style="background-color:#f5e0a5"><?php echo $rst3total; ?></td>
<td id="cst1total" style="background-color:#f5e0a5"><?php echo $cst1total; ?></td>
<td id="cst2total" style="background-color:#f5e0a5"><?php echo $cst2total; ?></td>
<td id="cst3total" style="background-color:#f5e0a5"><?php echo $cst3total; ?></td>
<td id="cst4total" style="background-color:#f5e0a5"><?php echo $cst4total; ?></td>
<td id="cst5total" style="background-color:#f5e0a5"><?php echo $cst5total; ?></td>
<td id="cst6total" style="background-color:#f5e0a5"><?php echo $cst6total; ?></td>
<td id="cst7total" style="background-color:#f5e0a5"><?php echo $cst7total; ?></td>
<td id="cst8total" style="background-color:#f5e0a5"><?php echo $cst8total; ?></td>
</tr>
<?php } ?>
</tr>
<?php
}
?>
</tbody>
</table>
<!-- afs table for type 5-->
<table id="afstabletype5" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
<thead>
<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="afsAppendtype5">
<?php
$rst51total1 = 0;
$rst52total1 = 0;
$rst53total1 = 0;
$cst51total1 = 0;
$cst52total1 = 0;
$cst53total1 = 0;
$cst54total1 = 0;
$cst55total1 = 0;
$cst56total1 = 0;
$cst57total1 = 0;
$cst58total1 = 0;
$rst51total2 = 0;
$rst52total2 = 0;
$rst53total2 = 0;
$cst51total2 = 0;
$cst52total2 = 0;
$cst53total2 = 0;
$cst54total2 = 0;
$cst55total2 = 0;
$cst56total2 = 0;
$cst57total2 = 0;
$cst58total2 = 0;
$rst51total3 = 0;
$rst52total3 = 0;
$rst53total3 = 0;
$cst51total3 = 0;
$cst52total3 = 0;
$cst53total3 = 0;
$cst54total3 = 0;
$cst55total3 = 0;
$cst56total3 = 0;
$cst57total3 = 0;
$cst58total3 = 0;
$rst51total = 0;
$rst52total = 0;
$rst53total = 0;
$cst51total = 0;
$cst52total = 0;
$cst53total = 0;
$cst54total = 0;
$cst55total = 0;
$cst56total = 0;
$cst57total = 0;
$cst58total = 0;
foreach ($afsdata5 as $key => $afs) {
if ($key == 10) {
$rst51total += $afs->rst1;
$rst52total += $afs->rst2;
$rst53total += $afs->rst3;
$cst51total += $afs->cst1;
$cst52total += $afs->cst2;
$cst53total += $afs->cst3;
$cst54total += $afs->cst4;
$cst55total += $afs->cst5;
$cst56total += $afs->cst6;
$cst57total += $afs->cst7;
$cst58total += $afs->cst8;
}
if ($key == 9 || $key == 8) {
$rst51total3 += $afs->rst1;
$rst52total3 += $afs->rst2;
$rst53total3 += $afs->rst3;
$cst51total3 += $afs->cst1;
$cst52total3 += $afs->cst2;
$cst53total3 += $afs->cst3;
$cst54total3 += $afs->cst4;
$cst55total3 += $afs->cst5;
$cst56total3 += $afs->cst6;
$cst57total3 += $afs->cst7;
$cst58total3 += $afs->cst8;
}
if ($key >= 3 && $key <= 7) {
$rst51total2 += $afs->rst1;
$rst52total2 += $afs->rst2;
$rst53total2 += $afs->rst3;
$cst51total2 += $afs->cst1;
$cst52total2 += $afs->cst2;
$cst53total2 += $afs->cst3;
$cst54total2 += $afs->cst4;
$cst55total2 += $afs->cst5;
$cst56total2 += $afs->cst6;
$cst57total2 += $afs->cst7;
$cst58total2 += $afs->cst8;
}
if ($key >= 0 && $key <= 2) {
$rst51total1 += $afs->rst1;
$rst52total1 += $afs->rst2;
$rst53total1 += $afs->rst3;
$cst51total1 += $afs->cst1;
$cst52total1 += $afs->cst2;
$cst53total1 += $afs->cst3;
$cst54total1 += $afs->cst4;
$cst55total1 += $afs->cst5;
$cst56total1 += $afs->cst6;
$cst57total1 += $afs->cst7;
$cst58total1 += $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>
<?php if ($key == 0) { ?>
<td id="spec1" rowspan="3" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 3) { ?>
<td id="spec2" rowspan="5" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 8) { ?>
<td id="spec3" rowspan="2" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<?php if ($key == 10) { ?>
<td id="spec4" rowspan="1" class="edit" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->spec; ?></td>
<?php } ?>
<!-- raw test sand -->
<td id="<?php echo ($key + 1) . 'rst51'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->rst1; ?></td>
<td id="<?php echo ($key + 1) . 'rst52'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->rst2; ?></td>
<td id="<?php echo ($key + 1) . 'rst53'; ?>" class="editrst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(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) . 'cst51'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst1; ?></td>
<td id="<?php echo ($key + 1) . 'cst52'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst2; ?></td>
<td id="<?php echo ($key + 1) . 'cst53'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst3; ?></td>
<td id="<?php echo ($key + 1) . 'cst54'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst4; ?></td>
<td id="<?php echo ($key + 1) . 'cst55'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst5; ?></td>
<td id="<?php echo ($key + 1) . 'cst56'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst6; ?></td>
<td id="<?php echo ($key + 1) . 'cst57'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst7; ?></td>
<td id="<?php echo ($key + 1) . 'cst58'; ?>" class="editcst" contenteditable="true" onkeypress="return keyValidate(event)" onkeyup="calculateAFStype5(this.parentNode.id,this.id,this.textContent)"><?php echo $afs->cst8; ?></td>
<?php if ($key == 2) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td style="background-color:#f5e0a5" id="rst51total1"><?php echo $rst51total1; ?></td>
<td style="background-color:#f5e0a5" id="rst52total1"><?php echo $rst52total1; ?></td>
<td style="background-color:#f5e0a5" id="rst53total1"><?php echo $rst53total1; ?></td>
<td style="background-color:#f5e0a5" id="cst51total1"><?php echo $cst51total1; ?></td>
<td style="background-color:#f5e0a5" id="cst52total1"><?php echo $cst52total1; ?></td>
<td style="background-color:#f5e0a5" id="cst53total1"><?php echo $cst53total1; ?></td>
<td id="cst54total1" style="background-color:#f5e0a5"><?php echo $cst54total1; ?></td>
<td id="cst55total1" style="background-color:#f5e0a5"><?php echo $cst55total1; ?></td>
<td id="cst56total1" style="background-color:#f5e0a5"><?php echo $cst57total1; ?></td>
<td id="cst57total1" style="background-color:#f5e0a5"><?php echo $cst57total1; ?></td>
<td id="cst58total1" style="background-color:#f5e0a5"><?php echo $cst58total1; ?></td>
</tr>
<?php } ?>
<?php if ($key == 7) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td style="background-color:#f5e0a5" id="rst51total2"><?php echo $rst51total2; ?></td>
<td style="background-color:#f5e0a5" id="rst52total2"><?php echo $rst52total2; ?></td>
<td style="background-color:#f5e0a5" id="rst53total2"><?php echo $rst53total2; ?></td>
<td id="cst51total2" style="background-color:#f5e0a5"><?php echo $cst51total2; ?></td>
<td id="cst52total2" style="background-color:#f5e0a5"><?php echo $cst52total2; ?></td>
<td id="cst53total2" style="background-color:#f5e0a5"><?php echo $cst53total2; ?></td>
<td id="cst54total2" style="background-color:#f5e0a5"><?php echo $cst54total2; ?></td>
<td id="cst55total2" style="background-color:#f5e0a5"><?php echo $cst55total2; ?></td>
<td id="cst56total2" style="background-color:#f5e0a5"><?php echo $cst56total2; ?></td>
<td id="cst57total2" style="background-color:#f5e0a5"><?php echo $cst57total2; ?></td>
<td id="cst58total2" style="background-color:#f5e0a5"><?php echo $cst58total2; ?></td>
</tr>
<?php } ?>
</tr>
<?php if ($key == 9) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td id="rst51total3" style="background-color:#f5e0a5"><?php echo $rst51total3; ?></td>
<td id="rst52total3" style="background-color:#f5e0a5"><?php echo $rst52total3; ?></td>
<td id="rst53total3" style="background-color:#f5e0a5"><?php echo $rst53total3; ?></td>
<td id="cst51total3" style="background-color:#f5e0a5"><?php echo $cst51total3; ?></td>
<td id="cst52total3" style="background-color:#f5e0a5"><?php echo $cst52total3; ?></td>
<td id="cst53total3" style="background-color:#f5e0a5"><?php echo $cst53total3; ?></td>
<td id="cst54total3" style="background-color:#f5e0a5"><?php echo $cst54total3; ?></td>
<td id="cst55total3" style="background-color:#f5e0a5"><?php echo $cst55total3; ?></td>
<td id="cst56total3" style="background-color:#f5e0a5"><?php echo $cst56total3; ?></td>
<td style="background-color:#f5e0a5" id="cst57total3"><?php echo $cst57total3; ?></td>
<td id="cst58total3" style="background-color:#f5e0a5"><?php echo $cst58total3; ?></td>
</tr>
<?php } ?>
<?php if ($key == 10) { ?>
<tr>
<td colspan="4" style="background-color:#f5e0a5">Total</td>
<td id="rst51total" style="background-color:#f5e0a5"><?php echo $rst51total; ?></td>
<td id="rst52total" style="background-color:#f5e0a5"><?php echo $rst52total; ?></td>
<td id="rst53total" style="background-color:#f5e0a5"><?php echo $rst53total; ?></td>
<td id="cst51total" style="background-color:#f5e0a5"><?php echo $cst51total; ?></td>
<td id="cst52total" style="background-color:#f5e0a5"><?php echo $cst52total; ?></td>
<td id="cst53total" style="background-color:#f5e0a5"><?php echo $cst54total; ?></td>
<td id="cst54total" style="background-color:#f5e0a5"><?php echo $cst54total; ?></td>
<td id="cst55total" style="background-color:#f5e0a5"><?php echo $cst55total; ?></td>
<td id="cst56total" style="background-color:#f5e0a5"><?php echo $cst56total; ?></td>
<td id="cst57total" style="background-color:#f5e0a5"><?php echo $cst57total; ?></td>
<td id="cst58total" style="background-color:#f5e0a5"><?php echo $cst58total; ?></td>
</tr>
<?php } ?>
</tr>
<?php
}
?>
</tbody>
</table>
<!-- END OF AFS TABLE for type 5-->
<?php // echo $cst51total;
?>
<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>
<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');
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">&nbsp;</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" name="reportfile" onchange="readURL(this);">
<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() . 'public/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->get('name'); ?>" readonly>
<input type="hidden" value="<?php echo $this->session->get('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">&nbsp;</div>
<div>
<div class="row">&nbsp;</div>
<div class="row">
<div class="col-md-3" id="savebutton">
<input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div>
</div>
</section>
</div>
<div id="packagingcalmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Packing Calculation On</h4>
</div>
<div class="modal-body">
<form>
<div class="radio">
<label><input type="radio" name="optPackaging" checked="checked" value='0' id="optPackaging"> Basic Amount</label>
</div>
<div class="radio">
<label><input type="radio" name="optPackaging" id="optPackaging" value='1'> After Discount Amount</label>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-success" ID="PackagingOption" onclick="SetPackagingOption();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-success" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/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
});
});
</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);
// $('#afstabletype7').hide();
// $('#afstabletype5').show();
show_hide_column(13, false, 'testreport');
show_hide_column(16, false, 'testreport2');
var type = <?php echo $reportdata['master'][0]->subtype ?>;
if (type == 0) {
$('#afstabletype5').show();
$('#afstabletype7').hide();
calculateAFS5();
} else {
$('#afstabletype5').hide();
$('#afstabletype7').show();
calculateAFS7();
}
$('#approvedby').val('<?php echo $reportdata['master'][0]->approvedby; ?>');
firstTimeValidateMastertable();
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;
}
}
$('#product').change(function() {
getAllSpec();
});
$('#customer').change(function() {
getAllSpec();
});
function typeChange(v) {
var v = v;
if (v == 0) {
$('#typename').text('Type 5');
$('#afstabletype7').hide();
$('#afstabletype5').show();
} else if (v == 1) {
$('#typename').text('Type 7');
$('#afstabletype7').show();
$('#afstabletype5').hide();
}
}
function getAllSpec() {
var p = $('#product').val();
var c = $('#customer').val();
var type = 'INPROCESS';
if (p == -1 || c == -1) {
return false;
} else {
$('#loader').show();
$.ajax({
data: {
param1: p,
param2: c,
param3: type
},
//dataType:"json",
type: "POST",
url: "<?php echo base_url() ?>quality/getAllSpecforReport",
success: function(data) {
// alert(data);
data = JSON.parse(data);
//alert(data);
$('#testreport tbody').remove();
$('#testreport').append('<tbody id="specAppend"></tbody>');
$('#testreport2 tbody').remove();
$('#testreport2').append('<tbody id="specAppend2"></tbody>');
if (data != '') {
htmlmaster1 = '';
htmlmaster2 = '';
var index2 = 0;
var index = 0;
$('#loader').hide();
$.each(data, function(i, item) {
var ide = '';
//console.log(item);
if (item.subtype == '0') {
//console.log('master1');
index += 1;
ide = item.testtype;
ide = ide.replace(/\s/g, "");
ide = ide.toLowerCase();
htmlmaster1 += '<tr id=' + index + '> <td>' + index + '</td> <td>' + item.testtype + '</td> <td>' + item.min + '</td> <td>' + item.max + '</td> <td>' + item.uom + '</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '1' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '2' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '3' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '4' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '5' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '6' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '7' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td contenteditable="true" class="edit" id=' + ide + '8' + ' onkeypress="return keyValidate(event);" onkeyup="calculateMaster1(this.id,this.parentNode.id);">0.00</td>' +
'<td>' + item.productspecmaster_id + '</td>' +
'</tr>';
} else {
ide = item.testtype;
ide = ide.replace(/\s/g, "");
ide = ide.toLowerCase();
index2 += 1;
// index -= 1;
htmlmaster2 += '<tr id=' + index2 + '> <td style="text-align:center;">' + index2 + '</td> <td style="text-align:center;">' + item.testtype + '</td> <td style="text-align:center;">' + item.min + '</td> <td style="text-align:center;">' + item.max + '</td> <td style="text-align:center;">' + item.uom + '</td>' +
'<td id=' + ide + 'rst1' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'rst2' + ' style="text-align:center;">0.00</td>' +
'<td id=' + ide + 'rst3' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst1' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst2' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst3' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst4' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst5' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst6' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst7' + ' style="text-align:center;" >0.00</td>' +
'<td id=' + ide + 'cst8' + ' style="text-align:center;" >0.00</td>' +
'<td>' + item.productspecmaster_id + '</td>' +
'</tr>';
}
});
$("#testreport tbody").append(htmlmaster1);
$("#testreport2 tbody").append(htmlmaster2);
show_hide_column(13, false, 'testreport');
show_hide_column(16, false, 'testreport2');
} else {
alert('No Master Records Found..!');
$('#loader').hide();
}
}
});
}
}
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 = '';
var nissansubtype = <?php echo $reportdata['master'][0]->subtype ?>;
if (nissansubtype == 0) {
testafsdata = $("#afstabletype5").tableToJSON();
//nissansubtype = 0;
} else {
testafsdata = $("#afstabletype7").tableToJSON();
//nissansubtype = 1;
}
var testreportdata2 = $("#testreport2").tableToJSON();
testreportdata = JSON.stringify(testreportdata);
// alert(testreportdata);
testreportdata2 = JSON.stringify(testreportdata2);
testloidata = JSON.stringify(testloidata);
testafsdata = JSON.stringify(testafsdata);
var masterid = $('#masterid').val();
var productid = $('#product').val();
var customerid = $('#customer').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 times = new Array($('#time1').val(), $('#time2').val(), $('#time3').val(), $('#time4').val(), $('#time5').val(), $('#time6').val(), $('#time7').val(), $('#time8').val());
var olddoc = $('#olddoc').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 = nissansubtype;
var param17 = masterid;
var param18 = 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);
formData.append('param18', param18);
$('#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/updateNissanInprocessTestReportData",
//async : false,
cache: false,
contentType: false,
processData: false,
success: function(data) {
if (data) {
alert(data);
$('#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 calculateAFStype7(pid, cid, cvalue) {
var cid = cid;
var cvalue = cvalue;
var pid = pid;
if (isNaN(cvalue) || cvalue == '') {
cvalue = 0.00;
}
// alert(pid+'-'+cid+'-'+cvalue);
if ($('#customer').val() == -1 || $('#product').val() == -1) {
alert('Please Select Product and Customer');
document.getElementById(cid).textContent = '0.00';
return false;
}
// Total and AFS Calculation
var tempcid = cid.substr(-4);
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;
var first_total = 0;
var second_total = 0;
var third_total = 0;
var fourth_total = 0;
for (var i = 1; i <= 11; i++) {
var id = i + tempcid;
var eachval = document.getElementById(id).textContent;
if (isNaN(eachval) || eachval == '') {
eachval = 0.00;
}
if (!isNaN(eachval)) {
total += parseFloat(eachval);
product += (parseFloat(eachval) * factor[i]);
}
if (i >= 1 && i <= 6) {
first_total += parseFloat(eachval);
}
if (i == 7 || i == 8) {
second_total += parseFloat(eachval);
}
if (i == 9 || i == 10) {
third_total += parseFloat(eachval);
}
if (i == 11) {
fourth_total += parseFloat(eachval);
}
}
var totalid1 = tempcid + 'total1'
if (isNaN(first_total)) {
first_total = 0.00;
}
document.getElementById(totalid1).textContent = parseFloat(first_total).toFixed(2);
totalid1 = '#' + totalid1;
var totalid2 = tempcid + 'total2'
if (isNaN(second_total)) {
second_total = 0.00;
}
document.getElementById(totalid2).textContent = parseFloat(second_total).toFixed(2);
totalid2 = '#' + totalid2;
var totalid3 = tempcid + 'total3'
if (isNaN(third_total)) {
third_total = 0.00;
}
document.getElementById(totalid3).textContent = parseFloat(third_total).toFixed(2);
totalid3 = '#' + totalid3;
var totalid4 = tempcid + 'total'
if (isNaN(fourth_total)) {
fourth_total = 0.00;
}
document.getElementById(totalid4).textContent = parseFloat(fourth_total).toFixed(2);
totalid4 = '#' + totalid4;
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 = finalafsvalue;
//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");
}
}
}
}
//FOR AFS TABLE COLOR CHANGE
if (tempcid != 'spec') {
///FOR FIRST TOTAL COLOR CHANGE
if (pid >= 1 && pid <= 6) {
//alert('inside if');
var spec1 = document.getElementById('1spec').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total1';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total1';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
}
///END OF FIRST TOTAL COLOR CHANGE
///FOR SECOND TOTAL COLOR CHANGE
if (pid == 7 || pid == 8) {
//alert('inside if');
var spec1 = document.getElementById('2spec').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total2';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total2';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
} ///END OF SECOND TOTAL COLOR CHANGE
///FOR THIRD TOTAL COLOR CHANGE
if (pid == 9 || pid == 10) {
//alert('inside if');
var spec1 = document.getElementById('3spec').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total3';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total3';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
} ///END OF THIRD TOTAL COLOR CHANGE
}
///FOR FOURTH TOTAL COLOR CHANGE
if (pid == 11) {
//alert('inside if');
var spec1 = document.getElementById('4spec').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
///END OF FOURTH TOTAL COLOR CHANGE
}
}
}
// END AFS type 7 Calculation
//FOR AFS type 5 Calculation
function calculateAFStype5(pid, cid, cvalue) {
var cid = cid;
var cvalue = cvalue;
var pid = pid;
if (isNaN(cvalue) || cvalue == '') {
cvalue = 0.00;
}
// alert(pid+'-'+cid+'-'+cvalue);
if ($('#customer').val() == -1 || $('#product').val() == -1) {
alert('Please Select Product and Customer');
document.getElementById(cid).textContent = '0.00';
return false;
}
// Total and AFS Calculation
var tempcid = cid.substr(-5);
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;
var first_total = 0;
var second_total = 0;
var third_total = 0;
var fourth_total = 0;
for (var i = 1; i <= 11; i++) {
var id = i + tempcid;
var eachval = document.getElementById(id).textContent;
if (isNaN(eachval) || eachval == '') {
eachval = 0.00;
}
if (!isNaN(eachval)) {
total += parseFloat(eachval);
product += (parseFloat(eachval) * factor[i]);
}
if (i >= 1 && i <= 3) {
first_total += parseFloat(eachval);
}
if (i >= 4 && i <= 8) {
second_total += parseFloat(eachval);
}
if (i == 9 || i == 10) {
third_total += parseFloat(eachval);
}
if (i == 11) {
fourth_total += parseFloat(eachval);
}
}
var totalid1 = tempcid + 'total1'
if (isNaN(first_total)) {
first_total = 0.00;
}
document.getElementById(totalid1).textContent = parseFloat(first_total).toFixed(2);
totalid1 = '#' + totalid1;
var totalid2 = tempcid + 'total2'
if (isNaN(second_total)) {
second_total = 0.00;
}
document.getElementById(totalid2).textContent = parseFloat(second_total).toFixed(2);
totalid2 = '#' + totalid2;
var totalid3 = tempcid + 'total3'
if (isNaN(third_total)) {
third_total = 0.00;
}
document.getElementById(totalid3).textContent = parseFloat(third_total).toFixed(2);
totalid3 = '#' + totalid3;
var totalid4 = tempcid + 'total'
if (isNaN(fourth_total)) {
fourth_total = 0.00;
}
document.getElementById(totalid4).textContent = parseFloat(fourth_total).toFixed(2);
totalid4 = '#' + totalid4;
finalafsvalue = parseFloat(product / total).toFixed(2);
if (isNaN(finalafsvalue)) {
finalafsvalue = '0.00';
}
//console.log(finalafsvalue);
var findafs = tempcid.split('5');
var afsid = 'afs' + findafs[0] + findafs[1];
if (findafs[1] == '') {
afsid = 'afs' + findafs[0] + '5';
}
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 = finalafsvalue;
//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");
}
}
}
}
//FOR AFS TABLE COLOR CHANGE
if (tempcid != 'spec') {
///FOR FIRST TOTAL COLOR CHANGE
if (pid >= 1 && pid <= 3) {
//alert('inside if');
var spec1 = document.getElementById('spec1').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total1';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total1';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
}
///END OF FIRST TOTAL COLOR CHANGE
///FOR SECOND TOTAL COLOR CHANGE
if (pid >= 4 && pid <= 8) {
//alert('inside if');
var spec1 = document.getElementById('spec2').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total2';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total2';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
} ///END OF SECOND TOTAL COLOR CHANGE
///FOR THIRD TOTAL COLOR CHANGE
if (pid == 9 || pid == 10) {
//alert('inside if');
var spec1 = document.getElementById('spec3').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total3';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total3';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
} ///END OF THIRD TOTAL COLOR CHANGE
}
///FOR FOURTH TOTAL COLOR CHANGE
if (pid == 11) {
//alert('inside if');
var spec1 = document.getElementById('spec4').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
//tempcid = tempcid.substr(-3);
var id = tempcid + 'total';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(min+'-'+max+'-'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
//alert('INSIDE MIN MAX ');
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#f5e0a5");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(afsid).css("background-color", "#fffff");
} else {
$(afsid).css("background-color", "#ffcccc");
}
}
} else {
var id = tempcid + 'total';
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
spec1 = parseFloat(spec1);
if (curval != spec1) {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
} else {
id = '#' + id;
$(id).css("background-color", "#f5e0a5");
}
}
///END OF FOURTH TOTAL COLOR CHANGE
}
}
}
// END AFS Calculation
//END OF AFS type 5 Calculation
$('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
}
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/printIndNissanInprocessReport');
$('#printPDF').attr('method', 'post');
$('#printPDF').submit();
}
function calculateAFS5() {
var spec1 = document.getElementById('spec1').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
for (i = 1; i <= 3; i++) {
var id = 'rst5' + i + 'total1';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst5' + i + 'total1';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL2 COLOR CHANGE
var spec2 = document.getElementById('spec2').textContent;
if (isNaN(spec2)) {
spec2 = spec2.split('-');
var min = spec2[0];
var max = spec2[1];
for (i = 1; i <= 3; i++) {
var id = 'rst5' + i + 'total2';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst5' + i + 'total2';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL3 COLOR CHANGE
var spec3 = document.getElementById('spec3').textContent;
if (isNaN(spec3)) {
spec3 = spec3.split('-');
var min = spec3[0];
var max = spec3[1];
for (i = 1; i <= 3; i++) {
var id = 'rst5' + i + 'total3';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst5' + i + 'total3';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL4 COLOR CHANGE
var spec4 = document.getElementById('spec4').textContent;
if (isNaN(spec4)) {
spec4 = spec4.split('-');
var min = spec4[0];
var max = spec4[1];
for (i = 1; i <= 3; i++) {
var id = 'rst5' + i + 'total';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst5' + i + 'total';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
}
function calculateAFS7() {
var spec1 = document.getElementById('1spec').textContent;
if (isNaN(spec1)) {
spec1 = spec1.split('-');
var min = spec1[0];
var max = spec1[1];
for (i = 1; i <= 3; i++) {
var id = 'rst' + i + 'total1';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst' + i + 'total1';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL2 COLOR CHANGE
var spec2 = document.getElementById('2spec').textContent;
if (isNaN(spec2)) {
spec2 = spec2.split('-');
var min = spec2[0];
var max = spec2[1];
for (i = 1; i <= 3; i++) {
var id = 'rst' + i + 'total2';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst' + i + 'total2';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL3 COLOR CHANGE
var spec3 = document.getElementById('3spec').textContent;
if (isNaN(spec3)) {
spec3 = spec3.split('-');
var min = spec3[0];
var max = spec3[1];
for (i = 1; i <= 3; i++) {
var id = 'rst' + i + 'total3';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst' + i + 'total3';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
//FOR SECOND TOTAL4 COLOR CHANGE
var spec4 = document.getElementById('4spec').textContent;
if (isNaN(spec4)) {
spec4 = spec4.split('-');
var min = spec4[0];
var max = spec4[1];
for (i = 1; i <= 3; i++) {
var id = 'rst' + i + 'total';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert(curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
//FOR CST TOTAL COLOR CHANGE
for (i = 1; i <= 8; i++) {
var id = 'cst' + i + 'total';
//alert(id);
var curval = document.getElementById(id).textContent;
curval = parseFloat(curval);
//alert('cst'+curval);
if ($.isNumeric(min) && $.isNumeric(max)) {
if (curval >= min && curval <= max) {
id = '#' + id;
$(id).css("background-color", "#f5e0a5"); //green color
} else {
id = '#' + id;
$(id).css("background-color", "#ffcccc");
}
} else if ($.isNumeric(min) && !($.isNumeric(max))) {
if (curval >= min) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
} else if (!$.isNumeric(min) && $.isNumeric(max)) {
if (curval <= max) {
$(id).css("background-color", "#f5e0a5");
} else {
$(id).css("background-color", "#ffcccc");
}
}
}
}
}
</script>