Current File : /home/inlingua/public_html/faridabad/icentex/pg/ingl_material_main.form.php
<?php
//  Created on: 13-04-2013
// Include header
include "header_in.php";
?>
<link href="../style.css" rel="stylesheet" type="text/css" />
<aside class="contentbox-head"> <span class="title">METERIAL ISSUE</span>            
          </aside>

<?php
echo $succFailMesg; 
// Show result of a form submission?
if ($showResult == "Y")
{	echo "<br><a href='ingl_invoice_main.select.php'>Back</a><br>";
	// Include footer
	include "footer_in.php";
	return; 
	}
?>

<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/student.js"></script>
<script language="javascript">
<!--
function validate1() 
{

     if (document.getElementById('Course1').value==""
	|| document.getElementById('Course1').value==undefined)
	{
	alert ("Please Fill Reg No First");
	return false;
	}

	if (document.aForm.recNo.value=="")
	{	alert("recNo cannot be blank. Please enter it.");
		document.aForm.recNo.focus(); return false;
	}
	
	if (document.aForm.student_address.value=="")
	{	alert("Address cannot be blank. Please enter it.");
		document.aForm.student_address.focus(); return false;
	}
	
	
	if (document.aForm.student_name.value=="")
	{	alert("Name cannot be blank. Please enter it.");
		document.aForm.student_name.focus(); return false;
	}
	if (document.aForm.rcpt_payment_mode.value=="")
	{	alert("Mode of Payment cannot be blank. Please enter it.");
		document.aForm.rcpt_payment_mode.focus(); return false;
	}
	
	if (document.aForm.received_by.value=="")
	{	alert("Mode of Payment cannot be blank. Please enter it.");
		document.aForm.received_by.focus(); return false;
	}
	
	return true;
}
-->
</script>
<script type="text/javascript">

function GetDate()
{
       var date = new Date();
var d  = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var CurrentDate=day + "/" + month + "/" + year;

document.getElementById("CurrentDate").value = CurrentDate;
}

</script>
<script>

			

	function checkdup(ch)
	{
		//alert(ch.value);
		var inputs = document.getElementsByClassName('nodupli');
		for (var i = 0; i < inputs.length; ++i) {

		//alert(inputs[i].className);
		val=inputs[i].value;
		//id=inputs[i].id;

		if(ch.value==val && inputs[i]!=ch && val!="0")
		{
		alert("Please check it is duplicate entry");
		//ch.value="0";
		}
		//alert(val);
		
		}
	}
</script>
<script language="javascript">

function subtot(ratesid,quanid,subtot,tax_s_id,tax_id)
{
rates=1*(document.getElementById(''+ratesid+'').value);
quan=1*(document.getElementById(''+quanid+'').value);
disc=1*(document.getElementById(''+tax_id+'').value);
//alert(rates);
//alert(quan);
//alert(disc);

per=((disc)*(rates*quan))/100;
//alert (per);
document.getElementById(''+subtot+'').value=((rates*quan)-(per));
//document.getElementById(''+tax_id+'').value=1*(document.getElementById(''+tax_s_id+'').value)*quan;
//gtotal();
getTotal();
}

</script>

