<? 
session_start();
include("test.php");
include("opendb.php");
include("includes/function.php");
include("calstock.php");

if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$qry=mysqli_query($db,"select * from invoice where invno='$inno'");
if(mysqli_num_rows($qry)<=0)
{
 print"<script>alert('invalid invoice number');document.location='viewinv1.php';</script>";
} 

?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>PSN Telcon</title>
<style>


#mask {
	display: none;
	background:url(images/bgimg1.gif) repeat;
	//background: #000; 
	position: fixed; left: 0; top: 0; 
	z-index: 10;
	width: 100%; height: 100%;
	opacity: 0.8;
	z-index: 999;
}

.login-popup{
		display:none;
	background:white;
	padding: 10px; 	
	border: 2px solid #ddd;
	float: left;
	font-size: 1.2em;
	position: fixed;
	top: 4%; left: 45%;
	z-index: 99999;
	box-shadow: 0px 0px 20px #999;
	-moz-box-shadow: 0px 0px 20px #999; /* Firefox */
    -webkit-box-shadow: 0px 0px 20px #999; /* Safari, Chrome */
	border-radius:3px 3px 3px 3px;
    -moz-border-radius: 3px; /* Firefox */
    -webkit-border-radius: 3px; /* Safari, Chrome */
}
}

img.btn_close {
	float: right; 
	margin: -28px -28px 0 0;
}

fieldset { 
	border:none; 
}

form.signin .textbox label { 
	display:block; 
	padding-bottom:7px; 
}

form.signin .textbox span { 
	display:block;
}

form.signin p, form.signin span { 
	color:white; 
	font-size:11px; 
	line-height:18px;
} 

form.signin .textbox input { 
	background:#666666; 
	border-bottom:1px solid #333;
	border-left:1px solid #000;
	border-right:1px solid #333;
	border-top:1px solid #000;
	color:white; 
	border-radius: 3px 3px 3px 3px;
	-moz-border-radius: 3px;
    -webkit-border-radius: 3px;
	font:13px Arial, Helvetica, sans-serif;
	padding:6px 6px 4px;
	width:200px;
}

