<?php
session_start();

include 'dbc.php';

$userid=$_SESSION['userid'];

$id=$_REQUEST["id"];

  $sqlcus = "select * from complain where v_no='$id' and user_id='$userid'";
   $result=$conn->query($sqlcus);
$ppp = $result->fetch_assoc();
    $date=$ppp["date"];
	$cell=$ppp["cell"];
	$netamount=$ppp["netamount"];
	$discount=$ppp["discount"];
	$gamount=$ppp["gamount"];
	$cashrec=$ppp["cashrec"];
	$balret=$ppp["balret"];
	$disc=$ppp["disc"];
	 $sqlcus1 = "select * from feenote";
   $result1=$conn->query($sqlcus1);
$ppp1 = $result1->fetch_assoc();
	 $notice=$ppp1["notice"];


 	    
		
echo "<table border=0 width=100% align=center bgcolor=white>";
echo "<tr>";

echo "<td bgcolor=white align=right colspan=2><font color=black size=6pt face=Arial>" . "Customer Complain Report" . "</font></td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left colspan=5> <hr></th>";
echo "</tr>";
echo "<tr>";

echo "<td bgcolor=white align=left >" ."<img src='logo.jpg' />" . "</td>";
echo "<td bgcolor=white align=left colspan=5><font color=black size=2pt face=Arial>" . $userid. "<br>231- B2, Johar Town, Lahore 54000, Pakistan <br>Tel: 0304-4441302-01". "</font></td>";

echo "</tr>";
echo "<td align=left colspan=3></td>" ;
   echo "<td bgcolor=white align=left ><font color=black size=2pt face=Arial>" . "Sales Tax Registration :" . "</font></td>";
  echo "<td align=left ><font color=black size=2pt face=Arial>"  ."30037559974" . "</font></td>" ;
  echo "</tr>"; 
  echo "<tr>";
   echo "<td align=left colspan=3></td>" ;
   echo "<td bgcolor=white align=left ><font color=black size=2pt face=Arial>" . "National Tax Number : " . "</font></td>";
  echo "<td align=left ><font color=black size=2pt face=Arial>"  ."3755997-4" . "</font></td>" ;
  echo "</tr>"; 
echo "<tr>";

  echo "<td align=left colspan=3><font color=black size=3pt face=Arial>" ."To" . "<br>" .$ppp["cname"] . "</font></td>" ;
  
  echo "<td bgcolor=white align=left > <font color=black size=2pt face=Arial>" . "Complain No" . "</font></td>";
  echo "<td align=left ><font color=black size=1pt face=Arial>"  .$ppp["id"] . "</font></td>" ;
  echo "</tr>"; 
  echo "<tr>";
   
  echo "<td align=left colspan=3><font color=black size=2pt face=Arial>"  .$cell . "</font></td>" ;
 echo "<td bgcolor=white align=left ><font color=black size=2pt face=Arial>"  . "Date" . "</font></td>";
  echo "<td align=left ><font color=black size=1pt face=Arial>"  .$ppp["date"] . "</font></td>" ;
 
  echo "</tr>"; 
   echo "<tr>";
   echo "<td align=left colspan=3></td>" ;
   echo "<td bgcolor=white align=left ><font color=black size=2pt face=Arial>" . "Assigned Engineer" . "</font></td>";
  echo "<td align=left ><font color=black size=2pt face=Arial>"  .$disc . "</font></td>" ;
  echo "</tr>"; 
 
 
 

 echo "</table>";
$sql1 = "select * from complain_details where inv_no='$id' and user_id='$userid'";
   $result1=$conn->query($sql1);