<script language="javascript">
$(function() {
		$('#datepicker3').datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
	$(function() {
		$('#datepicker4').datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
</script>
<tr>
<td><input type="radio" class="Serch" name="Search" id="Name" value="Name"  />Name</td>
<td><input type="radio" class="Serch" name="Search" id="ref_No" value="ref_No" />Ref. No</td>
<td><input type="radio" class="Serch" name="Search" id="mobile" value="mobile" checked="checked" />Mobile</td>
<td><input type="radio" class="Serch" name="Search" id="Email" value="Email" />Email</td>
</td>
<td>
<input list="SerchOption" placeholder="Search" onchange="invoice_customer(this.value)" ><datalist id="SerchOption" name="Browsers"></datalist>
</td></tr>





<form id='aForm' name="aForm" method='post' action='ingl_material_main.main.php' onsubmit="return validate1(this)">
<input type='hidden' name='recNo' class='required' value="<?php echo $dbObject->getDbField('recNo');?>">
<input type='hidden' name='kV' value="<?php echo $_REQUEST['kV'];?>">
<input type='hidden' name='type' value="M">
<input type='hidden' name='centre'  value="<?php echo $dbObject->getDbField('centre');?>">
<input type='hidden' name='Invoice'  value="<?php echo $dbObject->getDbField('invoice_no');?>">
<h5 id="Show_led"><a href="#">Show Customer Sort Ledger</a></h5>
<h5 id="Close_led"><a href="#">Close Customer Sort Ledger</a></h5>
	  <?php
      if($currentMode!="Add")
      {
      echo"<a class=\"Update\" rel=\"popuprel2\" href=\"#\" >Open Box</a>";
      }
      ?>



<div id="Ledger">

</div>


<table >
  <tr>
    <td>Student</td>
    <td><?php
	$customer= new dbHandler();
        $customer->connect();
        
		 if($_REQUEST['aC']=="sM")
{
	$query_customer="select  * from ingl_admission where  ref_No='".$dbObject->getDbField('student_id')."'  ";
}else {
$query_customer="select  * from ingl_admission where  center_no='".$_SESSION['branch_id']."'  order by recNo desc limit 0,10";	
	
}
		
		
        $result_customer=$customer->select($query_customer);
	    $customer_array=array();		
		while($data_customer=$customer->SelectNext($result_customer))
              {
		$customer_array[''.$data_customer[ref_No].'']="".$data_customer['ref_No']."";
	      }
			  
		$customer_selected=$dbObject->getDbField('student_id');
		$customer_extra='style="width:180px;  height:24px;"  id="student_id" onchange="invoice_customer(this.value)"';			  
		echo select_drop($customer_array,'student_id','Select',0,$customer_selected,$customer_extra);
			  //print_r($customer_array);
?></aside>
    </td>
    <td></td>
    <td rowspan="2" valign="top">Address</td>
    <td rowspan="2"><textarea wrap='virtual' style="height:50px;"  rows='3' cols='50' id="cus_address" name='student_address'><?php echo $dbObject->getDbField('student_address');?></textarea></td>
  </tr>
  <tr>
    <td>Name</td>
    <td><input type='text' name='student_name' value="<?php echo $dbObject->getDbField('student_name');?>" id="cus_name" size='20' maxlength='250' style="width:180px;" /></td>
    <td></td>
  </tr>
  <tr valign='top'>
    <td >Date</td>
    <td> <input id="CurrentDate" readonly="readonly" size='20'  style="width:180px;"/><input type="hidden" name='createDate' id="datepicker3" value="<?php echo $dbObject->getDbField('createDate');?>" size='20' maxlength='10' style="width:180px;" /></td>
    <td></td>
  </tr>
</table>
<table id='myDiv' style="width:100%">
  <tr style="width:100%; background:#CCCCCC; ">
    
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>CATEGORY</b> </td>
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>PRODUCT</b></td>
    <td style="padding:8px; border-radius:5px;"><b>REG. ID</b></td>
  <!--  <td>&nbsp;<b>Rate</b></td>-->
    <!--    <td>&nbsp;<b>Tax</b></td>-->
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>QUANTITY</b></td>
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>DISCOUNT (Rs)</b></td>
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>AMOUNT</b></td>
    <td style="padding:8px; border-radius:5px;">&nbsp;<b>REMARKS</b></td>
  </tr>
 
<tr><td>&nbsp;</td></tr>
  <?php
$i=1;
if($_REQUEST['aC']=="sM")
{
$queryP="select * from ingl_invoice_detail where main_id='".$_REQUEST['kV']."'";

$resultP=mysqli_query($conn,$queryP);



while($numP=mysqli_fetch_array($resultP))
{
 
$t2="".$i."";
?>
  <tr>
  
    <input type="hidden" name="recNo_1[]" value="<?php echo $numP['recNo']; ?>" />
    
    <td>&nbsp;
        <?php
		        $prodcat= new dbHandler();
                $prodcat->connect();
                $query_prodcat="select recNo,bill_category from ingl_billing_cat order by bill_category";
		
                $result_prodcat=$prodcat->select($query_prodcat);
		        $prodcat_array=array();
		
	        	while($data_prodcat=$prodcat->SelectNext($result_prodcat)){
			   $prodcat_array[''.$data_prodcat[recNo].'']=$data_prodcat['bill_category'];
			}
			  
			$prodcat_selected=$numP['category_id'];
			$prodcat_extra='id="targetcat" style="width:130px;" onchange="displaymain(this.value,\'prodcat'.$i.'\',\'Adm\');"';
			  
			echo select_drop($prodcat_array,'category[]','--  Select Category  --',0,$prodcat_selected,$prodcat_extra);
			  //print_r($customer_array);
?>    </td>
    <td id="prodcat<?php echo $i; ?>"><?php
				if($currentMode=="Add")
				{
				$subprodcat_array=array();
				$subprodcat_selected="";
				$subprodcat_extra='id="target'.$i.'" style="width:130px;" ';
				}
				else
				{
				  $subprodcat_array=array();
				  $subprodcat= new dbHandler();
				  $subprodcat->connect();
				  $query_subprodcat="select recNo,bill_details from ingl_billing_main where bill_category='".$numP['category_id']."'  order by bill_details";
				  $result_subprodcat=$subprodcat->select($query_subprodcat);
				  
				  while($data_subprodcat=$subprodcat->SelectNext($result_subprodcat))
				  {
				  $subprodcat_array[''.$data_subprodcat[recNo].'']=$data_subprodcat['bill_details'];			  
				  }
				  
				  $subprodcat_selected=$numP['product_id'];
				  $subprodcat_extra='style="width:130px; id="target'.$i.'" class="nodupli" onchange="checkdup(this);ajax_spec(this.value,\''.$t2.'\');"';
				}
				
				echo select_drop($subprodcat_array, 'product[]','--  Select Product  --',0,$subprodcat_selected,$subprodcat_extra);
				?></td>
    <td>&nbsp;
        <input type="number" name="CourseID[]" value="<?php echo $numP['course_id'] ?>" class="product_desc" style="width:70px;" id="Course<?php echo $i; ?>"/></td>
    <!--<td id="rates<?php echo $i; ?>" >&nbsp;
        <input type="hidden" name="rates[]"  value="<?php echo $numP['rates']; ?>"  style="width:70px;" id="rat<?php echo $i; ?>"  onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','tax<?php echo $i; ?>');getTotal();" /></td>-->
    <!--      <td><input type="text" name="tax_s[]" value="<?php echo $numP['tax_rates']; ?>" style="width:70px;" id="tax_s<?php echo $i; ?>" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','tax<?php echo $i; ?>');gtotal();"/>
				</td>-->
    <td>&nbsp;
        <input type="text" name="quan[]" id="quan<?php echo $i; ?>"   value="<?php echo $numP['quantity'] ?>" style="width:90px;" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','Dis<?php echo $i; ?>');getTotal();" />
      &nbsp;<span id='unit<?php echo $i; ?>'></span></td>
      <td>&nbsp;
        <input type="text" name="Discount[]"  value="<?php echo $numP['Discount'] ?>" id="Dis<?php echo $i; ?>" style="width:50px;" class="Discount" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','Dis<?php echo $i; ?>');" /></td>
    <td>&nbsp;
        <input type="text" name="total[]"  value="<?php echo $numP['amount'] ?>" id="tot<?php echo $i; ?>" style="width:70px;" class="net_tot" onkeyup="javascript:getTotal();"/>
        <input type="hidden" name="tax[]" value="<?php echo $numP['tax_amount']; ?>" style="width:70px;" class="tax" id="tax<?php echo $i; ?>" />    </td>
    <td>&nbsp;
        <textarea name="description[]" cols="14"   rows="1"><?php echo $numP['remarks']; ?> </textarea></td>
  </tr>
  <?php
$i++;
}

}
//else{
	////////////////
	for($i=$i;$i<=1;$i++)
{
	//////////////$i--;
	

?>


  <tr id="row">
  
    <input type="hidden" name="recNo_1[]" value="0" />
   
    <td>&nbsp;
      <?php
		        $prodcat= new dbHandler();
                $prodcat->connect();
                $query_prodcat="select recNo,bill_category from ingl_billing_cat where recNo in (15, 27, 25, 28) order by bill_category ";		
                $result_prodcat=$prodcat->select($query_prodcat);
		        $prodcat_array=array();
		        while($data_prodcat=$prodcat->SelectNext($result_prodcat)){
			    $prodcat_array[''.$data_prodcat[recNo].'']=$data_prodcat['bill_category'];
			     }
			  
			$prodcat_selected=$dbObject->getDbField('category');
			$prodcat_extra='id="targetcat" style="width:130px;" onchange="displaymain(this.value,\'prodcat'.$i.'\',\'Adm\');"';
			  
			echo select_drop($prodcat_array,'category[]','--Select Meterial--',0,$prodcat_selected,$prodcat_extra);
			  //print_r($customer_array);
?></td>
    <td id="prodcat<?php echo $i; ?>"><?php
	
				if($currentMode=="Add")
				{
				$subprodcat_array=array();
				$subprodcat_selected="";
				$subprodcat_extra='id="target'.$i.'" style="width:130px;" rel="popuprel2" class="nodupli" ';
				}
				else
				{
				
				$subprodcat_array=array();
				$subprodcat_selected="";
				$subprodcat_extra=' rel="popuprel2" class="nodupli" id="target'.$i.'"';
				
				}
				
				echo select_drop($subprodcat_array,'product[]','--  Select Product  --',0,$subprodcat_selected,$subprodcat_extra);
				?>    </td>
    <td>&nbsp;
      <input type="number" name="CourseID[]2" value="0" id="Course<?php echo $i ;?>" style="width:70px;" class="product_desc"/></td>
  <!-- <td id="rates<?php echo $i; ?>" >&nbsp;
        <input type="hidden" name="rates[]" value="<?php echo $numP['rates']; ?>" style="width:70px;" readonly id="rat<?php echo $i; ?>"  onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','tax<?php echo $i; ?>');getTotal();" /></td>-->
    <!--    <td><input type="text" name="tax_s[]" value="<?php echo $numP['tax_s']; ?>" style="width:70px;" id="tax_s<?php echo $i; ?>" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','tax<?php echo $i; ?>');gtotal();" />
				</td>-->
    <td>&nbsp;
        <input type="text" name="quan[]" id="quan<?php echo $i; ?>"   value="1" style="width:90px;" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','Dis<?php echo $i; ?>');getTotal();" />
      &nbsp;<span id='unit<?php echo $i; ?>'></span></td>
       <td>&nbsp;
        <input type="text" name="Discount[]"  value="0" id="Dis<?php echo $i; ?>" style="width:50px;" class="Disc" onkeyup="javascript:subtot('rat<?php echo $i; ?>','quan<?php echo $i; ?>','tot<?php echo $i; ?>','tax_s<?php echo $i; ?>','Dis<?php echo $i; ?>');" />
         </td>
    <td>&nbsp;
        <input type="text" name="total[]"  value="0" id="tot<?php echo $i; ?>" style="width:70px;" class="net_tot" onkeyup="javascript:getTotal();"/>
        <input type="hidden" name="tax[]" value="<?php echo $numP['tax']; ?>" style="width:70px;" class="tax" id="tax<?php echo $i; ?>" />    </td>
    <td>&nbsp;
        <textarea name="description[]" cols="14" rows="1"></textarea></td>
        
  </tr>
  <table id="details">
  </table>

  <?php 
  //echo  "<a  id='addmore' onclick=Addnewrow('2','Met') href='#' >Add New Row</a>";
}
//}
?>
  <tr>
    <!--<td colspan="5"  align="right">Sub-Total</td>
    <td><input type="text" id="sub_total" name="amount" onkeyup="gtotal();" value="<?php echo $dbObject->getDbField('amount');?>" size='10' maxlength='10' /></td>-->
    <td colspan="2" rowspan="5" >
	<!--Add Extra Caregoary For Regestration-->
	
		<table class="popupbox2" id="popuprel2">
		<?php
		$qureyReg="Select * from ingl_invoice_reg where recNo='".$_REQUEST['kV']."' ";
         $resustReg=mysqli_query($conn,$qureyReg);
		 $numReg=mysqli_fetch_array($resustReg);
		for ($x = 1; $x <= 3; $x++) {
		$Rt2="".$x."";
		
		 ?>
		
<tr id="intabdiv2" class="Reg<?php echo $x; ?>">
	<td>Category</td>
	<td>&nbsp;
        <?php
	
		        $prodcat= new dbHandler();
                $prodcat->connect();
                $query_prodcat="select recNo,bill_category from ingl_billing_cat where `recNo` not in (13)  order by bill_category   ";		
                $result_prodcat=$prodcat->select($query_prodcat);
		        $prodcat_array=array();		
		        while($data_prodcat=$prodcat->SelectNext($result_prodcat)){
			    $prodcat_array[''.$data_prodcat[recNo].'']=$data_prodcat['bill_category'];
			     }	
				  if($currentMode=="Add")
				  {
				  $prodcat_selected=$dbObject->getDbField('Regcategory');
				  }
				  else
				  {
				  $prodcat_selected=$numReg['reg_category'.$x];	 
				  }
				
			$prodcat_extra='id="targetReg'.$x.'" style="width:130px;" onchange="displaymain(this.value,\'Regprodcat'.$x.'\',\'Reg\');"';
			  
			echo select_drop($prodcat_array,'reg_category'.$x,'--  Select Category  --',1,$prodcat_selected,$prodcat_extra);
			  //print_r($customer_array);
?>    </td>
	<td> Product</td>
	<td id="Regprodcat<?php echo $x; ?>"><?php
	
				if($currentMode=="Add")
				{
				$subprodcat_array=array();
				$subprodcat_selected="";
				$subprodcat_extra='id="targetReg'.$x.'" style="width:130px;" ';
				}
				else
				{	
				   $subprodcat_array=array();
				  $subprodcat= new dbHandler();
				  $subprodcat->connect();
				  $query_subprodcat="select recNo,bill_details from ingl_billing_main where bill_category='".$numReg['reg_category'.$x]."'  order by bill_details";				
				  $result_subprodcat=$subprodcat->select($query_subprodcat);				  
				  while($data_subprodcat=$subprodcat->SelectNext($result_subprodcat))
				  {
				  $subprodcat_array[''.$data_subprodcat[recNo].'']=$data_subprodcat['bill_details'];			  
				  }
				  if($currentMode=="Add")
				  {
					  $subprodcat_selected=$dbObject->getDbField('reg_product');
				  }
				  else
				  {
					  $subprodcat_selected=$numReg['reg_product'.$x];	
				  }				
				  $subprodcat_extra='style="width:130px; id="targetReg'.$x.'" class="nodupli" onchange="checkdup(this);ajax_spec(this.value,\''.$x.'\');"';
				}				
				echo select_drop($subprodcat_array,'reg_product'.$x,'-- Select Product  --',1,$subprodcat_selected,$subprodcat_extra);
				?>    </td>
	</tr>
	<?php } ?>
	<tr>
	  <td colspan="4" align="center"><input name="submit" id="fadeout"   type="button" value="OK" onclick=""/></td>
	</tr>
</table>	</td>
  </tr>
<!--  <tr>
    <td colspan="5"   align="right">Tax</td>
    <td><input type="text" name="tax_value" id="tax_value" value="<?php echo $dbObject->getDbField('tax_value');?>" size="10" maxlength="10" /></td>
  </tr>
 <tr>
    <td colspan="2">Discount Type</td>
    <td><select name="DiscountType" id="Dis_Type">
      <option value="">-----SELECT-----</option>
      <option value="Ex Student">Ex Student</option>
      <option value="Seasonal">Seasonal</option>
      <option value="Refferal">Refferal</option>
      <option value="Special">Special</option>
    </select>    </td>
    <td   align="right"> Discount</td>
    <td><input type="text" name="discount_per" onkeyup="getTotal();" id="discount_per" value="<?php echo $dbObject->getDbField('discount_per');?>" size="5" maxlength="10" />
      %</td>
    <td><input type="text" name="discount_value" id="discount_value"  onkeyup="getTotal();" value="<?php echo $dbObject->getDbField('discount_value');?>" size="10" maxlength="10" /></td>
  </tr>-->
  <tr>
   <!--<td colspan="5"  align="right">Total</td>
    <td><input type="text" name="final_amount" id="grand_total" value="<?php echo $dbObject->getDbField('final_amount');?>" size="10" maxlength="10" />    </td>-->
  </tr>
</table>
<?php
if($currentMode=="Add" && $currentMode!="Add")
{
?>
<table width="100%">
<tr><td>Mode of Payment</td><td>
	<select name="rcpt_payment_mode" id="payment_mode">
	<option value="">---SELECT---</option>
	<option value="Cash">Cash</option>
	<option value="Cheque">Cheque</option>
	<option value="Card">Card</option>
	<option value="Net Banking">Net Banking</option>
        <option value="PayTM">Paid by PayTM</option>
	</select>
</td><td>&nbsp;</td><td>Amount Received</td><td><input type="text" name="rcpt_amount" value="" style="width:50px;"></td>
<td>&nbsp;</td><td id="cheque_card">Cheque No.</td><td><input type="text" name="rcpt_cheque_no" value="" style="width:100%"></td>

</tr>    
<tr>
	<td colspan="2"><span id="cheque_card_name">Cheque Drawn in favour of </span></td><td colspan="6"><input type="text" name="rcpt_favour_of" value="" style="width:100%"></td>
</tr>
</table>
<?php
}
?>

<table border='0' width="100%" class='pa-nor'>
<tr>
<td colspan="5">
<table border='0' width="100%" class='pa-nor'>
<tr>
<?php
if($currentMode=="Add" )
{
?>
<td align="right" width="30%">MODE OF PAYMENT :</td>
<td > 
	<select name="rcpt_payment_mode" id="payment_mode">
	<option value="">---SELECT---</option>
	<option value="Cash">Cash</option>
	<option value="Cheque">Cheque</option>
	<option value="Card">Card</option>
	<option value="Net Banking">Net Banking</option>
        <option value="PayTM">Paid by PayTM</option>
	</select>
</td>
<td id="cheque_card">Cheque No.</td><td><input type="text" name="rcpt_cheque_no" value="" style="width:100%"></td>
<tr>
	<td colspan="2"><span id="cheque_card_name">Cheque Drawn in favour of </span></td><td colspan="6"><input type="text" name="rcpt_favour_of" value="" style="width:100%"></td>
<?php } ?>
<td align="left"><input type='submit' style="width:100px; height:30px; background:#FF0;"  name='aC' value='<?php echo $currentMode;?>'></td>
</tr>
</table>
</td>
</tr>
</table>
</form>






<?php
// Include footer
include "footer_in.php";
?>

<script language="javascript">
/*
function gtotal()
	{
	 var inputs = document.getElementsByTagName('input');
 totalamount=0;
for (var i = 0; i < inputs.length; ++i) {
 //alert(inputs[i].className);
  if(inputs[i].className=="net_tot")
  {
  val=inputs[i].value;
  totalamount=totalamount+(1*val);
  //alert(val);
  }
  }  
  document.getElementById('sub_total').value=roundNumber(totalamount,2);
 /*
 taxamount=0;
for (var i = 0; i < inputs.length; ++i) {
 //alert(inputs[i].className);
  if(inputs[i].className=="tax")
  {
  val=inputs[i].value;
  taxamount=taxamount+(1*val);
  //alert(val);
  }
  }  
  document.getElementById('tax_value').value=taxamount;  
  tax1=document.getElementById('tax_value').value;  
  
  if(document.getElementById('discount_per').value!="" && 1*document.getElementById('discount_per').value>0)
  {
	per=((1*document.getElementById('discount_per').value)*((1*document.getElementById('sub_total').value)+(1*tax1)))/100;
	
        document.getElementById('discount_value').value=roundNumber(per,2);
  }
  
  discount1=document.getElementById('discount_value').value;

  /*tax2=document.getElementById('tax2').value;
  tax3=document.getElementById('tax3').value;
  tax4=document.getElementById('tax4').value;
  tax5=document.getElementById('tax5').value;
  tax6=document.getElementById('tax6').value;
  tax7=document.getElementById('tax7').value;
  
  
  document.getElementById('grand_total').value=(1*document.getElementById('sub_total').value)+(1*tax1)-(1*discount1);
  
  
}*/

function roundNumber(num, dec) {

	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);

	return result;

		 }
		 
		  //Sandeep Calculation
    function getTotal()
    {
      var items = new Array();
        var itemCount = document.getElementsByClassName("net_tot");
        var total = 0;
          var id= '';
            for(var i = 0; i < itemCount.length; i++)
            {
            id = "tot"+(i+1);
            total = total +  parseInt(document.getElementById(id).value);
            }
            document.getElementById('sub_total').value = total;
            //return total;
          
          
        /*  if(document.getElementById('discount_per').value!="" && 1*document.getElementById('discount_per').value>0)
          {
          per=((1*document.getElementById('discount_per').value)*((1*document.getElementById('sub_total').value)))/100;
          document.getElementById('discount_value').value=roundNumber(per,2);
          }
        
        discount1=document.getElementById('discount_value').value;*/
        //tax1=document.getElementById('tax_value').value;
      document.getElementById('grand_total').value=(1*document.getElementById('sub_total').value);
      
    }
</script>

<script>
	
	$("#payment_mode").change(function(){
	//alert($(this).val());
	if($(this).val()=="Card"){
	$("#cheque_card").html("Transaction Id");
	$("#cheque_card_name").html("Card Details");
	}
        
	if($(this).val()=="Cheque"){
	$("#cheque_card").html("Cheque No");
	$("#cheque_card_name").html("Cheque in favour of:");
	}	
	
	if($(this).val()=="Net Banking"){
	$("#cheque_card").html("Transaction Id");
	$("#cheque_card_name").html("Details:");
	}
});


$( document ).ready(function() {

if($("#payment_mode").val()=="Card"){
	$("#cheque_card").html("Transaction Id");
	$("#cheque_card_name").html("Card Details");
	}
        
	if($("#payment_mode").val()=="Cheque"){
	$("#cheque_card").html("Cheque No");
	$("#cheque_card_name").html("Cheque in favour of:");
	}	
	
	if($("#payment_mode").val()=="Net Banking"){
	$("#cheque_card").html("Transaction Id");
	$("#cheque_card_name").html("Details:");
	}

});
</script>