<?php
 session_start();
    
   include("../pdate.php");
   include("db.php");
 
   $date= $_POST['eyear']."-".$_POST['emonth']."-".$_POST['eday'];
   echo "<br>";
   $pervious = $_POST['year']."-".$_POST['month']."-".$_POST['day'];
 
/* $newdate = strtotime ( '-1 day' , strtotime ($oterDate)) ;
echo $previousDate = date ( 'Y/n/j' , $newdate );  */
	 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<title>لیست بردگی ها بابت خرید پول</title>
<head>
   <link rel="icon" href="../images/favicon.ico" type="image/png"/>  
   <link rel="stylesheet" href="table_style/table_style7.css">
   <link href="../css/pagenation.css" rel="stylesheet" type="text/css" /> 

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/print.css" /> 
<!-- ===================ÇíÌÇÏ íÇã ÈÑÇí æíÑÇíÔ ÝÇíá====================================-->
<script type="text/javascript" src="../change/edite/revenue_edite.js"></script> 
<script type="text/javascript" src="../change/delete/revenue_delete.js"></script>
 
<!--======================= ÇíÇä  ============================================================-->
 <style>
 a:link {
    text-decoration: none;
	color: #000;
}

 a:hover {
    color: red;
	text-decoration: underline;
}
a:active {
     
    color: #000;
}

@font-face {
	  font-family: 'hekmat';
	  src: url('../font/BHoma.ttf'); /* IE */
      src: local('BHoma-Bold'), url('../font/BHoma.ttf') format('truetype'); /* non-IE */
      font-weight:normal;
}
.font{
    color: #000;
    font-family: 'hekmat';  

}
@media print {

   .dontPrint {
       display:none;
    }

    }
	
	@media all{
.page-break{display:none;}
}
@media print{
.page-break{display:block;page-break-after:always;}
.dote img {visibility: visible;}
}
 
@page 
{
   size: auto;   /* auto is the initial value */
    margin: 3mm;  /* this affects the margin in the printer settings */
 }
  @media print {
    html, body {
        height: 99%;    
    }
}
 </style>

</head>
	<body onkeydown = "onKeyDown()" onKeyPress="return disableEnterKey(event)">
 <?php  
 echo "<table border='1' class='font' dir='rtl' cellpadding='0' cellspacing='0' style='margin: auto'>
	       
		   <tr>
			<td colspan='6' style='padding: 6px;text-align: center'>مفاد حاصل بر حسب دالر به تاریخ<br>".$date."</td>
		   </tr>
		   <tr>
				<th style='padding: 6px;background: #006699;color: #fff'>شماره</th>
				<th style='padding: 6px;background: #006699;color: #fff'>مجموع دارایی نقدی</th>
				 
				<th style='padding: 6px;background: #006699;color: #fff'>مجموع معاملات مشتریان</th>
				<th style='padding: 6px;background: #006699;color: #fff'>مجموع سرمایه خالص</th>
				<th style='padding: 6px;background: #006699;color: #fff'>تاریخ</th>
				</tr><tr>";
				 
  
  
include("db.php");

        
		   
		 
		/*جزئیات معاملات روز */
          $today_Details_Sql="select * from dailyprofit where date='$date'";
		  $today_Details_Query= $db ->query($today_Details_Sql);
		  $today_Details_Row=$today_Details_Query ->fetch_array();
		  $today_totalAsset=$today_Details_Row['totalAsset'];
		  $today_receivable=$today_Details_Row['dariyaft'];
		  $today_payable=$today_Details_Row['pardakht'];
		  $today_equity=$today_Details_Row['equity'];
		  $today_date=$today_Details_Row['date'];
		  $equityResult=$today_totalAsset-$today_equity;
		 echo "<td>1</td>";
		 echo "<td>".number_format($today_totalAsset,2)."</td>";
		 
		 echo "<td>".number_format($today_equity,2)."</td>";
		 echo "<td style='background:#00cc00'>".number_format($equityResult,2)."</td>";
		 echo "<td>".$today_date."</td>";
		 
		 echo "</tr><tr>";
		 /*جزئیات معاملات روز گذشته */
          $yesterday_Details_Sql="select * from dailyprofit where date='$pervious'";
		  $yeserday_Details_Query= $db ->query($yesterday_Details_Sql);
		  $yesterday_Details_Row=$yeserday_Details_Query ->fetch_array();
		  $yesterday_totalAsset=$yesterday_Details_Row['totalAsset'];
		  $yesterday_receivable=$yesterday_Details_Row['dariyaft'];
		  $yesterday_payable=$yesterday_Details_Row['pardakht'];
		  $yesterday_equity=$yesterday_Details_Row['equity'];
		  $yesterday_date=$yesterday_Details_Row['date'];
		   
		  
		  
		  $equity_result_yesterDay=$yesterday_totalAsset-$yesterday_equity;
		  
		  echo "<td>2</td>";
		  echo "<td>".number_format($yesterday_totalAsset,2)."</td>";
		 
		  echo "<td>".number_format($yesterday_equity,2)."</td>";
		  echo "<td style='background:#cc0000'>".number_format($equity_result_yesterDay,2)."</td>";
		  echo "<td>" .$yesterday_date."</td>";
		 
		 if($equityResult<0){
			 $equityResult=-$equityResult; 
		  }
		  if($equity_result_yesterDay<0){
			$equity_result_yesterDay=-$equity_result_yesterDay;  
		  }
		  $pourProfit=$equityResult-$equity_result_yesterDay;
		  echo "</tr>
		        <tr>
					<th colspan='6' style='padding: 6px;text-align: center'>مفاد امروز:".number_format($pourProfit,2)." </th>
				</tr>
		  
		  </table>";
 
?>