echo "<table border=1 width=100% align=center bgcolor=white>";
 echo "<tr>";
 echo "<th bgcolor=white align=left ><font color=black size=2pt face=Arial> Sr </font></th>";
 echo "<th bgcolor=white align=left ><font color=black size=2pt face=Arial> Date</font></th>";
  echo "<th bgcolor=white align=left ><font color=black size=2pt face=Arial> Model No </font></th>";
  echo "<th bgcolor=white align=left ><font color=black size=2pt face=Arial> serial No </font></th>";

 echo "<th bgcolor=white align=center ><font color=black size=2pt face=Arial> Complain / Service </font></th>";
 echo "<th bgcolor=white align=center ><font color=black size=2pt face=Arial> Remarks / Report No </font></th>";
 echo "<th bgcolor=white align=center ><font color=black size=2pt face=Arial> Status </font></th>";
 echo "<th bgcolor=white align=center ><font color=black size=2pt face=Arial> Closing Date </font></th>";
  echo "<th bgcolor=white align=center ><font color=black size=2pt face=Arial> Amount </font></th>";

 
 echo "</tr>";
  $sno=1;
  while($row = $result1->fetch_assoc())

  {
   echo "<tr>";
  
	 echo "<td height=30><font color=black size=1pt face=Arial>" .$sno . "</font></td>";
	  echo "<td height=30><font color=black size=1pt face=Arial>" . $row['date']. "</font>  </td>";
	 echo "<td height=30><font color=black size=1pt face=Arial>" . $row['item_name']. "</font>  </td>";
	  echo "<td height=30><font color=black size=1pt face=Arial>" . $row['sno']. "</font>  </td>";
	
	
	echo "<td height=30 align=center><font color=black size=1pt face=Arial>" .$row['complain'] . "</font></td>";
	echo "<td height=30 align=center><font color=black size=1pt face=Arial>" .$row['rply'] . "</font></td>";
	echo "<td height=30 align=center><font color=black size=1pt face=Arial>" .$row['status'] . "</font></td>";
	echo "<td height=30 align=center><font color=black size=1pt face=Arial>" .$row['cdate'] . "</font></td>";
	 echo "<td height=30 align=center><font color=black size=1pt face=Arial>" .$row['amount'] . "</font></td>";
		
		
  echo "</tr>";
 
  $sno=$sno + 1;
  $treceived=$treceived + $row['amount'];
  $tqty=$tqty + $row['qty'];
  
  }
  
echo "</table>";
echo "<table border=0 width=100% align=center bgcolor=white>";

echo "<tr>";
 echo "<th align=right bgcolor=white  colspan=3><font color=black size=2pt face=Arial> Total Amount    :    </font>  </th>";

 echo "<th align=right ><font color=black size=2pt face=Arial>" .$treceived . "</font></th>" ;
 echo "</tr>";
 /* echo "<tr>";
 echo "<th align=right bgcolor=white  colspan=4><font color=black size=2pt face=Arial> Discount    :    </font>  </th>";
 echo "<th align=center ><font color=black size=2pt face=Arial>" .$discount . "</font></th>" ;
 echo "</tr>";
  echo "<tr>";
 echo "<th align=right bgcolor=white  colspan=4><font color=black size=2pt face=Arial> Net Amount    :     </font> </th>";
 echo "<th align=center ><font color=black size=2pt face=Arial>" .$gamount . "</font></th>" ;
 echo "</tr>";
  echo "<tr>";
 echo "<th align=right bgcolor=white  colspan=4><font color=black size=2pt face=Arial> Cash Received    :   </font>   </th>";
 echo "<th align=center ><font color=black size=2pt face=Arial>" .$cashrec . "</font></th>" ;
 echo "</tr>";
  echo "<tr>";
 echo "<th align=right bgcolor=white  colspan=4> <font color=black size=2pt face=Arial>Bal Return    :   </font>   </th>";
 echo "<th align=center ><font color=black size=2pt face=Arial>" .$balret . "</font></th>" ;
 echo "</tr>";*/
 echo "<tr>";
 echo "</tr>";
 echo "<tr>";

 echo "</tr>";
  echo "<tr>";
 echo "<th align=left bgcolor=white  colspan=5><font color=black size=1pt face=Arial> $notice     </font></th>";
 echo "</tr>";

 echo "</table>";
  echo "<hr>";

	 
 
?>



