<?php 
session_start();
ob_start(); 
include "header.php";
//$objIms->Semifinisheditem_alter();
?>
<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">
window.addEventListener("keyup", function(e){ if(e.keyCode == 27) history.back(); }, false);

</script>
<style type="text/css">
    
    
        tr:hover {background-color:#bcd1cd;}

</style>

      <div class="page-wrapper">
            <!-- Container fluid  -->
            <div class="container-fluid">
                <!-- Start Page Content -->
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body" id="printableArea">
 

<form method="post">

					<div class="panel">
					<div class="panel-heading" style="font-style: bold"><h3>DayBook Details </h3></div>
					<p>&nbsp;</p>
          

          
          <table class="table">
          <tr height="32" align="right" style="background-color: skyblue;">
          <th nowrap="nowrap" width="10%" style="border: 0px; text-align: right;margin-left: 20px;"><span>From Date</span></th>
          <th nowrap="nowrap" width="20%" style="border: 0px"><input type="date" name="str_date" id="str_date" class="form-control" ></th>
          <th nowrap="nowrap" width="10%" style="border: 0px"><span >To Date</span></th>
          <th nowrap="nowrap" width="40%" style="border: 0px; float: left;"><input type="date" name="end_date" id="end_date" class="form-control"></th>
          

          <th nowrap="nowrap" width="20%" style="border: 0px"><input type="submit" name="Search"  value="Search" class="btn btn-info" style="float: right;"></th>
          </tr>
          </table>
          <br><br><br>
         <table width="100%" class="table table-bordered">
           <tr height="32" align="left">
            <th nowrap="nowrap" width="6%">S No</th>
            <th nowrap="nowrap" width="24%"> Date </th>
            <th nowrap="nowrap" width="35%">Particular</th>
           
            <th nowrap="nowrap" width="17%">Order No </th>
			      <th nowrap="nowrap" width="17%">Dr Amount</th>
            <th nowrap="nowrap" width="17%">Cr Amount</th>

          </tr>
<?php
if(isset($_POST["Search"])){
  $sdt = date('d-m-Y', strtotime($_POST["str_date"]));
  $s_date=$objIms->DateToInt($sdt);
  $edt = date('d-m-Y', strtotime($_POST["end_date"]));
  $end_date=$objIms->DateToInt($edt);

echo $sql_search = "SELECT * FROM tbl_account where session_login_id = '".$_SESSION['login_id']."' and trans_date >= '$s_date' and trans_date<='$end_date' ORDER BY `sales_type` ASC";
$i;
$res_search = mysql_query($sql_search);
while($rows = mysql_fetch_assoc($res_search)){
$i++;
  $trans_date2  =$objIms->IntToDate($rows["trans_date"]);
  $sales_type2  = $rows["sales_type"];
  $Dr_amt2 = $rows["Dr_Amt"];
  $Cr_amt2 = $rows["Cr_Amt"];

  $mas_id2 = $rows["mas_id"];
?>
       
            <tr height="32">
            <td nowrap="nowrap" width="6%"><?php echo $i; ?></td>
           
		         <td nowrap="nowrap" width="24%"><?php echo $trans_date2;  ?></td>
		    <td nowrap="nowrap" width="35%"><?php echo $sales_type2; ?></td>
            
            <td nowrap="nowrap" width="17%"><?php echo $mas_id2; ?></td>
            <td nowrap="nowrap" width="17%"><?php echo $Dr_amt2; ?></td>	
            <td nowrap="nowrap" width="17%"><?php echo $Cr_amt2; ?></td> 

	<?php	} ?>	
			</tr>
<?php
}else{
$abc=date('d-m-Y');
$curr_date  = $objIms->DateToInt($abc);

 $sql = "SELECT * FROM tbl_account where trans_date = '$curr_date' and session_login_id = '".$_SESSION['login_id']."' ORDER BY `sales_type` ASC";
$i;
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res)){
$i++;
  $trans_date1  =$objIms->IntToDate($row["trans_date"]);
  $sales_type  = $row["sales_type"];
  $Dr_amt = $row["Dr_Amt"];
  $Cr_amt = $row["Cr_Amt"];

  $mas_id = $row["mas_id"];
?>
  <tr height="32">
            <td nowrap="nowrap" width="6%"><?php echo $i; ?></td>
           
             <td nowrap="nowrap" width="24%"><?php echo $trans_date1;  ?></td>
        <td nowrap="nowrap" width="35%"><?php echo $sales_type; ?></td>
            
            <td nowrap="nowrap" width="17%"><?php echo $mas_id; ?></td>
            <td nowrap="nowrap" width="17%"><?php echo $Dr_amt; ?></td> 
            <td nowrap="nowrap" width="17%"><?php echo $Cr_amt; ?></td> 

  <?php } } ?>  
      </tr>
	
	 </table>
		<br />
     </form>
  

</div>
<br />

<div align="center"><span class="btn btn-info" onClick="printDiv('printableArea')">Print</span></div>

  </div>
                        </div>
                    </div>
                </div>
                <!-- End PAge Content -->
            </div>
            <!-- End Container fluid  -->
<?php include 'footer.php' ?>
 <script src="../js/lib/datatables/datatables.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/dataTables.buttons.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.flash.min.js"></script>
    <script src="../js/lib/datatables/cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
    <script src="../js/lib/datatables/cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
    <script src="../js/lib/datatables/cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.html5.min.js"></script>
    <script src="../js/lib/datatables/cdn.datatables.net/buttons/1.2.2/js/buttons.print.min.js"></script>
    <script src="../js/lib/datatables/datatables-init.js"></script>

