NEW MODULE QA

This commit is contained in:
velz2020 2017-12-01 20:56:24 +05:30
parent e8aadd1635
commit 4febdd7780
11 changed files with 3115 additions and 1 deletions

View File

@ -203,7 +203,7 @@ $route['Distribution'] = "MRIRcontroller/viewmMaterialDistributionList";
$route['ViewIncomeExpense'] = "cashbook/incomeExpenseList";
$route['addNewIncomeExpense'] = "cashbook/addNewIncomeExpenseLoad";
$route['addIncomeExpense'] = "cashbook/addIncomeExpense";
$route['qualityreportlist'] = "quality/reportList";
//<-------------Store page----------------->
$route['Stock'] = "storestatus/storeavailability";
$route['UpdatePOStatus'] = "servicepurchaseorder/UpdateServicePOStatus";

View File

@ -0,0 +1,287 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/BaseController.php';
/**
* Class : purchaseorder (PurchaseorderController)
* User Class to control all user related operations.
* @author : VenbaMail Mali
* @version : 1.1
* @since : 15 Feb 2016
*/
class quality extends BaseController
{
/**
* This is default constructor of the class
*/
public function __construct()
{
parent::__construct();
$this->load->model('quality_model');
$this->load->library('form_validation');
//$this->load->library('dompdf_gen');
$this->isLoggedIn();
}
/**
* This function used to load the first screen of the user
*/
public function index()
{
$data['products'] = $this->quality_model->getAllprodcuts();
$data['customers'] = $this->quality_model->getAllcustomers();
$data['existspec'] = $this->quality_model->getAllspec();
$this->global['pageTitle'] = 'Siddharth : Quality Master';
$this->loadViews("qualitymasterlistview", $this->global, $data , NULL);
}
public function reportList()
{
$data['records'] = $this->quality_model->getTestMasterforList();
$this->global['pageTitle'] = 'Siddharth : Quality Master';
$this->loadViews("reportmasterlist", $this->global, $data , NULL);
}
function addNewPage()
{
$data['products'] = $this->quality_model->getAllprodcuts();
$data['customers'] = $this->quality_model->getAllcustomers();
$this->global['pageTitle'] = 'Siddharth : Quality Master';
$this->loadViews("qualitymaster", $this->global, $data , NULL);
}
function saveSpectficationData()
{
$product = $this->input->post('param2');
$customer = $this->input->post('param3');
$jsondata = $this->input->post('param1');
$createdby = $this->session->userdata ( 'userId' );
$phpdata = json_decode($jsondata);
$total = 0;
// echo $product .'-'. $customer;
// print_r($phpdata);die();
foreach($phpdata as $data)
{
$name = $data->Name;
$name = strtoupper($name);
$uom = $data->UOM;
$min = $data->Min;
$max = $data->Max;
$temp = $data->Temp;
$isExist = $this->quality_model->checkExist($product,$customer,$name);
//echo $isExist[0]->count;die();
if($isExist[0]->count == 0)
{
$tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'created_by'=>$createdby);
$res = $this->quality_model->addSpecMast($tostore);
//echo 'i'.$res;
}
else if($isExist[0]->count == 1)
{
$tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'updated_by'=>$createdby);
$res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name);
//echo 'u'.$res;
}
$total +=$res;
}
echo $total.'- Specification Saved Successfully';
}
function deleteSpecification()
{
$spname = $this->input->post('param1');
$product = $this->input->post('param2');
$customer = $this->input->post('param3');
$res = $this->quality_model->deleteSpecification($spname,$product,$customer);
if($res == 1)
{
echo "Deleted Successfully..!";
}
else
{
echo "Something Went Wrong..!Try later";
}
}
function report()
{
$data['records'] = $this->quality_model->getDataforReport();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$this->global['pageTitle'] = 'Siddharth : Inspection Report Screen';
$this->loadViews("qualityreport", $this->global, $data, NULL);
}
function viewSpec()
{
$prodcutid = $this->uri->segment(3);
$customerid =$this->uri->segment(4);
$data['specifications'] = $this->quality_model->getIndividualSpec($prodcutid,$customerid);
$this->global['pageTitle'] = 'Siddharth : View reports Lists';
$this->loadViews("viewIndSpec", $this->global, $data, NULL);
}
function viewIndReport()
{
$reportid = $this->uri->segment(3);
$data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
$this->global['pageTitle'] = 'Siddharth : View Individual Report';
$this->loadViews("viewindreport", $this->global, $data, NULL);
}
function printReportPDF()
{
$reportid = $this->input->post('rid');
$data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
$filename = 'PRE DESPATCH INSPECTION REPORT'.$reportid;
$html = $this->load->View("viewindreportpdf",$data,true);
require APPPATH . '/third_party/mpdf/mpdf.php';
$mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 1;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->WriteHTML($html);
$mpdf->Output("".$filename.'.pdf','I',$php);
}
function getAllSpecforReport()
{
$productid = $this->input->post('param1');
$customerid = $this->input->post('param2');
//echo 'from cn'.$productid.'-'.$customerid;
$res = $this->quality_model->getSpecifications($productid,$customerid);
echo json_encode($res);
}
function saveTestReportData()
{
date_default_timezone_get('Asia/Kolkata');
$testjson = $this->input->post('param1');
$loijson = $this->input->post('param2');
$afsjson = $this->input->post('param3');
$invoiceno = $this->input->post('param4');
$batchno = $this->input->post('param5');
$chart = $this->input->post('param7');
$batchno = date_format(date_create($batchno),'Y-m-d');
$approver = $this->input->post('param6');
$testphpdata = json_decode($testjson,true);
$loiphpdata = json_decode($loijson,true);
$afsphpdata = json_decode($afsjson,true);
//print_r($afsphpdata);die();
$createdon = date('Y-m-d H:i:s');
$createby = $this->session->userdata ( 'userId' );
$masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart);
$MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
$descrition = '';
$min = '';
$max = '';
$uom = '';
$act1 = '';
$act2 = '';
$act3 = '';
$average = '';
$results = '';
$remarks1 = '';
foreach($testphpdata as $data)
{
//print_r($data);die();
$descrition = $data['Description'];
$min = $data['SpecificationMin'];
$max = $data['SpecificationMax'];
$uom = $data['SpecificationUOM'];
$act1 = $data['ACT X1'];
$act2 = $data['ACT X2'];
$act3 = $data['ACT X3'];
$average = $data['Average'];
$results = $data['Results'];
$remarks1 = $data['Remarks'];
$testreportdata = array('testreport_id'=>$MASTERID,'description'=>$descrition,'min'=>$min,'max'=>$max,'UOM'=>$uom,'act1'=>$act1,'act2'=>$act2,'act3'=>$act3,'average'=>$average,'result'=>$results,'remarks'=>$remarks1);
$reportid = $this->quality_model->saveTestReportData($testreportdata);
}
$start = '';
$end = '';
$temp = '';
$w1 = '';
$w2 = '';
$w3 = '';
$loip = '';
$remark = '';
foreach($loiphpdata as $loi)
{
$start = $loi['Heating Timestart'];
$end = $loi['Heating Timeend'];
$temp = $loi['Temp *c'];
$w1 = $loi['Crucible Weight w1(g)'];
$w2 = $loi['Before Heatingw2(g)'];
$w3 = $loi['After Heatingw3(g)'];
$loip = $loi['L.O.I %'];
$remark = $loi['Remarks'];
//echo $loip;
//echo $remark;die();
$loitabledata = array('testreport_id'=>$MASTERID,'start_time'=>$start,'end_time'=>$end,'temp'=>$temp,'w1'=>$w1,'w2'=>$w2,'w3'=>$w3,'loi_percentage'=>$loip,'remarks'=>$remark);
$loiid = $this->quality_model->saveTestReportLOIData($loitabledata);
}
$count =0;
foreach($afsphpdata as $afs)
{
$count++;
if($count != 12){
$ssize = $afs['Sieve Size µm'];
$sandweight = $afs['Sand Weight'];
$Percentage = $afs['Percentage'];
$Multiplier = $afs['Multiplier'];
$Product = $afs['Product'];
$afstabledata = array('testreport_id'=>$MASTERID,'sieve_size'=>$ssize,'sandweight'=>$sandweight,'percentage'=>$Percentage,'multiplier'=>$Multiplier,'product'=>$Product);
$afsid = $this->quality_model->saveTestReportAFSData($afstabledata);
}
}
echo "Report Data Saved Successfully!";
}
function pageNotFound()
{
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
$this->loadViews("404", $this->global, NULL, NULL);
}
}
?>

