<link rel="stylesheet" href="css/new_mxerp.css">
<?php ob_start();
$PageSecurity = 4;
$PageName = 'Issue Slip';
include('includes/DefinePOClass.php');
$Prefix_SQL = "Select prefix_id,prefix_code,prefix_name from prefix_tbl Where prefix_name ='".$PageName."'";
$Prefix_Result = DB_query($Prefix_SQL,$db);
$Prefix_Row = DB_fetch_array($Prefix_Result);
$Prefix_code = $Prefix_Row['prefix_code'];
$Prefix_date = date("Y");
$Prefix_date++;
$CurrentFinancialYear = date("Y")."-".$Prefix_date; 
if(isset($_GET['issueid'])  && isset($_GET['issueid']) !='')
{$title = _('Update Issue Slip');}
else
{$title = _('Add Issue Slip');}
include('includes/SQL_CommonFunctions.inc'); 
$IssueListFormId=$px->GetFormId('Issue_show.php');
$_SESSION['modid'];
if (empty($_GET['identifier'])) {
 $identifier=date('U');
} else {
 $identifier=$_GET['identifier'];

}
///////////////////////////////////////////// Add IUssue Slip  Form  By Amit Kumar////////////////////////////////////////
		 $date = date($_SESSION['DefaultDateFormat']);
