<?
session_start();
include("../opendb.php");
include("../test.php");
if($save)
{
 $sql="update warsparetransout set cssno='$cssno',notifno='$notifno',servord='$servord', stono='$stono', preqno='$preqno',invno='$invno',stat='$stat' where warno='$warno1' and brcode='$br'";
mysqli_query($db,$sql);
}// end save
?>
<script>
 function valid()
 {
   if(confirm('Do you want to update the changes?'))
     return true;
   else
     return false;
 }
</script>

<link rel="stylesheet" href="../style.css" type="text/css" />
<?
  $brres=mysqli_query($db,"select brname from branch where brcode='$br'");
  $brrow=mysqli_fetch_array($brres);
print "<form action='$PHP_SELF' method='post' onSubmit='return valid()'>";
print "<input type=hidden name='br' value='$br'>";
$sq="select * from warsparetransout where warno='$warno1' and brcode='$br'";
$res=mysqli_query($db,$sq)or die('Err1:'.mysqli_error());
$warrow=mysqli_fetch_array($res)or die('Err'.mysqli_error());
print "War No: <input type=text name=warno1 size=5 value='$warno1'> Branch: $brrow[0]";
?>
<table border=1>
<?
$dt=explode('-',$warrow[date]);
?>
<td>Date </td><td colspan=5>dd <input type=text name='d' size=2 value='<?print $dt[2]?>'>
mm <input type=text name='m' size=2 value='<?print $dt[1]?>'>
yy <input type=text name='y' size=4 value='<?print $dt[0] ?>'>
</td>
<tr><td>Customer </td><td colspan=4>
<?
print "<select name='cust' onChange=getmsno()>";
$c=explode('-',$warrow[cust]);
print "<option>$c[0]</option>";
print "</select>";
?>
<td colspan=3>
<font color=red>*</font>
MSNO:
<input type=text id='msno' name="msno" size=13 value='<?print $warrow[msno]?>'>

<!-- Comm Date <input type=text name='cdate' size=13 value='<?print $warrow[msno]?>'>-->
</td></tr>
<?
$fdt=explode('-',$warrow[failon]);
?>
<tr><td>Failure On</td><td>dd <input type=text name='d1' size=2 value='<?print $fdt[2]?>'>
mm <input type=text name='m1' size=2 value='<?print $fdt[1] ?>'>
yy <input type=text name='y1' size=4 value='<?print $fdt[0] ?>'>
</td>
<td>HMR </td><td><input type=text name='hmr' size=4 value='<?print $warrow[hmr]?>'></td>
<td>Failed LR No </td><td><input type=text name='flr' value='<?print $warrow[flr]?>'></td>
<td>Transport </td><td><input type=text name='transp' value='<?print $warrow[transp]?>'></td>
<tr><td> Trans Date </td>
<?
$trdt=explode('-',$warrow[transdate]);
?>
<td>dd <input type=text name='d2' size=2 value='<?print $trdt[2] ?>'>
mm <input type=text name='m2' size=2 value='<?print $trdt[1] ?>'>
yy <input type=text name='y2' size=4 value='<?print $trdt[0] ?>'>
</td>
<!--
<td>To </td><td>
-->
<td>Failure Info </td><td colspan=3><textarea name='finfo' rows=1 cols=52><?print $warrow[finfo]?></textarea></td></tr>
<tr bgcolor='yellow'><td>CSS No</td><td><input type=text name='cssno' value='<?print $warrow[cssno]?>'></td>
<td>Notif No</td><td><input type=text name='notifno' value='<?print $warrow[notifno]?>'></td>
<td>Serv Ord</td><td><input type=text name='servord' value='<?print $warrow[servord]?>'></td>
<tr bgcolor='yellow'> <td>STO No</td><td><input type=text name='stono' value='<?print $warrow[stono]?>'></td>
<td>P Req No</td><td><input type=text name='preqno' value='<?print $warrow[preqno]?>'></td>
<td>Inv NO. </td><td><input type=text name='invno' size=10 value='<?print $warrow[invno]?>'></td>
<td bgcolor='white'>Inv Date </td><td bgcolor='white'>
<?
$idt=explode('-',$warrow[transdate]);
?>

dd<input type=text name='d3' size=2 value='<?print $idt[2]?>'>
mm<input type=text name='m3' size=2 value='<?print $idt[1]?>'>
yy<input type=text name='y3' size=4 value='<?print $idt[0]?>'>
</td></tr>
<tr bgcolor='yellow'> <td>Satus</td><td><input type=text name='stat' value='<?print $warrow[stat]?>'></td>
</tr>
<tr><td colspan=10 align=center><input type=submit value='Save' name='save'></td></tr>
</table>
