<?
require_once('functions.php');
require_once('print.php');
require_once('face.php');
 require_once('mysql.php');

 $id=$_GET['id'];
 $idd=$_GET['idd'];
 
//echo $id;
$s="select p_name,qty,total_p,number,sale_id,session,price,name from sales where session='$id'
";
$sql=mysqli_query($dbc,$s);

$sb="select number from sales where session='$id'
";
$sq=mysqli_query($dbc,$sb);

$ne=mysqli_fetch_array($sq);
    $nu=$ne['number'];
     $ly="select amount ,type,id from x_report where receipt='$nu' and amount>0";
$so=mysqli_query($dbc,$ly);
   

?>

<div align="center"><h3> DETAILS FOR TRANSACTION NUMBER :&nbsp;<? echo $nu;?></div>


<table width="700" align="center" cellpadding="0" cellspacing="0" style="font-size:14px; border-color:#000000; background-color:#ffffff; border-style:solid; border-width:1px;">
  <tr>
      <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Edit Customer</strong></div></td>
    <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Edit Transaction</strong></div></td>
     <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Edit Date</strong></div></td>
    <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Product Name</strong></div></td>
    <td width="44" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Qty</strong></div></td>
        <td width="94" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Price </strong></div></td>
  <td width="94" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Total</strong></div></td>
  <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Delete</strong></div></td>
   
   
  </tr>
  <?
  require_once('mysql.php');


while($row = mysqli_fetch_array($sql))
{
  echo '<tr>

  <td style="border-color:#000000; border-style:solid; border-width:1px;">
  <div align="left"><a rel="facebox" href="ed_cus.
php?id=' . $row['session'] . '">Edit Customer</a></div>
<td style="border-color:#000000; border-style:solid; border-width:1px;">
  <div align="left"><a rel="facebox" href="eds_pri.
php?id=' . $row['sale_id'] . '">Edit Transaction</a>
<td style="border-color:#000000; border-style:solid; border-width:1px;">
  <div align="left"><a rel="facebox" href="ed_date.
php?id=' . $row['session'] . '">Edit Date</a></div>';
    echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.$row['p_name'].'</div></td>';
  echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.$row['qty'].'</div></td>';
    echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.number_format($row['price'],2).'</div></td>';
	 echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.number_format($row['total_p'],2).'</div></td>';
	  echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.($row['name']).'</div></td>
	 <td style="border-color:#000000; border-style:solid; border-width:1px;">
  <div align="left"><a rel="facebox" href="del_p.
php?id=' . $row['sale_id'] . '">Delete Transaction</a></div>';
	 echo'</td>';

$tota+=$row['total_p'];
	
	  echo '</tr>';
 }
   echo '<tr>';

  
    echo '<td colspan="3" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><b>TOTAL</div></td>
	<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><b>'.round($tota).'</div></td>';
 echo '</table><br /><br />';
 
 ?>
 <div align="center"><h3> PAYMENTS MODE FOR TRANSACTION NUMBER :&nbsp;<? echo $nu;?></div>


<table width="700" align="center" cellpadding="0" cellspacing="0" style="font-size:14px; border-color:#000000; background-color:#ffffff; border-style:solid; border-width:1px;">
  <tr>
    <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Edit</strong></div></td>
    <td width="200" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Payment Type</strong></div></td>
    <td width="44" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Amount</strong></div></td>
        <td width="44" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><strong>Delete</strong></div></td> 
   
  </tr>
  <?
  require_once('mysql.php');


while($row = mysqli_fetch_array($so))
{
  echo '<tr>';

  
    echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><a rel="facebox" href="edit_x.
php?id=' . $row['id'] . '">Edit Transaction</a></div></td><td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.$row['type'].'</div></td>';
  echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left">'.$row['amount'].'</div></td><td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><a rel="facebox" href="dex_x.
php?id=' . $row['id'] . '">Delete Transaction</a></div></td>';
  
$total+=$row['amount'];
	
	  echo '</tr>';
 }
   echo '<tr>';

  
    echo '<td colspan="1" style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><b>TOTAL</div></td>
	<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="left"><b>'.number_format($total).'</div></td>';
 echo '</table><br /><br />';
 
 


