<?
session_start();
include("../opendb.php");
include("../test.php");
$brres=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brrow=mysqli_fetch_array($brres);
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
	//tr{background-color:white}
	th{background-color:steelblue;color:white}
body,td{font-size:11}
.right{text-align:right}
</style>

<center>
<table>
<TR><TD COLSPAN=2 ALIGN=CENTER><b> PSN AUTOMOBILES 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><center>Printed by: <?print $user?> on <?print date("r");?>]</td></tr>
<tr><td><hr></td></tr>
</TABLE>
<h3>WARRANTY CLAIM/SERVICE AUTHORISATION APPLICATION FORM

<?
$sql="select * from warsparetransout where warno='$wwarno' and brcode='$brcode'";

$res=mysqli_query($db,$sql)or die('Err:'.mysqli_error($db));
if(mysqli_num_rows($res)<=0)
{
 print "Some error occured for the warranty: $wwarno<br>  Edit the same warranty or contact system administrator";
 return;
}
$row=mysqli_fetch_array($res);
print "<table border=1 cellspacing=1 cellpadding=4 bgcolor='gray' width=100%>";
print "<tr bgcolor=white><td><B>Customer </td><td COLSPAN=5>$row[cust]</td></TR>";
print "<tr bgcolor=white><td><b>Claim No</td><td><b>".substr($brcode,0,3).' '.$wwarno."</td>";
print "<td><b>Date </td><td>".datetohtml($row[date])."</td>";
print "<TR bgcolor=white><td><B>M/C Model</td><td></td>";
print "<td><B>M/C No</td><td>$row[msno]</td>";

print "<tr bgcolor=white><td><B>Date of Comm.</td><td></td>";
print "<td><B>Date of Failure</td><td>".datetohtml($row[failon])."</td>";

print "<tr bgcolor=white><td><B>HMR</td><td>$row[hmr]</td>";
print "<td><B>Branch</td><td>$brrow[brname]</td>";


print "<tr bgcolor=white><td><B>Css No</td><td>$row[cssno]</td>";
print "<td><B>Serv.Ord No(To be filled by Telcon)</td><td>&nbsp;</td>";

print "<tr bgcolor=white><td><B>Notif No</td><td>$row[notifno]</td>";
print "<td><B>STO NO (To be filled by Telcon)</td><td>$row[stono]&nbsp;</td>";
print "</tr></table>";
?>
<br>
<table border=1 cellspacing=1 cellpadding=4 bgcolor='gray' width=100% height=91>
<tr bgcolor=white valign=top><td>FAILURE INFORMATION<br>
<?print $row[finfo]?>
</TD>
</table><br>
<?
print "<br> <table border=1 cellspacing=1 cellpadding=4 bgcolor='gray'  width=100%>";
PRINT "<TH>NO.<TH>PART NO <TH>DESCRIPTION<TH>QTY<TH>PSN/TEL <TH>TELCON STO NO <TH WIDTH=100>DATE <TH>W HOUSE";

$i=1;
$t=0;
$tqty=0;
$sql="select * from warsparetransout where warno='$wwarno' and brcode='$brcode'";
$res1=mysqli_query($db,$sql)or die('Err:'.mysqli_error($db));

while($row1=mysqli_fetch_array($res1))
{
 $amt=($row1[psnqty]*$row1[price]);
  $t+=$amt;
  $tqty+=$row1[psnqty];
 print "<tr bgcolor=white><td>".$i++."</td><td>$row1[partcode]</td><td>$row1[partname]</td>";
 if($row1[psnqty]>0)
 {
  print "<td align=right>$row1[psnqty]</td>";
  print "<td align=center>PSN</td>";
 }
 else if($row1[telcqty]>0)
 {
  print "<td align=right>$row1[telcqty]</td>";
  print "<td align=center>TEL</td>";
 }

 print "<td align=right>&nbsp;</td><td align=right>&nbsp;</td><td align=right>&nbsp;</td>";
}
print "<tr bgcolor=white><td colspan=3 align=center><b>Total</td><td align=right>".putComa($tqty)."</td>";
PRINT "<td align=right>&nbsp;</td><td align=right>&nbsp;</td><td align=right>&nbsp;</td><td align=right>&nbsp;</td>";
?>
</table>
</center>
<BR>&nbsp;
<table  width=100%>
<tr><td>
<table border=1 cellspacing=1 cellpadding=4 bgcolor='gray'>
<TR bgcolor=white><TD COLSPAN=2><b>Despatch detail of failed part</td></tr>
<tr bgcolor=white><td>Transporter</td><td><?print $row[transp]?>&nbsp;</td></tr>
<tr bgcolor=white><td>Consignment Note No.</td><td width=400>&nbsp;</td></tr>
<tr bgcolor=white><td>Destination</td><td>&nbsp;</td></tr>
<tr bgcolor=white><td>Date</td><td>&nbsp;</td></tr>
</table>
</td><td valign=bottom>
Signature ACSC Service incharge 
<br>&nbsp;<br>&nbsp;

<br>&nbsp;<br>
Signature TELCON SERVICE MANAGER
</td></tr>
</table>


