<?php $PageSecurity = 11;
include('includes/session.inc');
//include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
$valno=$_REQUEST['valno'];
if($_REQUEST['valno']!='')
{
	$total=($valno*2)+3;
	$colsapn=$total;
}
else
{
	
}
?>

<table width="100%" border="1" cellpadding="3" cellspacing="0">
  <tr class="row1">
    <td class="tabledata"><strong>Srl.</strong></td>
    <td class="tabledata"><strong>Description</strong></td>
    <td class="tabledata"><strong>Basic Price</strong></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td class="tabledata"><strong>Qty</strong></td>
    <td class="tabledata"><strong><?php echo $i+1; ?></strong></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>Product Description</td>
    <td><input type="text" name="prod_desc" id="prod_desc" style="width:150px;" /></td>
    <td><!--<input type="text" name="basic_price" id="basic_price" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><!--<input type="text" name="qty" id="qty_<?php echo $i; ?>" style="width:60px;" />--></td>
    <td><select name="prod[]" id="prod_<?php echo $i; ?>" onchange="GetFinish(this.value,this.id)" style="width:90px;">
			<option value="">Select</option>
			<?php $ProdSQL=DB_query("select * from item_master where CompanyId='".$_SESSION['ACGCompanyId']."'",$db); 
			while($prod=DB_fetch_array($ProdSQL)){?>
			<option value="<?php echo $prod['id'] ?>"><?php echo $prod['item_name'] ?></option>
			<?php } ?>
		</select>	</td>
   <?php } ?>
   <input type="hidden" name="countcol" id="countcol" value="<?php echo $i; ?>" />
  </tr>
  <tr class="row1">
    <td>Wall Opening (H x W)</td>
    <td><input type="text" name="wallop" id="wallop" style="width:150px;" /></td>
    <td><!--<input type="text" name="wbasic" id="wbasic" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><input type="text" name="wqty[]" id="wqty_<?php echo $i; ?>" onkeyup="calqtytotal(this.value,this.id)" style="width:60px;" /></td>
    <td><select name="wprod[]" id="wprod_<?php echo $i; ?>" style="width:90px;" onchange="GetSizeval(this.value,this.id)">
			<option value="">Select</option>
			<?php $SizeSQL=DB_query("SELECT * FROM size_master where CompanyId='".$_SESSION['ACGCompanyId']."'",$db); 
			while($Size=DB_fetch_array($SizeSQL)){?>
			<option value="<?php echo $Size['id'] ?>"><?php echo $Size['size'] ?></option>
			<?php } ?>
		</select></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>Total Area</td>
    <td><input type="hidden" name="text_area" id="text_area" style="width:150px;" /></td>
    <td><input type="hidden" name="text_basicpric" id="text_basicpric" style="width:60px;" /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><input type="text" name="totalarea[]" readonly="" id="text_qty_<?php echo $i; ?>" style="width:60px;" /></td>
    <td id="areaid_<?php echo $i; ?>"><input type="text" readonly="" name="area[]" id="area_<?php echo $i; ?>" style="width:90px;"  /></td>
    <?php } ?>
  </tr>
  <tr class="row1">
    <td>Finish</td>
   <td><!--<input type="text" name="finish" id="finish" style="width:150px;" />--></td>
    <td><!--<input type="text" name="fbasic" id="fbasic" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><!--<input type="text" name="fqty" id="fqty_<?php echo $i; ?>" style="width:60px;" />--></td>
    <td id="finish_<?php echo $i; ?>"><input type="text" name="finish[]" readonly="" id="finishamt_<?php echo $i; ?>"  style="width:90px;" /></td>
   <?php } ?>
  </tr>
  <tr class="row1">
    <td>Door Type</td>
     <td><!--<input type="text" name="doortype" id="doortype" style="width:150px;"/>--></td>
    <td><!--<input type="text" name="dtbasic" id="dtbasic" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><!--<input type="text" name="dtqty" id="dtqty_<?php echo $i; ?>"  style="width:60px;"/>--></td>
    <td id="doortypeid_<?php echo $i; ?>"><input type="text" name="door[]" readonly="" id="dtAmt_<?php echo $i; ?>" style="width:90px;" /></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>Fire Rating</td>
     <td><!--<input type="text" name="firerating" id="firerating" style="width:150px;"/>--></td>
    <td><!--<input type="text" name="frbasic" id="frbasic" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><!--<input type="text" name="frqty" id="frqty_<?php echo $i; ?>"  style="width:60px;"/>--></td>
    <td id="frrting_<?php echo $i; ?>"><input type="text" name="firerating[]" readonly="" id="frAmt_<?php echo $i; ?>" style="width:90px;" /></td>
    <?php } ?>
  </tr>
  <tr class="row1">
    <td>Leaf Type</td>
    <td><!--<input type="text" name="leaftype" id="leaftype" style="width:150px;"/>--></td>
    <td><!--<input type="text" name="lfbasic" id="lfbasic" style="width:60px;" />--></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><!--<input type="text" name="lfqty" id="lfqty_<?php echo $i; ?>"  style="width:60px;"/>--></td>
    <td id="lting_<?php echo $i; ?>"><input type="text" name="leaftype[]" readonly id="lfAmt_<?php echo $i; ?>" style="width:90px;" /></td>
    <?php } ?>
  </tr>
  <tr class="row1">
    <td>Frame </td>
     <td><select name="frameprod" id="frame" style="width:150px;">
			<option value="">Select</option>
			<?php $frameSQli=DB_query("select * from item_master where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
			while($ItemFrame=DB_fetch_array($frameSQli)) {?>
			<option value="<?php echo $ItemFrame['id']; ?>"><?php echo $ItemFrame['item_name']; ?></option>
			<?php }?>
		</select></td>
    <td><input type="text" name="frm_basicprice" id="frm_basicprice" style="width:60px;" /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td id="frm_qty_<?php echo $i; ?>"><input type="text" name="frmqty[]" id="frmqty_<?php echo $i; ?>" style="width:60px;" /></td>
    <td><input type="text" name="frmAmt[]" readonly id="frmAmt_<?php echo $i; ?>" onfocus="calfinish(<?php echo $i; ?>)" style="width:90px;" /></td>
<?php } ?>
  </tr>
  <tr class="row1">
    <td>Shutter</td>
    <td><select name="shutterprod" id="shutter" style="width:150px;">
			<option value="">Select</option>
			<?php $sutterSQli=DB_query("select * from item_master where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
			while($ItemSutter=DB_fetch_array($sutterSQli)) {?>
			<option value="<?php echo $ItemSutter['id']; ?>"><?php echo $ItemSutter['item_name']; ?></option>
			<?php }?>
		</select></td>
    <td><input type="text" name="sutter_basicprice" id="sutter_basicprice" style="width:60px;" /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td id="sutterrid_<?php echo $i; ?>"><input type="text" name="shuttqty[]" id="shuttqty_<?php echo $i; ?>" style="width:60px;" /></td>
    <td><input type="text" name="shuttAmt[]" readonly id="shuttAmt_<?php echo $i; ?>" onfocus="calsutter(<?php echo $i; ?>)" style="width:90px;" /></td>
   <?php } ?>
  </tr>
  <tr class="row1">
    <td><strong>Total</strong></td>
   <td><input type="hidden" name="" /></td>
    <td><input type="hidden" name="" /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="Atotal[]" readonly id="sub_total_<?php echo $i ?>" style="width:90px;" onfocus="calsubtotal(<?php echo $i ?>)" /></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>Excise Duty</td>
    <td><select name="excise_duty" id="excise_duty" style="width:150px;" onchange="getexciseper(this.value)">
			<option value="">Select</option>
			<?php $EXCSQl=DB_query("SELECT * FROM excise_tax WHERE caption LIKE '%Excise%'",$db);
			while($Excise=DB_fetch_array($EXCSQl)) {?>
			<option value="<?php echo $Excise['id'] ?>"><?php echo $Excise['caption'] ?></option>
			<?php }?>
		</select></td>
    <td id="excisedif"><input type="hidden" name="" id="exciseper"  /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="excisevalue[]" readonly id="excisevalue_<?php echo $i; ?>" onfocus="calexciseval(<?php echo $i; ?>)" style="width:90px;"  /></td>
	<?php  }?>
  </tr>
  <?php $SHEcessSQl=DB_query("SELECT * FROM excise_tax WHERE caption LIKE '%Cess%'",$db);
  while($sheecess=DB_fetch_array($SHEcessSQl)){
  		$ecessval[]=$sheecess['def_rate'];}?>
  <tr class="row1">
    <td>E. Cess</td>
    <td><input type="text" name="Ecess" readonly id="Ecess" value="<?php echo $ecessval[0]; ?>" style="width:150px;" /></td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
	<td>&nbsp;</td>
    <td><input type="text" name="ecessval[]" onfocus="calecess(<?php echo $i; ?>)" readonly id="ecessval_<?php echo $i; ?>" style="width:90px;" /></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>SHE. Cess</td>
    <td><input type="text" name="SHEcess" id="SHEcess" value="<?php echo $ecessval[1]; ?>" style="width:150px;" /></td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
	<td>&nbsp;</td>
    <td><input type="text" name="SHEcessval[]" onfocus="Shecess(<?php echo $i; ?>)" readonly id="SHEcessval_<?php echo $i; ?>" style="width:90px;" /></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td>Sale Tax</td>
    <td><select name="saltax_ida" id="saltax_id" style="width:150px;" onchange="Getsaltaxper(this.value)">
			<option value="">Select</option>
			<?php $SaleSQL=DB_query("SELECT * FROM sales_tax_master",$db); 
			while($saltax=DB_fetch_array($SaleSQL)){?>
			<option value="<?php echo $saltax['salestax_id']; ?>"><?php echo $saltax['tax_code']; ?></option>
			<?php }?>
		</select></td>
    <td id="saltaxids"><input type="hidden" id="saltaxper" value=""  /></td>
   <?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
	<td>&nbsp;</td>
    <td><input type="text" name="saletaxval[]" readonly id="saletaxval_<?php echo $i; ?>" onfocus="calsaltaxval(<?php echo $i; ?>)" style="width:90px;" /></td>
	<?php } ?>
  </tr>
  <tr class="row1">
    <td><strong>A. Sub Total</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
     <?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
	 <td>&nbsp;</td>
    <td><input type="text" name="Asubtotal[]" readonly="" id="Asubtotal_<?php echo $i; ?>" onfocus="calAsubtotal(<?php echo $i; ?>)" style="width:90px;" /></td>
	 <?php }?>
  </tr>

  <tr class="row1">
    <td colspan="<?php echo $colsapn; ?>"><h3><strong>Hardware</strong></h3></td>
  </tr>
