edit description

This commit is contained in:
venbatechnologies@gmail.com 2018-01-04 17:31:10 +05:30
parent 374df9d2f1
commit 129ef94f6f
3 changed files with 118 additions and 10 deletions

View File

@ -482,6 +482,10 @@ class requisitionform extends BaseController
/* Table value update and Insert in the table */
//echo "RowCOunt:" .$RowCount;
$SkipInsert = False;
for ($i = 1; $i <= $RowCount; $i++)
{
@ -503,18 +507,22 @@ class requisitionform extends BaseController
if($SkipInsert == "False")
{
$MaterialCode = $this->input->post('MaterialCode'.$i);
$Quantity = $this->input->post('Quantity'.$i);
$otherD =$this->input->post('otherD'.$i);
//echo $otherD;
$IsExists = $this->requistion_model->LineItemIsExists($ReqNumber,$MaterialCode);
if(count( $IsExists) == 0)
{
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate);
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate,'MaterialDescription'=>$otherD);
$this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber);
}
else
{
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate);
$ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'UpdatedBy'=>$UpdatedBy,'UpdatedOn'=>$updatedDate,'MaterialDescription'=>$otherD);
$this->requistion_model->UpdateRequistionLineItem($ReqDetails,$ReqNumber,$MaterialCode);
}

View File

@ -297,6 +297,23 @@ if(!empty($ReqPOType))
?>
</div>
</div>
<div class="col-md-6" id="otherDescription" >
<label>Other Description</label>
<div class="form-group">
<?php
$data = array('name' => 'otherD','value' => set_value('otherD'),'id'=>'otherD', 'class' => 'form-control' ,'rows' => '5', 'cols' => '70','maxlength' => '500');
echo Form_textarea($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
@ -360,6 +377,25 @@ if(!empty($ReqPOType))
?>
</div>
</div>
<div class="col-md-6" id="EditotherDescription">
<label>Other Description</label>
<div class="form-group">
<?php
// $data = array('name' => 'EditotherD','value' => set_value('EditotherD'),'id'=>'EditotherD', 'class' => 'form-control','readonly'=>'true' );
// echo form_input($data);
$data = array('name' => 'EditotherD','value' => set_value('EditotherD'),'id'=>'EditotherD', 'class' => 'form-control' ,'rows' => '5', 'cols' => '70','maxlength' => '500');
echo Form_textarea($data);
?>
</div>
</div>
<div class="col-md-6">
<label>UOM</label>
<div>
@ -417,6 +453,8 @@ if(!empty($ReqPOType))
foreach($LineItem as $record)
{
$index = $index + 1;
$materialdesc=$record->MaterialDescription;
//echo $materialdesc;
?>
<tr id="<?php echo $index ; ?>">
<td align="left"><?php echo $index ; ?></td>
@ -510,6 +548,10 @@ $(function() {
}).appendTo('form');
});
$('#otherDescription').hide();
$('#EditotherDescription').hide();
$( ".datePicker" ).datepicker({ dateFormat: 'dd/mm/yy' });
@ -614,10 +656,21 @@ $('#drpMaterial').change(function() {
var id = $('#drpMaterial').val();
// var skillsSelect = document.getElementById("drpMaterial");
// var selectedText = skillsSelect.options[skillsSelect.selectedIndex].text;
var value = $("#drpMaterial option:selected").text();
answer = value.replace(/[^a-z]/gi, '');
var converttext = answer.toUpperCase();
//alert(converttext)
$("#Description").val('');
$("#UOM").val('');
if(id != '-1')
{
if((converttext != 'SERVICE'))
{
$('#content').loader('show');
$.ajax({
@ -633,6 +686,12 @@ $("#UOM").val('');
}
});
}
else
{
$('#otherDescription').show();
}
//$('#content').loader('hide');
}
else
@ -888,19 +947,29 @@ $('.addClick').click(function(){
var materialName = $("#Description").val();
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
var materialdescription= $('#otherD').val();
$('#drpMaterial option[value='+materialCode+']').remove();
$('#Description').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#drpMaterial option[value='+materialCode+']').remove();
$('#Description').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#otherD').val('')
index = parseInt(index)+1;
var template = jQuery("#tempList").html();
if(materialdescription == '')
{
$('#tempAppend').append(_.template(template,{index:temp,MaterialCode:materialCode,MaterialName:materialName,UOM:uom,Quantity:quantity}));
}
else
{
$('#tempAppend').append(_.template(template,{index:temp,MaterialCode:materialCode,MaterialName:materialdescription,UOM:uom,Quantity:quantity}));
}
var theForm = $(".requistion");
@ -937,6 +1006,13 @@ $('.addClick').click(function(){
name: 'Quantity'+ temp,
value:quantity
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'otherD' + temp,
name: 'otherD'+ temp,
value:materialdescription
}).appendTo('form');
$('#txtRowCount').val(temp);
@ -965,11 +1041,35 @@ $("#EditItem").on("shown.bs.modal", function(e) {
// alert(userid);
var tr= document.getElementById(userid);
var cellval = tr.cells;
//var desc=cellval[2].innerHTML;
var check=cellval[2].innerHTML;
var upcheck= check.toUpperCase();
var decs= <?php echo json_encode($materialdesc, JSON_PRETTY_PRINT) ?>;
//alert(decs)
if(upcheck=='SERVICE')
{
$('#EditotherDescription').show();
$('#EditotherD').val(decs)
}
else
{
$('#EditotherDescription').hide();
$('#EditotherD').val('')
}
//alert(x[1].innerHTML);
$('#EditMaterialCode').val(cellval[1].innerHTML);
$('#EditDescription').val(cellval[2].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditQuantity').val(cellval[4].innerHTML);
});
$('.EditClick').click(function(){

View File

@ -541,14 +541,14 @@ $('#MaterialCode').change(function() {
var checkanswer=answer.toUpperCase();
//alert(checkanswer)
// alert(checkanswer)
$("#Description").val('');
$("#UOM").val('');
if(id != '-1')
{
if(checkanswer != 'OTHERS')
if((checkanswer != 'SERVICE'))
{
$('#content').loader('show');