View File

@ -0,0 +1,225 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
class Quality_model extends CI_Model
{
function getAllInvoiceNo()
{
$this->db->select('invoice_id');
$this->db->from('ip_invoices');
$result = $this->db->get();
return $result->result();
}
function getAllprodcuts()
{
$this->db->select('product_id,product_name');
$this->db->from('ip_products');
$result = $this->db->get();
return $result->result();
}
function getAllcustomers()
{
$this->db->select('client_id,client_name');
$this->db->from('ip_clients');
$result = $this->db->get();
return $result->result();
}
function checkExist($product,$customer,$name)
{
$this->db->select('count(*) as count');
$this->db->from('T_Prodcut_Specification_Master');
$this->db->where('product_id',$product);
$this->db->where('customer_id',$customer);
$this->db->where('testtype',$name);
$result = $this->db->get();
return $result->result();
}
function addSpecMast($data)
{
//print_r($data);
$this->db->insert('T_Prodcut_Specification_Master',$data);
$r = $this->db->affected_rows();
return $r;
}
function updateSpecMast($data,$product,$customer,$name)
{
//echo $product.$customer.$name;
//print_r($data);
$this->db->where('product_id',$product);
$this->db->where('customer_id',$customer);
$this->db->where('testtype',$name);
$this->db->update('T_Prodcut_Specification_Master',$data);
$r = $this->db->affected_rows();
//echo $r;die();
return $r;
}
function getAllspec()
{
$this->db->select('T_Prodcut_Specification_Master.*,ip_products.product_name,ip_clients.client_name,count(*) as count');
$this->db->from('T_Prodcut_Specification_Master');
$this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id');
$this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id');
$this->db->group_by('product_id,customer_id');
$result = $this->db->get();
return $result->result();
}
function getIndividualSpec($prodcutid,$customerid)
{
$this->db->select('T_Prodcut_Specification_Master.*,ip_products.product_name,ip_clients.client_name');
$this->db->from('T_Prodcut_Specification_Master');
$this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id');
$this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id');
$this->db->where('T_Prodcut_Specification_Master.product_id',$prodcutid);
$this->db->where('T_Prodcut_Specification_Master.customer_id',$customerid);
$result = $this->db->get();
return $result->result();
}
function deleteSpecification($spname,$product,$customer)
{
$this->db->where("testtype", $spname);
$this->db->where("product_id", $product);
$this->db->where("customer_id", $customer);
$this->db->delete('T_Prodcut_Specification_Master');
$r = $this->db->affected_rows();
return $r;
}
function getDataforReport()
{
$this->db->select('ip_invoices.invoice_id,ip_invoices.client_id,ip_invoice_custom.invoice_custom_fieldvalue,ip_clients.client_name,ip_invoices.invoice_date_created,ip_invoice_items.item_product_id,ip_products.product_name,ip_invoice_items.item_quantity');
$this->db->from('ip_invoices');
$this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id');
$this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id');
$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id');
$this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62');
$this->db->order_by('ip_invoices.invoice_id');
$res = $this->db->get();
return $res->result();
}
function getSpecifications($productid,$customerid)
{
$this->db->where('product_id',$productid);
$this->db->where('customer_id',$customerid);
$res = $this->db->get('T_Prodcut_Specification_Master');
return $res->result();
}
function getEmplistforReport()
{
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName,');
$this->db->from('T_Employee_Details');
$this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode');
//$this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id');
//$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id');
//$this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62');
$this->db->order_by('T_Employee_Details.EmpID');
$res = $this->db->get();
return $res->result();
}
function saveMasterTestData($masterreportdata)
{
$this->db->insert('T_Test_Report_Master',$masterreportdata);
$id = $this->db->insert_id();
return $id;
}
function saveTestReportData($testreportdata)
{
$this->db->insert('T_Test_Report',$testreportdata);
$row = $this->db->affected_rows();
return $row;
}
function saveTestReportAFSData($afstabledata)
{
$this->db->insert('T_Test_Report_AFS',$afstabledata);
$row = $this->db->affected_rows();
return $row;
}
function saveTestReportLOIData($loitabledata)
{
$this->db->insert('T_Test_Report_LOI',$loitabledata);
$row = $this->db->affected_rows();
return $row;
}
function getIndividualReportData($reportid)
{
$this->db->select('T_Test_Report_Master.testreport_id,ip_invoices.invoice_date_created,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.chartdata,ip_clients.client_id,ip_clients.client_name,invoice_custom_fieldvalue,ip_products.product_id,ip_products.product_name,T_Employee_Details.FirstName,T_Employee_Details.LastName,ip_invoice_items.item_quantity,T_Test_Report_Master.approvedby');
$this->db->from('T_Test_Report_Master');
$this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_id');
$this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id');
$this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id');
$this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id');
$this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62');
$this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
//$this->db->join('T_Employee_Details','T_Test_Report_Master.EmpID=T_Employee_Details.EmpID');
//$this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62');
$this->db->where('testreport_id',$reportid);
// $this->db->join('T_Test_Report','T_Test_Report_Master.testreport_id=T_Test_Report.testreport_id');
// $this->db->join('T_Test_Report_loi','T_Test_Report_Master.testreport_id=T_Test_Report_loi.testreport_id');
// $this->db->join('T_Test_Report_afs','T_Test_Report_Master.testreport_id=T_Test_Report_afs.testreport_id');
$res = $this->db->get();
$reportdata['master'] = $res->result();
$this->db->select('T_Test_Report.*');
$this->db->from('T_Test_Report');
$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['masterreport'] = $res1->result();
$this->db->select('T_Test_Report_LOI.*');
$this->db->from('T_Test_Report_LOI');
$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['masterreportloi'] = $res1->result();
$this->db->select('T_Test_Report_AFS.*');
$this->db->from('T_Test_Report_AFS');
$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['masterreportafs'] = $res1->result();
$this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic');
$this->db->from('T_Company_Details');
//$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['company'] = $res1->result();
return $reportdata;
}
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');
$this->db->from('T_Test_Report_Master');
$this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_id');
$this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id');
$this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id');
$this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id');
$res = $this->db->get();
return $res->result();
}
}
?>

