<?
session_start();
include("../opendb.php");
include("../test.php");
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
//	tr{background-color:white}
	th{background-color:steelblue;color:white}
.right{text-align:right};
</style>
<center>
<?
if($show)
{
 $dfrom=$y1.'-'.$m1.'-'.$d1;
 $dto=$y2.'-'.$m2.'-'.$d2;

$brres=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brrow=mysqli_fetch_array($brres);
?>
<table>
<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>
<tr><td COLSPAN=2 ALIGN=CENTER>
</td></tr>
</table>

<h3>STOCK TRANSFER OUTWARD</H3>
<? print " from ".datetohtml($dfrom).' to '.datetohtml($dto);
?>

<?
$re=mysqli_query($db,"select tr_no, sum(a.qty),sum(amount*qty),b.brname,a.entrydate from sparetransout a,branch b where a.to_branch=b.brcode and a.brcode='$brcode' and a.entrydate>='$dfrom' and a.entrydate<='$dto' group by tr_no");
print "<table border=0 cellspacing=1 cellpadding=3 bgcolor='lightsteelblue'>";
print "<th>Tr No <th>Date <th>Branch <th>Amount";
while($row=mysqli_fetch_array($re))
{
 print "<tr bgcolor=white><td>$row[tr_no]</td><td>".datetohtml($row[entrydate])."</td>";
 print "<td>$row[3]</td><td align=right>$row[2]</td>";
 print "</tr>";
 $tqty+=$row[1];
 $tamt+=$row[2];
}
?>
<tr><td colspan=3><center><b>Total</td>
 <td align=right><b><?print putComa($tamt)?></td></tr>
</table>
<?
 return;
} // end if show
?>

<center>
<h3>SPARE INVOICE REPORT -2</H3>
<form action='<?Print $PHP_SELF?>' method='post'>
<table cellspacing=1 cellpadding=1 bgcolor='steelblue'>
<tr><td bgcolor='white' align=center>
<table class=noprint>
<tr><td>Date from </td><td>dd <input type=text name='d1' size=2 value='<?print date("d")?>'>
mm <input type=text name='m1' size=2 value='<?print date("m")?>'>
yy <input type=text name='y1' size=4 value='<?print date("Y")?>'></td></tr>

<tr><td align=right>to </td><td>dd <input type=text name='d2' size=2 value='<?print date("d")?>'>
mm <input type=text name='m2' size=2 value='<?print date("m")?>'>
yy <input type=text name='y2' size=4 value='<?print date("Y")?>'>
</td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'><input type=submit value='Show' name='show'></td></tr>
</table>
</td></tr>
</table>
</form>