form.signin input:-moz-placeholder { color:white; text-shadow:0 0 2px #000; }
form.signin input::-webkit-input-placeholder { color:hwite; text-shadow:0 0 2px #000;  }

.submit button { 
	background: -moz-linear-gradient(center top, #f3f3f3, #dddddd);
	background: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#dddddd));
	background:  -o-linear-gradient(top, #f3f3f3, #dddddd);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f3f3f3', EndColorStr='#dddddd');
	border-color:#000; 
	border-width:1px;
	border-radius:4px 4px 4px 4px;
	-moz-border-radius: 4px;
    -webkit-border-radius: 4px;
	color:#333;
	cursor:pointer;
	display:inline-block;
	padding:6px 6px 4px;
	margin-top:10px;
	font:12px; 
	width:100px;
}

.button:hover { background:#ddd; }

</style>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('a.login-window').click(function() {
		
		// Getting the variable's value from a link 
		var loginBox = $(this).attr('href');

		//Fade in the Popup and add close button
		$(loginBox).fadeIn(300);
		
		//Set the center alignment padding + border
		var popMargTop = ($(loginBox).height() + 24) / 2; 
		var popMargLeft = ($(loginBox).width() + 24) / 2; 
		
		$(loginBox).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		// Add the mask to body
		$('body').append('<div id="mask"></div>');
		$('#mask').fadeIn(300);
		
		return false;
	});
	
	// When clicking on the button close or the mask layer the popup closed
	$('a.close, #mask').live('click', function() { 
	  $('#mask , .login-popup').fadeOut(300 , function() {
		$('#mask').remove();  
	}); 
	return false;
	});
});
</script>

<script>
 $(document).ready(function(){
  $("#svbttn").click(function(){


$("#msgbox").html('<small>Loading...</small>');
      

    	// var name= $(this).attr('name');

    	 //$('#type_name').val(name);
   
  	 var values1 = $("#jforms").serialize();
 	// $(".typeselecter").attr("disabled", true);
 	 // $("#td1").html('');

  	  $.ajax({
   	   url: "sv_inv.php",
    	  type: "POST",
   	  data:   values1,
     	  success: function(msg){

 

           	 if(parseInt(msg)!=0)    

          	  {

                $('#msgbox').html(msg);
               // $("#load").html(''); 
                //$(".typeselecter").attr("disabled", false);  
		}
           

      	},
      error:function(){
          alert("failure");
          $("#msgbox").html('there is error while submit');
      }   
   	 }); 

	 }); 
	 }); 


</script>














<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
</script>
<script type="text/javascript">
    $(document).ready(function() {
        var cont_left = $("#container").position().left;
        $("a img").hover(function() {
            // hover in
            //$(this).parent().parent().css("z-index", 1);
            $(this).animate({
               height: "110",
               width: "110",
              
            }, "fast");
        }, function() {
            // hover out
         //   $(this).parent().parent().css("z-index", 0);
            $(this).animate({
                height: "80",
                width: "80",
                
            }, "fast");
        });
        
        $(".img").each(function(index) {
            var left = (index * 160) + cont_left;
            $(this).css("left", left + "px");
        });
    });
</script>

<!-- js code below for active enter with textfield-->

 
<script type="text/javascript">








/** code below for search field *******/

function showResult(str,r,pos)
{
var i=pos.parentNode.parentNode.rowIndex;


   var tbl = document.getElementById('myTable');
   var id1=tbl.rows[i].cells[0].innerHTML;






if (str.length==0)
  {
  
  document.getElementById("livesearch").innerHTML="";
  document.getElementById("livesearch").style.border="0px";
  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("livesearch").innerHTML=xmlhttp.responseText;
    document.getElementById("livesearch").style.border="1px solid #A5ACB2";

     var ptvld=document.getElementById("prtvald").value;

     if(ptvld=='invalid')
      {
     alert('Invalid Partname');
     document.getElementById(r).value='';
     document.getElementById('qty'+id1).value='';
     document.getElementById('unitprice'+id1).value='';
     document.getElementById('tot'+id1).value='';
      document.getElementById(r).focus();

var k=0;
   var ups = document.getElementsByName('tot[]'), sum = 0, k;
    for(k = ups.length; k--;)
        if(ups[k].value)
            sum += parseFloat(ups[k].value, 10);
			document.getElementById('sum_total').value=sum.toFixed(2);





      }
    }
  }
xmlhttp.open("GET","livesearch.php?q="+str+"&&pos="+r+"&&pos1="+id1,true);
xmlhttp.send();
}



/*** function below for validate partname */


 function partnamevalid(pid,pval)
 {
alert('xxx');
   if(pval=='')
    {
   alert('Please Enter The Partname');
     
      document.getElementById(pid).focus();
 
   
  }
 }




function prtval(str,pos,flg,pos1)
{

//alert(pos);

document.getElementById(pos).value=str;
document.getElementById('typ'+pos1).value=flg;
document.getElementById(pos).focus();
document.getElementById("livesearch").innerHTML="";

}




function chkpart(prt,r)
 {

var i=r.parentNode.parentNode.rowIndex;
var part = document.getElementById("partname"+i).value;

  }



function qtycheck(str,r,qid)
{
 if(str.length==0)
 {
  str=0;
  }
 var fldid=document.getElementById(qid).value;
 if(isNaN(fldid))
  {
   alert('enter digit');
  document.getElementById(qid).value=0;
  }



var i=r.parentNode.parentNode.rowIndex;


   var tbl = document.getElementById('myTable');
   var id1=tbl.rows[i].cells[0].innerHTML;

   


var part = document.getElementById("partname"+id1).value;

 if(part=='')
 {
   alert('enter PartName');
   document.getElementById("partname"+id1).focus();
   
  }

else
 {

   var n=document.getElementById('myTable').rows.length-1;
//alert(n);
if(i>=1)
   {
   var m;
   var str1=0;


   for(m=1;m<=n;m++)	
    {
     var tbl1 = document.getElementById('myTable');
     var id2=tbl1.rows[m].cells[0].innerHTML;
    var part_pre = document.getElementById("partname"+id2).value;
    var qty_pre = document.getElementById("qty"+id2).value;
      if((part==part_pre)&&(m!=i))
        {
         str1=parseFloat(str1)+parseFloat(qty_pre); 
        }
     }

  }


   
   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("txtHint").innerHTML=xmlhttp.responseText;

      

var msg=document.getElementById("alertmsg").value;
     
     if(msg<1)
      {
           alert ('Sorry!...Quantity Exceeded');
      document.getElementById("qty"+id1).value='';


         var up=document.getElementById("untprice").value;
         var tp=document.getElementById("totalamt").value;

       document.getElementById("unitprice"+id1).value=up;
        document.getElementById("tot"+id1).value=tp;
       document.getElementById("qty"+id1).focus();
      }
      else
      {

         var up=document.getElementById("untprice").value;
         var tp=document.getElementById("totalamt").value;
         
       document.getElementById("unitprice"+id1).value=up;
        document.getElementById("tot"+id1).value=tp;
        //document.getElementById("unitprice"+id1).focus();





       }
    


var k=0;
   var ups = document.getElementsByName('tot[]'), sum = 0, k;
   
    for(k = ups.length; k--;)
        if(ups[k].value)
            sum += parseFloat(ups[k].value, 10);
			document.getElementById('sum_total').value=sum.toFixed(2);


var p=0;
   var ups1 = document.getElementsByName('tot[]'), sum1 = 0, p;
    var t1 = document.getElementsByName('typ[]');
   
    for(p = ups1.length; p--;)
             
        if((ups1[p].value)&&(t1[p].value=='spares'))
           
            sum1 += parseFloat(ups1[p].value, 10);
          
			document.getElementById('spare_total').value=sum1.toFixed(2);
                   


     var p1=0;
   var ups2 = document.getElementsByName('tot[]'),sum2 = 0, p1;
    var t2 = document.getElementsByName('typ[]');
   
    for(p1 = ups2.length; p1--;)
             
        if((ups2[p1].value)&&(t2[p1].value=='labour'))
           
            sum2 += parseFloat(ups2[p1].value, 10);
          
			
                    document.getElementById('labour_total').value=sum2.toFixed(2);




    }
  }
xmlhttp.open("GET","invo_qty_ajax.php?qty="+str+"&&part="+part+"&&ind="+id1+"&&preqty="+str1,true);
xmlhttp.send();



}
}