View File

@ -551,6 +551,18 @@ $(function() {
<span>View Material Inspection Report</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>quality">
<i class="fa fa-list-alt"></i>
<span>Product Test Specification Master</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>qualityreportlist">
<i class="fa fa-table"></i>
<span>Product Test Report</span>
</a>
</li>
<?php
}

View File

@ -0,0 +1,313 @@
<style>
th{
text-align:center ! important;
}
</style>
<?php
//print_r($products);
$products2=array(-1=>'Select Products');
foreach($products as $product)
{
$products2[$product->product_id] = $product->product_name;
}
$customers2 = array(-1 => 'Select Customer');
foreach($customers as $customer)
{
$customers2[$customer->client_id] = $customer->client_name;
}
?>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Product Test Specification Master Screen</center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!--<center><h3 class="box-title">-->
<div class="box-tools">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<?php echo form_dropdown('name="product"',$products2,set_value('product',$products2[-1]),'id="product"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<?php echo form_dropdown('name="customer"',$customers2,set_value('customer',$customers2[-1]),'id="customer"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
</div>
</div>
<br/>
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Name</th>
<th>UOM</th>
<th>Min</th>
<th>Max</th>
<th>Temp</th>
<th>Action</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
if(!empty($existspec))
{
foreach($existspec as $data)
{
?>
<!-- <tr> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true"><?php echo $data->min?></td> <td contenteditable="true"><?php echo $data->max?></td></tr> -->
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-3" id="savebutton">
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
<div id="specmodel" 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">Add New Specification</h4>
</div>
<div class="modal-body">
<form>
<center>
<table >
<tr>
<td style="text-align:center;padding:10px;">Specification Name</td><td style="padding:10px;"><input type="text" name="spname" id="spname"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">UOM</td><td style="padding:10px;"><input type="text" name="uom" id="uom"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">Min</td><td style="padding:10px;"><input type="text" name="min`" id="min"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;;">Max</td><td style="padding:10px;"><input type="text" name="max" id="max"/></td>
</tr>
<tr>
<td style="text-align:center;padding:10px;;">Temp</td><td style="padding:10px;"><input type="text" name="temp" id="temp"/></td>
</tr>
</table>
</center>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="addNewRow" onclick="addNewRow();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</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 type="text/html" id="addList">
<tr id=<%=index%>>
<td align="left" contenteditable="false"><%=Name%></td>
<td align="left"contenteditable="true"><%=UOM%></td>
<td align="right" contenteditable="true"><%=Min%></td>
<td align="right" contenteditable="true"><%=Max%></td>
<td align="right" contenteditable="true"><%=Temp%></td>
<td align="center" contenteditable="false"><a data-target='#specmodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#specmodel">&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
</tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
</script>
<script>
$('#addspec').click(function(){
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else
{
$('#specmodel').modal('show');
}
});
function addNewRow()
{
var sname = $('#spname').val();
sname = sname.toUpperCase();
var uom = $('#uom').val();
var min = $('#min').val();
var max = $('#max').val();
var temp = $('#temp').val();
if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
{
alert('Please Enter all specification');
}
else
{
var rows = document.getElementById('testspecifications').rows.length;
//rows = rows-1;
var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp}));
$('#spname').val('');
$('#uom').val('');
$('#min').val('');
$('#max').val('');
$('#temp').val('');
document.getElementById('spname').focus();
}
}
$("#specmodel").on("shown.bs.modal", function(e) {
document.getElementById('spname').focus();
});
function getAllData()
{
var alldata = $("#testspecifications").tableToJSON();
//alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
$('#content').loader('show');
$.ajax({
data:{param1:alldata,param2:product,param3:customer},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/saveSpectficationData",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
//console.log(data);
}
}
});
}
}
function DeleteRow(rowid)
{
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
var d='';
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
$.each(Row,function(index,value){
if(index == 1 ){
d = value.textContent
}
});
$('#content').loader('show');
$.ajax({
data:{param1:d,param2:product,param3:customer},
type:"POST",
url:"<?php echo base_url() ?>quality/deleteSpecification",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
}
</script>

View File

@ -0,0 +1,293 @@
<?php
//print_r($existspec);
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Product Test Specification List</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">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<div class="col-md-3">
<a href=" <?php echo base_url().'quality/addNewPage';?> " type="button" class="btn btn-primary">Add New</a>
</div>
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<!-- <div class="row">
<div class="col-md-3">
<?php echo form_dropdown('name="product"',$products2,set_value('product',$products2[-1]),'id="product"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<?php echo form_dropdown('name="customer"',$customers2,set_value('customer',$customers2[-1]),'id="customer"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
</div>
</div> -->
<br/>
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Product Name</th>
<th>Company Name</th>
<th>Total Specification</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
if(!empty($existspec))
{
foreach($existspec as $data)
{
//print_r($data);echo "</br></br>";
?>
<tr> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $data->product_id.'/'.$data->customer_id ?>"><?php echo $data->product_name?></a></td> <td><a href="<?php echo base_url()?>quality/viewSpec/<?php echo $data->product_id.'/'.$data->customer_id ?>"><?php echo $data->client_name?></a></td> <td><?php echo $data->count?></td></tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-3" id="savebutton">
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
<div id="specmodel" 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">Add New Specification</h4>
</div>
<div class="modal-body">
<form>
<center>
<table >
<tr>
<td style="text-align:center;padding:10px;">Specification Name</td><td style="padding:10px;"><input type="text" name="spname" id="spname"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">UOM</td><td style="padding:10px;"><input type="text" name="uom" id="uom"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">Min</td><td style="padding:10px;"><input type="text" name="min`" id="min"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;;">Max</td><td style="padding:10px;"><input type="text" name="max" id="max"/></td>
</tr>
</table>
</center>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="addNewRow" onclick="addNewRow();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</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 () {
$('#testspecifications').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
});
</script>
<script type="text/html" id="addList">
<tr id=<%=index%>>
<td align="left" contenteditable="false"><%=Name%></td>
<td align="left"contenteditable="true"><%=UOM%></td>
<td align="right" contenteditable="true"><%=Min%></td>
<td align="right" contenteditable="true"><%=Max%></td>
<td align="center" contenteditable="false"><a data-target='#specmodel' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#specmodel">&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
</tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
</script>
<script>
$('#addspec').click(function(){
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else
{
$('#specmodel').modal('show');
}
});
function addNewRow()
{
var sname = $('#spname').val();
sname = sname.toUpperCase();
var uom = $('#uom').val();
var min = $('#min').val();
var max = $('#max').val();
if(sname == '' || uom =='' || min == '' || max == '')
{
alert('Please Enter all specification');
}
else
{
var rows = document.getElementById('testspecifications').rows.length;
//rows = rows-1;
var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max}));
$('#spname').val('');
$('#uom').val('');
$('#min').val('');
$('#max').val('');
}
}
$("#specmodel").on("shown.bs.modal", function(e) {
// userid = $(e.relatedTarget).data('userid');
// var tr= document.getElementById(userid);
// var cellval = tr.cells;
});
function getAllData()
{
var alldata = $("#testspecifications").tableToJSON();
//alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
$('#content').loader('show');
$.ajax({
data:{param1:alldata,param2:product,param3:customer},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/saveSpectficationData",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
//console.log(data);
}
}
});
}
}
function DeleteRow(rowid)
{
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
var d='';
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
$.each(Row,function(index,value){
if(index == 1 ){
d = value.textContent
}
});
$('#content').loader('show');
$.ajax({
data:{param1:d,param2:product,param3:customer},
type:"POST",
url:"<?php echo base_url() ?>quality/deleteSpecification",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
}
</script>

View File

@ -0,0 +1,955 @@
<style>
.edit{
background-color:#eeffcc ! important;
}
</style>
<?php
//color:red ! important;
$invoicenos = array(-1=>'Select Invoice No');
foreach($records as $rec)
{
$invoicenos[$rec->invoice_id] = $rec->invoice_id;
}
//print_r($emplist);
$approvedby = array(-1=>'Select Approver Name');
foreach($emplist as $r)
{
$approvedby[$r->FirstName.' '.$r->LastName] = $r->FirstName.' '.$r->LastName.'-'.$r->shortName;
}
?>
<style>
th{
text-align:center !important;
}
</style>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Pre Dispatch Inspection Report Screen</center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!--<center><h3 class="box-title">-->
<div class="box-tools">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<form action="<?php echo base_url() ?>monthlypay/monthlyListing" method="POST" id="searchList">
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<label>Invoice No</label>
<?php echo form_dropdown('name="invoiceno"',$invoicenos,set_value('invoiceno',$invoicenos[-1]),'id="invoiceno"' ,'class="form-control select2', 'style="text-align:center;"');?>
</div>
<div class="col-md-3">
<label>Invoice Date</label>
<input type="text" id="invoicedate" name="invoicedate" class="form-control" readonly>
</div>
<div class="col-md-3">
<label>Customer Name</label>
<input type="text" id="customername" name="customername" class="form-control" readonly>
<input type="hidden" id="customerid" name="customerid" readonly>
</div>
<div class="col-md-3">
<label>Product Name</label>
<input type="text" id="productname" name="productname" class="form-control" readonly>
<input type="hidden" id="productid" name="productid" readonly>
</div>
</div>
<div class="row">
<div class="col-md-3">
<label>Batch No</label>
<input type="text" id="batchno" name="batchno" class="form-control" readonly>
</div>
<div class="col-md-3">
<label>Qty</label>
<input type="text" id="qty" name="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">
</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">
</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">
</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">
<tr id="1"> <td>1</td> <td id="1size">1700</td> <td id="1sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="1p">0.00</td><td id="1m">5</td><td id="1pt">0.0000</td></tr>
<tr id="2"> <td>2</td> <td id="2size">850</td> <td id="2sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="2p">0.00</td><td id="2m">10</td><td id="2pt">0.0000</td></tr>
<tr id="3"> <td>3</td> <td id="3size">600</td> <td id="3sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="3p">0.00</td><td id="3m">20</td><td id="3pt">0.0000</td></tr>
<tr id="4"> <td>4</td> <td id="4size">425</td> <td id="4sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="4p">0.00</td><td id="4m">30</td><td id="4pt">0.0000</td></tr>
<tr id="5"> <td>5</td> <td id="5size">300</td> <td id="5sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="5p">0.00</td><td id="5m">40</td><td id="5pt">0.0000</td></tr>
<tr id="6"> <td>6</td> <td id="6size">212</td> <td id="6sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="6p">0.00</td><td id="6m">50</td><td id="6pt">0.0000</td></tr>
<tr id="7"> <td>7</td> <td id="7size">150</td> <td id="7sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="7p">0.00</td><td id="7m">70</td><td id="7pt">0.0000</td></tr>
<tr id="8"> <td>8</td> <td id="8size">106</td> <td id="8sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="8p">0.00</td><td id="8m">100</td><td id="8pt">0.0000</td></tr>
<tr id="9"> <td>9</td> <td id="9size">75</td> <td id="9sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="9p">0.00</td><td id="9m">140</td><td id="9pt">0.0000</td></tr>
<tr id="10"> <td>10</td> <td id="10size">53</td> <td id="10sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="10p">0.00</td><td id="10m">200</td><td id="10pt">0.0000</td></tr>
<tr id="11"> <td>11</td> <td id="11size">pan</td> <td id="11sw" class="edit" contenteditable="true" onkeyup="calculateAFS(this.parentNode.id,this.textContent,this.id);">0.00</td><td id="11p">0.00</td><td id="11m">300</td><td id="11pt">0.0000</td></tr>
<tr id="12"> <td>&nbsp;</td> <td><b>Total</b></td> <td id="12sw">0.00</td><td id="12p">0.00</td><td id="12m">&nbsp;</td><td id="12pt">0.0000</td></tr>
</tbody>
</table>
</div>
<div class="col-md-12">
<div class="col-md-3"><b> 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 $this->session->userdata ( 'name' );?>" readonly>
<input type="hidden" value="<?php echo $this->session->userdata ( 'userId' );?>">
</div>
<div class="col-md-3 col-md-offset-6 ">
<label>Approved By :</label>
<?php echo form_dropdown('name="approvedby"',$approvedby,set_value('approvedby',$approvedby[-1]),'id="approvedby"' ,'class="form-control select2', 'style="text-align:center;"');?>
<!-- <input type="text" id="approvedby" class="form-control"> -->
</div>
</div>
<div class="row">&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-primary" onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
<script type="text/javascript">
$(function () {
$('#monthlylisting').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true
});
});
</script>
<script>
$(document).ready(function(){
$("#loibutton").click(function(){
$("#loiarea").toggle("slow");
});
$("#afsbutton").click(function(){
$("#afsarea").toggle("slow");
});
$("#chartbutton").click(function(){
$("#chartarea").toggle("slow");
});
$('#reportdate').datepicker({
minDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});
// $('#testreport td').click(funciton(e){
// alert(e);
// });
var jsrecords = <?php echo json_encode($records);?>;
$('#invoiceno').change(function(){
var invoiceid = $('#invoiceno').val();
//alert(invoiceid);
////console.log(jsrecords);
//console.log(jsrecords[0]['invoice_id'])
$.each(jsrecords,function(index,value){
// console.log(index+'-'+value['invoice_id']);
if(invoiceid == value['invoice_id'])
{
$('#testreport tbody').remove();
$('#testreport').append('<tbody id="specAppend"></tbody>');
$('#loitable tbody').remove();
$('#loitable').append('<tbody id="loiAppend"></tbody>');
var d=new Date(value['invoice_date_created']);
var d = d.getDate()+'-'+(d.getMonth()+1)+'-'+d.getFullYear();
$('#invoicedate').val(d);
$('#customername').val(value['client_id']+'-'+value['client_name']);
$('#customerid').val(value['client_id']);
$('#productname').val(value['item_product_id']+'-'+value['product_name']);
$('#productid').val(value['item_product_id']);
$('#qty').val(value['item_quantity']);
var batchno = 0;
if(value['invoice_custom_fieldvalue'] != ''){ batchno = value['invoice_custom_fieldvalue'];}
$('#batchno').val(batchno);
}
});
var productid = $('#productid').val();
var customerid = $('#customerid').val();
$('#content').loader('show');
$.ajax({
data:{param1:productid,param2:customerid},
type:"POST",
url:"<?php echo base_url() ?>quality/getAllSpecforReport",
success:function(data) {
if(data)
{
//alert(data);
var jsdata = data;
var jsdata = JSON.parse(jsdata);
// console.log(jsdata);
var html = '';
var html2 = '';
$.each(jsdata,function(i,item){
var index = i+1;
var test = item['testtype'];
var min = item['min'];
var max = item['max'];
var uom = item['uom'];
var temp = item['temp'];
//console.log(spec);
html += '<tr id='+index+'><td>'+index+'</td><td id='+index+'description>'+test+'</td><td id='+index+'min>'+min+'</td><td id='+index+'max>'+max+'</td><td>'+uom+'</td>';
if(test != 'AFS' && test != 'LOI')
{
html +='<td class="edit" contenteditable="true" onkeyup="calculateMaster(this.id);" id='+index+'act1>0.00</td> <td class="edit" contenteditable="true" onkeyup="calculateMaster(this.id);" id='+index+'act2>0.00</td> <td class="edit" contenteditable="true" onkeyup="calculateMaster(this.id);" id='+index+'act3>0.00</td>';
}
else if(test == 'AFS')
{
html += '<td colspan="3" id="AFS" onkeyup="calculateMaster(this.id);">0.00</td>';
}
else if(test == 'LOI')
{
html +='<td onkeyup="calculateMaster(this.id);" id=1loi'+index+'>0.00</td> <td onkeyup="calculateMaster(this.id);" id=2loi'+index+'>0.00</td> <td onkeyup="calculateMaster(this.id);" id=3loi'+index+'>0.00</td>';
}
html += '<td id='+index+'avg>0.00</td><td id='+index+'result>-</td><td contenteditable="true"></td></tr>';
if(test == 'LOI')
{
for(i=1;i<=3;i++){
html2 += '<tr id='+i+'> <td>'+i+'</td> <td class="edit" contenteditable="true" id='+i+'start onkeyup="calculateMaster(this.id);">0.00</td> <td class="edit" contenteditable="true" id='+i+'end onkeyup="calculateMaster(this.id);">0.00</td> <td id='+i+'temp>'+temp+'</td>';
html2 += '<td class="edit" contenteditable="true" id='+i+'w1 onkeyup="calculateMaster(this.id);">0.00</td> <td class="edit" contenteditable="true" id='+i+'w2 onkeyup="calculateMaster(this.id);">0.00</td> <td class="edit" contenteditable="true" id='+i+'w3 onkeyup="calculateMaster(this.id);">0.00</td> <td id='+i+'loi>0.00</td> <td contenteditable="true"></td> </tr>';
}
}
});
$("#testreport tbody").append(html);
$("#loitable tbody").append(html2);
$('#content').loader('hide');
}
}
});
});//End of invoice change funciton
$('.edit').bind('keypress', function(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))
{
return true;
}
if(e.keyCode == 13)
{
return false;
}
if(((e.which || e.keyCode) < 48) || ((e.which || e.keyCode) > 57))
{
return false;
}
});
}); // End of document on ready funciton
function calculateMaster(id)
{
if($('#invoiceno').val() == -1)
{
alert('Select Invoice No');
return false;
}
var cid = id;
if(document.getElementById(id)){
var cvalue = document.getElementById(id).textContent;
if(cvalue == 0 )
{
document.getElementById(id).textContent = '';
}
}
var Rows = $('#testreport').find('tr');
var size = Object.keys(Rows).length;
size = size-5;
var LOIROWNO = 0;
for(i=1;i<=size;i++)
{
var Row = $('#testreport').find('tr').eq(i).find('td');
//console.log(Row);
var desc = ''; var min =''; var max = ''; var act1 = ''; var act2 = ''; var act3 = ''; var avg = ''; var res = '';
$.each(Row,function(index,value){
//console.log(index);
if(index != 0 && index != 4 && index != 10)
{
//console.log('**************************************');
//console.log(value.id+'-'+value.textContent);
if(index == 1){ desc = value.textContent; }
if(index == 2){ min = value.textContent; }
if(index == 3){ max = value.textContent; }
if(index == 5){ act1 = value.textContent; }
if(index == 6){ act2 = value.textContent; }
if(index == 7){ act3 = value.textContent; }
}
});
if(desc == 'LOI')
{
LOIROWNO = i;
}
if(desc != 'AFS')
{
if(isNaN(act1) || act1 == '' || act1 == null)
{
act1 = 0.00;
}
if(isNaN(act2) || act2 == '' || act2 == null)
{
act2 = 0.00;
}
if(isNaN(act3) || act3 == '' || act3 == null)
{
act3 = 0.00;
}
avg = ((parseFloat(act1) + parseFloat(act2) + parseFloat(act3))/ 3);
}
else
{
avg = document.getElementById('AFS').textContent;
}
min = parseFloat(min);
max = parseFloat(max);
avg = parseFloat(avg);
//console.log(min+'-'+max+'-'+avg);
var curavgid = i+'avg';
document.getElementById(curavgid).textContent = parseFloat(avg).toFixed(2);
if($.isNumeric(min) && $.isNumeric(max))
{
if(avg >= min && avg <= max)
{
res = 'OK';
}
else
{
res = '-';
}
}
else if($.isNumeric(min) && !($.isNumeric(max)))
{
if(avg >= min)
{
res = 'OK';
//alert(res);
}
else
{
res = '-';
}
}
else if(!$.isNumeric(min) && $.isNumeric(max))
{
if(avg <= max)
{
res = 'OK';
}
else
{
res = '-';
}
}
var curresultid = i+'result';
document.getElementById(curresultid).textContent = res;
}
for(j=1;j<=3;j++)
{
var loiRow = $('#loitable').find('tr').eq(j).find('td');
var start = ''; var end =''; var temp = ''; var act1 = ''; var w1 = ''; var w2 = ''; var w3 = ''; var loiid = '';var loi = 0;
$.each(loiRow,function(iter,rec){
if(iter != 0 && iter != 8)
{
//console.log('**************************************');
//console.log(iter+'-'+rec.id+'-'+rec.textContent);
if(iter == 1){ start = rec.textContent; }
if(iter == 2){ end = rec.textContent; }
if(iter == 3){ temp = rec.textContent; }
if(iter == 4){ w1 = rec.textContent; }
if(iter == 5){ w2 = rec.textContent; }
if(iter == 6){ w3 = rec.textContent; }
if(iter == 7){ loiid = rec.id; }
}
});
w1 = parseFloat(w1);
w2 = parseFloat(w2);
w3 = parseFloat(w3);
//console.log(w1+'-'+w2+'-'+w3);
loi = ((w2 - w3)/(w2 - w1))*100;
loi = isNaN(loi)?0.00:parseFloat(loi).toFixed(2);
//console.log(w1+'-'+w2+'-'+w3+'-'+loi);
var curid = j+'loi';
if(document.getElementById(curid))
{
document.getElementById(curid).textContent = parseFloat(loi).toFixed(2);
}
var curid = j+'loi'+LOIROWNO;
//console.log(curid);
if(document.getElementById(curid))
{
document.getElementById(curid).textContent = parseFloat(loi).toFixed(2);
}
}
}
function getAllData()
{
calculateMaster();
var Rows = $('#testreport').find('tr');
var size = Object.keys(Rows).length;
var flag = 0;
size = size-5;
if($('#invoiceno').val() == -1 || $('#reportdate').val() == '')
{
alert('Select Invoice No and Report Date');
return false;
}
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');
return false;
}
var testreportdata = $("#testreport").tableToJSON();
var testloidata = $("#loitable").tableToJSON();
var testafsdata = $("#afstable").tableToJSON();
testreportdata=JSON.stringify(testreportdata);
testloidata=JSON.stringify(testloidata);
testafsdata=JSON.stringify(testafsdata);
// alert(testreportdata);
// alert(testloidata);
// alert(testafsdata);
var invoiceno = $('#invoiceno').val();
var batchno = $('#reportdate').val();
var approvedby = $('#approvedby').val();
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
var c = document.getElementById("myCanvas");
var fullQuality = c.toDataURL('image/png', 1.0);
$('.content').loader('show');
$.ajax({
data:{param1:testreportdata,param2:testloidata,param3:testafsdata,param4:invoiceno,param5:batchno,param6:approvedby,param7:fullQuality},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/saveTestReportData",
success:function(data) {
if(data){
alert(data);
$('.content').loader('hide');
window.location = "<?php echo base_url().'qualityreportlist';?>";
}
}
});
//
}
}
function calculateAFS(pid,cvalue,cid)
{
if($('#invoiceno').val() == -1)
{
alert('Select Invoice No');
return false;
}
var cid = cid;
// if(cvalue == 0)
// {
// document.getElementById(cid).textContent = '';
// }
var Row = $('#afstable').find('tr').eq(pid).find('td');
var sandweight = '';
var sandweightid ='';
var percentage = '';
var percentageid = '';
var multiplier = '';
var multiplierid = '';
var product = '';
var productid = '';
$.each(Row,function(index,item){
if(index == 2){
//console.log('sanweight'+item.textContent);
sandweight = item.textContent;
sandweightid = item.id;
//console.log('sanweight'+item.textContent);
}
else if(index == 3){
percentageid = item.id;
percentage = item.textContent;
}
else if(index == 4){
multiplierid = item.id;
multiplier = item.textContent;
}
else if(index == 5){
product = item.textContent;
productid = item.id;
}
});
if(isNaN(sandweight) || sandweight == '' || sandweight == null)
{
sandweight = 0.00;
}
//console.log('sanweight'+sandweight);
if(isNaN(cvalue) || cvalue == '' || cvalue == null)
{
cvalue = 0.00;
}
document.getElementById(percentageid).textContent = parseFloat(sandweight).toFixed(2);
prodcut = ( sandweight * multiplier);
document.getElementById(productid).textContent = parseFloat(prodcut).toFixed(4);
var totalsandweight = 0;
var totalproduct = 0;
for(i=1;i<=11;i++)
{
var id = i+'sw';
var temp = parseFloat(document.getElementById(id).textContent);
if(isNaN(temp) || temp == '' || temp == null)
{
temp = 0.00;
}
totalsandweight = totalsandweight + temp;
var id2 = i+'pt';
var temp2 = parseFloat(document.getElementById(id2).textContent);
totalproduct = totalproduct + temp2;
}
if(isNaN(totalsandweight) || totalsandweight == '' || totalsandweight == null)
{
totalsandweight = 0.00;
}
if(isNaN(totalproduct) || totalproduct == '' || totalproduct == null)
{
totalproduct = 0.00;
}
document.getElementById('12sw').textContent = parseFloat(totalsandweight).toFixed(2);
document.getElementById('12p').textContent = parseFloat(totalsandweight).toFixed(2);
document.getElementById('12pt').textContent = parseFloat(totalproduct).toFixed(3);
if(document.getElementById('AFS') != null)
{
document.getElementById('AFS').textContent = isNaN(totalproduct)?'0.00': parseFloat((totalproduct/totalsandweight)).toFixed(2);
}
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);
}
// console.log(dataset);
//console.log(datalabel);
drawChart(dataset,datalabel);
}
$('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);
}
});
// $(".edit").focusin(function(){
// alert('skjhjkdf');
// });
function drawChart(dataset,datalabel){
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.moveTo(30,0);
ctx.lineTo(30,canvasheight);
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.font = "10px Arial";
ctx.fillStyle = "black";
ctx.fillText("Sand Weight",(canvaswidth/2),(canvasheight-2));
ctx.closePath();
var xaxislabelwidth = (canvaswidth/12);
var startingpointX = 30;
var startingpointY = (canvasheight-30);
for(i=1;i<=xlabelscount;i++) //X DataLabel
{
ctx.beginPath();
ctx.font = "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,3,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),3,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.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 circle
{
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)
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.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.moveTo(finallocationofX[i],finallocationofY[i]);
ctx.lineTo(finallocationofX[i+1],finallocationofY[i+1]);
ctx.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
}
//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();
}
</script>

