<?

?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
tr{background-color:white} 
th{background-color:c1d799;font-size:13}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<p align=right> <input type=button value='View / Print All' onClick=window.open('prnconrepo.php')> </p>
<center>

<?
$tmp1="vehstock";
mysqli_query($db,"delete from $tmp1");
$sql="create table $tmp1 (da varchar(100),config varchar(250),";
$sql.="chno varchar(100),pdate date, pvalue double(14,2),loc varchar(200))";
mysqli_query($db,$sql);

$re=mysqli_query($db,"select dano,config,chno,pdate,pval,loc from vehopstock where brcode='$brcode' order by config");
while($row=mysqli_fetch_row($re))
{
 $sq="insert into $tmp1 values('$row[0]','$row[1]','$row[2]','$row[3]','$row[4]','$row[5]')";
  mysqli_query($db,$sq) or die('err1'.mysqli_error());
}

$re=mysqli_query($db,"select da,newconfig,chasis,entrydate,amt2,loc from veh_purchase where brcode='$brcode'   and type !='pur-ret' and sale_invoice='-'order by entrydate")or die(mysqli_error());$i=1;
while($row=mysqli_fetch_row($re))
{
 $sq="insert into $tmp1 values('$row[0]','$row[1]','$row[2]','$row[3]','$row[4]','$row[5]')";
// print $i++.$sq."<br>";
 mysqli_query($db,$sq) or die('err2'.mysqli_error());
}

$re=mysqli_query($db,"select da from veh_invoice where brcode='$brcode'");
$i=1;
while($row=mysqli_fetch_row($re))
{
 $sql="delete from $tmp1 where da='$row[0]'";
 mysqli_query($db,$sql);
}
return;
//***********************************



 // end if
?>
