RESIN BATCH CARD CHANGE REQUIREMENT

This commit is contained in:
velz2020 2018-04-06 14:17:43 +05:30
parent f93c716ec5
commit 8420fe8f50
4 changed files with 439 additions and 64 deletions

View File

@ -25,17 +25,19 @@ class resinbatchcard extends BaseController
/**
* This function used to load the first screen of the user
*/
function addNewResinBatchCard()
{
$data['productsoutward'] = $this->quality_model->getAllprodcuts();
$data['customersoutward'] = $this->quality_model->getAllcustomers();
$data['emplist'] = $this->quality_model->getEmplistforReport();
$data['operatorslist'] = $this->quality_model->getOperatorsListforReport();
$data['machinelist'] = $this->quality_model->getMachineList();
$data['trpbatchcardnos'] = $this->quality_model->getTRPBatchcardNos();
$data['igrno'] = $this->quality_model->getIGRNos();
$this->global['pageTitle'] = 'Siddharth : Resin Batch Card';
$this->loadViews("newresinbatchcard", $this->global, $data , NULL);
}
@ -45,12 +47,13 @@ class resinbatchcard extends BaseController
$sql = 'select IGRItemNo from T_IGR_Details where IGRNO = ?';
$res = $this->db->query($sql,array($igrno));
echo json_encode($res->result());
echo json_encode($res->result());
}
function resinBatchCardLisitng()
{
$data['records'] = $this->quality_model->getResinBatchCardTestMasterList();
@ -82,9 +85,11 @@ class resinbatchcard extends BaseController
$totaldata = json_decode($totaldata,true);
$createby = $this->session->userdata ( 'userId' );
$document = null;
$resinname = $this->input->post('param13');
$oplist = $this->input->post('param14');
$oplist = json_decode($oplist);
//print_r($masterdata);die();
//print_r($totaldata);
if(!empty($_FILES['rfile']['name']))
{
$fs = $this->uploadFile();
@ -93,6 +98,7 @@ class resinbatchcard extends BaseController
$sandtotal = 0;
$resintotal = 0;
$catalysttotal = 0;
$hextotal = 0;
$cstotal = 0;
$bags50total = 0;
@ -106,6 +112,7 @@ class resinbatchcard extends BaseController
$sandtotal = $tot['Sand'];
$resintotal = $tot['Resin'];
$hextotal = $tot['Hexamine'];
$catalysttotal = $tot['Catalyst'];
$cstotal = $tot['CS'];
$bags50total = $tot['50 Bags'];
$ton1bagstotal = $tot['1 ton Bag'];
@ -114,8 +121,8 @@ class resinbatchcard extends BaseController
}
}
$masterreportdata = array('productid'=>$productid,'customerid'=>$customerid,'batchdate'=>$batchdate,'plantname'=>$plantname,'machinecode'=>$macinecode,'trpbatchcardno'=>$trpbatchcard,'igrno'=>$igrnos,'igrlineno'=>$igrlinenos,'remarks'=>$remarks,'createdby'=>$createby,'approvedby'=>$approvedby,'document'=>$document,'sandtotal'=>$sandtotal,'resintotal'=>$resintotal,'hextotal'=>$hextotal,'cstotal'=>$cstotal,'bags50total'=>$bags50total,'ton1bagstotal'=>$ton1bagstotal,'producitonloss'=>$producitonloss,'finishedproduct'=>$finishedproduct);
//print_r($masterreportdata);
$masterreportdata = array('productid'=>$productid,'customerid'=>$customerid,'batchdate'=>$batchdate,'plantname'=>$plantname,'machinecode'=>$macinecode,'trpbatchcardno'=>$trpbatchcard,'igrno'=>$igrnos,'igrlineno'=>$igrlinenos,'remarks'=>$remarks,'createdby'=>$createby,'approvedby'=>$approvedby,'document'=>$document,'sandtotal'=>$sandtotal,'resintotal'=>$resintotal,'hextotal'=>$hextotal,'cstotal'=>$cstotal,'catalysttotal'=>$catalysttotal,'bags50total'=>$bags50total,'ton1bagstotal'=>$ton1bagstotal,'producitonloss'=>$producitonloss,'finishedproduct'=>$finishedproduct);
$MASTERID = $this->quality_model->saveResinBatchCardMasterTestData($masterreportdata);
//echo $MASTERID;die();
@ -138,6 +145,12 @@ class resinbatchcard extends BaseController
}
}
foreach($oplist as $op)
{
$nArray = array('master_id'=>$MASTERID,'EmpID'=>$op);
$this->db->insert('T_ResinBatchCard_Operators',$nArray);
}
echo "Report Data Saved Successfully!";
@ -167,9 +180,15 @@ class resinbatchcard extends BaseController
$createby = $this->session->userdata ( 'userId' );
$document = $this->input->post('param13');
$MASTERID = $this->input->post('param14');
$opstoinsert = $this->input->post('param15');
$opstodelete = $this->input->post('param16');
//print_r($masterdata);die();
//print_r($totaldata);
$opstoinsert = json_decode($opstoinsert);
$opstodelete = json_decode($opstodelete);
// print_r($opstoinsert);
// print_r($opstodelete);
// die();
//$oplist = json_decode($oplist);
if(!empty($_FILES['rfile']['name']))
{
@ -191,6 +210,7 @@ class resinbatchcard extends BaseController
$resintotal = 0;
$hextotal = 0;
$cstotal = 0;
$catalysttotal = 0;
$bags50total = 0;
$ton1bagstotal = 0;
$producitonloss = 0;
@ -203,6 +223,7 @@ class resinbatchcard extends BaseController
$resintotal = $tot['Resin'];
$hextotal = $tot['Hexamine'];
$cstotal = $tot['CS'];
$catalysttotal = $tot['Catalyst'];
$bags50total = $tot['50 Bags'];
$ton1bagstotal = $tot['1 ton Bag'];
$producitonloss = $tot['Production Loss Lump'];
@ -210,7 +231,7 @@ class resinbatchcard extends BaseController
}
}
$masterreportdata = array('remarks'=>$remarks,'updatedby'=>$createby,'approvedby'=>$approvedby,'document'=>$document,'sandtotal'=>$sandtotal,'resintotal'=>$resintotal,'hextotal'=>$hextotal,'cstotal'=>$cstotal,'bags50total'=>$bags50total,'ton1bagstotal'=>$ton1bagstotal,'producitonloss'=>$producitonloss,'finishedproduct'=>$finishedproduct);
$masterreportdata = array('remarks'=>$remarks,'updatedby'=>$createby,'approvedby'=>$approvedby,'document'=>$document,'sandtotal'=>$sandtotal,'resintotal'=>$resintotal,'hextotal'=>$hextotal,'cstotal'=>$cstotal,'catalysttotal'=>$catalysttotal,'bags50total'=>$bags50total,'ton1bagstotal'=>$ton1bagstotal,'producitonloss'=>$producitonloss,'finishedproduct'=>$finishedproduct);
//print_r($masterreportdata);
$this->quality_model->updateResinBatchCardMasterTestData($masterreportdata,$MASTERID);
@ -235,6 +256,27 @@ class resinbatchcard extends BaseController
}
}
if(!empty($opstoinsert)){
foreach($opstoinsert as $opstins)
{
$tArray = array('master_id'=>$MASTERID,'EmpID'=>$opstins);
$this->db->insert('T_ResinBatchCard_Operators',$tArray);
//print_r($tArray);
}
}
if(!empty($opstodelete)){
foreach($opstodelete as $key => $opstdel)
{
$this->db->where('master_id',$MASTERID);
$this->db->where('EmpID',$opstdel[$key]);
$this->db->delete('T_ResinBatchCard_Operators');
//print_r($tArray);
}
}
echo "Report Data Saved Successfully!";
@ -322,6 +364,8 @@ class resinbatchcard extends BaseController
//echo $rbcid;
$data['emplist'] = $this->quality_model->getEmplistforReport();
$data['records'] = $this->quality_model->getResinBatchCardDetails($rbcid);
$data['operatorslist'] = $this->quality_model->getOperatorsListforReport();
$data['existoperatorslist'] = $this->quality_model->getExistOperatorsListforReport($rbcid);
//print_r($data['records']);die();
$this->global['pageTitle'] = 'Siddharth : Edit Resin Batch Card';
$this->loadViews("editresinbatchcard", $this->global, $data , NULL);

