<?php 
session_start();
ob_start(); 
include "header.php";
//$objIms->Semifinisheditem_alter();
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

		
	
		 <style>
			select.error { background-color:#ffa8a8; border: 1px dotted red;  }
			input.error{ background-color:#ffa8a8;   }
			textarea.error{ background-color:#ffa8a8; border: 1px dotted red;  }
         </style>
		 
        


<style type="text/css">
<!--
.table_bg{ border:#CCCCCC solid 1px; border-radius:5px; height:auto; width:auto; padding:20px; margin-bottom:10px;}


-->
</style>
</head>
<script type="text/javascript">
 
function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}

</script>
<script type="text/javascript">
	$(document).ready(function() {                
	$("#form1").validate({
	rules: {
	
	client_name: "required",
	
	
	},
	messages: {
	
	client_name:"",
	
	},
	});                
	});
	</script>
<body>

<div class="span11" style=" width:83%;">



<div class="12" style=" margin-left:0px; ">



<br />
<br />
<br />

<div class="12" style=" margin-left:0px;">
<div id="printableArea">
<div class="panel" style="border:<?php echo THEMECOLOR?> solid 1px; border-radius:0px;">
<div class="entry-head" >
<h4>View Sales Report
</div>
<p>&nbsp;</p>
<form name="form1" id="form1" method="post">
  <table width="100%" border="0" align="center">
   <!-- <tr>
      <td width="6%" height="49" nowrap="nowrap"><strong>From Date </strong></td>
      <td width="1%"><strong>:</strong></td>
      <td width="15%"><input name="s_date" type="text" class="tcal" id="s_date" readonly=""  value="<?=date('d-m-Y')?>"/></td>
      <td width="7%"><strong>To Date </strong></td>
      <td width="1%"><strong>:</strong></td>
      <td width="23%"><input name="end_date" type="text" class="tcal" id="end_date" readonly=""  value="<?=date('d-m-Y')?>" /></td>
    
      <td width="1%">&nbsp;</td>
      <td width="22%"><input type="submit" name="Search" value="Search" class="btn btn-info" /></td>
      </tr>-->
  </table>
</form>
<br />
<form method="post">
<?php 
if(isset($_POST["Search"]))
{
/*$s_date=$objIms->DateToInt($_POST["s_date"]);
$end_date=$objIms->DateToInt($_POST["end_date"]);
$client_name=$_POST["client_name"];
$whr1="id='$client_name'";
$get=$objIms->getRows('tbl_client',$whr1);*/
?>
     
            
		
            <?php 
				 //$sql_viewtmp="select * from view_sales_master where cancel_status=0 and stampdate>='$s_date'  and stampdate<='$end_date' order by id desc";
				 $sql_viewtmp="select * from view_sales_master where session_login_id = '".$_SESSION['login_id']."' and cancel_status='0' order by id desc";
				$res_viewtmp=mysql_query($sql_viewtmp);
				if(mysql_num_rows($res_viewtmp)>0)
				{ 
					$i=1;
					$sums=0;
					?>
					<div class="panel">
					<div class="panel-heading">Sales To 
					  <strong>
					  <?=$get["client_name"]?>
					  </strong>					</div>
					<p>&nbsp;</p>
                     <table width="100%" class="table table-bordered">
                     <tr height="32" align="left">
            <th nowrap="nowrap" width="6%">Si No</th>
            <th nowrap="nowrap" width="24%">Date </th>
            <th nowrap="nowrap" width="35%">Client Name</th>
           
            <th nowrap="nowrap" width="17%">Particulars </th>
			 <th nowrap="nowrap" width="17%">Amount </th>
            <th nowrap="nowrap" width="18%">View</th>
            </tr>
            <?php
			$sum=0;
				while($rows=mysql_fetch_assoc($res_viewtmp))
					{
						
						
						
						
							
							
			?>
           
            <tr height="32">
            <td nowrap="nowrap" width="6%"><?php echo $i++;?></td>
           
		    <td nowrap="nowrap" width="24%"><?php echo $objIms->IntToDate($rows["stampdate"]);?></td>
		    <td nowrap="nowrap" width="35%"><?php echo $rows["client_name"];?></td>
            
            <td nowrap="nowrap" width="17%"><?php echo $rows["sale_no"];?></td>
			<td nowrap="nowrap" width="17%"><?php  $sql_viewtmp1="select * from tbl_account where session_login_id = '".$_SESSION['login_id']."' and mas_id='". $rows["id"]."' and sales_type='Sales' and cancel_status ='0' order by id limit 1";
				$res_viewtmp1=mysql_query($sql_viewtmp1);
				$rows1=mysql_fetch_assoc($res_viewtmp1);
			$amount =	$rows1['actual_amt'];
			echo $amount;
				?></td>
            <td nowrap="nowrap" width="18%"><a onclick="PopupCenter('Salespopup_view.php?uid=<?php echo md5($rows["id"]);?>','xtf','1000','700');" style="cursor:pointer; text-decoration:none">View</a></td>
            </tr>   <?php 
			$sum +=$amount;
			
			}?>
			<tr><td colspan="4">Total amount</td>
			<td colspan="4"><?php echo $sum;?></td>
			</tr>
			
			
		</table>
			</div>
		</div>	
         
		   </div>
    <?php }
	else
	{
	echo '<span style="color:#FF0000">No Data Found</span>';
	}
	}?>
	
		

   
<p></p>
		<br />
       
</form>

</div>
</div>
<br />

<div align="center"><span class="btn btn-info" onClick="printDiv('printableArea')">Print</span></div>
<script>
$("input[name='r3']").click(function() {
    var status = $(this).val();
    if (status == 'Cheque') {
        $("#cheq_hide_header").show('slow');
		$("#cheq_hide").show('slow');
    } else {
		$("#cheq_hide").hide();
		$("#cheq_hide_header").hide('slow');
    }
});
</script>
</body>
</html>