<?php $k=0;$ProdManuSQL=DB_query("SELECT * FROM product_manufacture where CompanyId='".$_SESSION['ACGCompanyId']."'",$db); 
while($prodManuf=DB_fetch_array($ProdManuSQL)){?>
  <tr class="row1">
    <td><?php echo $prodManuf['manufacturer']; ?><input type="hidden" name="manufac[]" id="manufac" value="<?php echo $prodManuf['id']; ?>" /></td>
    <td><?php $GetItemsSQL=DB_query("select * from item_master where make='".$prodManuf['id']."'",$db); ?>
	<select style="width:150px;" name="manufact[]" id="manufact">
      <option value="">--Select--</option>
	  <?php while($GetItemsFors=DB_fetch_array($GetItemsSQL)){?>
	  <option value="<?php echo $GetItemsFors['id']; ?>"><?php echo $GetItemsFors['item_name']; ?></option>
	  <?php }?>
    </select></td>
    <td><input type="text" name="hbbasic[]" id="hbbasic_<?php echo $k; ?>" style="width:60px;" /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td><input type="text" name="hbqty[]" id="hbqty_<?php echo $k; ?><?php echo $i; ?>" onkeyup="calhbtotal(<?php echo $k; ?>,<?php echo $i;?>)" style="width:60px;" /></td>
    <td><input type="text" name="hbAmt[]" readonly="" id="hbAmt_<?php echo $k; ?><?php echo $i; ?>" style="width:90px;" /></td>
	<?php }?>
  </tr>
  <?php $k++;}?>
  <input type="hidden" id="count" value="<?php echo $k; ?>" />
  <tr class="row1">
    <td><strong>Total</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="Btotal[]" readonly id="subtotal1_<?php echo $i; ?>" onfocus="calsubto12(<?php echo $i; ?>)" style="width:90px;" /></td>
   <?php }?>
  </tr>
  <tr class="row1">
    <td>Sale Tax</td>
    <td><select name="saltax_idb" id="saltax_idb" style="width:150px;" onchange="Getsaltaxper2(this.value)">
			<option value="">Select</option>
			<?php $SaleSQL=DB_query("SELECT * FROM sales_tax_master",$db); 
			while($saltax=DB_fetch_array($SaleSQL)){?>
			<option value="<?php echo $saltax['salestax_id']; ?>"><?php echo $saltax['tax_code']; ?></option>
			<?php }?>
		</select></td>
    <td id="saltaxidsb"><input type="hidden" id="saltaxBPre" value=""  /></td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="saltaxvalueb[]" readonly="" id="saltaxvalueb_<?php echo $i; ?>" onfocus="calsaltaxvalueb(<?php echo $i; ?>)" style="width:90px;" /></td>
   <?php }?>
  </tr>

  <tr class="row1">
    <td class="tabledata1"><strong>B. Sub Total</strong></td>
   <td>&nbsp;</td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="bsubtotal[]" id="bsubtotal_<?php echo $i; ?>" readonly="" onfocus="calbsubtotalamt(<?php echo $i; ?>)" style="width:90px;"  /></td>
   <?php }?>
  </tr>
  <tr class="row1">
    <td class="tabledata1"><strong>C. Total (A+B)</strong></td>
   <td>&nbsp;</td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="subtotal_A_B[]" readonly="" id="subtotal_A_B_<?php echo $i; ?>" style="width:90px;" onfocus="calsubtotalAandB(<?php echo $i; ?>)" /></td>
   <?php }?>
  </tr>
  <tr class="row1">
    <td class="tabledata1"><strong>D. Grand Total</strong></td>
   <td>&nbsp;</td>
    <td>&nbsp;</td>
	<?php for($i=0;$i<$_REQUEST['valno'];$i++) {?>
    <td>&nbsp;</td>
    <td><input type="text" name="grandtotal[]" id="grandtotal_<?php echo $i; ?>" style="width:90px;" onfocus="calgrandtotal(<?php echo $i; ?>)" /></td>
   <?php }?>
  </tr>
</table>
