<? 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
include_once("test.php");
include_once("opendb.php");
include_once("includes/function.php");
$inno=$_REQUEST['inno'];
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$qry=mysqli_query($db,"select * from prodinvoicewholesale where invno='$inno' and brcode='$brcode'");
if(mysqli_num_rows($qry)<=0)
{
 print"<script>alert('invalid invoice number');document.location='viewinvwhole1.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>

<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 prodinvoicewholesale where invno='$inno' and brcode='$brcode'");
$row=mysqli_fetch_array($qry);       
$date = $row[1];
$newDate = date("d-m-Y", strtotime($date));

?>    
<body style="text-align: center;"  >


<center ><h2>COUNTER SALE</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>Customer Id</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>


</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>Tax<th>Net<br>Amount<th>Sales Person</tr>

<?
$i=1;
$s_ntot=0;
$l_ntot=0;
$res=mysqli_query($db,"select * from prodinvoicewholesale where invno='$inno' and brcode='$brcode'");
while($res1=mysqli_fetch_array($res))
  {
   $tots=$res1[10];
   $disc=$res1[16]+$res1[17]+$res1[19]+$res1[23]+$res1[24]+$res1[25];
	$nttot=$tots-	$disc+$res1[21];
   print "<tr><td>".$i."</td><td>".$res1[5]."</td><td> ".$res1[6]."</td><td>".$res1[7]."</td><td>".$tots."</td><td>".$disc."</td><td>".$res1[21]."</td><td>".$nttot."</td><td>".$res1[12]."</td></tr>";
   $i++;
   $s_ntot+= $nttot; 
  }
?>


</table>

</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 $s_ntot; ?>" type="text">

</td><td></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>
