diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index 69847058..f41d666d 100755 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -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); } diff --git a/application/views/editrequisitionform.php b/application/views/editrequisitionform.php index 28f2148b..84bbf2ba 100755 --- a/application/views/editrequisitionform.php +++ b/application/views/editrequisitionform.php @@ -297,6 +297,23 @@ if(!empty($ReqPOType)) ?> + + + +
+ +
+ 'otherD','value' => set_value('otherD'),'id'=>'otherD', 'class' => 'form-control' ,'rows' => '5', 'cols' => '70','maxlength' => '500'); + echo Form_textarea($data); + ?> +
+
+ + + + +
@@ -360,6 +377,25 @@ if(!empty($ReqPOType)) ?>
+ + + +
+ +
+ '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); + ?> +
+
+ + + +
@@ -417,6 +453,8 @@ if(!empty($ReqPOType)) foreach($LineItem as $record) { $index = $index + 1; + $materialdesc=$record->MaterialDescription; + //echo $materialdesc; ?> @@ -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'); + + $('').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= ; + //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(){ diff --git a/application/views/requisitionform.php b/application/views/requisitionform.php index 5afc3207..ea059b74 100755 --- a/application/views/requisitionform.php +++ b/application/views/requisitionform.php @@ -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');