QAD FILE UPLOAD OPTION
This commit is contained in:
parent
9648e33a20
commit
fcb2600112
@ -218,6 +218,7 @@ class quality extends BaseController
|
||||
function saveTestReportData()
|
||||
{
|
||||
|
||||
|
||||
date_default_timezone_get('Asia/Kolkata');
|
||||
$testjson = $this->input->post('param1');
|
||||
$loijson = $this->input->post('param2');
|
||||
@ -236,8 +237,17 @@ class quality extends BaseController
|
||||
//print_r($afsphpdata);die();
|
||||
$createdon = date('Y-m-d H:i:s');
|
||||
$createby = $this->session->userdata ( 'userId' );
|
||||
$document = null;
|
||||
if(!empty($_FILES['rfile']['name']))
|
||||
{
|
||||
|
||||
|
||||
$fs = $this->uploadFile();
|
||||
$document = $fs;
|
||||
|
||||
}
|
||||
|
||||
$masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart);
|
||||
$masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart,'document'=>$document);
|
||||
$MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
|
||||
|
||||
|
||||
@ -319,6 +329,8 @@ class quality extends BaseController
|
||||
function saveInwardTestReportData()
|
||||
{
|
||||
|
||||
|
||||
|
||||
date_default_timezone_get('Asia/Kolkata');
|
||||
$testjson = $this->input->post('param1');
|
||||
$loijson = $this->input->post('param2');
|
||||
@ -339,22 +351,21 @@ class quality extends BaseController
|
||||
//print_r($afsphpdata);die();
|
||||
$createdon = date('Y-m-d H:i:s');
|
||||
$createby = $this->session->userdata ( 'userId' );
|
||||
|
||||
$masterreportdata = array('igrno'=>$igrno,'igrlineitemno'=>$igrlineitemno,'batchdate'=>$report_date,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart);
|
||||
$document = null;
|
||||
if(!empty($_FILES['rfile']['name']))
|
||||
{
|
||||
|
||||
|
||||
$fs = $this->uploadFile();
|
||||
$document = $fs;
|
||||
|
||||
}
|
||||
$masterreportdata = array('igrno'=>$igrno,'igrlineitemno'=>$igrlineitemno,'batchdate'=>$report_date,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart,'document'=>$document);
|
||||
$MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
|
||||
|
||||
|
||||
|
||||
// $descrition = '';
|
||||
// $min = '';
|
||||
// $max = '';
|
||||
// $uom = '';
|
||||
// $act1 = '';
|
||||
// $act2 = '';
|
||||
// $act3 = '';
|
||||
// $average = '';
|
||||
// $results = '';
|
||||
// $remarks1 = '';
|
||||
|
||||
foreach($testphpdata as $data)
|
||||
{
|
||||
//print_r($data);die();
|
||||
@ -456,6 +467,34 @@ class quality extends BaseController
|
||||
|
||||
$this->loadViews("404", $this->global, NULL, NULL);
|
||||
}
|
||||
|
||||
function uploadFile()
|
||||
{
|
||||
|
||||
$pathinfo = pathinfo($_FILES['rfile']['name']);
|
||||
$config['upload_path'] = 'uploads/QAD/';
|
||||
$config['allowed_types'] = '*';
|
||||
$config['file_name'] = $_FILES['rfile']['name'];
|
||||
$this->load->library('upload',$config);
|
||||
$this->upload->initialize($config);
|
||||
|
||||
|
||||
if($this->upload->do_upload('rfile'))
|
||||
{
|
||||
$uploadData = $this->upload->data();
|
||||
$uploadfilename = $uploadData['file_name'];
|
||||
return $uploadfilename;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
$uploadfilename = '';
|
||||
print_r($error);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -307,7 +307,7 @@ class Quality_model extends CI_Model
|
||||
|
||||
function getTestMasterforList()
|
||||
{
|
||||
$this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description');
|
||||
$this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.document,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description');
|
||||
$this->db->from('T_Test_Report_Master');
|
||||
$this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number');
|
||||
$this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id');
|
||||
@ -329,7 +329,7 @@ class Quality_model extends CI_Model
|
||||
// $res = $this->db->get();
|
||||
// return $res->result();
|
||||
|
||||
$this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName');
|
||||
$this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Test_Report_Master.document,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName');
|
||||
$this->db->from('T_Test_Report_Master');
|
||||
$this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO');
|
||||
$this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php //print_r(count($reports['notgenerated']));?>
|
||||
<?php //print_r($reports['notgenerated']);?>
|
||||
<?php //print_r($reports['generated']);?>
|
||||
<style>
|
||||
.edit{
|
||||
@ -227,7 +227,7 @@ th{
|
||||
<thead style="background-color:#ddf">
|
||||
<tr>
|
||||
|
||||
<th>NO</th><th>Sieve Size <EFBFBD>m</th><th>Mesh Size</th><th>Sand Weight</th><th>Percentage</th><th>Multiplier</th><th>Product</th>
|
||||
<th>NO</th><th>Sieve Size µm</th><th>Mesh Size</th><th>Sand Weight</th><th>Percentage</th><th>Multiplier</th><th>Product</th>
|
||||
|
||||
|
||||
</tr>
|
||||
@ -267,6 +267,15 @@ th{
|
||||
|
||||
|
||||
<div class="row"> </div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<label>File Upload:</label>
|
||||
<form id="report_file" name="report_file" enctype="multipart/form-data" accept-charset="utf-8" method="POST" action="">
|
||||
<input type="file" id="reportfile" name="reportfile">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="col-md-3">
|
||||
@ -714,24 +723,6 @@ function calculateMaster(id)
|
||||
exit();
|
||||
}
|
||||
|
||||
// for(z=1;z<=size;z++)
|
||||
// {
|
||||
// var ide = z+'result';
|
||||
// var res = document.getElementById(ide).textContent;
|
||||
// console.log(res)
|
||||
// if(res != 'OK')
|
||||
// {
|
||||
// flag++;
|
||||
// }
|
||||
// }
|
||||
// // alert(flag);
|
||||
// var total_sandweight = parseFloat(document.getElementById('12sw').textContent);
|
||||
// if(flag != 0 || (total_sandweight!=100) )
|
||||
// {
|
||||
// alert('Test Failed, Cant Save Test Report!');
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if($('#approvedby').val() == -1)
|
||||
{
|
||||
alert('Enter Approver Name');
|
||||
@ -757,19 +748,53 @@ function calculateMaster(id)
|
||||
var approvedby = $('#approvedby').val();
|
||||
var approvedby = $('#approvedby').val();
|
||||
var report_date = $('#report_date').val();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var r = confirm('Do you Want to Save Report?');
|
||||
//alert(r);
|
||||
if(r){
|
||||
|
||||
var c = document.getElementById("myCanvas");
|
||||
var fullQuality = c.toDataURL('image/png', 1.0);
|
||||
var formData = new FormData();
|
||||
var reportfile = $("#reportfile").prop('files')[0];
|
||||
formData.append('rfile',reportfile);
|
||||
|
||||
var param1 = testreportdata;
|
||||
var param2 = testloidata;
|
||||
var param3 = testafsdata;
|
||||
var param4 = igrno;
|
||||
var param5 = igrlineitemno;
|
||||
var param6 = approvedby;
|
||||
var param7 = fullQuality;
|
||||
var param8 = report_date;
|
||||
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);
|
||||
$('.content').loader('show');
|
||||
$.ajax({
|
||||
data:{param1:testreportdata,param2:testloidata,param3:testafsdata,param4:igrno,param5:igrlineitemno,param6:approvedby,param7:fullQuality,param8:report_date},
|
||||
//dataType:"json",
|
||||
data:formData,
|
||||
//dataType:"json",{param1:testreportdata,param2:testloidata,param3:testafsdata,param4:igrno,param5:igrlineitemno,param6:approvedby,param7:fullQuality,param8:report_date},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>quality/saveInwardTestReportData",
|
||||
async : false,
|
||||
cache : false,
|
||||
contentType : false,
|
||||
processData : false,
|
||||
beforeSend: function() {
|
||||
// setting a timeout
|
||||
$('.content').loader('show');
|
||||
|
||||
},
|
||||
success:function(data) {
|
||||
if(data){
|
||||
alert(data);
|
||||
@ -942,7 +967,7 @@ 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() {
|
||||
@ -977,7 +1002,7 @@ ctx.closePath();
|
||||
ctx.beginPath();
|
||||
ctx.font = "bold 12px Arial";
|
||||
ctx.fillStyle = "black";
|
||||
ctx.fillText("Sieve size <EFBFBD>m ",(canvaswidth/2),(canvasheight-2));
|
||||
ctx.fillText("Sieve size µm ",(canvaswidth/2),(canvasheight-2));
|
||||
ctx.closePath();
|
||||
|
||||
var xaxislabelwidth = (canvaswidth/12);
|
||||
|
||||
@ -194,6 +194,14 @@ th{
|
||||
|
||||
|
||||
<div class="row"> </div>
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<label>File Upload:</label>
|
||||
<form id="report_file" name="report_file" enctype="multipart/form-data" accept-charset="utf-8" method="POST" action="">
|
||||
<input type="file" id="reportfile" name="reportfile">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="col-md-3">
|
||||
@ -638,10 +646,30 @@ function calculateMaster(id)
|
||||
|
||||
var c = document.getElementById("myCanvas");
|
||||
var fullQuality = c.toDataURL('image/png', 1.0);
|
||||
var formData = new FormData();
|
||||
var reportfile = $("#reportfile").prop('files')[0];
|
||||
formData.append('rfile',reportfile);
|
||||
|
||||
var param1 = testreportdata;
|
||||
var param2 = testloidata;
|
||||
var param3 = testafsdata;
|
||||
var param4 = invoiceno;
|
||||
var param5 = batchno;
|
||||
var param6 = approvedby;
|
||||
var param7 = fullQuality;
|
||||
|
||||
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);
|
||||
|
||||
$('.content').loader('show');
|
||||
$.ajax({
|
||||
data:{param1:testreportdata,param2:testloidata,param3:testafsdata,param4:invoiceno,param5:batchno,param6:approvedby,param7:fullQuality},
|
||||
//dataType:"json",
|
||||
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() ?>quality/saveTestReportData",
|
||||
success:function(data) {
|
||||
|
||||
@ -73,7 +73,11 @@
|
||||
|
||||
//print_r($data);echo "</br></br>";
|
||||
?>
|
||||
<tr> <td><a href="<?php echo base_url()?>quality/viewIndReport/<?php echo $data->testreport_id ?>"><?php echo $data->testreport_id?></a></td> <td><?php echo $data->invoiceid?></td> <td style="text-align:right;"><?php echo date_format(date_create($data->batchdate),'d-m-Y');?></td><td><?php echo $data->product_name;?></td><td><?php echo $data->client_name;?></td></tr>
|
||||
<tr> <td><a href="<?php echo base_url()?>quality/viewIndReport/<?php echo $data->testreport_id ?>"><?php echo $data->testreport_id?></a>
|
||||
<?php if(!empty($data->document)){?>
|
||||
<a href="<?php echo base_url()?>uploads/QAD/<?php echo $data->document ?>"><span class="fa fa-file-o"></span></a>
|
||||
<?php }?>
|
||||
</td> <td><?php echo $data->invoiceid?></td> <td style="text-align:right;"><?php echo date_format(date_create($data->batchdate),'d-m-Y');?></td><td><?php echo $data->product_name;?></td><td><?php echo $data->client_name;?></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,14 @@
|
||||
|
||||
//print_r($data);echo "</br></br>";
|
||||
?>
|
||||
<tr> <td><a href="<?php echo base_url()?>quality/viewIndInwardReport/<?php echo $data->testreport_id ?>"><?php echo $data->testreport_id?></a></td> <td><?php echo $data->IGRNO?></td> <td><?php echo $data->IGRItemNo?></td><td style="text-align:right;"><?php echo date_format(date_create($data->batchdate),'d-m-Y');?></td><td><?php echo $data->SupplierName;?></td><td><?php echo $data->Materialname;?></td></tr>
|
||||
<tr> <td><a href="<?php echo base_url()?>quality/viewIndInwardReport/<?php echo $data->testreport_id ?>"><?php echo $data->testreport_id?></a>
|
||||
<?php if(!empty($data->document))
|
||||
{
|
||||
?>
|
||||
<a target="_blank" href="<?php echo base_url()?>uploads/QAD/<?php echo $data->document ?>"><span class="fa fa-file-o"></span></a>
|
||||
<?php } ?>
|
||||
|
||||
</td> <td><?php echo $data->IGRNO?></td> <td><?php echo $data->IGRItemNo?></td><td style="text-align:right;"><?php echo date_format(date_create($data->batchdate),'d-m-Y');?></td><td><?php echo $data->SupplierName;?></td><td><?php echo $data->Materialname;?></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
BIN
uploads/QAD/6643071.jpg
Normal file
BIN
uploads/QAD/6643071.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 MiB |
Loading…
Reference in New Issue
Block a user