if(isset($_POST['Submit']))
{
	//echo "<pre>";print_r($_POST); 	
	 $_POST['PRDate']=Date($_SESSION['DefaultDateFormat']);
	$_POST['DatePrinted']=Date($_SESSION['DefaultDateFormat']);
	ConvertSQLDate($_SESSION['MR'.$identifier]->Orig_OrderDate);
/////////////////////////////////////////////////  Add ISSUE Slip Number With Financial Year And Module //////////////////////////////////////////	
	$prefixcode="NRG";						 
	$siteCode = $_REQUEST['site'];
	$site_Code=substr($siteCode,0,3);
	 $sql="select id, NRGP_no from nrgp_challan where site='".$_REQUEST['site']."' order by id desc limit 1";
	 $result = DB_query($sql,$db);
	  $numrows = DB_num_rows($result);
	 if($numrows>0)
	 {
			 $i=0;
			 $strmax = "";
			 $myrow=DB_Fetch_array($result);
			 
			 if($myrow['NRGP_no'] !='')
			 {
			         $val= substr($myrow['NRGP_no'],19);
					   $strChar = substr($myrow['NRGP_no'],0,19);
					 if($val!="")
					 {
						 $arr[$i] = $val;
						 $i++;
					}
			
			if(is_array($arr))
			{ 
				$maxval =  max($arr);
			}
			else
			{
				$maxval=0;
			}
		}
		else
		{
			$strChar = $prefixcode."/".$_REQUEST['site']."/".$CurrentFinancialYear."/";
		}
	  }
	  $strChar = $prefixcode."/".$_REQUEST['site']."/".$CurrentFinancialYear."/";
	  
	$strFinal = $maxval+1;
	$strBothFinal = $strChar.str_pad($strFinal,4,"0",STR_PAD_LEFT);
	
	$qty=$_REQUEST['itemcode'];
	$qty1=count($qty);
	
 	$sql = "INSERT INTO nrgp_challan set
						id='',  
						site='".$_REQUEST['site']."',  
						store='".$_REQUEST['store']."',  
						NRGP_no='".$strBothFinal."', 
						challan_date='".FormatDateForSQL(date('d/m/Y'))."',  
						form_no='".$_REQUEST['form_no']."',  
						issued_for='".$_REQUEST['issued_for']."',
						remarks='".$_REQUEST['remarks']."',
						createdby='".$_SESSION['UserID']."',  
						createddate='".FormatDateForSQL(date('d/m/Y'))."' ,
						CompanyId='".$_SESSION['ACGCompanyId']."'";
						
						
				$ErrMsg = _('An error occurred Record Note Save') . '. ' . _('The error says');
				$insertResult = DB_query($sql,$db,$ErrMsg);
			 	$Lastreq_id=DB_Last_Insert_ID($db,'addissue',$ErrMsg);
			 
				if($Lastreq_id!='')
				{
					$totalqty=0;
				for($i=0;$i<$qty1;$i++)
					 {
			        	$makeID=$s->getField('product_manufacture','manufacturer',$_REQUEST['make'][$i],'id');
						$gradeID=$s->getField('product_grade','grade',$_REQUEST['grade'][$i],'id');
						$colorID=$s->getField('product_color','color',$_REQUEST['color'][$i],'id');
						$unitID=$s->getField('unitsofmeasure','unitname',$_REQUEST['uom'][$i],'unitid');
					
					$sql2 = "INSERT INTO nrgp_challan_details set
								id='".$_REQUEST[''][$i]."', 
								nrgp_challan_id='".$Lastreq_id."', 
								itemcode='".$_REQUEST['itemcode'][$i]."', 
								itemdesc='".$_REQUEST['desc'][$i]."', 
								uom='".$unitID."',    
								Stockbalance='".$_REQUEST['Stockbalance'][$i]."', 
								issueqty='".$_REQUEST['issueqty'][$i]."'";
					 
					$stock=DB_query("Select stockbalance from stock_maintenance where itemcode='".$_REQUEST['itemcode'][$i]."'",$db);
					$stock_row=DB_fetch_array($stock);
					//echo $stock_row['stockbalance']; exit;	
					if($stock_row['itemcode']=$_REQUEST['itemcode'][$i] && $stock_row['site']=$_REQUEST['site'] && $stock_row['store']=$_REQUEST['store'])
					{
						 $condition1="itemcode='".$_REQUEST['itemcode'][$i]."' && site='".$_REQUEST['site']."' && store='".$_REQUEST['store']."'";
						
					 $current_bal=$stock_row['stockbalance']-$_REQUEST['issueqty'][$i];
					 //$current_bal; exit;
					//print_r($current_bal); exit;
					$balance_arr['site'] = $_REQUEST['site'];
					$balance_arr['store'] = $_REQUEST['store'];  
					$balance_arr['itemcode']= $_REQUEST['itemcode'][$i];
					
					$balance_arr['stockbalance']=$current_bal;
					$balance_arr['created_by']=$_SESSION['UserID'];
					$update1=$s->EditRecord(stock_maintenance, $balance_arr, $condition1);
					$row1=DB_query($update1,$db);
					
					if(!$row1)
					{
	  					 die('Error'.DB_error());
					}
					}
					else{
						$balance_arr['site'] = $_REQUEST['site'];
						$balance_arr['store'] = $_REQUEST['store'];  
						$balance_arr['itemcode']= $_REQUEST['itemcode'][$i];
						
						$balance_arr['stockbalance']= $_REQUEST['issueqty'][$i];
						$balance_arr['created_by']=$_SESSION['UserID'];
						$insert_stock_maintenance=$s->insertRecord('stock_maintenance', $balance_arr);
						$row1=DB_query($insert_stock_maintenance,$db);
						if(!$row1)
						{
		  					 die('Error'.DB_error());
						}
					}
					  $ErrMsg = _('An error occurred Record Note Save') . '. ' . _('The error says');
				      $insertResult2 = DB_query($sql2,$db,$ErrMsg);
					  
					 }
					}

if($insertResult2 == true)
{
	 prnMsg( _('Record Inserted Successfully'),'success');
	 echo "<script>location.href='index.php?route=ADD_NRGP_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
}
 }
 ?>
<script language="javascript" type="text/javascript">
function Remaningqtn(str)
{
alert(str);
var StockBalance=document.getElementById("Stockblance_"+i).value;	
var Issuequantity=document.getElementById("issuebalanc_"+i).value;	
var RemaningBalance =parseFloat(StockBalance)-parseFloat(Issuequantity;)
document.getElementById("remaningbalance_"+i).value =RemaningBalance;
}

