QAD NEW CHANGES AND LOAN OVER DUE ISSUE RESLOVED

This commit is contained in:
velz2020 2018-01-02 13:43:52 +05:30
parent aea916c9e2
commit 6dce4d99f3
7 changed files with 374 additions and 155 deletions

View File

@ -423,6 +423,7 @@ class quality extends BaseController
function addNewInward_Report()
{
$data['records'] = $this->quality_model->getIGRNOforReport();
$data['reports'] = $this->quality_model->getIGRNOReport(); ;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Siddharth : Inward Inspection';
$this->loadViews("inward_report_create", $this->global,$data,NULL);
@ -457,4 +458,4 @@ class quality extends BaseController
}
}
?>
?>

View File

@ -148,6 +148,7 @@ class Quality_model extends CI_Model
$this->db->where('ip_invoices.invoice_number NOT IN (SELECT invoiceid from T_Test_Report_Master)',NULL,false);
$this->db->order_by('ip_invoices.invoice_number','desc');
$res = $this->db->get();
//print_r($res->result());die();
return $res->result();
}
@ -352,7 +353,9 @@ class Quality_model extends CI_Model
$sql = 'select distinct IGRNO from T_IGR_Details
join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode
where T_MaterialMaster.Category like "%Raw Material%" order by IGRNO desc';
where T_MaterialMaster.Category like "%Raw Material%"and T_IGR_Details.CreatedDate
between SUBDATE(CURRENT_DATE,1) and CURRENT_DATE
order by IGRNO desc';
$result = $this->db->query($sql);
return $result->result();
}
@ -365,7 +368,7 @@ class Quality_model extends CI_Model
$sql = 'select IGRItemNo from T_IGR_Details
join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode
where IGRNO = ? and T_MaterialMaster.Category like "%Raw Material%"';
where T_IGR_Details.IGRItemNo not in (select igrlineitemno from T_Test_Report_Master where igrno != "") and IGRNO = ? and T_MaterialMaster.Category like "%Raw Material%"';
$result = $this->db->query($sql,array($igrno));
return $result->result();
@ -373,7 +376,26 @@ class Quality_model extends CI_Model
}
function getIGRNOReport()
{
$this->db->select('igrno,igrlineitemno');
$this->db->from('T_Test_Report_Master');
$res['generated'] = ($this->db->get()->result());
// $this->db->select('IGRNO,IGRItemNo');
// $this->db->from('T_IGR_Details');
// $this->db->where('IGRNO NOT IN (SELECT IGRNO from T_Test_Report_Master)',NULL,false);
// $this->db->or_where('IGRItemNo NOT IN (SELECT IGRItemNo from T_Test_Report_Master)',NULL,false);
$sql= 'select distinct IGRNO,IGRItemNo from T_IGR_Details join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode
where (T_IGR_Details.IGRNO not in (select igrno from T_Test_Report_Master where igrno != "")
or T_IGR_Details.IGRItemNo not in (select igrlineitemno from T_Test_Report_Master where igrno != "") )
and T_MaterialMaster.Category like "%Raw Material%"
order by T_IGR_Details.IGRNO DESC';
$r = $this->db->query($sql);
$res['notgenerated'] = ($r->result());
return $res;
}
function getIGRDataforReport($igrno,$igrlineitemno)
{

View File

@ -1,3 +1,5 @@
<?php //print_r(count($reports['notgenerated']));?>
<?php //print_r($reports['generated']);?>
<style>
.edit{
@ -59,9 +61,24 @@ th{
<div class="box-body">
<div class="row">
<div class="col-md-3">
<div class="col-md-3" style="padding:0px">
<div class="col-md-10" >
<label>IGR No</label>
<?php echo form_dropdown('name="igrno"',$igrnos,set_value('igrno',$igrnos[-1]),'id="igrno"' ,'class="form-control select2', 'style="text-align:center;"');?>
<select id='igrno' onchange="changeIGRNO();">
<option value="-1">Select IGRNO</option>
<?php
foreach($records as $rec)
{
echo "<option value=".$rec->IGRNO.">".$rec->IGRNO."</option>";
}
?>
</select>
</div>
<div class="col-md-2"><br>
<a class="btn btn-primary" id="reportbutton" ><i class="fa fa-bars" aria-hidden="true"></i></a>
</div>
</div>
<div class="col-md-3">
@ -79,10 +96,59 @@ th{
<input type="text" id="invoicedate" name="invoicedate" class="form-control" readonly>
</div>
</div>
</div>
<div class="row" id="reportarea" style="padding:20px;display:none;">
<div class="col-md-12" style="border:1px solid;height:300;overflow:scroll">
<div class="col-md-6">
<center>
<label>Report Generated IGRNO's</label>
<hr>
<div style="background-color:#e6ffe6;">
<table id="gen" class="table" style="text-align:center;">
<thead><th>IGRNO</th><th>IGR Lineitem No</th></thead>
<?php
if(!empty($reports['generated']))
{
foreach($reports['generated'] as $d)
{
echo "<tr><td>".$d->igrno."</td><td>".$d->igrlineitemno."</td></tr>";
}
}
?>
</table>
</div>
</center>
</div>
<div class="col-md-6">
<center>
<label>Non Report Generated IGRNO's</label>
<hr>
<div style="background-color:#ffeee6;">
<table id="non" class="table" style="text-align:center;">
<thead><th>IGRNO</th></thead>
<?php
if(!empty($reports['notgenerated']))
{
foreach($reports['notgenerated'] as $r)
{
echo "<tr><td onclick='getIGRNO(this.textContent);'>".$r->IGRNO."</td></tr>";
}
}
?>
</table>
</div>
</center>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<label>Supplier Name</label>
@ -247,12 +313,34 @@ th{
"autoWidth": true
});
$('#non').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
$('#gen').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
});
</script>
<script>
$(document).ready(function(){
//$("#reportarea").hide();
$("#loibutton").click(function(){
$("#loiarea").toggle("slow");
});
@ -263,6 +351,11 @@ $(document).ready(function(){
$("#chartarea").toggle("slow");
});
$("#reportbutton").click(function(){
$("#reportarea").toggle("slow");
});
$('#report_date').datepicker({
//minDate : 'year+16',
maxDate : 'now',
@ -270,44 +363,14 @@ $(document).ready(function(){
});
// $('#testreport td').click(funciton(e){
// $('#igrno').select2();
//$('#igrlineitemno').select2();
// alert(e);
// });
//var jsrecords = 10;//<?php echo json_encode($records);?>;
$('#igrno').change(function(){
if($('#igrno').val() != -1)
{
var igrno = $('#igrno').val();
var html = '<option value = -1>Select IGRItemNo</option>';
$('.content').loader('show');
$.ajax({
data:{param1:igrno},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/getIGRLineItemNo",
success:function(data) {
if(data)
{
$('.content').loader('hide');
var data = JSON.parse(data);
//alert(data);
$.each(data,function(index,value){
//alert(value.IGRItemNo);
html+='<option value='+value.IGRItemNo+'>'+value.IGRItemNo+'</option>';
});
$('#igrlineitemno').find('option').remove();
$('#igrlineitemno').append(html);
}
}
});
}
});
$('#igrlineitemno').change(function(){
@ -871,6 +934,9 @@ function calculateMaster(id)
// });
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);
@ -893,6 +959,7 @@ 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";
@ -900,6 +967,7 @@ ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
@ -917,11 +985,26 @@ 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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillStyle = "black";
ctx.fillText(xlabels[i-1],(startingpointX+(xaxislabelwidth * i)),(startingpointY+15));
ctx.closePath();
@ -932,7 +1015,7 @@ for(i=1;i<=xlabelscount;i++) //X DataLabel
for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,3,0,2*Math.PI);
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,4,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.closePath();
@ -949,13 +1032,13 @@ for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc(startingpointX,(startingpointY-j),3,0,2*Math.PI);
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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillText((j/7),(startingpointX-30),(startingpointY-j));
ylabel = ylabel + 5;
j=j+35;
@ -965,20 +1048,20 @@ for(i=1;i<=xlabelscount;i++) // X Data
var finallocationofY = [];
var finallocationofX = [];
for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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),8,8)
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 = "10px Arial";
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();
@ -988,37 +1071,93 @@ for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
ctx.closePath();
}
ctx.setLineDash([]);
//ctx.beginPath();
for(i=1;i<=dataset_locationsY.length;i++) // Drawing Dashed Lines from Y
{
ctx.beginPath();
ctx.moveTo(startingpointX,dataset_locationsY[i]);
ctx.lineTo(canvaswidth,dataset_locationsY[i]);
ctx.setLineDash([3,6]);
ctx.strokeStyle="black";
ctx.lineWidth=0.2;
ctx.stroke();
ctx.closePath();
}
//sctx.closePath();
}
function getIGRNO(t)
{
//alert(t);
var tt = t;
var html = "<option value="+tt+">"+tt+"</option>";
$('#igrno').append(html);
$('#igrno').val(tt);
changeIGRNO();
//$("#igrno option:contains("+tt+")").attr("selected",true);
}
function changeIGRNO()
{
//alert($('#igrno :selected').text());
if($('#igrno').val() != -1)
{
var igrno = $('#igrno').val();
$('.content').loader('show');
$.ajax({
data:{param1:igrno},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/getIGRLineItemNo",
success:function(data) {
if(data == '')
{
alert('No Line Item Available..!');
$('.content').loader('hide');
$('#igrno').val('No Line Item Available..!');
// var data = JSON.parse(data);
// $.each(data,function(index,value){
// alert(value.IGRItemNo);
// html+='<option value='+value.IGRItemNo+'>'+value.IGRItemNo+'</option>';
// });
// $('#igrlineitemno').find('option').remove();
// $('#igrlineitemno').append(html);
}
else {
$('.content').loader('hide');
var data = JSON.parse(data);
var html = '<option value = -1>Select IGRItemNo</option>';
$.each(data,function(index,value){
//alert(value.IGRItemNo);
html+='<option value='+value.IGRItemNo+'>'+value.IGRItemNo+'</option>';
});
$('#igrlineitemno').find('option').remove();
$('#igrlineitemno').append(html);
}
}
});
}
}
</script>

View File

@ -34,19 +34,36 @@
{
// echo date('Y-m-d h:m:s');
// echo $r->Due_Start_Date;
$noofdus = $r->No_of_Dues;
$rdues = $r->No_of_Dues;
$time=strtotime($r->Due_Start_Date);
$month=date("m",$time);
$finalmonth = $month+($noofdus-1);
//echo $finalmonth;
$curmonth = date('m');
//echo $curmonth;
if($curmonth > $finalmonth)
{
// echo 'overdue';
//echo ($curmonth - $finalmonth);
$overdueflag = 1;
// echo date('Y-m-d',$time);
$dueendyear=date("Y",$time);
$dueendmonth=date("m",$time);
$dueenddate=date("d",$time);
$dueendmonth = $dueendmonth + ($rdues - 1);
if($dueendmonth < 10){
$dueendmonth = '0'.$dueendmonth;
}
// echo $dueendmonth;
$finaldueenddate = $dueendyear.'-'.$dueendmonth.'-'.$dueenddate;
$curdate = date('Y-m-d');
// echo $curdate.'-'.$finaldueenddate;exit();
if($curdate > $finaldueenddate)
{
$overdueflag =1;
}
@ -266,6 +283,7 @@
<?php
}
$overdueflag == 0;
}
?>

View File

@ -263,7 +263,7 @@ $(document).ready(function(){
});
// $('#testreport td').click(funciton(e){
$('#invoiceno').select2();
// alert(e);
// });
@ -669,7 +669,7 @@ function calculateMaster(id)
if($('#invoiceno').val() == -1)
{
alert('Select Invoice No');
return false;
//return false;
}
var cid = cid;
// if(cvalue == 0)
@ -807,12 +807,15 @@ function calculateMaster(id)
// });
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);
console.log(xlabelscount);
var dataset = dataset;
Array.prototype.max = function() {
@ -829,6 +832,7 @@ 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";
@ -836,6 +840,7 @@ ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
@ -853,11 +858,26 @@ 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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillStyle = "black";
ctx.fillText(xlabels[i-1],(startingpointX+(xaxislabelwidth * i)),(startingpointY+15));
ctx.closePath();
@ -868,7 +888,7 @@ for(i=1;i<=xlabelscount;i++) //X DataLabel
for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,3,0,2*Math.PI);
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,4,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.closePath();
@ -885,13 +905,13 @@ for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc(startingpointX,(startingpointY-j),3,0,2*Math.PI);
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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillText((j/7),(startingpointX-30),(startingpointY-j));
ylabel = ylabel + 5;
j=j+35;
@ -901,20 +921,20 @@ for(i=1;i<=xlabelscount;i++) // X Data
var finallocationofY = [];
var finallocationofX = [];
for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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),8,8)
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 = "10px Arial";
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();
@ -924,33 +944,26 @@ for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
ctx.closePath();
}
ctx.setLineDash([]);
//ctx.beginPath();
for(i=1;i<=dataset_locationsY.length;i++) // Drawing Dashed Lines from Y
{
ctx.beginPath();
ctx.moveTo(startingpointX,dataset_locationsY[i]);
ctx.lineTo(canvaswidth,dataset_locationsY[i]);
ctx.setLineDash([3,6]);
ctx.strokeStyle="black";
ctx.lineWidth=0.2;
ctx.stroke();
ctx.closePath();
}
//sctx.closePath();

