<link rel="stylesheet" href="css/new_mxerp.css">
<?php ob_start();?>
<script>
var xmlHttp
function changestorename(str)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	var url="Store_Name.php";
	url=url+"?store_code="+str;
	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;
}
  
  
function openPopupProfile(i)
{
  	window.open("Search_item_MRN.php?rowcount="+i,"profiles_popup_window","height=425,width=640,toolbar=no,menubar=no,dependent=yes,resizable =no");
}
 $(function() {
$(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' ,changeMonth: true,
		changeYear: true,
		yearRange: '-80:+20'});
});
function Completetotal(id)
{
 	var  Item_Amount = document.getElementById('total_Item_Amount').value;
 	var  Charge_Amount = document.getElementById('Charge_Amount').value;
	var inclusive=document.getElementById('tax_suroct_value').value;
	var total_tax=document.getElementById('tax_chargeamount').value;
 	var Grand_Total = parseFloat(Item_Amount) + parseFloat(Charge_Amount)+parseFloat(total_tax)+parseFloat(inclusive);
  	document.getElementById('grandtotal').value =Grand_Total;
}

function calculate_short(id)
{
	var x = document.getElementById('reciveqty_'+id).value;
	var poqty = document.getElementById('poqty_'+id).value;
	var reject = document.getElementById('rejectqty_'+id).value;
	var rate = document.getElementById('itemrate_'+id).value;
	//var tot = document.getElementById('totalrate_'+id).value;
	//alert("total rate is : "+tot);

	if(x != '')
	{
		if(poqty >= x)
		{
			//alert(rate);
			if(reject >0){
				document.getElementById('rejectqty_'+id).disabled =false;
			}
			else{
				document.getElementById('short_accessid_'+id).value = parseInt(poqty)- parseInt(x);
				document.getElementById('rejectqty_'+id).disabled =true;
				document.getElementById('totalrate_'+id).value = parseInt(rate) * parseInt(x);
				//alert(document.getElementById('totalrate_'+id).value);
			}

		}
		else
		{
			alert("Received Quantity can not be greater than PO Quantity");
			return false;
		}
		return true;
	}
	else
	{
		document.getElementById('short_accessid_'+id).value = '0';
	}
}


//--------------  ADD Sub charges----------------------------------
function cal_surcharges(id)
{
	 
	   document.getElementById("hidden_percent_inclusivecharge").value=id;
}
 
function cal_surcharges1()
{
  
   var surcharge=document.getElementById("percent_inclusivecharge").value;
   var per=document.getElementById('percent_inclusive').value;
   var amount=document.getElementById('tax_chargeamount').value;
  var total=document.getElementById('total_Item_Amount').value;
  var   total_tax=document.getElementById('tax_chargeamount').value;
   	if(surcharge=="SUR"){  
		totals=(parseInt(per)*parseFloat(amount))/100;
 		var	 final=totals;
 	 }
	else if(surcharge=="OCT"){
 	   	totals=parseFloat(total)+parseFloat(total_tax);
	 	var 	final=(parseFloat(totals)*  parseFloat(per))/100;
		 }	
 
		document.getElementById('tax_suroct_value').value=final;
	  
}

 


function update_amount(id)
{
document.getElementById("item_total_rate_"+id).value= (document.getElementById("reciveqty_"+id).value) * (document.getElementById("itemprice_"+id).value);
 }
 function update_basic()
{
var  itemamount = 0;
   var table = document.getElementById("totalrow").value;
   for(i=1; i<=table; i++)
	{
 		var totalrate = document.getElementById('itemprice_'+i).value;
 			itemamount  =parseInt(itemamount)+  parseInt(totalrate);
			 
			document.getElementById('total_Item_Amount').value = itemamount;
 	}
	
}
 