var countries=new ddtabcontent("countrytabs")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init();
function calTotal(obj)
{
	alert("manvi");
	var rowCount = document.getElementById('dataTable').rows.length;
	var arr = obj.id.split("_");
	var rowx1=0;
	if (arr[1]==undefined)
	var nm='';
	else
	var nm='_'+arr[1];
	for(var i=1;i<rowCount;i++)
	{
		
		 if(parseInt(document.getElementById('reqiredbalance'+nm).value) <= document.getElementById('issuebalanc'+nm).value))
		  {
			  alert('Please Enter Less then value In Required Quantity');
			  document.getElementById('issuebalanc'+nm).focus();
			  return false;
	  }else{	
			  rowx1=parseInt(document.getElementById('Stockblance'+nm).value) - parseInt(document.getElementById('issuebalanc'+nm).value);
			if(isNaN(rowx1))
			{
				document.getElementById('remaningbalance'+nm).value=parseInt(0);
			}
			else
			 {
				document.getElementById('remaningbalance'+nm).value=rowx1;
			 }
		}
	}
}


function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}


 var xmlHttp
function changestorename(str)
{ 
 
 // alert('hi');
   xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="storename.php";
	url=url+"?store_code="+str;
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=NumberChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function NumberChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	   document.getElementById("txtid").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
</script> 
<div class="body_contain">
<div class="tab_div">

<h1>Non Returnable Challan</h1>
<form name="form1" action="" method="post">
<div align="center">
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
    <td class="tabledata1">Branch</td>
    <td style="width:250px">
	<?php
	if($_SESSION['AssignedBranch']!='0')
	  {	  	
  $ss="Select loccode, locationname from locations  where CompanyId='".$_SESSION['ACGCompanyId']."' and loccode in('".$_SESSION['AssignedBranch'].")'";
	  	 $site_sql=DB_query($ss,$db);
	  }
	  else
	  {
		$ss="Select loccode,locationname from locations where CompanyId='".$_SESSION['ACGCompanyId']."'";
		$site_sql=DB_query($ss,$db);
	  }
	?>
	<select name="site" id="site" style="width:100%">
	<option value="0">Select</option>
       <?php 
					while($Row=DB_fetch_array($site_sql)){?>
             <option value="<?php echo $Row['loccode']?>"<?php echo($_SESSION['Site']==$Row['loccode'] ? 'selected':'');?> ><?php echo $Row['locationname']?></option>
                                <?php  } ?>
    </select></td>
    <td class="tabledata1">Godown</td>
    <td><?php
	     $sql_store ='select distinct StoreCode, StoreName from storetype';
		 $resultStkLocs = DB_query($sql_store,$db);
		?>
      <select name="store" id="store" style="width:100%">
        <option value="0">Select</option>
        <?php 
		while ($myrow=DB_fetch_array($resultStkLocs))
		{?>
        <option value="<?php echo $myrow['StoreCode'];?>"><?php echo $myrow['StoreName'];?></option>
        <?php 
		}
		?>
      </select></td>
</tr>
  <tr>
    <td class="tabledata1">NRGP No.</td>
    <td><input name="NRGP_no" type="text" id="NRGP_no" readonly="readonly" value="Autogenerate"  style="width:100%"></td>
    <td class="tabledata1">Challan Date </td>
    <td><input name="challan_date" type="text" id="challan_date" value="<?php echo $challan_date; ?>"  style="width:100%" class="datepicker"/></td>
  </tr>
  
  
  <tr>
    <td class="tabledata1">Form No. </td>
    <td><input name="form_no" type="text" id="form_no"  style="width:100%"></td>
    
    <td class="tabledata1">Issued For </td>
    <td><input name="issued_for" type="text" id="issued_for"  style="width:100%" ></td>
    
  </tr>
 
  <tr></tr>
</table>
</div>
<p align="left">
<input type="button" onclick="addRow('dataTable')" value="Add More" />&nbsp;
<input type="button" class="crmbutton small delete"  onclick="deleteRow('dataTable')" value="Delete" />
</p>
<div align="center">
<div style="overflow:auto; width:810px; height:auto">

<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
  <tr>
    <td class="tabledata">&nbsp;</td>
    <td class="tabledata">Item Code</td>
    <td class="tabledata">&nbsp;</td>
    <td class="tabledata">Description</td>
    <td class="tabledata">UOM</td>
    <td class="tabledata">Stock Balance </td>
    <td class="tabledata">Issue Qty </td>
  </tr>
  <tbody id="dataTable">

   <tr bgcolor="#e7e7e7">
 <td><input name="delitem[]" type="checkbox"  id="delitem" /></td>
 <td><input type="text" value="" tabindex="" id="itemcode" name="itemcode[]"size="20" onkeyup="opendata(this.value,this.id)"/></td>
<td><input  type="hidden"   readonly=""  id="itemdataid"  name="itemdataid[]" /></td>
<td><input type="text" name="desc[]"  id="descriptions" size="25"  value="" readonly=""/></td>
 <td><input type="text" name="uom[]" id="uom" value="" readonly  size="30"/>  </td>
 <td><input type="text" name="Stockbalance[]"  id="Stockbalance"  size="30"   readonly/></td>
   <td><input  type="text" name="issueqty[]"  id="issueqty" size="30"   value="" onkeyup="calamt(this.id,this.value)"  /></td>
          </tr>
  </tbody>
</table>

</div>
</div>
<div class="body_lightbox1" id="lightbox1" style="overflow:auto; width:600px; height:250px; display:none;"></div>
  <input type="hidden" name="hiditemcount" id="hiditemcount" value="" />
  <input type="hidden" name="" value="" id="edit_cnt" />

<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata">Remarks </td>
<td><textarea name="remarks"  style="width:100%" id="remark"><?php echo $mysqlrow['remarks']; ?></textarea></td>
</tr>
</table>
<p align="center"><input type="submit" name="Submit" value="Save" /></p>
</form>

</div></div>





<script language="javascript" type="text/javascript">
function openPopupProfile(i)
{ 
		window.open("issu_searchpopup.php?rowcount="+i,"profiles_popup_window","height=425,width=640,toolbar=no,menubar=no,dependent=yes,resizable=yes");
}
 var xmlHttp

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}

