	<link rel="stylesheet" href="css/new_mxerp.css">
	<link rel="stylesheet" href="/css/jquery.ui.all.css">
	<script src="js1/jquery-1.7.2.js"></script>
	<script src="js1/jquery.ui.widget.js"></script>
	<script src="js1/jquery.ui.tabs.js"></script>

<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
	</script>


<?php 

if($_REQUEST['Save']!='' && $_REQUEST['SID']=='' )
{
   $insert1="Insert into salesorder set 
					branch='".$_REQUEST['site']."',    
					orderNo='".$_REQUEST['orderNo']."', 
					quotation_subject='".$_REQUEST['quotation_subject']."', 
					DeliveryDate='".FormatDateForSQL($_REQUEST['DeliveryDate'])."', 
					orderDate='".FormatDateForSQL($_REQUEST['orderDate'])."',  
					client='".$_REQUEST['client']."', 
					quoteNo='".$_REQUEST['QID']."', 
					PORefNo='".$_REQUEST['PORefNo']."',
					quotationType='".$_REQUEST['quotationType']."',
					 orderReceived='".$_REQUEST['orderReceived']."',  
 					orderType='".$_REQUEST['orderType']."',
					Sale_Key_Exec='".$_REQUEST['Sale_Key_Exec']."',
					validTill  ='".FormatDateForSQL($_REQUEST['validTill'])."',
					PPC  ='".$_REQUEST['PPC']."',					
					basicAmount='".$_REQUEST['basicAmount']."',  
					totalDiscountedPrice='".$_REQUEST['totalDiscountedPrice']."',  
					exciseDuty='".$_REQUEST['exciseDuty']."', 
		 
					exciseValue='".$_REQUEST['exciseValue']."',  
					ECessValue='".$_REQUEST['ECessValue']."',  
					SAHCessValue='".$_REQUEST['SAHCessValue']."',  
					taxableAmount='".$_REQUEST['taxableAmount']."',
					VatCst='".$_REQUEST['VatCst']."',  
					VatCstValue='".$_REQUEST['VatCstValue']."',  
					freightValue='".$_REQUEST['freightValue']."',  
					packagingCharges='".$_REQUEST['packagingCharges']."',  
					additionalCharges='".$_REQUEST['additionalCharges']."',  
					roundOff='".$_REQUEST['roundOff']."',  
					grandTotal='".$_REQUEST['grandTotal']."',  
					createdBy='".$_SESSION['UserID']."',  
					description='".$_REQUEST['description']."',
					freightStatus='".$_REQUEST['freightStatus']."',
					paymentAgainst='".$_REQUEST['paymentAgainst']."',  
					dispatchTo  ='".$_REQUEST['dispatchTo']."', 
					CompanyId='".$_SESSION['ACGCompanyId']."', 
 					createdDate='".date('Y-m-d')."' ";
	$result1=DB_query($insert1,$db);
	
 	  $masterId=DB_Last_Insert_ID($db,'salesorder','id');
	 
	if($masterId!='')
	{
		for($cnt=0;$cnt<$_REQUEST['hiditemcount'];$cnt++)
		{	
		  if($_REQUEST['item_code'][$cnt]!=''){
 		 $insert2="Insert into salesorder_details set
						masterId='".$masterId."',  
						itemCode='".$_REQUEST['item_code'][$cnt]."',  
						unit='".$_REQUEST['Unit'][$cnt]."',  
						Quantity='".$_REQUEST['stock_qty'][$cnt]."',   
						Rate='".$_REQUEST['stock_price'][$cnt]."',
						pricePer ='".$_REQUEST['stock_perunit'][$cnt]."', 
						Amount='".$_REQUEST['stock_value'][$cnt]."',  
						DiscountType='".$_REQUEST['discountType'][$cnt]."',  
						Discount='".$_REQUEST['total_stock'][$cnt]."',  
						valAfterDisc='".$_REQUEST['valueAfterDisc'][$cnt]."',  
						reqDate='".date('Y-m-d')."'  ";
			$result2=DB_query($insert2,$db);
			}
		}
	}
	
	
		  $add_sql="Insert into salesorder_address set
						mst_salesorder_id ='".$masterId."',  
						address1='".$_REQUEST['address1']."',  
						city='".$_REQUEST['city']."',  
						zipcode='".$_REQUEST['zipcode']."',   
						country='".$_REQUEST['country']."',
						Shipping_address ='".$_REQUEST['Shipping_address']."', 
						Shipping_city='".$_REQUEST['Shipping_city']."',  
						Shipping_zipcode='".$_REQUEST['Shipping_zipcode']."',  
						Shipping_country='".$_REQUEST['Shipping_country']."'";
						
						
					$result_address=DB_query($add_sql,$db);	
	
					 $insert2="update  quotation set 
					ConvertIntoSales='Y',
				    SalesOrderNo='".$masterId."'  
					where id='".$_REQUEST['QID']."' ";
					$result_quotation=DB_query($insert2,$db);

		
		prnMsg(_('Inserted Successfully'),'Success');			
					
echo "<script>location.href='index.php?route=CRM/ViewSalesOrder&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."&action=view&Id=".$masterId."'</script>";
}


 
if($_REQUEST['Save']!='' && $_REQUEST['action']=='Edit' &&  $_REQUEST['SID']!='')
{
	
	    $update_sales="update  salesorder set 
					branch='".$_REQUEST['site']."',    
					orderNo='".$_REQUEST['orderNo']."',  
					PORefNo='".$_REQUEST['PORefNo']."',
					DeliveryDate='".FormatDateForSQL($_REQUEST['DeliveryDate'])."',  
					quotation_subject='".$_REQUEST['quotation_subject']."', 
					quotationType='".$_REQUEST['quotationType']."',
					orderDate='".FormatDateForSQL($_REQUEST['orderDate'])."',  
					client='".$_REQUEST['client']."', 
					quoteNo='".$_REQUEST['QID']."', 
					 orderReceived='".$_REQUEST['orderReceived']."',  
 					orderType='".$_REQUEST['orderType']."',
					Sale_Key_Exec='".$_REQUEST['Sale_Key_Exec']."',
					validTill  ='".FormatDateForSQL($_REQUEST['validTill'])."',
					PPC  ='".$_REQUEST['PPC']."',					
					basicAmount='".$_REQUEST['basicAmount']."',  
					totalDiscountedPrice='".$_REQUEST['totalDiscountedPrice']."',  
					exciseDuty='".$_REQUEST['exciseDuty']."', 
		 
					exciseValue='".$_REQUEST['exciseValue']."',  
					ECessValue='".$_REQUEST['ECessValue']."',  
					SAHCessValue='".$_REQUEST['SAHCessValue']."',  
					taxableAmount='".$_REQUEST['taxableAmount']."',
					VatCst='".$_REQUEST['VatCst']."',  
					VatCstValue='".$_REQUEST['VatCstValue']."',  
					freightValue='".$_REQUEST['freightValue']."',  
					packagingCharges='".$_REQUEST['packagingCharges']."',  
					additionalCharges='".$_REQUEST['additionalCharges']."',  
					roundOff='".$_REQUEST['roundOff']."',  
					grandTotal='".$_REQUEST['grandTotal']."',  
					createdBy='".$_SESSION['UserID']."',  
					description='".$_REQUEST['description']."',
					freightStatus='".$_REQUEST['freightStatus']."',
					paymentAgainst='".$_REQUEST['paymentAgainst']."',  
					dispatchTo  ='".$_REQUEST['dispatchTo']."',  
					CompanyId='".$_SESSION['ACGCompanyId']."', 
 					createdDate='".date('Y-m-d')."' where id='".$_REQUEST['SID']."' ";
					$result_address=DB_query($update_sales,$db);
					
				
				
		
					for($cnt=0;$cnt<count($_REQUEST['item_code']);$cnt++)
		          {
		          
		                   $update_details="update salesorder_details set
						
						 
						unit='".$_REQUEST['Unit'][$cnt]."',  
						Quantity='".$_REQUEST['stock_qty'][$cnt]."',   
						Rate='".$_REQUEST['stock_price'][$cnt]."',
						pricePer ='".$_REQUEST['stock_perunit'][$cnt]."', 
						Amount='".$_REQUEST['stock_value'][$cnt]."',  
						DiscountType='".$_REQUEST['discountType'][$cnt]."',  
						Discount='".$_REQUEST['total_stock'][$cnt]."',  
						valAfterDisc='".$_REQUEST['valueAfterDisc'][$cnt]."',  
						reqDate='".date('Y-m-d')."' where ItemCode='".$_REQUEST['item_code'][$cnt]."'";
			             $result2=DB_query($update_details,$db);
			}
			
				
 					
 					
   $add_sql="update  salesorder_address set
						 
						address1='".$_REQUEST['address1']."',  
						city='".$_REQUEST['city']."',  
						zipcode='".$_REQUEST['zipcode']."',   
						country='".$_REQUEST['country']."',
						Shipping_address ='".$_REQUEST['Shipping_address']."', 
						Shipping_city='".$_REQUEST['Shipping_city']."',  
						Shipping_zipcode='".$_REQUEST['Shipping_zipcode']."',  
						Shipping_country='".$_REQUEST['Shipping_country']."' where mst_salesorder_id='".$_REQUEST['SID']."'";
						
					$result_address=DB_query($add_sql,$db);	
				
						//$s->pageLocation("index.php?route=CRM/ViewSalesOrder".$rurl);	
	
 }