View File

@ -0,0 +1,95 @@
<?php
//print_r($records);
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Product Test Reports List</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">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<div class="col-md-3">
<a href=" <?php echo base_url().'quality/report';?> " type="button" class="btn btn-primary">Add New</a>
</div>
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<!-- <div class="row">
<div class="col-md-3">
<?php echo form_dropdown('name="product"',$products2,set_value('product',$products2[-1]),'id="product"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<?php echo form_dropdown('name="customer"',$customers2,set_value('customer',$customers2[-1]),'id="customer"' ,'class="form-control select2');?>
</div>
<div class="col-md-3">
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
</div>
</div> -->
<br/>
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Test Report ID</th>
<th>Invoice ID</th>
<th>Batch Date</th>
<th>Product Name</th>
<th>Customer Name</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
if(!empty($records))
{
foreach($records as $data)
{
//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>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
</div>
</div>
</section>
</div>

View File

@ -0,0 +1,315 @@
<style>
th{
text-align:center ! important;
}
</style>
<?php
$pname = '';
$cnamme = '';
$pid='';
$cid='';
foreach($specifications as $s)
{
$pname = $s->product_name;
$cname = $s->client_name;
$pid = $s->product_id;
$cid = $s->customer_id;
break;
}
?>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Product Customer Test Specification Master Screen</center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!--<center><h3 class="box-title">-->
<div class="box-tools">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<form action="<?php echo base_url() ?>monthlypay/monthlyListing" method="POST" id="searchList">
</form>
</div><!--</h3></center>-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-md-3">
<input type="text" name="p" id="p" class="form-control" value="<?php echo $pname;?>" readonly>
<input type="hidden" name="product" id="product" value="<?php echo $pid;?>">
</div>
<div class="col-md-3">
<input type="text" name="c" id="c" class="form-control" value="<?php echo $cname;?>" readonly>
<input type="hidden" name="customer" id="customer" value="<?php echo $cid;?>">
</div>
<div class="col-md-3">
<input type="button" id="addspec" class="btn btn-primary" value = "Add New Specification">
</div>
</div>
<br/>
<table id="testspecifications" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<thead style="background-color:#ddf">
<tr>
<th>Name</th>
<th>UOM</th>
<th>Min</th>
<th>Max</th>
<th>Temp</th>
<th>Action</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
$index = 0;
if(!empty($specifications))
{
foreach($specifications as $data)
{
$index++;
?>
<tr id="<?php echo $index;?>"> <td><?php echo $data->testtype?></td> <td contenteditable="true"><?php echo $data->uom?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->min?></td> <td contenteditable="true" style="text-align:right;"><?php echo $data->max?></td> <td contenteditable="true" style="text-align:right;"><?php if(!empty($data->temp)){ echo $data->temp; } else { echo "-"; }?></td> <td style="text-align:center;"><a href='#' onclick = "DeleteRow(this.id);"> <span class="glyphicon glyphicon-trash"></span></td> </tr>
<?php
}
}
?>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-3" id="savebutton">
<input type="button" id="submit" value = "Save" class="btn btn-primary" onclick="getAllData();">
</div>
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</div><!-- /.box -->
<div id="specmodel" 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">Add New Specification</h4>
</div>
<div class="modal-body">
<form>
<center>
<table >
<tr>
<td style="text-align:center;padding:10px;">Specification Name</td><td style="padding:10px;"><input type="text" name="spname" id="spname"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">UOM</td><td style="padding:10px;"><input type="text" name="uom" id="uom"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;">Min</td><td style="padding:10px;"><input type="text" name="min`" id="min"/> </td>
</tr>
<tr>
<td style="text-align:center;padding:10px;;">Max</td><td style="padding:10px;"><input type="text" name="max" id="max"/></td>
</tr>
<tr>
<td style="text-align:center;padding:10px;;">Temp</td><td style="padding:10px;"><input type="text" name="temp" id="temp"/></td>
</tr>
</table>
</center>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-primary" ID="addNewRow" onclick="addNewRow();" style="margin-top: -24px;">&nbsp;&nbsp;<span class="bold">Ok</span></a>
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
</div>
</div>
</div>
</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 type="text/html" id="addList">
<tr id=<%=index%>>
<td align="left" contenteditable="false"><%=Name%></td>
<td align="left"contenteditable="true"><%=UOM%></td>
<td align="right" contenteditable="true"><%=Min%></td>
<td align="right" contenteditable="true"><%=Max%></td>
<td align="right" contenteditable="true"><%=Temp%></td>
<td align="center" contenteditable="false"> <a href='#' onclick = "DeleteRow(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
</tr> <!-- <i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit <%=index%> "></i> -->
</script>
<script>
$('#addspec').click(function(){
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else
{
$('#specmodel').modal('show');
}
});
function addNewRow()
{
var sname = $('#spname').val();
sname = sname.toUpperCase();
var uom = $('#uom').val();
var min = $('#min').val();
var max = $('#max').val();
var temp = $('#temp').val();
if(sname == '' || uom =='' || min == '' || max == '' || temp == '')
{
alert('Please Enter all specification');
}
else
{
var rows = document.getElementById('testspecifications').rows.length;
//rows = rows-1;
//alert(rows);
var template = jQuery("#addList").html();
$('#specAppend').append(_.template(template,{index:rows,Name:sname,UOM:uom,Min:min,Max:max,Temp:temp}));
$('#spname').val('');
$('#uom').val('');
$('#min').val('');
$('#max').val('');
$('#temp').val('');
document.getElementById('spname').focus();
}
}
$("#specmodel").on("shown.bs.modal", function(e) {
document.getElementById('spname').focus();
});
function getAllData()
{
var alldata = $("#testspecifications").tableToJSON();
//alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata)
var product = $('#product').val();
var customer = $('#customer').val();
if(product == -1 || customer == -1)
{
alert('Please Select Product and Customer.');
}
else{
$('#content').loader('show');
$.ajax({
data:{param1:alldata,param2:product,param3:customer},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>quality/saveSpectficationData",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
//console.log(data);
}
}
});
}
}
function DeleteRow(rowid)
{
var product = $('#product').val();
var customer = $('#customer').val();
if(product == '' || customer == '')
{
alert('Please Select Product and Customer.');
}
else{
alert(rowid);
var d='';
var Row = $('#testspecifications').find('tr').eq(rowid).find('td');
$.each(Row,function(index,value){
if(index == 1 ){
d = value.textContent
}
});
$('#content').loader('show');
$.ajax({
data:{param1:d,param2:product,param3:customer},
type:"POST",
url:"<?php echo base_url() ?>quality/deleteSpecification",
success:function(data){
$('#content').loader('hide');
alert(data);
}
});
tr.parentNode.removeChild(tr);
}
}
</script>

View File

@ -0,0 +1,473 @@
<style>
.edit{
background-color:#eeffcc ! important;
}
</style>
<?php
//print_r($reportdata);die();
$reportid = '';
$invoiceno = '';
$invoicedate = '';
$customername = '';
$product_name = '';
$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_name = $m->product_id.'-'.$m->product_name;
$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" 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 $invoicedate;?>" 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_name;?>" 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 $batchdate?>" 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> 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 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.moveTo(30,0);
ctx.lineTo(30,canvasheight);
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.moveTo(0,(canvasheight-30));
ctx.lineTo(canvaswidth,(canvasheight-30));
ctx.strokeStyle="black";
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.font = "10px Arial";
ctx.fillStyle = "black";
ctx.fillText("Sand Weight",(canvaswidth/2),(canvasheight-2));
ctx.closePath();
var xaxislabelwidth = (canvaswidth/12);
var startingpointX = 30;
var startingpointY = (canvasheight-30);
for(i=1;i<=xlabelscount;i++) //X DataLabel
{
ctx.beginPath();
ctx.font = "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,3,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),3,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.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 circle
{
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)
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.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.moveTo(finallocationofX[i],finallocationofY[i]);
ctx.lineTo(finallocationofX[i+1],finallocationofY[i+1]);
ctx.setLineDash([0,0]);
//ctx.strokeStyle="#1a75ff";
ctx.lineWidth=3;
//setInterval(function(){
ctx.stroke();
//},30000);
}
//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 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>

View File

@ -0,0 +1,146 @@
<?php
//print_r($reportdata);
$src='';
$reportid = '';
$invoiceno = '';
$invoicedate = '';
$customername = '';
$product_name = '';
$batchno = '';
$qty = '';
$batchdate = '';
$inspector = '';
$approvedby = '';
if(!empty($reportdata['master'])){
foreach($reportdata['master'] as $m)
{
$src = $m->chartdata;
$reportid = $m->testreport_id;
$invoiceno = $m->invoiceid;
$invoicedate = $m->invoice_date_created;
$customername = $m->client_id.'-'.$m->client_name;
$product_name = $m->product_id.'-'.$m->product_name;
$batchno = $m->invoice_custom_fieldvalue;
$qty = $m->item_quantity;
$batchdate = $m->batchdate;
$inspector = $m->FirstName.' '.$m->LastName;
$approvedby = $m->approvedby;
}
}
$cname = '';
$caddress = '';
$pic = '';
if(!empty($reportdata['company'])){
foreach($reportdata['company'] as $c)
{
$cname = $c->CompanyName;
$caddress = $c->Address;
$pic = $c->ProfilePic;
}
}
?>
<style>
td{
text-align:center;
height:17px;
}
table{
width:100%;
}
</style>
<html>
<body>
<table style="border-collapse: collapse;border-left-style:hidden;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr><td colspan="6" style="text-align:center;"><h2>PRE DISPATCH INSPECTION REPORT - <?php echo $reportid;?></h2></td></tr>
<tr><td rowspan="5" style="text-align:center;width:20%"><img src="<?php echo base_url().'uploads/images/'.$pic;?>" alt="no image"/></td>
<td rowspan="5" style="text-align:center;"><b><?php echo $cname;?></b><br><?php echo $caddress;?></td>
<td style="text-align:center;width:10%">CUSTOMER NAME</td>
<td colspan="3"style="text-align:center;width:20%"><b><?php echo $customername;?></b></td>
</tr>
<tr><td style="text-align:center;width:10%">MATERIAL NAME</td><td style="text-align:center;width:20%"><b><?php echo $product_name;?><b></td><td style="text-align:center;width:20%">INVOICE NO</td><td style="text-align:center;width:10%"><b><?php echo $invoiceno;?></b></td></tr>
<tr><td rowspan="3">Qty</td> <td rowspan="3"> <b><?php echo $qty;?> kgs</b></td> <td>INVOICEDATE</td><td><b><?php echo date_format(date_create($invoicedate),'d-m-Y');?></b></td></tr>
<tr><td>Batch NO</td><td><b><?php echo $batchno;?></b></td></tr>
<tr><td>BATCH DATE</td><td><b><?php echo date_format(date_create($batchdate),'d-m-Y');?></b></td></tr>
</tbody>
</table>
<br>
<table style="border-collapse: collapse;border-left-style:hidden;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr><th rowspan="3">SNO</th><th rowspan="3" >DESCRIPTION</th><th rowspan="2" colspan="3">SPECIFICATION</th><th colspan="3" >ACT</th> <th rowspan="3">Average</th> <th rowspan="3">Results</th> <th rowspan="3">Remarks</th> </tr> <tr><th rowspan="2">X1</th> <th rowspan="2">X2</th> <th rowspan="2">X3</th></tr> <tr><th>Min</th><th>Max</th><th>UOM</th></tr>
<?php
$index = 0;
foreach($reportdata['masterreport'] as $master)
{
$index++;
?>
<tr> <td><?php echo $index;?></td> <td style="text-align:left;"><?php echo $master->description;?></td><td><?php if($master->min == 0 || $master->min == '') { echo "-"; } else { echo $master->min;} ?></td> <td><?php if($master->max == 0 || $master->max == '') { echo '-'; } else { 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 style="text-align:left;"><?php echo $master->remarks;?></td> </tr>
<?php
}
?>
</tbody>
</table>
<h3>L.O.I DETAILS</h3>
<table style="border-collapse: collapse;border-left-style:hidden;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr><th rowspan="2">SNO</th><th>HEATING TIME</th><th>TEMP</th><th>CRUCIBLE WEIGHT</th><th>BEFORE HEATING WEIGHT</th><th>AFTER HEATING WEIGHT</th> <th rowspan="2">L.O.I (%)</th><th rowspan="2">Remarks</th> </tr>
<tr><th>START TIME - END TIME</th><th>*C</th> <th>W1(g)</th> <th>W2(g)</th> <th>W3(g)</th></tr>
<?php
$indexx = 0;
foreach($reportdata['masterreportloi'] as $loi)
{
$indexx++;
?>
<tr> <td><?php echo $indexx;?></td> <td><?php echo $loi->start_time.'~'.$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 style="text-align:left;"><?php echo $loi->remarks;?></td></tr>
<?php
}
?>
</tbody>
</table>
<h3>AFS DETAILS</h3>
<table style="border-collapse: collapse;border-left-style:hidden;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr> <th>S.NO</th> <th>Sieve Size µm </th> <th>SAND WEIGHT</th> <th>Percantage</th> <th>Multiplier</th> <th>Product</th></tr>
<?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>
<br>
<div>
<!-- <center><canvas id="myCanvas" width="1000" height="350" style="border:1px solid #d3d3d3;"></canvas></center> -->
<center><img id="ren" src="<?php echo $src;?>" alt="NO"/></center>
</div>
<hr>
<br><br>
<table>
<tr><td>INSPECTOR NAME</td><td><?php echo $inspector;?></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>APPROVED BY</td><td><?php echo $approvedby;?></td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td>Signature</td><td>&nbsp;</td></tr>
</table>
</body>
</html>