<?
session_start();
include("../opendb.php");
include("../test.php");
$brres=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brrow=mysqli_fetch_array($brres);
$res=mysqli_query($db,"select * from sparetransin where tr_no='$trno' and brcode='$brcode'");
$row=mysqli_fetch_array($res);
?>
<style>
th{font-size:13;background-color:silver}
td,body{font-family:'arial narrow';font-size:15;letter-spacing:1}
</style>

<center>

<table width=100% BORDER=0>
<tr><td>Spare Transfer In No : <?print $trno?>
</td><td align=right>Date : <?print datetohtml($row[entrydate])?> </td></tr>
<tr><td>Tr Out No. : <?print substr($row[from_branch],0,3).$row[troutno]?></TD><TD align=left></TD></TR>
<tr><td>From : <?print getbrname($row[from_branch])?></TD><TD align=left></TD></TR>
<tr><td>Orer No. : <?print $row[pord_no]?></TD><TD align=left></TD></TR>
<TR><TD COLSPAN=2 ALIGN=CENTER><b> PSN CONSTRUCTION EQUIPMENTS P LTD </b><BR>
	 <?print $brrow[braddr].",".$brrow[brcity].",<br><u> PH - ".$brrow[brphone]?></u>
TIN: <?print $brrow[tin]?>, CST: <?print $brrow[cstno]?>&nbsp;
</td></tr>
</table>
<br>
<?
$res2=mysqli_query($db,"select * from sparetransin where tr_no='$trno' and brcode='$brcode'");
print "<table cellspacing=1 cellpadding=1 bgcolor='gray'>";
print "<th>No <th>Part Code <th>Part Name <th>Qty <th>Amount<th>Location";
$i=1;
while($row=mysqli_fetch_array($res2))
{
 $tq+=$row[qty];
 print "\n<tr bgcolor=white><td>".$i++."</td><td>$row[partcode]</td><td>$row[partname]</td>";
 print "<td align=right>$row[qty]</td><td align=right>".putcoma($row[qty]*$row[amount])."</td>";
 $sq="select * from loc_master where brcode='$brcode' and code='$row[partcode]'";
  $locres=mysqli_query($db,$sq)or die(mysqli_error());
  $locrow=mysqli_fetch_array($locres);
 print "<td>$locrow[lname]</td></tr>";
}
print "<tr bgcolor=silver><td colspan=3 align=center>Total</td><td align=right>".putComa($tq)."</td><td></td><td></td></tr>";
?>
</table><br>
<?print "Printed by $user on ".date("r");?>