?>
<script language="JavaScript" type="text/javascript">
	function enquiryDetails(str)
	{
		var branch=document.getElementById("site").value;
		
		if (str.length==0)
  		{
  			document.getElementById("enquiryId").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("enquiryId").innerHTML=xmlhttp.responseText;
    		}
  		}
		xmlhttp.open("GET","showEnquiryDetails.php?party="+str+"&branch="+branch,true);
		xmlhttp.send();
	}
	function showEnqDetails(str)
	{
		if (str.length==0)
  		{
  			document.getElementById("enqdetailsId").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("enqdetailsId").innerHTML=xmlhttp.responseText;
    		}
  		}
		xmlhttp.open("GET","showEnquiryDetails.php?enquiryNo="+str,true);
		xmlhttp.send();
	}
function calculateDiscount(str,a)
{
	var discType=document.getElementById("discountType_"+a).value;
	var value=document.getElementById("totalValue_"+a).value;
	if(str==''){str=0;}
	if(discType=='A') 
	{
		var discount=str;
	}
	else
	if(discType=='P') 
	{
		var discount=value*(str/100);	
	}
	document.getElementById("valueAfterDisc_"+a).value=(parseFloat(value)-parseFloat(discount)).toFixed(2);
}
function calculateBasic()
{
	var totalBasic=0;
	var cnt=document.getElementById("hiditemcount").value;
 	var totalBasic=document.getElementById("itemcount_totalamt").value;
 	document.getElementById("basicAmount").value=totalBasic;
	  document.getElementById("totalDiscountedPrice").value =document.getElementById("itemcount_AfterDisc").value;
}
 