/**** code below to calculate discount  ***/

function discountcal(val,r)
  {
   

 var i=r.parentNode.parentNode.rowIndex;


   var tbl = document.getElementById('myTable');
   var id1=tbl.rows[i].cells[0].innerHTML;
  
    var totval=document.getElementById('tot'+id1).value;
 //alert(val+"-"+totval);
      if(val> totval)
        {
        document.getElementById('dis'+id1).value='0';
        
         }
      else
        {
            document.getElementById('tot'+id1).value=totval-val;


            var k=0;
           var ups = document.getElementsByName('tot[]'), sum = 0, k;
            for(k = ups.length; k--;)
            if(ups[k].value)
            sum += parseFloat(ups[k].value, 10);
			document.getElementById('sum_total').value=sum.toFixed(2);






   var p=0;
   var ups1 = document.getElementsByName('tot[]'), sum1 = 0, p;
    var t1 = document.getElementsByName('typ[]');
   
    for(p = ups1.length; p--;)
        if((ups1[p].value)&&(t1[p].value=='spares'))
     
            sum1 += parseFloat(ups1[p].value, 10);
			document.getElementById('spare_total').value=sum1.toFixed(2);

           
             var p1=0;
   var ups2 = document.getElementsByName('tot[]'),sum2 = 0, p1;
    var t2 = document.getElementsByName('typ[]');
   
    for(p1 = ups2.length; p1--;)
             
        if((ups2[p1].value)&&(t2[p1].value=='labour'))
           
            sum2 += parseFloat(ups2[p1].value, 10);
          
			
                    document.getElementById('labour_total').value=sum2.toFixed(2);

        
         }


  
            

      
   }