function showitem_details(str)
{
if (str=="")
  {
  document.getElementById("txt_item_details").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("txt_item_details").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getitem_details.php?addmrn="+str,true);
xmlhttp.send();
}



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 get_mrn_details(str)
{
if(str=="")
  {
  document.getElementById("orderid").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("orderid").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","mrn_order_details.php?mrnno="+str,true);
xmlhttp.send();
}


function showmrn(str)
{
//alert(str);
var site= document.getElementById('site').value;
var store= document.getElementById('store').value;
//alert(site);
//alert(store);

if (str=="")
  {
  document.getElementById("getmrn").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("getmrn").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_mrn.php?vendor="+str+"&site="+site+"&store="+store,true);
xmlhttp.send();
}
function validate()
{
	var site=document.getElementById("site").value;
	var store=document.getElementById("store").value;
	var vendor=document.getElementById("vendor").value;
	var mrn_no=document.getElementById("mrn_no").value;
	var bill=document.getElementById("bill").value;
	var bill_date=document.getElementById("bill_date").value;
	var purchase_orderno=document.getElementById("purchase_orderno").value;
	var cash_credit=document.getElementById("cash_credit").value;
	var credit_days=document.getElementById("credit_days").value;
	if(site=='000')
	{
		alert("Please Select Site");
		document.getElementById("site").focus();
		return false;
	}
	if(store=='000')
	{
		alert("Please Select Store");
		document.getElementById("store").focus();
		return false;
	}
	if(vendor=='000')
	{
		alert("Please Select Vendor");
		document.getElementById("vendor").focus();
		return false;
	}
	if(mrn_no=='000')
	{
		alert("Please Select MRN Number");
		document.getElementById("mrn_no").focus();
		return false;
	}
	if(bill=='')
	{
		alert("Please Enter Bill Number");
		document.getElementById("bill").focus();
		return false;
	}
	if(bill_date=='')
	{
		alert("Please Enter Bill Date");
		document.getElementById("bill_date").focus();
		return false;
	}
	if(purchase_orderno=='')
	{
		alert("Please Enter Order Number");
		document.getElementById("purchase_orderno").focus();
		return false;
	}
	if(cash_credit=='000')
	{
		alert("Please Select Cash/Credit");
		document.getElementById("cash_credit").focus();
		return false;
	}
	if(credit_days=='')
	{
		alert("Please Enter Credit Days");
		document.getElementById("credit_days").focus();
		return false;
	}
	
}
function check()
{
	if(document.getElementById("ledger").value == '000')
	{
		alert("Please Select Ledger");
		document.getElementById("ledger").focus();
		return false;
	}
	if(document.getElementById("remarks").value == '')
	{
		alert("Please Enter Remarks");
		document.getElementById("remarks").focus();
		return false;
	}
}
</script>
<?php 
$PageSecurity = 4;
$PageName = 'Purchase Bill Book';
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
if (isset($_GET['ModifyOrderNumber']) and $_SESSION[UserType]=='SuperAdmin')  {
	$title = _('Modify Purchase BillBook') . ' ' . $_GET['ModifyOrderNumber'];
} else {
}
if(isset($_GET['issueid'])  && isset($_GET['issueid']) !='')
{

	$title = _('Update Issue Slip');
}
else
{
	$title = _('Purchase BillBook');
}
?>
<?php 
if($_REQUEST['Save']) 
{
for($i=0; $i<count($_REQUEST['mrn_charges']); $i++)
{
	$mrnqty[]=$_REQUEST['mrn_charges'][$i];
}	
if(isset($mrnqty))
{
	$mrnqty_ids=implode(',',$mrnqty);
}
for($cr=0; $cr<count($_REQUEST['item_id']); $cr++)
{
	$item_row[]=$_REQUEST['item_id'][$cr];
}
if(isset($item_row))
{
	$item=implode(',',$item_row);
}

for($str=1;$str<$_REQUEST['count_tax'];$str++)
	{
		$caption_val[$str] = $_REQUEST['caption_value'][$str];
		$percent[$str] = $_REQUEST['rate'][$str];
	}	
	
$insert_sql="INSERT INTO purchase_billbook set
			  id='',  
			  site='".$_REQUEST['site']."',    
			  store='".$_REQUEST['store']."',   
			  bill='".$_REQUEST['bill']."',    
			  vendor='".$_REQUEST['vendor']."',  
			  bill_date='".FormatDateForSQL($_REQUEST['bill_date'])."',  
			  mrn_no='".$_REQUEST['mrn_id']."',  
			  orderno='".$_REQUEST['purchase_orderno']."',  
			  cash_credit='".$_REQUEST['cash_credit']."',  
			  credit_days='".$_REQUEST['credit_days']."',  
			  charge_details='".$mrnqty_ids."',  
			  mrnqty_ids='".$item."',  
			  ledger_list='".$_REQUEST['ledger']."',  
			  remarks='".$_REQUEST['remarks']."',  
			  basic_amount='".$_REQUEST['basic_amount']."', 
			  Excise_Duty_perc ='".$percent[1]."',
			  Excise_Duty='".$caption_val[1]."',
			  Edu_Cess_perc ='".$percent[2]."', 
			  Edu_Cess='".$caption_val[2]."',
			  SHE_Cess_perc='".$percent[3]."',  
			  SHE_Cess='".$caption_val[3]."',  
			  taxable_amt='".$_REQUEST['taxable_amt']."',  
			  taxname='".$_REQUEST['taxname']."', 
			  taxrate ='".$_REQUEST['taxrate']."', 
			  total_tax='".$_REQUEST['total_tax']."',  
			  sur_oct='".$_REQUEST['sur_oct']."',  
			  sur_oct_perc='".$_REQUEST['sur_oct_perc']."',  
			  sur_oct_value='".$_REQUEST['sur_oct_value']."',  
			  total_charges='".$_REQUEST['total_charges']."',  
			  grand_total='".$_REQUEST['grand_total']."',
			  bill_status ='Pending', 
			  pending_amount='0.00',  
			  created_date='".FormatDateForSQL(date('d/m/Y'))."',  
			  created_by='".$_SESSION['UserID']."' ,
			  CompanyId='".$_SESSION['ACGCompanyId']."' ";
			 
//echo "<pre>";
//print_r($insert_sql); 
//exit;
$insert_res=DB_query($insert_sql,$db);
$update_mrn="Update addmrn set mrnstatus='closed' where id='".$_REQUEST['mrn_id']."'";
$update_res=DB_query($update_mrn,$db);
echo "<script>location.href='index.php?route=PurchBillBook_list&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
prnMsg( _('Record Inserted Successfully!'),'success');

}
?>



<div class="body_contain">
<div class="tab_div">

<h1>Miscellaneous Purchase Bill</h1>
<form action="" method="post">

<table width="100%" cellpadding="0"  cellspacing="0">
<tr class="row1">
<td class="tabledata1">Branch</td>
<td> 
<?php 
$sql = "select loccode, locationname from locations where CompanyId='".$_SESSION['ACGCompanyId']."' and loccode='".$_SESSION['AssignedBranch']."'";
$result=DB_query($sql, $db);
?>
<select name="site" id="site"  class="select_purch" style="width:98%;">
<option value ="000">---Select Site---</option>
<?php
while($myrow=DB_fetch_array($result))
{ 
$p='';
if($myrow['loccode']==$_REQUEST['site'])
$p="selected";

?>
<option value="<?php echo $myrow['loccode']; ?>" <?php echo $p; ?>> <?php echo $myrow['locationname']; ?> </option>
<?php } ?>
</select></td>
<td class="tabledata1">
 lnvoice No </td>
<td><div id="orderid"><input name="bill" type="text" value="<?php echo $_REQUEST['bill'];?>" size="15" id="bill" readonly="true"  style="width:98%;"/>
</div></td>

</tr>
<tr class="row1">
<td class="tabledata1">Document Type</td>
<td>
<?php
$sql = "select distinct StoreCode, StoreName from storetype";
$result=DB_query($sql, $db);
?>
<select name="store" id="store" class="select_purch" style="width:98%;">
<option value="000">---Select Store---</option>
<?php
while($myrow=DB_fetch_array($result))
{
$p='';
if($myrow['StoreCode']==$_REQUEST['store'])
$p="selected";
?>
<option value="<?php echo $myrow['StoreCode']; ?>" <?php echo $p; ?>><?php echo $myrow['StoreName']; ?> </option>
<?php } ?>
</select></td>

<td class="tabledata1">P. Voucher No.</td>
<td><input name="bill4" type="text" value="<?php echo $_REQUEST['bill'];?>" size="15" id="bill4" readonly="true"  style="width:98%;"/></td>
<!-- <input type="text" name="textfield210" />-->

</tr>


<tr class="row1">
<td class="tabledata1">Party Name. </td>
<td><select name="cash_credit2" class="select_purch" style="width:98%;" id="cash_credit2">
  <option value="000">---Select Cash/Credit---</option>
  <option value="Cash">Cash</option>
  <option value="Credit" selected="selected">Credit</option>
</select></td>
<td class="tabledata1">Invoice Date</td>
<td><input name="bill2" type="text" value="<?php echo $_REQUEST['bill'];?>" size="15" id="bill2" readonly="true" style="width:98%;"/></td>

</tr>


<tr class="row1">
<td class="tabledata1">Passing Date</td>
<td><div id="getmrn">
  <input name="bill3" type="text" value="<?php echo $_REQUEST['bill'];?>" size="15" id="bill3" readonly="true" style="width:98%;"/>
</div></td> 
<td class="tabledata1">Transporter</td>
<td><select name="cash_credit3" class="select_purch" id="cash_credit" style="width:98%;">
  <option value="000">---Select Cash/Credit---</option>
  <option value="Cash">Cash</option>
  <option value="Credit" selected="selected">Credit</option>
</select></td>
</tr>
<tr class="row1">
  <td class="tabledata1">Tariff No.</td>
  <td><input name="credit_days3" type="text" value="<?php  echo $_REQUEST['credit_days'];?>" size="15" id="credit_days" style="width:98%;"/></td>
  <td class="tabledata1">Truck No.</td>
  <td><input name="credit_days2" type="text" value="<?php  echo $_REQUEST['credit_days'];?>" size="15" id="credit_days2" style="width:98%;"/></td>
</tr>
<tr class="row1">
  <td class="tabledata1">Against Form</td>
  <td><select name="cash_credit4" class="select_purch" style="width:98%;" id="cash_credit3">
    <option value="000">---Select Cash/Credit---</option>
    <option value="Cash">Cash</option>
    <option value="Credit" selected="selected">Credit</option>
  </select></td>
  <td class="tabledata1">Form No.</td>
  <td><input name="credit_days4" type="text" value="<?php  echo $_REQUEST['credit_days'];?>" size="15" id="credit_days3" style="width:98%;"/></td>
</tr>
<tr class="row1">
  <td class="tabledata1">Gate No.</td>
  <td><input name="credit_days5" type="text" value="<?php  echo $_REQUEST['credit_days'];?>" size="15" id="credit_days4" style="width:98%;"/></td>
  <td class="tabledata1">Ref. No.</td>
  <td><input name="credit_days6" type="text" value="<?php  echo $_REQUEST['credit_days'];?>" size="15" id="credit_days5" style="width:98%;"/></td>
</tr>
</table>
<p align="left" style="padding-left:10px;"><input name="Search" type="submit" value="Proceed" onclick="return validate()"/></p>
</form>
<br />
<form name="form1"  action="" method="post">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
  	<tr>
    	<td><input type="button" name="" value="Add Items" /></td>
    </tr>
    <tr>
  	  <td><table width="100%" border="1" cellspacing="0" cellpadding="3">
  	    <tr>
  	      <td class="tabledata">Part Code</td>
  	      <td class="tabledata">Item Name</td>
  	      <td class="tabledata">Unit</td>
  	      <td class="tabledata">Bill Qty</td>
  	      <td class="tabledata">Act. Rcv. Qty</td>
  	      <td class="tabledata">Short Qty</td>
  	      <td class="tabledata">Reject Qty</td>
  	      <td class="tabledata">Rate</td>
  	      <td class="tabledata">Disc%</td>
  	      <td class="tabledata">Amount</td>
  	      <td class="tabledata">Store Location</td>
  	    </tr>
  	    <?php 
	if($_REQUEST['View']!='')
	{
		$filter=array();
		
		$fromDate=$_REQUEST['fromDate'];
		$fromDateBrk=explode("/",$fromDate);
		$fromDate=$fromDateBrk[0];
		$fromMonth=$fromDateBrk[1];
		$fromYear=$fromDateBrk[2];
		$From=$fromYear."-".$fromMonth."-".$fromDate;
		
		$toDate=$_REQUEST['toDate'];
		$toDateBrk=explode("/",$toDate);
		$toDate=$toDateBrk[0];
		$toMonth=$toDateBrk[1];
		$toYear=$toDateBrk[2];
		$To=$toYear."-".$toMonth."-".$toDate;
		
		if($_REQUEST['site']!='0')
		$filter[]="A.sitecode='".$_REQUEST['site']."'";
		if($_REQUEST['vendor']!='0')
		$filter[]="A.supplierno='".$_REQUEST['vendor']."'";
		if($_REQUEST['itemCode']!='0')
		$filter[]="B.itemcode ='".$_REQUEST['itemCode']."'";
		if($_REQUEST['itemName']!='0')
		$filter[]="B.itemdescription='".$_REQUEST['itemName']."'";
		if($_REQUEST['fromDate']!='' && $_REQUEST['toDate']!='')
		$filter[]="A.orddate between '".$From."' and '".$To."'";
		
		if($filter!='')
		{
			if($_REQUEST['site']!='0'){$filter2=implode(" and ",$filter)." group by B.orderno";}
			else
			$filter2=implode(" and ",$filter);
		}
		
		if($_REQUEST['site']!='0')
		{
			$sql="Select A.*, B.*, sum(quatity) from purchorders A, purchorderdetails B where B.orderno=A.orderno and $filter2";
		}
		else{
		$sql="Select A.*, B.* from purchorders A, purchorderdetails B where B.orderno=A.orderno and $filter2"; }
		//echo $sql;
		
		
		$result=DB_query($sql,$db);
		$i=1;
		if(DB_num_rows($result)>0)
		{
			while($myrow=DB_fetch_array($result))
			{
		?>
  	    <tr bgcolor="#FFFFFF">
  	      <td><?php echo $i;?></td>
  	      <td><?php 
	$sitename=$s->getField('locations','loccode',$myrow['sitecode'],'locationname');
	echo $sitename;?></td>
  	      <td><?php echo ConvertSQLDate($myrow['orddate']);?></td>
  	      <td><?php 
	  $vendorname=$s->getField('suppliers','vendor_code',$myrow['supplierno'],'vendor_name');
	  echo $vendorname;?></td>
  	      <td><?php echo $myrow['PO_Orderno']; //echo "===".$myrow['orderno'];?></td>
  	      <td><?php echo $myrow['vendor_quotation_no']; ?></td>
  	      <td>&nbsp;</td>
  	      <td><?php if($_REQUEST['site']!='0'){echo $myrow['sum(quatity)'];}
	if($_REQUEST['itemCode']!='0' || $_REQUEST['itemName']!='0'){echo $myrow['quatity'];}
	?></td>
  	      <td><?php if($_REQUEST['site']!='0'){echo $myrow['sum(quatity)'];}
	if($_REQUEST['itemCode']!='0' || $_REQUEST['itemName']!='0'){echo $myrow['quatity'];}
	?></td>
  	      <td>&nbsp;</td>
  	      <td><?php if($_REQUEST['site']!='0'){echo $myrow['sum(quatity)'];}
	if($_REQUEST['itemCode']!='0' || $_REQUEST['itemName']!='0'){echo $myrow['quatity'];}
	?></td>
	      </tr>
  	    <?php $i++;}
  		}
		else
		{?>
  	    <tr>
  	      <td colspan="12"><font color="#FF0000">No Record Found</font></td>
	      </tr>
  	    <?php 	
		}
  }
	?>
    </table></td></tr>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  	<td colspan="2">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" width="50%">
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
     <tr>
            <td colspan="2">
                <table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
        <tr>
            <td class="tabledata1" style="text-align:center;" colspan="2">Account Posting Ledger/Excise Effect</td>
        </tr>
        <tr>
          <td class="tabledata" width="40%" scope="row">Accounting Ledger</td>
          <td>
          <select name="pack_forward" id="menu1" style="width:98%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select></td>
          </tr>
          <tr>
        <td class="tabledata" width="40%" scope="row">Excise Effect</td>
        <td><select name="freight" id="menu2" style="width: 98%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select></td>
        </tr>
    </table>
            </td>
        </tr>
	<tr>
    <td valign="top">
    <table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
        
        <tr>
            <td class="tabledata1" style="text-align:center;" colspan="2">Terms And Conditions</td>
        </tr>
        <tr>
          <td class="tabledata" width="40%" scope="row">Pkg &amp; Forwarding</td>
          <td>
          <select name="pack_forward" id="menu1" style="width: 48%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select><input type="text" name="PFRemarks" id="remarks1" value="" size="23%" />
          </td>
          </tr>
          <tr>
        <td class="tabledata" width="40%" scope="row">Freight</td>
        <td><select name="freight" id="menu2" style="width: 48%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select><input type="text" name="freightRemarks" id="remarks2" value="" size="23%" /></td>
        </tr>
      <tr>
        <td class="tabledata" scope="row">Payment Terms</td>
        <td><select name="payTerms" style="width: 48%">
            <?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>
        </tr>
        <tr>
        <td class="tabledata" scope="row">Sales Tax</td>
        <td><select name="salesTax" id="menu3" style="width: 48%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select><input type="text" name="salesRemarks" id="remarks3" value="" size="23%" /></td>
      </tr>
      <tr>
        <td class="tabledata">Excise</td>
        <td><select name="Excise" id="" style="width: 48%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
          </select><input type="text" name="exciseRemarks" id="" value="" size="23%" /></td>
        </tr>
        <tr>
          <td class="tabledata" nowrap="nowrap">Insurance</td>
          <td><select name="insurance" id="menu4" style="width: 48%" onchange="checkApplicable(this.value)">
            <option value="AS">As per calculation</option>
            <option value="NA">N/A</option>
            </select><input type="text" name="insRemarks" id="remarks4" value="" size="23%" /></td>
        </tr>
        <tr>
          <td class="tabledata">Remarks</td>
          <td><textarea name="textarea" cols="" rows="" style="width:100%; height:40px;"></textarea></td>
        </tr>
    </table>	
    </td>
    </tr>
  </table>
  </td>
  
<td valign="top" rowspan="2">
<table width="90%" border="1" cellspacing="0" cellpadding="3" align="right">
    		<tr>
    	<td class="tabledata1" style="text-align:center;" colspan="2">Amount And Taxes</td>
    </tr>
    <tr>
    	  <tr>
    	    <td class="tabledata">Basic Amount</td>
    	    <td><input name="basicAmount" type="text" value="<?php echo $_REQUEST['basicAmount'];?>" size="25" style="width:98%;" onfocus="calculateBasic()" id="basicAmount" readonly /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata" nowrap="nowrap">Discounted Price</td>
    	    <td><input name="totalDiscountedPrice" id="totalDiscountedPrice" type="text" value="" size="25" style="width:98%;" readonly onfocus="calculateDiscounted()" /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata">Excise Duty</td>
    	    <td nowrap="nowrap"><select name="exciseDuty" style="width:40%;">
    	      <option value="">Select</option>
    	     
  	      </select>
    	      <input name="exciseValue" type="text" value="" size="25" style="width:56%;" /></td>
    	      </tr>
    	      <tr>
    	    <td class="tabledata">E Cess</td>
    	    <td><input name="ECessValue" type="text" value="" size="25" style="width:40%;" /><input name="ECessValue" type="text" value="" size="25" style="width:57%;" /></td>
    	    </tr>
    	    <tr>
            <td class="tabledata" nowrap="nowrap">SAH-E Cess </td>
    	    <td><input name="SAHCessValue" type="text" value="" size="25" style="width:40%;" /><input name="ECessValue" type="text" value="" size="25" style="width:57%;" /></td>
  	    </tr>
    	  <tr>
    	    <td class="tabledata">VAT/CST</td>
    	    <td nowrap="nowrap"><select name="VatCst" id="value3" style="width:40%;">
    	      <option value="">Select</option>
  	      </select>
    	      <input name="VatCstValue" id="" type="text" value="" size="25" style="width:56%;" readonly /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata">Freight</td>
    	    <td><input name="freightValue" id="value2" type="text" value="" size="25" style="width:98%;" /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata">Pkg Charges</td>
    	    <td><input name="packagingCharges" id="value1" type="text" value="" size="25" style="width:98%;" /></td>
    	    
  	    </tr>
  	    <tr>
    	    <td class="tabledata">Additional Charges</td>
    	    <td><input name="additionalCharges" id="value4" type="text" value="" size="25" style="width:98%;" /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata">Round Off</td>
    	    <td><input name="roundOff" type="text" value="" size="25" style="width:98%;" /></td>
    	    
  	    </tr>
    	  <tr>
    	    <td class="tabledata">Net Bill Total</td>
    	    <td><input name="grandTotal" type="text" value="" size="25" style="width:98%;" /></td>
    	    
  	    </tr>
  	    </table>
</td>
</tr></table>
<p align="left" style="padding-left:10px;"><input type="submit" name="Save" value="Save" onclick="return check()"/></p>
</form>

</div></div>




<?php 
 //include('includes/footer.inc');
?>
