siddharth_application/application/views/viewindreport.php
2023-05-30 18:45:55 +05:30

486 lines
14 KiB
PHP

<style>
.edit{
background-color:#eeffcc ! important;
}
</style>
<?php
//print_r($reportdata);die();
$reportid = '';
$invoiceno = '';
$invoicedate = '';
$customername = '';
$product_description = '';
$batchno = '';
$qty = '';
$batchdate = '';
$inspector = '';
$approvedby = '';
foreach($reportdata['master'] as $m)
{
$reportid = $m->testreport_id;
$invoiceno = $m->invoiceid;
$invoicedate = $m->invoice_date_created;
$customername = $m->client_id.'-'.$m->client_name;
$product_description = $m->product_id.'-'.$m->product_description;
$batchno = $m->invoice_custom_fieldvalue;
$qty = $m->item_quantity;
$batchdate = $m->batchdate;
$inspector = $m->FirstName.' '.$m->LastName;
$approvedby = $m->approvedby;
}
?>
<style>
th{
text-align:center !important;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Pre Dispatch Inspection Report - Test Report No:<?php echo $reportid;?></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="col-md-3" id="savebutton">
<input type="button" id="submit" target="_blank" value = "Print" class="btn btn-primary" onclick="PrintFunction();">
</div>
<form id="printPDF">
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<label>Invoice No</label>
<input type="text" class="form-control" value="<?php echo $invoiceno;?>" readonly>
<input type="hidden" class="form-control" value="<?php echo $reportid;?>" name="rid" readonly>
</div>
</form>
<div class="col-md-3">
<label>Invoice Date</label>
<input type="text" id="invoicedate" name="invoicedate" value="<?php echo date_format(date_create($invoicedate),'d-m-Y');?>" class="form-control" readonly>
</div>
<div class="col-md-3">
<label>Customer Name</label>
<input type="text" id="customername" name="customername" value="<?php echo $customername;?>" class="form-control" readonly>
</div>
<div class="col-md-3">
<label>Product Name</label>
<input type="text" id="productname" name="productname" value="<?php echo $product_description;?>" class="form-control" readonly>
</div>
</div>
<div class="row">
<div class="col-md-3">
<label>Batch No</label>
<input type="text" id="batchno" name="batchno" value="<?php echo $batchno;?>" class="form-control" readonly>
</div>
<div class="col-md-3">
<label>Qty</label>
<input type="text" id="qty" name="qty" value="<?php echo $qty?>" class="form-control ;" readonly>
</div>
<div class="col-md-3">
<label>Batch Date</label>
<input type="text" id="reportdate" name="reportdate" class="form-control" value = "<?php echo date_format(date_create($batchdate),'d-m-Y');?>" 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:#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>ACT X1</th><th>ACT X2</th><th>ACT X3</th><th width="5px">Average</th><th width="5px">Results</th><th>Remarks</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
$index = 0;
foreach($reportdata['masterreport'] as $master)
{
$index++;
?>
<tr> <td><?php echo $index;?></td> <td><?php echo $master->description;?></td><td><?php echo $master->min;?></td> <td><?php echo $master->max;?></td> <td><?php echo $master->UOM;?></td><td><?php if(!empty($master->act1)){ echo $master->act1; }else {echo '0.00';}?></td><td><?php if(!empty($master->act2)){ echo $master->act2; } else {echo '0.00';}?></td> <td><?php if(!empty($master->act3)){ echo $master->act3; } else {echo '0.00';}?></td> <td><?php echo $master->average;?></td> <td><?php echo $master->result;?></td> <td><?php echo $master->remarks;?></td> </tr>
<?php
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<hr>
<div class="col-md-12">
<div class="col-md-3"><b> L.O.I Details </b></div> <div class="col-md-1 col-md-offset-8 text-right"><i class="fa fa-expand" id="loibutton"></i></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><center>SNO</center></th><th><center>Heating Time</center></br><center>start</center></th><th><center>Heating Time</center></br><center>end</center></th><th>Temp *c</th><th><center>Crucible Weight</center></br> <center>w1(g)<center></th><th><center>Before Heating</center></br><center>w2(g)</center></th><th><center>After Heating<center></br>w3(g)</center></th><th>L.O.I %</th><th>Remarks</th>
</tr>
</thead>
<tbody id="loiAppend">
<?php
$indexx = 0;
foreach($reportdata['masterreportloi'] as $loi)
{
$indexx++;
?>
<tr> <td><?php echo $indexx;?></td> <td><?php echo $loi->start_time;?></td> <td><?php echo $loi->end_time;?></td> <td><?php echo $loi->temp;?></td> <td><?php echo $loi->w1;?></td> <td><?php echo $loi->w2;?></td> <td><?php echo $loi->w3;?></td> <td><?php echo $loi->loi_percentage;?></td> <td><?php echo $loi->remarks;?></td></tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="col-md-12">
<div class="col-md-3"><b> AFS Details </b></div> <div class="col-md-1 col-md-offset-8 text-right"><i class="fa fa-expand" id="afsbutton"></i></div>
</div>
<div id="afsarea">
<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>Sieve Size µm</th><th>Sand Weight</th><th>Percentage</th><th>Multiplier</th><th>Product</th>
</tr>
</thead>
<tbody id="afsAppend">
<?php
$ind = 0;
$total_sandweight = 0;
$totalproduct = 0;
foreach($reportdata['masterreportafs'] as $afs)
{
$ind++;
?>
<tr> <td><?php echo $ind;?></td> <td id="<?php echo $ind.'size';?>"><?php echo $afs->sieve_size?></td> <td id="<?php echo $ind.'p';?>"><?php echo $afs->sandweight;?></td><td><?php echo $afs->percentage?></td><td ><?php echo $afs->multiplier?></td><td><?php echo $afs->product;?></td></tr>
<?php
$total_sandweight = $total_sandweight + $afs->sandweight;
$totalproduct = $totalproduct + $afs->product;
}
?>
<tr id="12"> <td>&nbsp;</td> <td><b>Total</b></td> <td id="12sw"><?php echo $total_sandweight;?></td><td id="12p"><?php echo $total_sandweight;?></td><td id="12m">&nbsp;</td><td id="12pt"><?php echo number_format($totalproduct,3,'.','');?></td></tr>
</tbody>
</table>
</div>
<div class="col-md-12">
<div class="col-md-3"><b>AFS CHART </b></div> <div class="col-md-1 col-md-offset-8 text-right"><i class="fa fa-expand" id="chartbutton"></i></div>
</div>
<div id="chartarea">
<div>
<center><canvas id="myCanvas" width="1000" height="350" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas></center>
</div>
</div>
<div class="row">&nbsp;</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 $inspector;?>" readonly>
</div>
<div class="col-md-3 col-md-offset-6 ">
<label>Approved By :</label>
<input type="text" id="inspector" class="form-control" value="<?php echo $approvedby;?>" readonly>
<!-- <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>
</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
});
});
</script>
<script>
$(document).ready(function(){
var dataset = [];
var datalabel = [];
for(x=1;x<=11;x++)
{
var swid = x+'p';
var sanddata = document.getElementById(swid).textContent;
dataset.push(sanddata);
var sizeid = x+'size';
var sizedata = document.getElementById(sizeid).textContent;
datalabel.push(sizedata);
}
drawChart(dataset,datalabel);
}); // End of document on ready funciton
function drawChart(dataset,datalabel){
var dashlinestart = [11,287,252,217,182,147,112,77,42];
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.clearRect(0, 0, c.width, c.height);
var xlabels = datalabel;
var xlabelscount = xlabels.length;
console.log(xlabelscount);
var dataset = dataset;
Array.prototype.max = function() {
return Math.max.apply(null, this);
};
var maxdataitem = dataset.max();
maxdataitem = Math.round((maxdataitem + 10)/5);
var dataset_locationsX = [];
var dataset_locationsY = [];
var canvaswidth = document.getElementById('myCanvas').offsetWidth;
var canvasheight = document.getElementById('myCanvas').offsetHeight;
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(30,0);
ctx.lineTo(30,canvasheight);
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.font = "bold 12px Arial";
ctx.fillStyle = "black";
ctx.fillText("Sieve size µm ",(canvaswidth/2),(canvasheight-2));
ctx.closePath();
var xaxislabelwidth = (canvaswidth/12);
var startingpointX = 30;
var startingpointY = (canvasheight-30);
for(i=1;i<=dashlinestart.length;i++) // Drawing Dashed Lines from Y
{
ctx.beginPath();
ctx.lineWidth=0.8;
ctx.moveTo(startingpointX,dashlinestart[i-1]);
//console.log(dataset_locationsY[i]);
ctx.lineTo(canvaswidth,dashlinestart[i-1]);
ctx.setLineDash([3,6]);
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
}
ctx.setLineDash([]);
for(i=1;i<=xlabelscount;i++) //X DataLabel
{
ctx.beginPath();
ctx.font = "bold 10px Arial";
ctx.fillStyle = "black";
ctx.fillText(xlabels[i-1],(startingpointX+(xaxislabelwidth * i)),(startingpointY+15));
ctx.closePath();
}
for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,4,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.closePath();
var xl = (startingpointX+(xaxislabelwidth * i));
dataset_locationsX.push(xl);
}
var j = 0;
var ylabel = 0;
for(i=1;i<=maxdataitem;i++) // y Data and Y labels
{
ctx.beginPath();
ctx.arc(startingpointX,(startingpointY-j),4 ,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
var yl = ((startingpointY-j));
dataset_locationsY.push(yl);
ctx.fillStyle = "black";
ctx.font = "bold 10px Arial";
ctx.fillText((j/7),(startingpointX-30),(startingpointY-j));
ylabel = ylabel + 5;
j=j+35;
ctx.closePath();
}
var finallocationofY = [];
var finallocationofX = [];
for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red points
{
ctx.beginPath();
<!-- ctx.arc((parseFloat(dataset_locationsX[i-1])),((startingpointY - parseFloat(dataset[i-1]) * 7)),4,0,2*Math.PI); -->
ctx.fillStyle="red";
ctx.lineCap = 'round';
<!-- ctx.fill(); -->
ctx.fillRect((parseFloat(dataset_locationsX[i-1])-5),((startingpointY - parseFloat(dataset[i-1]) * 7)-5),10,10)
finallocationofY.push((startingpointY - parseFloat(dataset[i-1]) * 7));
finallocationofX.push(parseFloat(dataset_locationsX[i-1]));
ctx.closePath();
//Draw text for data points
ctx.beginPath();
ctx.font = "bold 12px Arial";
ctx.fillStyle="blue";
ctx.fillText(dataset[i-1],(parseFloat(dataset_locationsX[i-1])),((startingpointY - parseFloat(dataset[i-1]) * 7)-10));
ctx.closePath();
}
for(i=0;i<=xlabelscount;i++) //Exact Chart Data Draw line
{
ctx.beginPath();
ctx.lineWidth = 4;
ctx.setLineDash([15,5]);
ctx.moveTo(finallocationofX[i],finallocationofY[i]);
ctx.lineTo(finallocationofX[i+1],finallocationofY[i+1]);
//ctx.strokeStyle="#1a75ff";
//ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
ctx.closePath();
}
ctx.setLineDash([]);
//ctx.beginPath();
//sctx.closePath();
}
function PrintFunction()
{
// var reportid = <?php echo $reportid;?>;
// $.ajax({
// data:{param1:reportid},
// type:"POST",
// url:"<?php echo base_url() ?>quality/printReportPDF",
// success:function(data) {
// }
// });
$('#printPDF').attr('action', '<?php echo base_url() ?>quality/printReportPDF');
$('#printPDF').attr('method', 'post');
$('#printPDF').submit();
}
</script>