/***********************************************
* Disable "Enter" key in Form script
* This notice must stay intact for use
***********************************************/
                
function handleEnter (field, event) {
               
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      


var cur=1;
//var partcode=[];
var partname=[];
var unitprice=[];
var qty=[];
var tot=[];
var typ=[];
var cnt=1;

function insRow(event)
{
//alert(cur);



var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if((keyCode == 13)||(cnt==1))
 {
var rowCount = document.getElementById('myTable').rows.length;
var rowcount1=parseFloat(rowCount)+parseFloat(1);
//alert(rowCount);
var x=document.getElementById('myTable').insertRow(rowCount);


if(rowCount>=1)
 {
  document.getElementById('insrowbttn').type='hidden';
 }

var a=x.insertCell(0)
var y=x.insertCell(1)
var u=x.insertCell(2)

var z=x.insertCell(3)	
var z1=x.insertCell(4);
var dis=x.insertCell(5);
var t=x.insertCell(6);

var dd=x.insertCell(7);
var k;//=this.rowIndex;
var k1;
a.innerHTML=cur;
/* var value="<select name=partname[] id='partname"+cur+"' onKeyPress='return handleEnter(this, event)'><option></option>";//onChange=setval(this.selectedIndex)

for(k=0;k<partname.length;k++)
 value=value+"<option >"+partname[k]+"</option>";

value=value+"</select>";
y.innerHTML=value;*/
y.innerHTML="<input type=text   name=partname[] id=partname"+cur+"  class='partname' size=20 onKeyPress='return handleEnter(this, event)'  onkeyup='showResult(this.value,this.id,this)'  >";//
u.innerHTML="<input type=text name=unit[] id=unit"+cur+" size=5 class='unit' value='Ltr' readonly onKeyPress='return handleEnter(this, event)'>";
z.innerHTML="<input type=text name='qty[]' class='xx' id=qty"+cur+" size=2 onKeyPress='return handleEnter(this, event)'  onKeyup='qtycheck(this.value,this,this.id)'>";//onKeyup=validnum(this.id)
z1.innerHTML="<input type=text name=unitprice[] readonly id=unitprice"+cur+" size=20 class='unitprice'  onKeyPress='return handleEnter(this, event)'>";
t.innerHTML="<input type=text  id='tot"+cur+"' name=tot[] readonly size=10 class='tot'   onKeyPress='insRow(event)'><input type=hidden  id='typ"+cur+"' name=typ[] value='' readonly size=3 class='typ'   >";
dis.innerHTML="<input type=text  id='dis"+cur+"' name=dis[] value='0' size=5 class='dis' onchange='discountcal(this.value,this)'  onKeyPress='return handleEnter(this, event)'  >";
dd.innerHTML="<input type=button value='Delete' onClick='delrow(this)'>";


document.getElementById("partname"+cur).focus();
  cur++; 

cnt++;



var table = document.getElementById("myTable");
var row = table.rows[index];
console.log(secondRow.id);
}





}// end function insrow




function delrow(r)
{


var i=r.parentNode.parentNode.rowIndex;




 document.getElementById('myTable').deleteRow(i);

  var rowCount = document.getElementById('myTable').rows.length;
   var tbl = document.getElementById('myTable');
   
  var q;
  var id1;
  var part; 
  var sum2=0;
   var sum3=0;
  var stot;
  var ltot;
   for(q=1;q<rowCount;q++)
    {
     id1=tbl.rows[q].cells[0].innerHTML;
     part = document.getElementById("typ"+id1).value;
     
     if(part=='spares')
      {
       stot = document.getElementById("tot"+id1).value;
       sum2+= parseFloat(stot);
      }
      else
      { 
      ltot = document.getElementById("tot"+id1).value;
       sum3+= parseFloat(ltot);
      }
      
    }
   document.getElementById('spare_total').value=sum2.toFixed(2);
    document.getElementById('labour_total').value=sum3.toFixed(2);




 if(rowCount<=1)
 {
  document.getElementById('insrowbttn').type='button';
 }





var k=0;
   var ups = document.getElementsByName('tot[]'), sum = 0, k;
    for(k = ups.length; k--;)
        if(ups[k].value)
            sum += parseFloat(ups[k].value, 10);
			document.getElementById('sum_total').value=sum.toFixed(2);












cnt--;
     
 }

  function validnum(str)
{
  var fldid=document.getElementById(str).value;
 if(isNaN(fldid))
  {
   alert('enter digit');
  document.getElementById(str).value=0;
  }
} 




function printpage(str)
  {
   window.open("printinv.php?inno="+str);


  }




</script>




<link type="text/css" href="css/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" />	
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" href="tabjs/style.css" type="text/css" media="screen">
<script src="tabjs/8118fe14b349163c4420c20a933e602d581acc6d.js" async="" type="text/javascript"></script>
<script src="tabjs/i.js" async="" type="text/javascript"></script>
<script src="tabjs/dc.js" async="" type="text/javascript"></script>
<script type="text/javascript" src="tabjs/jquery-1.js"></script>
<script type="text/javascript" src="tabjs/jquery-ui-1.js"></script>
<script type="text/javascript" src="tabjs/jquery.js"></script>
<script type="text/javascript" src="tabjs/ajaxupload.js"></script>
<script type="text/javascript" src="tabjs/constants.js"></script>
<script type="text/javascript" src="tabjs/javascript.js"></script>
<link type="text/css" href="tabjs/jquery-ui-1.css" rel="Stylesheet">
<script type="text/javascript" src="tabjs/jquery_003.js"></script>
<script type="text/javascript" src="tabjs/jquery-ui.js"></script>
<script type="text/javascript" src="tabjs/jquery_002.js"></script>
<script type="text/javascript" src="tabjs/jquery.js"></script>

<style>
.cont
	{
	background-color:#3b5998;

	//background:url(images/bg-inner.jpg) #e9e0c3 repeat-x;
  	width: 100%;position: absolute ;
	height:99%;
    	/* Optional - just for DIV)*/
    	//border: solid 1px #000000;
	-moz-box-shadow: 0px 5px 5px #888;
	-webkit-box-shadow: 0px 5px 5px #888;
	box-shadow: 0px 5px 10px #888;
    }
.tble1 input {
background-color:transparent;
border: 0px solid;
height:20px;
//width:160px;
color:black;
}
.tble1
{
border-collapse:collapse;
//font-style:normal;
}	



</style>
 <?
$qry=mysqli_query($db,"select * from invoice where invno='$inno'");
$row=mysqli_fetch_array($qry);       
$date = $row[1];
$newDate = date("d-m-Y", strtotime($date));
?>    
<body style="text-align: center;"  >

 
<center ><h2>INVOICE</h2></center >
 <table class='tbl2' id='tbl2' ><tr><td>
<table width=100%>

<tr><td align='left'><b>Customer Name</b></td><td ><b>:</b></td><td align='left'><? echo $row[2]; ?></td><td width=40%></td><td align='left'><b>Invoice No </b></td><td><b> :</b></td><td align='left'><? echo $row[0]; ?></td></tr>
<tr><td align='left'><b>Register No</b></td><td ><b>:</b></td><td align='left'><? echo $row[3]; ?></td><td width=40%></td><td align='left'><b>Invoice Date </b></td><td><b> :</b></td><td align='left'><? echo $newDate; ?></td></tr>
<tr><td align='left'><b>Chasis No</b></td><td ><b>:</b></td><td align='left'><? echo $row[19]; ?></td></tr>

</table>
</td></tr><tr><td>
<table width=100% class='tble1' border=1>

<tr bgcolor='#767668' style='color:white'><th>Sl No<th>Item<th>Unit<th>Quantity<th>Total<br>Amount<th>Disc<th>Net<br>Amount<th>Sales Person</tr>

<?
$i=1;
$s_ntot=0;
$l_ntot=0;
$res=mysqli_query($db,"select sum(qty),group1,sum(dis),sum(total) from invoice where invno='$inno' and flag='spares' group by group1");
if(mysqli_num_rows($res)>0)
{
?>
<tr><td colspan='8'align='left' bgcolor='#A8A894'><b><font style="color:white">Spare</font></b></td></tr>
<?
}

//print "select sum(qty),group1,sum(dis),sum(total),salesman from invoice where invno='$inno' group by group1";
while($res1=mysqli_fetch_array($res))
  {
   $tots=$res1[2]+$res1[3];
   print "<tr><td>".$i."</td><td>".$res1[1]."</td><td> litre</td><td>".$res1[0]."</td><td>".$tots."</td><td>".$res1[2]."</td><td>".$res1[3]."</td><td>".$res1[4]."</td></tr>";
   $i++;
   $s_ntot+= $res1[3]; 
  }
?>


<?
$i=1;
$res2=mysqli_query($db,"select * from invoice where invno='$inno' and flag='labour' ");
if(mysqli_num_rows($res2)>0)
{
?>
<tr><td colspan='8'align='left' bgcolor='#A8A894'><b><font style="color:white">Labour</font></b></td></tr>
<?
}
//print "select sum(qty),group1,sum(dis),sum(total) from invoice where invno='$inno' group by group1";
while($res3=mysqli_fetch_array($res2))
  {
   $totl=$res3[8]+$res3[9];
   print "<tr><td>".$i."</td><td>".$res3[4]."</td><td> --</td><td>".$res3[6]."</td><td>".$totl."</td><td>".$res3[8]."</td><td>".$res3[9]."</td><td>".$res3[12]."</td></tr>";
   $i++;
   $l_ntot+= $res3[9]; 
  }
  $gtot=$s_ntot+$l_ntot;
?>
</table>

</td></tr>
<!--div below for popup window-->

 <div id="login-box" class="login-popup" >
        <a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
          <div id='msgbox'></div>
		</div>



   



<tr><td colspan='2' style="text-align:right;">
                    Spare Total
                
                    <input  style="border:0px solid white;text-align:right; width:100px; padding-right:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;" readonly="readonly" name="spare_total" id="spare_total" value="<?echo $s_ntot; ?>" type="text">

 </td></tr>               
<tr><td colspan='2' style="text-align:right;">
                    Labour Total
               
                    <input  style="border:0px solid white;text-align:right; width:100px; padding-right:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;" readonly="readonly" name="labour_total" id="labour_total" value="<?echo $l_ntot; ?>" type="text">
</td></tr>
<tr><td colspan='2' style="text-align:right;">
                    Grand Total
               
                    <input onclick="alert('The total is calculated automatically as soon as you have entered something into both the unit price and the quantity field in the lines above.\n\nExample: If you wish to invoice a service for $100.00, you should enter 100.00 in the unit price field and 1.00 in the quantity field.')" style="border:0px solid white;text-align:right; width:100px; padding-right:5px; font-weight:normal; font-family:verdana;font-size:13px;color:#3c3c3c;" readonly="readonly" name="sum_total" id="sum_total" value="<?echo $gtot; ?>" type="text">

</td></tr>            
<tr><td colspan=2 align='left'><a href="#pop2"  onclick=' showHint()' style="text-decoration:none;"><img src='images/back.png'/></a></td></tr>
</table>
  </form>
	

		
</body></html>


<?
$re=mysqli_query($db,"select * from jcardparts where brcode='$brcode'")or die('prt err:'.mysqli_error($db));
$i=1;

while($row=mysqli_fetch_array($re))
{
 

 print "\n<script> partname[$i]='$row[3]';</script> ";
 
 $i++;
}
?>