View File

@ -307,6 +307,9 @@ $(document).ready(function(){
}); // 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);
@ -329,6 +332,7 @@ 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";
@ -336,6 +340,7 @@ ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
@ -345,7 +350,7 @@ ctx.closePath();
ctx.beginPath();
ctx.font = "bold 12px Arial";
ctx.fillStyle = "black";
ctx.fillText("Sieve Size µm",(canvaswidth/2),(canvasheight-2));
ctx.fillText("Sieve size µm ",(canvaswidth/2),(canvasheight-2));
ctx.closePath();
var xaxislabelwidth = (canvaswidth/12);
@ -353,11 +358,26 @@ 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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillStyle = "black";
ctx.fillText(xlabels[i-1],(startingpointX+(xaxislabelwidth * i)),(startingpointY+15));
ctx.closePath();
@ -368,7 +388,7 @@ for(i=1;i<=xlabelscount;i++) //X DataLabel
for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,3,0,2*Math.PI);
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,4,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.closePath();
@ -385,13 +405,13 @@ for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc(startingpointX,(startingpointY-j),3,0,2*Math.PI);
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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillText((j/7),(startingpointX-30),(startingpointY-j));
ylabel = ylabel + 5;
j=j+35;
@ -401,20 +421,20 @@ for(i=1;i<=xlabelscount;i++) // X Data
var finallocationofY = [];
var finallocationofX = [];
for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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),8,8)
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 = "10px Arial";
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();
@ -424,33 +444,26 @@ for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
ctx.closePath();
}
ctx.setLineDash([]);
//ctx.beginPath();
for(i=1;i<=dataset_locationsY.length;i++) // Drawing Dashed Lines from Y
{
ctx.beginPath();
ctx.moveTo(startingpointX,dataset_locationsY[i]);
ctx.lineTo(canvaswidth,dataset_locationsY[i]);
ctx.setLineDash([3,6]);
ctx.strokeStyle="black";
ctx.lineWidth=0.2;
ctx.stroke();
ctx.closePath();
}
//sctx.closePath();