function claculateExcise(str)
{
	var discounted=document.getElementById("totalDiscountedPrice").value;
	if (str.length==0)
  		{
  			document.getElementById("exciseId").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("exciseId").innerHTML=xmlhttp.responseText;
    		}
  		}
		xmlhttp.open("GET","calculateExcise.php?taxId="+str+"&discounted="+discounted,true);
		xmlhttp.send();
}
function calculateVATCST(str)
{
	var taxableAmount=document.getElementById("taxableAmount").value;
	if (str.length==0)
  		{
  			document.getElementById("VATId").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("VATId").innerHTML=xmlhttp.responseText;
    		}
  		}
		xmlhttp.open("GET","calculateExcise.php?salesId="+str+"&taxable="+taxableAmount,true);
		xmlhttp.send();
}
function calculateECess()
{
	var exciseValue=document.getElementById("exciseValue").value;
	var ECessPercentage=document.getElementById("ECessPercentage").value;
	var total=exciseValue*(ECessPercentage/100);
	document.getElementById("ECessValue").value=total.toFixed(2);
}
function calculateSAHCess()
{
	var exciseValue=document.getElementById("exciseValue").value;
	var SAHCessPercentage=document.getElementById("SAHCessPercentage").value;
	var total=exciseValue*(SAHCessPercentage/100);
	document.getElementById("SAHCessValue").value=total.toFixed(2);
}
function calculateTaxable()
{
	var totalDiscountedPrice=document.getElementById("totalDiscountedPrice").value;
	var exciseValue=document.getElementById("exciseValue").value;
	var ECessValue=document.getElementById("ECessValue").value;
	var SAHCessValue=document.getElementById("SAHCessValue").value;
	
	if(totalDiscountedPrice==''){totalDiscountedPrice=0;}
	if(exciseValue==''){exciseValue=0;}
	if(ECessValue==''){ECessValue=0;}
	if(SAHCessValue==''){SAHCessValue=0;}
	
	var TOTAL=parseFloat(totalDiscountedPrice)+parseFloat(exciseValue)+parseFloat(ECessValue)+parseFloat(SAHCessValue);
	document.getElementById("taxableAmount").value=TOTAL.toFixed(2);
}
function calculateGrand()
{
	var a=document.getElementById("totalDiscountedPrice").value;
	var b=document.getElementById("taxableAmount").value;
	var c=document.getElementById("VatCstValue").value;
	var d=document.getElementById("value2").value;
	var e=document.getElementById("value1").value;
	var f=document.getElementById("value4").value;
	
	
	if(b==''){b=0;}
	if(c==''){c=0;}
	if(d==''){d=0;}
	if(e==''){e=0;}
	if(f==''){f=0;}
	
	var GRAND=parseFloat(b)+parseFloat(c)+parseFloat(d)+parseFloat(e)+parseFloat(f);
	document.getElementById("grandTotal").value=GRAND.toFixed(2);
	
}
function getCode(str)
{
	if (str.length==0)
  {
  document.getElementById("CODE").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("CODE").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","codeGenerator.php?quotesite="+str,true);
xmlhttp.send();
}

function datavalidation()
{
if(document.frm1.site.value=='000')
{
alert("Must Select Branch Name");
document.frm1.site.focus();
return false;	
}
if(document.frm1.quotationNo.value=='')
{
alert("Must Enter Quotation Number");
document.frm1.quotationNo.focus();
return false;	
}		
if(document.frm1.quotationDate.value=='')
{
alert("Must Select Quotation Date");
document.frm1.quotationDate.focus();
return false;	
}	
if(document.frm1.party.value=='000')
{
alert("Must Select Party Name");
document.frm1.party.focus();
return false;	
}	
if(document.frm1.quotationType.value=='')
{
alert("Must Select Qutotaion Type");
document.frm1.quotationType.focus();
return false;	
}				
if(document.frm1.enquiryNo.value=='000')
{
alert("Must Enter Enquiry No");
document.frm1.enquiryNo.focus();
return false;	
}	

return false;	
	
}
</script>
<?php 
if($_REQUEST['QID']!='' &&  $_REQUEST['SID']=='')
{ 
	 $sql1=DB_query("Select * from quotation where id='".$_REQUEST['QID']."'",$db);
	$result1=DB_fetch_array($sql1);
	$site= $result1['site']; 
				$quotationNo=$result1['quotationNo'];  
				$quotationDate=ConvertSqlDate($result1['quotationDate']);  
					$party=$result1['party'];   
					$quotationType=$result1['quotationType'];
					$quotation_subject=$result1['quotation_subject'];
					
					$quotation_funnel  =$result1['quotation_funnel'];
				    $PPC  =$result1['PPC'];
				 	$orderReceived   =$result1['orderReceived'];
  					$PORefNo=$result1['PORefNo'];  
					
 					$partyContact=$result1['partyContact'];  
			        $validTill=ConvertSqlDate($result1['validTill']);  
					$pack_forward=$result1['pack_forward'];  
					$freight=$result1['freight']; 
					$payTerms=$result1['payTerms'];  
					$salesTax=$result1['salesTax'];  
					$Excise=$result1['Excise'];  
					$insurance=$result1['insurance'];  
					$basicAmount=$result1['basicAmount'];  
					$totalDiscountedPrice=$result1['totalDiscountedPrice'];  
					$exciseDuty=$result1['exciseDuty'];  
					$exciseValue=$result1['exciseValue'];  
					$ECessValue=$result1['ECessValue'];  
					$SAHCessValue=$result1['SAHCessValue'];  
					$taxableAmount=$result1['taxableAmount'];
					$VatCst=$result1['VatCst'];  
					$VatCstValue=$result1['VatCstValue'];  
					$freightValue=$result1['freightValue'];  
					$packagingCharges=$result1['packagingCharges'];  
					$additionalCharges=$result1['additionalCharges'];  
					$roundOff=$result1['roundOff'];  
				  	$grandTotal=$result1['grandTotal'];  
					$createdBy=$_SESSION['UserID'];  
}
if(  $_REQUEST['SID']!='' && $_REQUEST['QID']!='' )
{
	
	 $sql1=DB_query("Select * from salesorder where id='".$_REQUEST['SID']."'",$db);
	$result1=DB_fetch_array($sql1);
	$site= $result1['branch']; 
					$quotationNo=$result1['quoteNo'];  
					$orderDate=ConvertSqlDate($result1['orderDate']);  
					$party=$result1['client'];  
				 	$orderReceived =$result1['orderReceived'];
				    $quotationType=$result1['quotationType'];
					$quotation_subject=$result1['quotation_subject'];
					$DeliveryDate=$result1['DeliveryDate'];
					$quotation_funnel  =$result1['quotation_funnel'];
					$quotation_stage  =$result1['quotation_stage'];
				 	$enquiryNo =$result1['enquiryNo'];
  					$PORefNo=$result1['PORefNo'];  
 					$partyContact=$result1['partyContact'];  
			        $validTill=ConvertSqlDate($result1['validTill']); 
				    $orderType= $result1['orderType'];
					$Sale_Key_Exec=$result1['Sale_Key_Exec'];
				 
					$pack_forward=$result1['pack_forward'];  
					$freight=$result1['freight']; 
					$payTerms=$result1['payTerms'];  
					$salesTax=$result1['salesTax'];  
					$Excise=$result1['Excise'];  
					$insurance=$result1['insurance'];  
					$basicAmount=$result1['basicAmount'];  
					$totalDiscountedPrice=$result1['totalDiscountedPrice'];  
					$exciseDuty=$result1['exciseDuty'];  
					$exciseValue=$result1['exciseValue'];  
					$ECessValue=$result1['ECessValue'];  
					$SAHCessValue=$result1['SAHCessValue'];  
					$taxableAmount=$result1['taxableAmount'];
					$VatCst=$result1['VatCst'];  
					$VatCstValue=$result1['VatCstValue'];  
					$freightValue=$result1['freightValue'];  
					$packagingCharges=$result1['packagingCharges'];  
					$additionalCharges=$result1['additionalCharges'];  
					$roundOff=$result1['roundOff'];  
				  	$grandTotal=$result1['grandTotal'];  
					$createdBy=$_SESSION['UserID'];  
					
					$freightStatus=$result1['freightStatus'];
					$paymentAgainst=$result1['paymentAgainst'];
					$dispatchTo  =$result1['dispatchTo'];
					$description  =$result1['description'];

}
?>


<div class="body_contain">
<h1>Sales Order</h1>

<div class="insideclass">


	<?php  
if($_REQUEST['action']=='Edit'){
	?>
	 <a href="CRM/tcpdf/PDFSalesOrder.php?record=<?php echo $_REQUEST['QID'].'&Sid='.$_REQUEST['SID'].$rurl;?>">
	 <input type="button" name=" Export to PDF" value=" Export to PDF" style=" background-image:
	 url(images/PDF.gif)background-color:#d1d4be; color:#006699; font-weight:800; padding-top:3px; padding-bottom:3px; " />
</a><?php } ?>


<div style="z-index:-1000em;">
	<div class="demo">

<div id="tabs">
	<ul>
		<li><a href="#tabs-1">Order Detials</a></li>
		<li><a href="#tabs-2">More Information</a></li>


	</ul>
	<div id="tabs-1">
		<div class="tab_div">
			<form action="" method="post"  name="frm1">
				<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
	<?php if(count($msgErr)>0){?>
   <tr>
   <td colspan="4"><?php
   for($i=0;$i<count($msgErr);$i++)
   {
     echo "<div class='error'>".$msgErr[$i].'</div>';
   }
    ?></td>
   </tr>
   <?php } ?>
	<tr><td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr class="row1">
    <td class="tabledata1">Branch</td>
    <td>
    <select name="site"   id="site" onchange="getCode(this.value)" style="width:107px;">
    <option value="000">Select</option>
    <?php 
    $site_sql=DB_query("Select loccode, locationname from locations where CompanyId='".$_SESSION['ACGCompanyId']."' and loccode in('".$_SESSION['AssignedBranch']."')",$db);
    while($site_row=DB_fetch_array($site_sql))
	{?>
		<option value="<?php echo $site_row['loccode']?>"<?php echo($site==$site_row['loccode']?'selected':'')?>><?php echo $site_row['locationname']?></option>
	<?php 	
	}
    ?>
    </select></td>
    <td class="tabledata1">Sales Order No.</td>
    <td id="CODE">
	<?php 
  	$prefix=	$s->GetFieldValue('locations',"loccode='".$site."'" ,'prefix');
 	$quote_sql="Select id from salesorder where branch='".$site."' order by id DESC limit 1";
	$quote_result=DB_query($quote_sql,$db);	
	if(DB_num_rows($quote_result)>0)
	{
		$quote_row=DB_fetch_array($quote_result);
		$en1=substr($quote_row['id'],0,6);
		$en2=substr($quote_row['id'],-4);
		$next=$en2+1;
		$finalString=$prefix.'/SO-'.str_pad($next,4,"0",STR_PAD_LEFT);
	}
	else
	{
		$finalString=$prefix."/SO-0001";
	}
	?>
	
	<input name="orderNo" type="text" value="<?php if(isset($_REQUEST['orderNo'])) { echo $_REQUEST['orderNo']; } else {echo $finalString;}?>" style="width:107px;"/></td>
  </tr>
  <tr class="row1">
    <td class="tabledata1">Sales Order Date </td>
    <td nowrap="nowrap"><input type="text" name="orderDate" value="<?php if(isset($orderDate)){echo $orderDate;}?>" style="width:107px;" class="datepicker" /></td>
    <td class="tabledata1">Format</td>
    <td nowrap="nowrap"><select name="format" style="width:107px;">
      <option value="Standard">Standard</option>
    </select></td>
  </tr>
  <tr class="row1">
    <td class="tabledata1">Account Name</td>
    <td nowrap="nowrap">
	 <?php 
	// echo "Select AccountsID,vender_client,AccountName,ledgertype from accountledger where AccountsID='".$party."' and ledgertype in('leads','client')";
      $client_sql=DB_query("Select AccountsID,vender_client,AccountName,ledgertype from accountledger where AccountsID='".$party."' and ledgertype in('leads','client')",$db);
	  while($client_row=DB_fetch_array($client_sql))
	  {
	  //echo $client_row['ledgertype'];
	  if($client_row['ledgertype']=='client')
		{
	   $clientid=$client_row['vender_client'];
		}
		else
		{
		$clientid=$client_row['AccountName'];
		}
	  
	  ?>
		<input name="party" type="hidden" value="<?php echo $clientid;?>" style="width:auto" />
			<input  type="text" value="<?php echo $s->GetFieldValue('clientmaster'," id='".$clientid."'" ,'c_name');?>"  style="width:107px;" />
		
		<input name="client" type="hidden" value="<?php echo $clientid;?>"  style="width:auto" />
	<?php }	?>	      </td>
    <td class="tabledata1">Type of Quotation</td>
    <td><select name="quotationType" style="width:107px;">
      <option value="M"<?php echo($quotationType=='M'?'selected':'')?>>Material</option>
      <option value="E"<?php echo($quotationType=='E'?'selected':'')?>>Export</option>
      <option value="R"<?php echo($quotationType=='R'?'selected':'')?>>Retail</option>
    </select></td>
    </tr>
  <tr class="row1">
    <td class="tabledata1">Against   Quotation </td>
    <td><div id='hid_Leads'>
	<?php 
	if(isset($_REQUEST['QID']))
		$enquery_quoteNo =$s->GetFieldValue('quotation',"id='".$_REQUEST['QID']."'",'quotationNo');
 	?>
	
	
	<input type="text" name="quoteNo" style="width:107px;" value="<?php  echo $enquery_quoteNo;?>" /></div></td>
    <td class="tabledata1">Customer PO Ref. No.</td>
    <td nowrap="nowrap"><input type="text" name="PORefNo" id="PORefNo" style="width:107px;" value="<?php echo $PORefNo;?>" /></td>
  </tr>
  
  
  <tr class="row1">
    <td class="tabledata1">Subject</td>
    <td nowrap="nowrap"><input name="quotation_subject" type="text"  value="<?php echo $quotation_subject; ?>" style="width:107px;"/></td>
    <td class="tabledata1">Delivery Date</td>
	<td><input name="DeliveryDate" type="text"  value="<?php echo $DeliveryDate; ?>" style="width:107px;" class="datepicker"/></td>
					  </tr>

  <tr class="row1">
    <td class="tabledata1">Order Received </td>
    <td nowrap="nowrap"><select name="orderReceived" id="orderReceived" style="width:107px;">
      <option value="000">---Select---</option>
      <option value="MO" <?php echo($orderReceived=='MO'?'selected':'')?>>Material Order</option>
      <option value="EO" <?php echo($orderReceived=='EO'?'selected':'')?>>Export Order</option>
      <option value="RO" <?php echo($orderReceived=='RO'?'selected':'')?>>Retail Order</option>
      <option value="SO" <?php echo($orderReceived=='SO'?'selected':'')?>>Service Order</option>
      <option value="CO" <?php echo($orderReceived=='CO'?'selected':'')?>>CT3 Order</option>
    </select></td>
    <td class="tabledata1">Valid Till</td>
    <td><input name="validTill" type="text" value="<?php if(isset($validTill)){echo $validTill;} else {echo date('d/m/Y');}?>" size="12" class="datepicker"  style="width:107px;"/></td>
  </tr>
  <tr class="row1">
    <td class="tabledata1">Mobile No.</td>
    <td nowrap="nowrap"><input type="text" name="partyContact2"
    style="width:107px;" value="<?php if(isset($partyContact)){echo $partyContact;} else { echo $_REQUEST['partyContact'];}?>" /></td>
    <td class="tabledata1">Order Type</td>
    <td><select name="orderType" id="orderType" style="width:107px;">
                      <option value="000">---Select---</option>
                      <option value="P" <?php echo($orderType=='P'?'selected':'')?>>Process Order</option>
                      <option value="O" <?php echo($orderType=='O'?'selected':'')?>>Open Order</option>
                      <option value="PS" <?php echo($orderType=='PS'?'selected':'')?>>Process Order Schedule</option>
                      <option value="OS" <?php echo($orderType=='OS'?'selected':'')?>>Open Order Schedule</option>
          </select></td>
  </tr>
<!--<tr class="row1">
    <td nowrap="nowrap">Salesman</td>
    <td nowrap="nowrap"><select name="salesMan" id="salesMan" style="width:107px;">
                      <option value="000">---Select---</option>
                      <?php 
                    $sales_sql=DB_query("select id,sales_name from salesman_master",$db);
                    while($sales_row=DB_fetch_array($sales_sql)){
                    ?>
                      <option value="<?php echo $sales_row['id'];?>"<?php echo ($salesMan==$sales_row['id']?'selected':'')?>><?php echo $sales_row['sales_name'];?></option>
                      <?php } ?>
                      </select>&nbsp;</td>
    <td scope="row">Send to PPC</td>
    <td><select name="PPC" onchange="showEnqDetails(this.value)" style="width:107px;">
                  <option value="Yes"<?php echo($_REQUEST['PPC']=='Yes'?'selected':'')?>>Yes</option>
                   <option value="No"<?php echo($_REQUEST['PPC']=='No'?'selected':'')?>>No</option>
                   </select>&nbsp;</td>
  </tr>-->
  <tr class="row1">
    <td class="tabledata1">Sales Key Executive</td>
                    <td colspan="3">
						<?php 
						$Dept=DB_query("SELECT id FROM deptmaster WHERE deptcode='MKT' OR deptcode='sal'",$db);
	while($DeptRow=DB_fetch_array($Dept))
	{
		$DCode[]=$DeptRow['id'];
	}
	 $Dept_id=implode(',',$DCode);
							$Sale_key_Exe=DB_query("select * from www_users where companyid='".$_SESSION['ACGCompanyId']."' and department in($Dept_id)",$db);
							
						?>
						<select name="Sale_Key_Exec" id="Sale_Key_Exec" style="width:107px;">
						<option value="0">Select</option>
						<?php while($Sale_keyRow=DB_fetch_array($Sale_key_Exe))
						{
						 ?>
						 <option value="<?php echo $Sale_keyRow['id'] ?>"<?php echo ($Sale_Key_Exec==$Sale_keyRow['id']?'selected':'')?>><?php echo $Sale_keyRow['userid']; ?></option>
						 <?php } ?>
						</select>
					</td>
  </tr>
</table>
</td></tr>
<tr><td valign="top">
	<div id='hid_LeadsRecord'>

  <h3>Account  Billing  &  shipping  Address  Information</h3>

 	<!--- table 2 -->
<?php 
 if($_REQUEST['SID']=='')
 {
 	

     $getlead=DB_query( "select * from crm_accounts where mst_leadid='".$enquiryNo."'  ",$db);
	 while($row_lead=DB_fetch_array($getlead))
	 {
		$leadcode=$row_lead['leadcode'];
		$company_name=$row_lead['company_name'];
		$address1=$row_lead['address1'];
		$groupid=$row_lead['groupid'];
		$city=$row_lead['city'];
		$zipcode=$row_lead['zipcode'];
		$country=$row_lead['country'];
		$Shipping_address=$row_lead['Shipping_address'];
		$Shipping_zipcode=$row_lead['Shipping_zipcode'];
		$Shipping_city=$row_lead['Shipping_city'];
		$Shipping_country=$row_lead['Shipping_country'];

  	 }
 }
 else {
 		
     $getlead=DB_query( "select * from salesorder_address where mst_salesorder_id ='".$_REQUEST['SID']."'  ",$db);
	 while($row_lead=DB_fetch_array($getlead))
	 {
		
		$address1=$row_lead['address1'];
		
		$city=$row_lead['city'];
		$zipcode=$row_lead['zipcode'];
		$country=$row_lead['country'];
		$Shipping_address=$row_lead['Shipping_address'];
		$Shipping_zipcode=$row_lead['Shipping_zipcode'];
		$Shipping_city=$row_lead['Shipping_city'];
		$Shipping_country=$row_lead['Shipping_country'];

  	 }
     
 }
?>
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr class="row1">
    <td class="tabledata1">Billing Address</td>
    <td>
    <input type="text" name="address1" style="width:107px;"   value="<?php  echo $address1;?>"/></td>
    <td class="tabledata1">Shipping Address</td>
    <td id="CODE"><input type="text" name="Shipping_address" style="width:107px;"   value="<?php  echo $Shipping_address;?>"/></td>
  </tr>
  <tr class="row1">
    <td class="tabledata1">Billing city</td>
    <td nowrap="nowrap"><input name="city" type="text"  style="width:107px;" value="<?php  echo $city?>"/></td>
    <td class="tabledata1">Shipping City</td>
    <td nowrap="nowrap"><input name="Shipping_city" type="text"  style="width:107px;" value="<?php  echo $Shipping_city?>"/></td>
  </tr>
	
<tr class="row1">
    <td class="tabledata1">Billing Postal Code</td>
    <td nowrap="nowrap">
    <input type="text" name="zipcode" style="width:107px;"  value="<?php  echo $zipcode?>" /></td>
    <td class="tabledata1">Shipping Postal Code</td>
    <td><input type="text" name="Shipping_zipcode" style="width:107px;"  value="<?php  echo $Shipping_zipcode?>" /></td>
    </tr>
	
	<tr class="row1">
    <td class="tabledata1">Billing Country</td>
    <td nowrap="nowrap"><input name="country" type="text"  style="width:107px;" value="<?php  echo $country?>"/></td>
    <td class="tabledata1">Shipping Country</td>
    <td><input name="Shipping_country" type="text"  style="width:107px;" value="<?php  echo $Shipping_country?>"/></td>
    </tr>
</table>

 <h3>Item Details</h3>
 <div style="width:807px; overflow:auto;">
 <?php 
 if(isset($_REQUEST['QID']) &&  $_REQUEST['SID']==''){?>
 <table align="center" width="100%">
<tr class="row1">
<td class="tabledata">Item Code</td>
<td class="tabledata">Item Name</td>
<td class="tabledata">Unit</td>
<td class="tabledata">Qty</td>
<td class="tabledata">Price</td>
<td class="tabledata">Per Unit(s)</td>
<td class="tabledata">Value</td>
<td class="tabledata">Discount Type</td>
<td class="tabledata">Discount</td>
<td class="tabledata">Total</td>
</tr>
	<?php $total=0; $i=0;$after_discount=0;
	//echo "select * from quotation_details where parentId='".$_REQUEST['QID']."' ";
	$getitem=DB_query("select * from quotation_details where parentId='".$_REQUEST['QID']."' ",$db); 
    while($row=DB_fetch_array($getitem))
 	{
  	 $itemquery=DB_query("select * from item_master where id='".$row['itemCode']."'" , $db);
	 $item_row=DB_fetch_array($itemquery);
 	
		if($i%2==0)
		{$bg="#CCCCCC";}
		else
		$bg="#C8BECB";
 	?>
	<tr bgcolor="<?php //echo $bg;?>" class="row1">
     <td class="tabledata"><?php echo $row['itemCode'];?><input type="hidden" name="item_code[<?php echo $i;?>]" id="item_code_<?php echo $i;?>" value="<?php echo $row['itemCode'];?>">	</td>
   <td style="white-space:nowrap"><?php echo $item_row['item_name'];?><input type="hidden" name="item_name[<?php echo $i;?>]" id="item_name[<?php echo $i;?>]" value="<?php echo $item_row['item_name'];?>"/>	</td>
   <td><?php		$grade_query=DB_query("select * from unitsofmeasure where unitid='".$item_row['unit']."'", $db);
		while($grade_row=DB_fetch_array($grade_query))
		 {
		 echo $grade_row['unitname'];?>
		<?php } ?><input type="hidden" name="Unit[<?php echo $i;?>]" id="Unit[<?php echo $i;?>]" value="<?php $grade_row['id'];?>"/>			</td>
    <td><input type="text" name="stock_qty[<?php echo $i;?>]" id="stock_qty_<?php echo $i;?>" style="width:60px;"  value="<?php echo $row['quantity'];?>" readonly="true"/></td>
    <td><input type="text" name="stock_price[<?php echo $i;?>]" id="stock_price_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['price'];?>" readonly="true" /></td>
    <td><input type="text" name="stock_perunit[<?php echo $i;?>]" id="stock_perunit_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['PerUnits'];?>" readonly="true"/></td>
    <td><input type="text" name="stock_value[<?php echo $i;?>]" id="stock_value_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['totalValue'];?>" readonly="true"/></td>
 	 <td><select   name="discountType[<?php echo $i;?>]" id="discountType_<?php echo $i;?>"  style="width:107px;">
         <option value="A" <?php  echo ($row['discountType']=='A'?'selected':'')?>>Amount</option>
         <option value="P" <?php  echo ($row['discountType']=='P'?'selected':'')?>>Percent</option>
       </select></td>
 <td>
<?php  $total+=$row['total_stock'];
$after_discount+=$row['stock_value']-$row['total_stock'];
 ?>
<input type="text" name="total_stock[<?php echo $i;?>]" id="total_stock_<?php echo $i;?>" style="width:80px;" value="<?php echo $row['discount'];?>" /></td>
 
<td><input type="text" name="valueAfterDisc[<?php echo $i;?>]" id="valueAfterDisc_<?php echo $i;?>" value="<?php echo $row['valueAfterDisc']?>" size="15"/></td>
   
</tr>

   
  
  <?php
    $i++;
  }?>
</table>
 
<input type="hidden" name="itemcount_totalamt" id="itemcount_totalamt" value="<?php echo $total;?>" />
<input type="hidden" name="itemcount_AfterDisc" id="itemcount_AfterDisc" value="<?php echo $after_discount;?>" />

<input type="hidden" name="hiditemcount" id="hiditemcount" value="<?php echo $i;?>" />
 <?php }
 
 else if($_REQUEST['QID']!='' && $_REQUEST['SID']!=''){
 ?>
<h3>Item Details</h3>
 
 <table align="center" width="100%">
<tr class="row1">
<td>Item Code</td>
<td>Item Name</td>
<td>Unit</td>
<td>Qty</td>
<td>Price</td>
<td>Per Unit(s)</td>
<td>Value</td>
<td>Discount Type</td>
<td>Discount</td>
 <td>Total</td>
</tr>
	<?php $total=0;
	  $i=0;
	  $after_discount=0;

	$getitem=DB_query("select * from salesorder_details where masterId='".$_REQUEST['SID']."' ",$db); 
    while($row=DB_fetch_array($getitem))
 	{
 		
		
     $itemquery=DB_query("select * from item_master where id='".$row['ItemCode']."'" , $db);
 	$item_row=DB_fetch_array($itemquery);
	
		if($i%2==0)
		{$bg="#CCCCCC";}
		else
		$bg="#C8BECB";
	
 	?>
	<tr bgcolor="<?php echo $bg;?>">
     <td>
     	<input type="hidden" name="item_code[]" value="<?php echo $row['ItemCode'];?>">
     	<?php echo $row['ItemCode'];?><input type="hidden" name="item_code[<?php echo $i;?>]" id="item_code_<?php echo $i;?>" value="<?php echo $row['ItemCode'];?>"></td>
   <td><?php echo $item_row['item_name'];?><input type="hidden" name="item_name[<?php echo $i;?>]" id="item_name[<?php echo $i;?>]" value="<?php echo $item_row['item_name'];?>"/>	</td>
   <td><?php		$grade_query=DB_query("select * from unitsofmeasure where unitid='".$item_row['unit']."'", $db);
		while($grade_row=DB_fetch_array($grade_query))
		 {
		 echo $grade_row['unitname'];?>
		<?php } ?><input type="hidden" name="Unit[<?php echo $i;?>]" id="Unit[<?php echo $i;?>]" value="<?php $grade_row['id'];?>"/></td>
    <td><input type="text" name="stock_qty[<?php echo $i;?>]" id="stock_qty_<?php echo $i;?>" style="width:60px;"  value="<?php echo $row['Quantity'];?>" readonly="true"/></td>
    <td><input type="text" name="stock_price[<?php echo $i;?>]" id="stock_price_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['Rate'];?>" readonly="true" /></td>
    <td><input type="text" name="stock_perunit[<?php echo $i;?>]" id="stock_perunit_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['pricePer'];?>" readonly="true"/></td>
    <td><input type="text" name="stock_value[<?php echo $i;?>]" id="stock_value_<?php echo $i;?>" style="width:60px;" value="<?php echo $row['Amount'];?>" readonly="true"/></td>
 	 <td><select   name="discountType[<?php echo $i;?>]" id="discountType_<?php echo $i;?>"  style="width:107px;">
         <option value="A" <?php  echo ($row['DiscountType']=='A'?'selected':'')?>>Amount</option>
         <option value="P" <?php  echo ($row['DiscountType']=='P'?'selected':'')?>>Percent</option>
       </select></td>
 <td>
<?php  $total+=$row['Amount'];
$after_discount+=$row['Amount']-$row['Discount'];
 ?>
<input type="text" name="total_stock[<?php echo $i;?>]" id="total_stock_<?php echo $i;?>" style="width:80px;" value="<?php echo $row['Discount'];?>" /></td>
 
<td><input type="text" name="valueAfterDisc[<?php echo $i;?>]" id="valueAfterDisc_<?php echo $i;?>" value="<?php echo $row['valAfterDisc']?>" size="15"/></td>
   
</tr>

   
  
  <?php 
    $i++;
  }?>
</table>
 
<input type="hidden" name="itemcount_totalamt" id="itemcount_totalamt" value="<?php echo $total;?>" />
<input type="hidden" name="itemcount_AfterDisc" id="itemcount_AfterDisc" value="<?php echo $after_discount;?>" />

<input type="hidden" name="hiditemcount" id="hiditemcount" value="<?php echo $i;?>" />
 <?php 
 }
 else{ ?>
 

  <h3>Item Details</h3>

<table align="center" width="100%">
<tr class="row1">
<td class="tabledata">Item Code</td>
<td class="tabledata">Item Name</td>
<td class="tabledata">Unit</td>
<td class="tabledata">Qty</td>
<td class="tabledata">Price</td>
<td class="tabledata">Per Unit(s)</td>
<td class="tabledata">Value</td>
<td class="tabledata">Discount Type</td>
<td class="tabledata">Discount</td>
<td class="tabledata">Discounted Price</td>
<td class="tabledata">Date Of Requisition</td>
</tr>
 
 </table>

 <?php }?>
  </div>
</div>
</td></tr>
</table>

<div style="width:807px; margin-top:-2px; margin-left:1px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #ccc;">
    		<tr class="row1">
			<td colspan="2" style="text-align:center;"><strong>Terms And Conditions</strong></td>
    	<td style="text-align:center;" colspan="2"><strong>Amount And Taxes</strong></td>
    </tr>
    <tr class="row1">
    <td class="tabledata1">Freight</td>
    <td nowrap="nowrap">
	<select name="freightStatus" id="freightStatus" style="width:107px;">
      	<option value="AS">As per calculation</option>
      	<option value="NA">N/A</option>
      </select></td>
    <td class="tabledata1">Basic Amount</td>
    <td><input name="basicAmount" type="text" value="<?php echo $basicAmount;?>" style="width:107px;" onFocus="calculateBasic()" id="basicAmount"   /></td>
    	    
  	    </tr>
    	  <tr class="row1">
    <td class="tabledata1">Payment Terms</td>
    <td><select name="paymentAgainst" style="width:107px;">
      	<?php 
      	$payment_sql=DB_query("Select * from paymentterms",$db);
		while($payment_row=DB_fetch_array($payment_sql))
		{?>
			<option value="<?php echo $payment_row['termsindicator'];?>"><?php echo $payment_row['terms'];?></option>
		<?php 	
		}
      	?>
      </select></td>
    <td class="tabledata1">Discounted Price</td>
    	    <td><input name="totalDiscountedPrice" id="totalDiscountedPrice" type="text" value="<?php echo $totalDiscountedPrice;?>" style="width:107px;"   />
		<!--	onblur ="calculateDiscounted()" -->
			
			</td>
    	    
  	    </tr>
    	  <tr class="row1">
    <td class="tabledata1">DispatchTo</td>
    <td nowrap="nowrap"><input name="dispatchTo" type="text" value="<?php echo $dispatchTo?>" style="width:107px;" /> </td>
    <td class="tabledata1">Excise</td>
    	    <td nowrap="nowrap"> 
    	    <select name="exciseDuty" onChange="claculateExcise(this.value)" style="width:107px;">
    	    <option value="0">Select</option>
    	    <?php 
    	    $excise_sql=DB_query("Select * from excise_tax where caption like '%excise%' and form_type='Sales'",$db);
			while($excise_row=DB_fetch_array($excise_sql))
			{?>
				<option value="<?php echo $excise_row['id'];?>" <?php echo ( $exciseDuty== $excise_row['id']?'selected':'')?>><?php echo $excise_row['caption'];?></option>
			<?php 	
			}
    	    ?> 
  	      </select><div id="exciseId"><input name="exciseValue" id="exciseValue" type="text" value="<?php echo $exciseValue;?>" style="width:107px;" /></div>
    	   </tr>
    	     
    	     <?php 
    	     $cessSql=DB_query("Select caption from excise_tax where caption like '%cess%'",$db);
			 $k=1;
			 while($cessRow=DB_fetch_array($cessSql))
			 {
			 	$caption[$k]=$cessRow['caption']; 
				
				$rate_sql=DB_query("Select def_rate from excise_tax where caption='".$caption[$k]."'",$db);
				while($rate_row=DB_fetch_array($rate_sql))
				{
					$rate[$k]=$rate_row['def_rate'];
				}
				$k++;
			 } 
    	     ?>
    	     <tr class="row1">
    <td class="tabledata1">Description</td>
      <td nowrap="nowrap"><textarea name="description" style="width:250px;"><?php  echo $description?></textarea></td>
       <td class="tabledata1">E-Cess</td>
    	    <td><input name="ECessPercentage" id="ECessPercentage" type="text" value="<?php echo $rate[1];?>" style="width:107px;" readonly />
    	    	<input name="ECessValue" id="ECessValue" type="text" value="<?php echo $ECessValue?>" style="width:107px;" readonly onFocus="calculateECess()"/></td>
    	    </tr>
    	    <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
    <td class="tabledata1">SAH-E Cess </td>
    	    <td><input name="SAHCessPercentage" id="SAHCessPercentage" type="text" value="<?php echo $rate[2];?>" style="width:107px;" readonly/>
    	    	<input name="SAHCessValue" id="SAHCessValue" type="text" value="<?php echo $SAHCessValue?>" style="width:107px;" readonly onFocus="calculateSAHCess()"/></td>
  	    	</tr>
    	  
    	  
   <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
    <td class="tabledata1">Taxable Amount</td>
   	<td><input name="taxableAmount" id="taxableAmount" type="text" value="<?php echo $taxableAmount?>" style="width:107px;" onFocus="calculateTaxable()"/></td>
   </tr>
    	  
    	  <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">VAT/CST</td>
    	    <td nowrap="nowrap">
    	    <select name="VatCst" id="value3" onChange="calculateVATCST(this.value)" style="width:107px;">
    	    <option value="">Select</option>
    	    <?php 
    	    $salesSql=DB_query("Select * from sales_tax_master",$db);
			while($salesRow=DB_fetch_array($salesSql))
			{?>
				<option value="<?php echo $salesRow['salestax_id'];?>" <?php echo $VatCst==$salesRow['salestax_id']?'selected':''?>><?php echo $salesRow['tax_code'];?></option>
			<?php 	
			}
    	    ?>
  	      </select>
    	      <div id="VATId"> <input name="VatCstValue" id="VatCstValue" type="text" value="<?php echo $VatCstValue?>" style="width:107px;" readonly /></div></td>
    	    
  	    </tr>
    	  <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">Freight</td>
    	    <td><input name="freightValue" id="value2" type="text" value="<?php echo $freightValue?>" style="width:107px;" /></td>
    	    
  	    </tr>
    	  <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">Pkg Charges</td>
    	    <td><input name="packagingCharges" id="value1" type="text" value="<?php echo $packagingCharges;?>" style="width:107px;" /></td>
    	    
  	    </tr>
  	    <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">Additional Charges</td>
    	    <td><input name="additionalCharges" id="value4" type="text" value="<?php  echo $additionalCharges;?>" style="width:107px;" /></td>
    	    
  	    </tr>
    	  <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">Round Off</td>
    	    <td><input name="roundOff" type="text" value="<?php echo $roundOff;?>" style="width:107px;" /></td>
    	    
  	    </tr>
    	  <tr class="row1">
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		    <td class="tabledata1">Grand Total</td>
    	    <td><input name="grandTotal" id="grandTotal" type="text"  style="width:107px;" onFocus="calculateGrand()" readonly="readonly" value="<?php echo $grandTotal  ;?>" /></td>
    	    
  	    </tr>
  	    </table>



<p align="center"><input type="submit" name="Save" value="Save" class="bottonsview"  /></p>
</div>
			
<div style="clear:both;"></div>	

			</form>
		</div>
	</div><!-- Tab 1 Close -->
	
	<div id="tabs-2">
			<div class="tab_div">

			<div style="width:auto;">
				<p style="margin:0px; padding:0px; text-align:left; font-weight:bold">Comment 1</p>
				<p style="margin:0px; padding:0px; text-align:left;"><textarea style="width:700px;" ></textarea></p>				
			<p style="margin:0px; padding:0px; text-align:left; color:#003366">User Name 1</p>
			
			</div>
			<br />
			<div style="width:auto;">
				<p style="margin:0px; padding:0px; text-align:left; font-weight:bold">Comment 2</p>
				<p style="margin:0px; padding:0px; text-align:left;"><textarea style="width:700px;" ></textarea></p>				
			<p style="margin:0px; padding:0px; text-align:left; color:#003366">User Name 2</p>
			
			</div>
			<br />
			<div style="width:auto;">
				<p style="margin:0px; padding:0px; text-align:left; font-weight:bold">Comment 3</p>
				<p style="margin:0px; padding:0px; text-align:left;"><textarea style="width:700px;" ></textarea></p>				
			<p style="margin:0px; padding:0px; text-align:left; color:#003366">User Name 3</p>
			
			</div>
			<br />
			<div style="width:auto;">
				<p style="margin:0px; padding:0px; text-align:left; font-weight:bold">Comment 4</p>
				<p style="margin:0px; padding:0px; text-align:left;"><textarea style="width:700px;" ></textarea></p>				
			<p style="margin:0px; padding:0px; text-align:left; color:#003366">User Name 4</p>
			
			</div>
			
			</div>


	<p style="text-align:right;"><input type="button" value="Save" name="save" /></p>

	</div><!-- Tab 2 Close -->



</div></div></div>


</div><!-- inside div close -->
</div><!-- Main div close -->
