 <!DOCTYPE html>
<html>
	<head>
	<link href="css/fontstyle.css" rel="stylesheet" type="text/css"/>	 
	<title>گزارش عملکرد روزانه</title>
	</head>
	<body>
	<form method="post" action="">
		<table border="0" align="center" dir="rtl">
			<tr>
				<th>تــاریخ:</td>
				<td style="direction:ltr"><input type="text" name="date" value=' <?php  include("pdate.php"); echo  $pdate = pdate("Y-m-d");   ?>'>
				<td><input type="submit" name="submit" value=" جستـجــــوی ">
			</tr>
		</table>
	</form>
	
		<?php
		 if($_POST['submit']){
		 include("db.php"); 
		 $date =trim($_POST['date']);
	     $asset_Sql="select sum(dollarTotal) from dailyasset where date='$date'";
		 $asset_query=$db ->query($asset_Sql);
		 $asset_Row=$asset_query->fetch_array();
		 $asset_amoun=number_format($asset_Row['sum(dollarTotal)'],2);
         //=======================================================
		  //total of customer Debit
		         $customer_debit_sql="SELECT SUM(dollarTotal) FROM customerpayment WHERE  transacttype='1' and date='$date' and customersell_id='0' ";
		         $customer_debit_query= $db ->query($customer_debit_sql);
				 $customer_debit_row=$customer_debit_query ->fetch_array();
		         $customer_debit=number_format($customer_debit_row['SUM(dollarTotal)'],2);
		    //total of customer credit
			     $customer_credit_sql="SELECT SUM(dollarTotal) FROM customerpayment WHERE  transacttype='2' and date='$date' and customersell_id='0' ";
		         $customer_credit_query= $db ->query($customer_credit_sql);
				 $customer_credit_row=$customer_credit_query ->fetch_array();
		         $customer_credit=number_format($customer_credit_row['SUM(dollarTotal)'],2);
		    //--------------------------------
			//total of general buy
			     $general_buy_sql="SELECT SUM(dollarTotal) FROM transaction WHERE  treatment='1' and date='$date' ";
		         $general_buy_query= $db ->query($general_buy_sql);
				 $general_buy_row=$general_buy_query ->fetch_array();
		         $general_buy=number_format($general_buy_row['SUM(dollarTotal)'],2);
		    //total of general sale
			     $general_sale_sql="SELECT SUM(dollarTotal) FROM transaction WHERE  treatment='2' and date='$date' ";
		         $general_sale_query= $db ->query($general_sale_sql);
				 $general_sale_row=$general_sale_query ->fetch_array();
		         $general_sale=number_format($general_sale_row['SUM(dollarTotal)'],2);
		  
		    //total of Customer buy
			     $customer_buy_sql="SELECT SUM(dollarTotal) FROM customerpayment WHERE  transacttype='1' and date='$date' and customersell_id!='0' ";
		         $customer_buy_query= $db ->query($customer_buy_sql);
				 $customer_buy_row=$customer_buy_query ->fetch_array();
		         $customer_buy=number_format($customer_buy_row['SUM(dollarTotal)'],2);
		    //total of Customer sale
			     $customer_sale_sql="SELECT SUM(dollarTotal) FROM customerpayment WHERE  transacttype='2' and date='$date' and customersell_id!='0' ";
		         $customer_sale_query= $db ->query($customer_sale_sql);
				 $customer_sale_row=$customer_sale_query ->fetch_array();
		         $customer_sale=number_format($customer_sale_row['SUM(dollarTotal)'],2);
		  
		    //total consume
			     $consume_sql="SELECT SUM(dollarTotal) FROM others WHERE  typeOthers='1' and date='$date' ";
		         $consume_query= $db ->query($consume_sql);
				 $consume_row=$consume_query ->fetch_array();
		         $consume=number_format($consume_row['SUM(dollarTotal)'],2);
		    
			//total consume
			     $income_sql="SELECT SUM(dollarTotal) FROM others WHERE  typeOthers='2' and date='$date' ";
		         $income_query= $db ->query($income_sql);
				 $income_row=$income_query ->fetch_array();
		         $income=number_format($income_row['SUM(dollarTotal)'],2);
		  
		 
		 
         //=======================================================
		 echo "<table border='1' class='fotntitle' width='700px' dir='rtl' cellpadding='0' cellspacing='0'>
		      <tr>
			      <td style='text-align: center' colspan='2' >
				   <h3 class='fotntitle'>گــــزارش عمـل کـــــرد روزانــــــه</h3>
				   <h3 class='fotntitle'>مــــورخ</h3>
				   <h3>". $date."</h3>
				  
				  </td>
			  </tr>
			  <tr>
			      <td> 
				   <ul>
				      <li class='fotntitle'>
					      <a href='asset_details.php?date=$date' target='_'>موجودی نقدی</a>
					  </li>
					</ul>
					  </td>
			      <td> 
				     <ul>
				      <li style='color: #003366;font-weight: bold'>
					     <a href='asset_details.php?date=$date' target='_'>$asset_amoun </a>
						 
					  </li>
					</ul>
				  
				  </td>
			  </tr >
			  <tr>
					<tr></td>
			  </tr>
			  <tr>
			      <td ><span>مشتـــــــریــــان</span>
				  <ul>
				     <li  class='font'><a href='customerRecive.php?date=$date & transaction=recive' ' target='_'>رسیدگیــها</a></li>
				     <li  class='font'><a href='customerSend.php?date=$date & transaction=send' ' target='_'>بــردگیــها</a></li>
				  </ul>
				  </td>
				  <td>
                   <ul>				  
				     <li class='font'><a href='customerRecive.php?date=$date & transaction=recive' target='_'>$customer_debit</a></li>
				     <li class='font'><a href='customerSend.php?date=$date'  & transaction=send' target='_'>$customer_credit</a></li>
				  </ul>
				  </td>
			  </tr>
			   <tr>
			      <td> معاملات خریدو فروش 
				  <ul>
				     <li class='font'><a href='dily_buy.php?date=$date & treatment=1' ' target='_'>خریــداریهــا</a></li>
				     <li class='font'><a href='dily_sale.php?date=$date & treatment=1' ' target='_'>فــروشــات حاصـل از خــریـداریــها</a></li>
				     
				  </ul>
				  </td>
				  <td>
                   <ul>				  
				     <li class='font'><a href='dily_buy.php?date=$date & treatment=1' ' target='_'>$general_buy</a></li>
				     <li class='font'><a href='dily_sale.php?date=$date & treatment=1' ' target='_'>$general_sale</a></li>
				     
				  </ul>
				  </td>
			  </tr> 	 
			  <tr>
			      <td> معاملات خریدو فروش مشتریان 
				  <ul>
				     <li class='font'><a href='customers_dily_buy.php?date=$date & treatment=1' ' target='_'>خریــدارییهــای مشتــریــان</a></li>
				      
				     <li class='font'><a href='customers_dily_sale.php?date=$date & treatment=1' ' target='_'>فــروشـات بــه مشـتــریــان</a></li>
				  </ul>
				  </td>
				  <td>
                   <ul>				  
				     <li class='font'><a href='customers_dily_buy.php?date=$date & treatment=1' ' target='_'>$customer_buy</a></li>
				     <li class='font'><a href='customers_dily_sale.php?date=$date & treatment=1' ' target='_'>$customer_sale</a></li>
				   
				  </ul>
				  </td>
			  </tr> 		  
			  <tr>
			      <td> متفرقـــه 
				  <ul>
				     <li class='font'><a href='expences.php?date=$date & treatment=1' ' target='_'>مصارف</a></li>
				     <li class='font'><a href='income.php?date=$date & treatment=1' ' target='_'>درآمـــدهـای خـارجـــی</a></li>
				    
				  </ul>
				  </td>
				  <td>
                   <ul>				  
				     <li class='font'><a href='expences.php?date=$date & treatment=1' ' target='_'>$consume</a></li>
				     <li class='font'><a href='income.php?date=$date & treatment=1' ' target='_'>$income</a></li>
				      
				  </ul>
				  </td>
			  </tr>";
			   
			  }
		 
?>
</div>
 
</div>
</body>
</html>