View File

@ -298,6 +298,9 @@ $(document).ready(function(){
}); // 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);
@ -320,6 +323,7 @@ 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";
@ -327,6 +331,7 @@ ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 1;
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
@ -336,7 +341,7 @@ ctx.closePath();
ctx.beginPath();
ctx.font = "bold 12px Arial";
ctx.fillStyle = "black";
ctx.fillText("Sieve Size µm",(canvaswidth/2),(canvasheight-2));
ctx.fillText("Sieve size µm ",(canvaswidth/2),(canvasheight-2));
ctx.closePath();
var xaxislabelwidth = (canvaswidth/12);
@ -344,11 +349,26 @@ 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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillStyle = "black";
ctx.fillText(xlabels[i-1],(startingpointX+(xaxislabelwidth * i)),(startingpointY+15));
ctx.closePath();
@ -359,7 +379,7 @@ for(i=1;i<=xlabelscount;i++) //X DataLabel
for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,3,0,2*Math.PI);
ctx.arc((startingpointX+(xaxislabelwidth * i)),startingpointY,4,0,2*Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.closePath();
@ -376,13 +396,13 @@ for(i=1;i<=xlabelscount;i++) // X Data
{
ctx.beginPath();
ctx.arc(startingpointX,(startingpointY-j),3,0,2*Math.PI);
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 = "10px Arial";
ctx.font = "bold 10px Arial";
ctx.fillText((j/7),(startingpointX-30),(startingpointY-j));
ylabel = ylabel + 5;
j=j+35;
@ -392,20 +412,20 @@ for(i=1;i<=xlabelscount;i++) // X Data
var finallocationofY = [];
var finallocationofX = [];
for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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),8,8)
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 = "10px Arial";
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();
@ -415,33 +435,26 @@ for(i=1;i<=xlabelscount;i++) //Exact chart Data Draw red circle
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.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
ctx.closePath();
}
ctx.setLineDash([]);
//ctx.beginPath();
for(i=1;i<=dataset_locationsY.length;i++) // Drawing Dashed Lines from Y
{
ctx.beginPath();
ctx.moveTo(startingpointX,dataset_locationsY[i]);
ctx.lineTo(canvaswidth,dataset_locationsY[i]);
ctx.setLineDash([3,6]);
ctx.strokeStyle="black";
ctx.lineWidth=0.2;
ctx.stroke();
ctx.closePath();
}
//sctx.closePath();