edit store requistion deletion function issues fixed

This commit is contained in:
gandhimathi 2017-08-18 16:43:30 +05:30
parent d4df1902cc
commit 9355445e42

View File

@ -1,6 +1,6 @@
<?php <?php
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$CurrentDate = $dt->format('d-m-y'); $CurrentDate = $dt->format('d-m-Y');
// print_r($cost);die(); // print_r($cost);die();
@ -34,7 +34,7 @@ $(function() {
$("#Date").datepicker({ $("#Date").datepicker({
// minDate : 'now', // minDate : 'now',
maxDate : 'now', maxDate : 'now',
dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0' dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
}); });
@ -51,6 +51,7 @@ $(function() {
} }
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div id="content"></div>
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1> <h1>
@ -348,10 +349,11 @@ $(function() {
<td align="left"><?php echo $record->Remarks ?></td> <td align="left"><?php echo $record->Remarks ?></td>
<td> <td>
<a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-target='#EditItem' data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick = "DeleteRow(<?php echo $index ; ?>)" class="link" data-id="<?php echo $record->MaterialCode ; ?>" data-userid="<?php echo $index ; ?>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a> <a data-id="<?php echo $index ; ?>" data-userid="<?php echo $index ; ?>" data-target='#EditItem' data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode ; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick = "RemoveList(<?php echo $index ; ?>)" class="link" data-id="<?php echo $record->MaterialCode ; ?>" data-userid="<?php echo $index ; ?>" id="Del"><span class="glyphicon glyphicon-trash"></span></a>
</td> </td>
</tr> </tr>
<?php $RowCount = $index; } <?php $RowCount = $index; }
?> ?>
@ -414,7 +416,7 @@ elseif ($StatusCode==STORE_APPROVAL)
<td align="left"><%=Remarks%></td> <td align="left"><%=Remarks%></td>
<td> <td>
<a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&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> <a data-target='#EditItem' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#EditItem"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick = "RemoveList(<%=index%>)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
@ -545,7 +547,8 @@ $("#mypo").on("shown.bs.modal", function(e) {
} }
}); });
var index=1; var index=<?php echo $index; ?>;
$('.addClick').click(function() $('.addClick').click(function()
{ {
@ -612,7 +615,6 @@ function clear()
} }
var index = '1';
var userid = ''; var userid = '';
function removeHiddenRows(rowcount) function removeHiddenRows(rowcount)
{ {
@ -680,6 +682,7 @@ function Deleterow(rowid)
{ {
var id = []; var id = [];
var tr= document.getElementById(rowid); var tr= document.getElementById(rowid);
var cellval = tr.cells; var cellval = tr.cells;
@ -761,8 +764,93 @@ function Deleterow(rowid)
} }
} }
// this function used to remove the item from listing table
function RemoveList(rowid)
{
var id = [];
var tr= document.getElementById(rowid);
var cellval = tr.cells;
var MaterialCode = cellval[1].innerHTML;
// alert(cellval[1].innerHTML);
id[0] = $('#txtReqNo').val();
id[1] = MaterialCode;
var answer = confirm(" Do you want to delete the Item from the List?")
if (answer)
{
// To delete the item from list
var x = <?php echo json_encode($LineItem, JSON_PRETTY_PRINT) ?>;
var result = '0';
//alert(x);
//alert(MaterialCode);
if(MaterialCode != "0")
{
$.each(x, function(idx, obj) {
if(obj.MaterialCode === MaterialCode)
{
result = '1';
return false;
}
});
}
if(result == '0')
{
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
}
// To delete the value from Tables
else if(result == '1')
{
$('#content').loader('show');
var DelRows = $('#txtDeletedRow').val();
tr.parentNode.removeChild(tr);
if(DelRows != '')
{
DelRows = DelRows + ":" + rowid;
}
else
{
DelRows= "0" + ":" + rowid;
}
$('#txtDeletedRow').val(DelRows);
$.ajax({
data:{id:id},
type:"POST",
url:"<?php echo base_url() ?>storerequisitionlist/DeleteRequistionForm",
success:function(data) {
if(data)
{
$('#content').loader('hide');
alert(data);
}
else
{
alert("Error");
}
}});
}
}
}
function validateBeforeAdd() function validateBeforeAdd()
{ {
@ -913,4 +1001,5 @@ function validate()
}); });
}); });
</script> </script>