View File

@ -4,7 +4,7 @@ class Quality_model extends CI_Model
{
function getAllInvoiceNo()
{
$this->db->select('invoice_number');
$this->db->select('invoice_number');
$this->db->from('ip_invoices');
$result = $this->db->get();
return $result->result();
@ -182,7 +182,20 @@ class Quality_model extends CI_Model
//print_r($res->result());
}
function getOperatorsListforReport()
{
$r = $this->db->select('EmpID,FirstName,LastName')->from('T_Employee_Details')->get();
return $r->result();
}
function getExistOperatorsListforReport($rbcid)
{
$sql = "select T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName
from T_ResinBatchCard_Operators join T_Employee_Details on T_ResinBatchCard_Operators.EmpID =
T_Employee_Details.EmpID where T_ResinBatchCard_Operators.master_id = ?";
$r = $this->db->query($sql,array($rbcid));
return $r->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,');

View File

@ -23,6 +23,12 @@ background-color:#ada5d2 ;
</style>
<?php
$operators = array(-1=>'Select Employee');
foreach($operatorslist as $re)
{
$operators[$re->EmpID] = $re->EmpID.'-'.$re->FirstName.'-'.$re->LastName;
}
$approvedby = array(-1=>'Select Approver Name');
foreach($emplist as $r)
{
@ -67,16 +73,16 @@ th{
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="col-md-4">
<label>Customer</label>
<input type="text" value="<?php echo $records['masterdata'][0]->client_name?>" class="form-control" readonly>
<input type="hidden" id="MASTERID" value="<?php echo $records['masterdata'][0]->resinbatch_id?>" >
<input type="hidden" id="customer" value="<?php echo $records['masterdata'][0]->customerid?>" >
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>Grade</label>
<input type="text" value="<?php echo $records['masterdata'][0]->product_name.'-'.$records['masterdata'][0]->product_description?>" class="form-control" readonly>
<input type="hidden" id="product" value="<?php echo $records['masterdata'][0]->productid?>" >
@ -85,49 +91,59 @@ th{
<div class="col-md-3">
<div class="col-md-4">
<label>Batch Date</label>
<input type="text" id="batchdate" name="batchdate" class="form-control" readonly value="<?php echo date_format(date_create($records['masterdata'][0]->batchdate),'d-m-Y');?>">
</div>
<div class="col-md-3">
</div>
<div class="col-md-12">
<div class="col-md-4">
<label>Resin Name</label>
<input type="text" id="resinname" name="resinname" class="form-control" readonly value="<?php echo $records['masterdata'][0]->resinname?>">
</div>
<div class="col-md-4">
<label>Shift Name</label>
<input type="text" id="plantname" name="plantname" class="form-control" readonly value="<?php echo $records['masterdata'][0]->plantname?>">
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="col-md-4">
<label>Machine Name</label>
<input type="text" value="<?php echo $records['masterdata'][0]->machinecode;?>" class="form-control" readonly>
</div>
<div class="col-md-3">
</div>
<div class="col-md-12">
<div class="col-md-4">
<label>TRP Batch No(For TRP Sand)</label>
<input type="text" value="<?php echo $records['masterdata'][0]->trpbatchcardno;?>" class="form-control" readonly>
</div>
<div class="col-md-3">
</div>
<div class="col-md-4">
<label>IGR No(For Fresh Sand)</label>
<input type="text" value="<?php echo $records['masterdata'][0]->igrno;?>" class="form-control" readonly>
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>IGR Line Item No</label>
<input type="text" value="<?php echo $records['masterdata'][0]->igrlineno;?>" class="form-control" readonly>
</div>
<p>&nbsp;</p>
</div><br>
<br/>
@ -184,12 +200,12 @@ th{
<p><b>Raw/Packing Material Consumption<b></p>
<table id="finaltable" class="table table-bordered" style="background-color:#fff;font-size:12px;text-align:center;">
<thead style="background-color:#ddf;">
<tr><th>Particulars</th><th>Sand</th><th>Resin</th><th>Hexamine</th><th>CS</th><th>50 Bags</th><th>1 ton Bag</th><th>Production Loss <br> Lump</th><th>Finished Prodcut <br> PCS</th></tr>
<tr><th>Unit</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Nos</th><th>Kgs</th><th>Kgs</th></tr>
<tr><th>Particulars</th><th>Sand</th><th>Resin</th><th>Hexamine</th><th>CS</th><th>Catalyst</th><th>50 Bags</th><th>1 ton Bag</th><th>Production Loss <br> Lump</th><th>Finished Prodcut <br> PCS</th></tr>
<tr><th>Unit</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Nos</th><th>Kgs</th><th>Kgs</th></tr>
</thead>
<tbody id="">
<tr><td>Qty</td><td id="sandtotal"><?php echo $records['masterdata'][0]->sandtotal;?></td><td id="resintotal"><?php echo $records['masterdata'][0]->resintotal;?></td><td id="hextotal"><?php echo $records['masterdata'][0]->hextotal;?></td><td id="cstotal"><?php echo $records['masterdata'][0]->cstotal;?></td><td id="50bagtotal" contenteditable="true"><?php echo $records['masterdata'][0]->bags50total;?></td><td id="1tonbagtotal" contenteditable="true"><?php echo $records['masterdata'][0]->ton1bagstotal;?></td><td id="lumptotal" contenteditable="true"><?php echo $records['masterdata'][0]->producitonloss;?></td><td id="pcstotal" contenteditable="true"><?php echo $records['masterdata'][0]->finishedproduct;?></td></tr>
<tr><td>Qty</td><td id="sandtotal"><?php echo $records['masterdata'][0]->sandtotal;?></td><td id="resintotal"><?php echo $records['masterdata'][0]->resintotal;?></td><td id="hextotal"><?php echo $records['masterdata'][0]->hextotal;?></td><td id="cstotal"><?php echo $records['masterdata'][0]->cstotal;?></td><td id="catalysttotal"><?php echo $records['masterdata'][0]->catalysttotal;?></td><td id="50bagtotal" contenteditable="true"><?php echo $records['masterdata'][0]->bags50total;?></td><td id="1tonbagtotal" contenteditable="true"><?php echo $records['masterdata'][0]->ton1bagstotal;?></td><td id="lumptotal" contenteditable="true"><?php echo $records['masterdata'][0]->producitonloss;?></td><td id="pcstotal" contenteditable="true"><?php echo $records['masterdata'][0]->finishedproduct;?></td></tr>
</tbody>
</table>
<hr>
@ -220,7 +236,20 @@ th{
<input type="hidden" id = "olddoc" value="<?php echo $records['masterdata'][0]->document?>">
</form>
</div>
<div class="col-md-9">
<div class="col-md-3">
<label>Operators:</label>
<select name="listops" id="listops" multiple>
<?php
foreach($existoperatorslist as $ex)
{
echo "<option value=".$ex->EmpID.">".$ex->EmpID.'-'.$ex->FirstName.'-'.$ex->LastName."</opiton>";
}
?>
</select>
</div>
<div class="col-md-6">
<label>Remarks:</label>
<textarea id="remarks" class="form-control" rows="1"><?php echo $records['masterdata'][0]->remarks; ?></textarea>
@ -230,12 +259,15 @@ th{
<div class="col-md-12">
<div class="col-md-3">
<label>Operated By :</label>
<label>Created 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 ">
<div class="col-md-3">
<label>Select Operators :</label>
<?php echo form_dropdown('operators',$operators,set_value('operators',$operators[-1]),'id="operators"' ,'class="form-control select2', 'style="text-align:center;"');?>
</div>
<div class="col-md-3 col-md-offset-3 ">
<label>Production In charge :</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"> -->
@ -296,7 +328,7 @@ $(document).ready(function(){
$('#approvedby').val('<?php echo $records['masterdata'][0]->approvedby?>');
$('#operators').select2();
@ -667,6 +699,48 @@ function masterCalculationCheck(id,val)
}
}
if(ide == 'catalyst')
{
for(i=1;i<=overallrows;i++)
{
var tid = i+''+ide;
if(document.getElementById(tid))
{
var currentvalue = document.getElementById(tid).textContent;
if(isNaN(currentvalue) || currentvalue == '')
{
currentvalue = 0.00;
}
totalsandqty +=parseFloat(currentvalue);
}
}
if(document.getElementById('catalysttotal'))
{
document.getElementById('catalysttotal').textContent = parseFloat(totalsandqty);
}
}
else if(ide2 == 'catalyst')
{
for(i=1;i<=overallrows;i++)
{
var tid = i+''+ide2;
if(document.getElementById(tid))
{
var currentvalue = document.getElementById(tid).textContent;
if(isNaN(currentvalue) || currentvalue == '')
{
currentvalue = 0.00;
}
totalsandqty +=parseFloat(currentvalue);
}
}
if(document.getElementById('catalysttotal'))
{
document.getElementById('catalysttotal').textContent = parseFloat(totalsandqty);
}
}
//FOr total Hexamine Calculaiton
@ -767,7 +841,21 @@ function masterCalculationCheck(id,val)
}
var listopsforstore = [];
var opstodelete = [];
var opstoinsert =[];
var oldops = [];
<?php
foreach($existoperatorslist as $ex)
{
echo "listopsforstore.push('".$ex->EmpID."');";
echo "oldops.push('".$ex->EmpID."');";
}
?>
console.log(listopsforstore+'-'+oldops);
function getAllData()
{
@ -797,7 +885,7 @@ function masterCalculationCheck(id,val)
var olddoc = $('#olddoc').val();
var MASTERID = $('#MASTERID').val();
if(productid == -1 || customerid == -1 || batchdate == '' || plantname == '' || macinecode == '' || trpbatchcard == -1 || igrlinenos == -1 ||igrnos == -1 || approvedby == -1)
if(approvedby == -1 || listopsforstore.length == 0)
{
alert('Please Enter All Master Details..!');
return false;
@ -840,6 +928,9 @@ function masterCalculationCheck(id,val)
var param12 = finaltable;
var param13 = olddoc;
var param14 = MASTERID;
var param15 = JSON.stringify(opstoinsert);
var param16 = JSON.stringify(opstodelete);
formData.append('param1',param1);
formData.append('param2',param2);
@ -855,6 +946,8 @@ function masterCalculationCheck(id,val)
formData.append('param12',param12);
formData.append('param13',param13);
formData.append('param14',param14);
formData.append('param15',param15);
formData.append('param16',param16);
$('.content').loader('show');
@ -880,7 +973,91 @@ function masterCalculationCheck(id,val)
}
$('#operators').change(function(){
var val = $('#operators').val();
var text = $("#operators option:selected").text();
//alert(val);
//alert(text);
var totalelements = listopsforstore.length
if(totalelements != 0)
{
$.each(listopsforstore,function(key,value){
//alert(value);
if(value == val)
{
alert('Operator Already Added..!Choose Another One.!');
brea();
}
});
}
listopsforstore.push(val);
var locali = 0;
$.each(oldops,function(key,value){
//alert(value);
if(value == val)
{
//nothing
}
else
{
//opstoinsert.push(val);
locali++;
}
});
if(locali != 0)
{
opstoinsert.push(val);
}
opstodelete = opstodelete.filter(item => item != val);
console.log('INSERT-'+opstoinsert);
console.log('OLD-'+oldops);
console.log('DELETE-'+opstodelete);
console.log('CURRENT-'+listopsforstore);
console.log('*************************');
$("#listops").append('<option value='+val+'>'+text+'</option>');
});
$("#listops").dblclick(function(){
var text = $("#listops option:selected").text();
var val = $('#listops').val();
//alert(text+'-'+val);
$('option:selected', this).remove();
listopsforstore = listopsforstore.filter(item => item != val);
var localj = 0;
// if(totalelements != 0)
// {
$.each(oldops,function(key,value){
//alert(value);
if(value == val)
{
localj++;
}
});
if(localj != 0){ opstodelete.push(val);}
opstoinsert = opstoinsert.filter(item => item != val);
// }else{opstodelete.push(val);}
console.log('INSERT-'+opstoinsert);
console.log('OLD-'+oldops);
console.log('DELETE-'+opstodelete);
console.log('CURRENT-'+listopsforstore);
console.log('*************************');
});

View File

@ -24,6 +24,15 @@ background-color:#ada5d2 ;
<?php
//color:red ! important;
//print_r($igrno);
//print_r($operatorslist);
$operators = array(-1=>'Select Employee');
foreach($operatorslist as $re)
{
$operators[$re->EmpID] = $re->EmpID.'-'.$re->FirstName.'-'.$re->LastName;
}
$products = array(-1=>'Select Product');
foreach($productsoutward as $rec)
{
@ -100,14 +109,15 @@ th{
<div class="box-body">
<div class="row">
<div class="col-md-3">
<div class="col-md-12">
<div class="col-md-4">
<label>Customer</label>
<?php echo form_dropdown('customer',$customers,set_value('customer',$customers[-1]),'id="customer"' ,'class="form-control select2','style="text-align:center;"');?>
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>Grade</label>
<?php echo form_dropdown('product',$products,set_value('product',$products[-1]),'id="product"' ,'class="form-control select2', 'style="text-align:center;"');?>
</div>
@ -119,48 +129,63 @@ th{
<input type="text" id="batchno" name="batchno" class="form-control" >
</div> -->
<div class="col-md-3">
<div class="col-md-4">
<label>Batch Date</label>
<input type="text" id="batchdate" name="batchdate" class="form-control" >
</div>
<div class="col-md-3">
<label>Shift Name</label>
<input type="text" id="plantname" name="plantname" class="form-control" >
</div>
</div>
</br>
<div class="col-md-12">
<div class="row">
<div class="col-md-4">
<label>Resin Name</label>
<input type="text" id="resinname" name="resinname" class="form-control" >
</div>
<div class="col-md-4">
<label>Shift Name</label>
<input type="text" id="plantname" name="plantname" class="form-control" >
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>Machine Name</label>
<?php echo form_dropdown('machines',$machines,set_value('machines',$machines[-1]),'id="machines"' ,'class="form-control select2','style="text-align:center;"');?>
</div>
<div class="col-md-3">
</div>
</br>
<div class="col-md-12">
<div class="col-md-4">
<label>TRP Batch No(For TRP Sand)</label>
<?php echo form_dropdown('trpbatchnos',$trpbatchnos,set_value('trpbatchnos',$trpbatchnos[-1]),'id="trpbatchnos"' ,'class="form-control select2','style="text-align:center;"');?>
<?php echo form_dropdown('trpbatchnos',$trpbatchnos,set_value('trpbatchnos',$trpbatchnos[-1]), 'id="trpbatchnos"' ,'class="form-control select2','style="text-align:center;"');?>
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>IGR No(For Fresh Sand)</label>
<?php echo form_dropdown('igrnos',$igrnos,set_value('igrnos',$igrnos[-1]),'id="igrnos"' ,'class="form-control select2','style="text-align:center;"');?>
</div>
<div class="col-md-3">
<div class="col-md-4">
<label>IGR Line Item No</label>
<?php echo form_dropdown('igrlinenos',$igrlinenos,set_value('igrlinenos',$igrlinenos[-1]),'id="igrlinenos"' ,'class="form-control select2','style="text-align:center;"');?>
</div>
</div>
</div><br>
<br/>
<p>&nbsp;</p>
<table id="testreport" class="table table-bordered" style="background-color:#fff;font-size:12px;text-align:center;">
<thead style="background-color:#ddf;">
<tr id="firstrowheader"><th>SNO</th><th>Time</th></tr>
@ -184,12 +209,12 @@ th{
<p><b>Raw/Packing Material Consumption<b></p>
<table id="finaltable" class="table table-bordered" style="background-color:#fff;font-size:12px;text-align:center;">
<thead style="background-color:#ddf;">
<tr><th>Particulars</th><th>Sand</th><th>Resin</th><th>Hexamine</th><th>CS</th><th>50 Bags</th><th>1 ton Bag</th><th>Production Loss <br> Lump</th><th>Finished Prodcut <br> PCS</th></tr>
<tr><th>Unit</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Nos</th><th>Kgs</th><th>Kgs</th></tr>
<tr><th>Particulars</th><th>Sand</th><th>Resin</th><th>Hexamine</th><th>CS</th><th>Catalyst</th><th>50 Bags</th><th>1 ton Bag</th><th>Production Loss <br> Lump</th><th>Finished Prodcut <br> PCS</th></tr>
<tr><th>Unit</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Kgs</th><th>Nos</th><th>Kgs</th><th>Kgs</th></tr>
</thead>
<tbody id="">
<tr><td>Qty</td><td id="sandtotal">0.00</td><td id="resintotal">0.00</td><td id="hextotal">0.00</td><td id="cstotal">0.00</td><td id="50bagtotal" contenteditable="true">0.00</td><td id="1tonbagtotal" contenteditable="true">0.00</td><td id="lumptotal" contenteditable="true">0.00</td><td id="pcstotal" contenteditable="true">0.00</td></tr>
<tr><td>Qty</td><td id="sandtotal">0.00</td><td id="resintotal">0.00</td><td id="hextotal">0.00</td><td id="cstotal">0.00</td><td id="catalysttotal">0.00</td><td id="50bagtotal" contenteditable="true">0.00</td><td id="1tonbagtotal" contenteditable="true">0.00</td><td id="lumptotal" contenteditable="true">0.00</td><td id="pcstotal" contenteditable="true">0.00</td></tr>
</tbody>
</table>
<hr>
@ -219,7 +244,15 @@ th{
<input type="file" id="reportfile" name="reportfile">
</form>
</div>
<div class="col-md-9">
<div class="col-md-3">
<label>Operators:</label>
<select name="listops" id="listops" multiple>
</select>
</div>
<div class="col-md-6">
<label>Remarks:</label>
<textarea id="remarks" class="form-control" rows="1"></textarea>
@ -229,12 +262,16 @@ th{
<div class="col-md-12">
<div class="col-md-3">
<label>Operated By :</label>
<label>Created 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">
<label>Select Operators :</label>
<?php echo form_dropdown('operators',$operators,set_value('operators',$operators[-1]),'id="operators"' ,'class="form-control select2', 'style="text-align:center;"');?>
</div>
<div class="col-md-3 col-md-offset-6 ">
<div class="col-md-3 col-md-offset-3 ">
<label>Production In charge :</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"> -->
@ -302,6 +339,7 @@ $(document).ready(function(){
$('#trpbatchnos').select2();
$('#approvedby').select2();
$('#igrlinenos').select2();
$('#operators').select2();
//show_hide_column(13,false);
@ -708,6 +746,49 @@ function masterCalculationCheck(id,val)
}
if(ide == 'catalyst')
{
for(i=1;i<=overallrows;i++)
{
var tid = i+''+ide;
if(document.getElementById(tid))
{
var currentvalue = document.getElementById(tid).textContent;
if(isNaN(currentvalue) || currentvalue == '')
{
currentvalue = 0.00;
}
totalsandqty +=parseFloat(currentvalue);
}
}
if(document.getElementById('catalysttotal'))
{
document.getElementById('catalysttotal').textContent = parseFloat(totalsandqty);
}
}
else if(ide2 == 'catalyst')
{
for(i=1;i<=overallrows;i++)
{
var tid = i+''+ide2;
if(document.getElementById(tid))
{
var currentvalue = document.getElementById(tid).textContent;
if(isNaN(currentvalue) || currentvalue == '')
{
currentvalue = 0.00;
}
totalsandqty +=parseFloat(currentvalue);
}
}
if(document.getElementById('catalysttotal'))
{
document.getElementById('catalysttotal').textContent = parseFloat(totalsandqty);
}
}
//FOr total Hexamine Calculaiton
@ -808,7 +889,7 @@ function masterCalculationCheck(id,val)
var listopsforstore = []; //This one for Geeting all operators list
function getAllData()
{
@ -829,18 +910,26 @@ function masterCalculationCheck(id,val)
var customerid = $('#customer').val();
var batchdate = $('#batchdate').val();
var plantname = $('#plantname').val();
var resinname = $('#resinname').val();
var macinecode = $('#machines').val();
var trpbatchcard = $('#trpbatchnos').val();
var igrnos = $('#igrnos').val();
var igrlinenos = $('#igrlinenos').val();
var remarks = $('#remarks').val();
var approvedby = $('#approvedby').val();
if(productid == -1 || customerid == -1 || batchdate == '' || plantname == '' || macinecode == '' || trpbatchcard == -1 || igrlinenos == -1 ||igrnos == -1 || approvedby == -1)
if(productid == -1 || customerid == -1 || batchdate == '' || plantname == '' || macinecode == -1 || approvedby == -1 || listopsforstore.length == 0 || resinname == '')
{
alert('Please Enter All Master Details..!');
return false;
}
if(( igrnos == -1 || igrlinenos == -1) && trpbatchcard == -1 )
{
alert('Please Enter All Master Details...!');
return false;
}
var f = 0;
for(i=1;i<=overallrows;i++)
{
@ -864,7 +953,19 @@ function masterCalculationCheck(id,val)
listopsforstore = JSON.stringify(listopsforstore);
if(trpbatchcard == -1 )
{
trpbatchcard ="";
}
if(igrnos == -1 )
{
igrnos = "";
}
if(igrlinenos == -1 )
{
igrlinenos = "";
}
var formData = new FormData();
var reportfile = $("#reportfile").prop('files')[0];
formData.append('rfile',reportfile);
@ -881,6 +982,8 @@ function masterCalculationCheck(id,val)
var param10 = approvedby;
var param11 = testreportdata;
var param12 = finaltable;
var param13 = resinname;
var param14 = listopsforstore;
formData.append('param1',param1);
@ -895,6 +998,8 @@ function masterCalculationCheck(id,val)
formData.append('param10',param10);
formData.append('param11',param11);
formData.append('param12',param12);
formData.append('param13',param13);
formData.append('param14',param14);
$('.content').loader('show');
@ -921,7 +1026,43 @@ function masterCalculationCheck(id,val)
}
$('#operators').change(function(){
var val = $('#operators').val();
var text = $("#operators option:selected").text();
//alert(val);
//alert(text);
var totalelements = listopsforstore.length
if(totalelements != 0)
{
$.each(listopsforstore,function(key,value){
//alert(value);
if(value == val)
{
alert('Operator Already Added..!Choose Another One.!');
brea();
}
});
}
listopsforstore.push(val);
//console.log(listopsforstore);
$("#listops").append('<option value='+val+'>'+text+'</option>');
});
$("#listops").dblclick(function(){
var text = $("#listops option:selected").text();
var val = $('#listops').val();
//alert(text+'-'+val);
$('option:selected', this).remove();
listopsforstore = listopsforstore.filter(item => item != val);
//console.log(listopsforstore);
});