function getsitename(str)
{
if (str.length==0)
  {
  document.getElementById("txtsite").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtsite").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_sitename.php?site="+str,true);
xmlhttp.send();
}
function getsitename22(str)
{
if (str.length==0)
  {
  document.getElementById("txtsite22").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtsite22").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_sitename.php?q2="+str,true);
xmlhttp.send();
}
function Get_issuedetails(str)
{
  if (str.length==0)
  {
  document.getElementById("issueid").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("issueid").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_IssueDetails.php?q="+str,true);
xmlhttp.send();
}

function getpartyname(str)
{
	//alert(str);
	var hidparty=document.getElementById("hidden_party").value;
	//alert(hidparty);
	if (str.length==0)
  {
  document.getElementById("pname").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pname").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_IssuePartyName.php?name="+str+"&partytype="+hidparty,true);
xmlhttp.send();
}
	

function get_referredby(str)
{
	if (str.length==0)
  {
  document.getElementById("rname").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("rname").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_IssueEmployeeName.php?q="+str,true);
xmlhttp.send();
}

 var xmlHttp
function requisition_detail(str)
{ 
   //alert(str);
   xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="reqdetail.php";
	url=url+"?req_number="+str;
	
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=changedetail;
	
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function changedetail() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	   var responsestr = xmlHttp.responseText;
	   resstr = responsestr.split("@@##@");
	   document.getElementById("reqdate").value=resstr[0];
	   document.getElementById("txtdetail").innerHTML=resstr[1];
	  
	}
}
function calculateTotalAmount(str)
{
	var str_BRK=str.split('_');
	if(str_BRK[1]==undefined)
	{
		var issue=document.getElementById("issueqty").value;
		var average=document.getElementById("averageamt").value;
		var TOTAL=issue*average;
		document.getElementById("totalamount").value=TOTAL.toFixed(2);
	}
	else
	{
		var issue=document.getElementById("issueqty_"+str_BRK[1]).value;
		var average=document.getElementById("averageamt_"+str_BRK[1]).value;
		var TOTAL=issue*average;
		document.getElementById("totalamount_"+str_BRK[1]).value=TOTAL.toFixed(2);
	}
}
function Get_departmentdetails(str)
{

if (str=="")
  {
  document.getElementById("department").innerHTML="";
  return;
  }
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	document.getElementById("department").value=xmlhttp.responseText;
	
    }
  }
  //alert(str);
xmlhttp.open("GET","get_department.php?department="+str,true);
xmlhttp.send();

//xmlhttp.open("GET","getSort.php?s="+str+"&cat="+cat,true);

}

function opendata(str,id)
{

  
  var sitecode=document.getElementById("site").value;
   var date=document.getElementById("challan_date").value;
   
  if (str.length == 0)
    {    	
     document.getElementById("lightbox1").innerHTML="";
     document.getElementById("lightbox1").style.border="0px";
     return;
    }	
	if(sitecode=='0')
	{
	alert("Must Select Site");
	document.getElementById("site").focus();
	return;
	}
	else if(date=='')
	{
	alert("Must Select Date");
	document.getElementById("challan_date").focus();
	return;
	}

var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("lightbox1").style.display='block';	
	document.getElementById("lightbox1").innerHTML=xmlhttp.responseText;	
    }
  }
  var store=document.getElementById("store").value;
 
  xmlhttp.open("GET","showpopupissue.php?site="+str+"&data="+id+"&store="+store+"&site1="+sitecode+"&date="+date,true);
	xmlhttp.send();	
	
}
function hidedata()
{
document.getElementById("lightbox1").style.display='none';
}

function getItemsList1(id,code,shade,netrate,mrprate,rate,ctr)
{ 
    var ctr1=ctr.split("_");
    var i=ctr1[1]
	var itemcount=parseInt(document.getElementById('hiditemcount').value)+1;
	var edit_cnt=document.getElementById('edit_cnt').value;
	if(edit_cnt==''){var counter=1;} else if(edit_cnt>itemcount){var counter=edit_cnt;
	var itemcount=parseFloat(counter)+parseFloat(itemcount);
	} else  {var counter=edit_cnt;}
	  
	if(ctr1[1]==undefined)
	{
	//if(document.getElementById('itemdataid').value=='')
	//{
	
	document.getElementById('itemdataid').value = id;
	document.getElementById('itemcode').value = code;
	document.getElementById('descriptions').value = shade;
	document.getElementById('uom').value = netrate;
	document.getElementById('Stockbalance').value = mrprate;
	document.getElementById("issueqty").value=rate;
	//}
	}
	else
	{
	//if(document.getElementById('itemdataid_'+i).value=='')
	//{		
	document.getElementById('itemdataid_'+i).value = id;
	document.getElementById('itemcode_'+i).value = code;
	document.getElementById('descriptions_'+i).value = shade;
	document.getElementById('uom_'+i).value = netrate;
	document.getElementById('Stockbalance_'+i).value = mrprate;
	document.getElementById("issueqty_"+i).value=rate;
	//}	
	}	
	document.getElementById("lightbox1").style.display='none';
	//var data= addRow('dataTable')
	
}

</script>
<style type="text/css">
.body_lightbox1 {
width:100%;
background-color:#e7e7e7;
position:absolute;
left:280px;
top:95px;
padding-left:5px;
padding-right:5px;
border:#666666 solid 3px;
}
</style>