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



<?php

if(isset($_GET["uid"]))
{
$uid=$_GET["uid"];
$rs=$objIms->getRows("view_purchase_supplier","md5(id)='$uid' and session_login_id = '".$_SESSION['login_id']."'");
$pur_id=$rs["id"];
$order_no=$rs["order_no"];
$purchase_date=$objIms->IntToDate($rs["purchase_date"]);
$supplier_name=$rs["supplier_name"];

}


	
?>


		
	
		 <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>

<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">
$(function(){
    $('button').click(function(){
        var url='data:application/vnd.ms-excel,' + encodeURIComponent($('#tableWrap').html()) 
        location.href=url
        return false
    })
})
</script>
<!-- Page wrapper  -->
        <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">
							
							<h3>Account Report</h3><hr />
<form name="form1" id="form1" method="post">
  <table width="100%" border="0" align="center">
    <tr>
      <!--<td width="10%" height="49" nowrap="nowrap"><strong>From Date </strong></td>
      <td width="1%"><strong>:</strong></td>
      <td width="25%"><input name="s_date" type="text" class="tcal" id="s_date" readonly=""  value="<?=date('d-m-Y')?>"/></td>-->
      <td width="13%"><strong>To Date </strong></td>
      <td width="3%"><strong>:</strong></td>
      <td width="21%"><input name="end_date" type="date" class="tcal form-control" id="end_date"    value="<?=date('d-m-Y')?>" /></td>
	  <td width="13%" align="center"><strong>Bank</strong> </td>
		  <td width="3%"><strong>:</strong></td>
		  <td><select name="bank" id="bank"   class="required form-control" required>
     
      <?php 
							$sqlc="select * from tbl_bank_detail where session_login_id = '".$_SESSION['login_id']."'";
							//echo $sqlc;
							$c=mysql_query($sqlc);
							if(mysql_num_rows($c)>0){
							while($cs=mysql_fetch_array($c))
							{?>
      <option value="<?=$cs["id"];?>" >
      <?=$cs["bank_name"];?> (AC/NO:  <?=$cs["acc_no"];?>)
      </option>
      <?php }}?>
    </select></td>
      <td width="3%">&nbsp;</td>
      <td width="24%"><input type="submit" name="Search" value="Search" class="btn btn-info" /></td>
	  
      </tr>
  </table>
</form>
<br />
<div id="tableWrap">
<div id="printableArea">
<?php 
if(isset($_POST["Search"]))
{
//$s_date=$objIms->DateToInt($_POST["s_date"]);
$end_date=$objIms->DateToInt($_POST["end_date"]);
$bank = $_REQUEST['bank'];
?>
     
            
		
            <?php 
			$pur_amt =0;
			$pur_paid=0;
			$sl_amt=0;
			$sl_paid=0;
			$amt_add_to_bank=0;
			$exp_amt=0;
			$transfer_amount=0;
			
			 $sql_viewtmp111="select * from tbl_bank_detail where id = '$bank' and session_login_id = '".$_SESSION['login_id']."'";
				$res_viewtmp111=mysql_query($sql_viewtmp111);
				$rows111=mysql_fetch_assoc($res_viewtmp111);


			$sql_repo="select * from tbl_bank where bankdet_id='$bank' and session_login_id = '".$_SESSION['login_id']."'";
			$res_repo=mysql_query($sql_repo);		
					?>
					<div class="panel">
					<div class="panel-heading"></div>
					<p>&nbsp;</p>
					<form method="post">
                     <table width="100%" class="table table-bordered">
					
                     <tr height="32" align="left">
            <th nowrap="nowrap" width="6%">SL No</th>
            <th nowrap="nowrap" width="24%">Transaction Date </th>
            <th nowrap="nowrap" width="35%">Head</th>
            
            <th nowrap="nowrap" width="18%">Total Amount</th>
            <th nowrap="nowrap" width="18%">Invest Amount</th>
            </tr>
            <?php
				while($rows=mysql_fetch_assoc($res_repo))
					{
						$i++;
					 $row_id=$rows["id"];
					 $row_head=$rows["head"];
					 $row_debit=$rows["debit"];
					  $row_credit=$rows["credit"];
					   $row_date=$rows["stampdate"];
					
						
						
						
			?>
           
            <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 $row_head;  ?></td>
		  
           
            <td nowrap="nowrap" width="18%"><?php echo $row_debit; $debit_amt+=$row_debit?></td>	
            <td nowrap="nowrap" width="18%"><?php echo $row_credit; $credit_amt+=$row_credit ?></td>

            </tr>
           
				
		<?php  }  ?>	

			 <tr height="30">
			
              <td colspan="3" nowrap="nowrap"><div align="right"><strong>Closing Balance</strong></div></td>
             
              <td nowrap="nowrap"><?php $cl_blnc = ($debit_amt)-($credit_amt); echo number_format($cl_blnc,2);?><input type="hidden" name="cl_bln" value="<?php echo $cl_blnc;?>"></td>
            </tr>


<!-- 			<tr>
     
      <td width="13%"><strong>Closing Date </strong></td>
      <td width="3%"><strong>:</strong></td>
      <td width="21%"><input name="cls_date" type="date" class="tcal form-control" id="cls_date" value="<?=date('d-m-Y')?>" /></td>
	  <td> <input type="submit" name="save" value="save and close" class="btn btn-info" /></td>
	  </tr> -->
           </table>
		  
		   </form>
		   </div>
    <?php }
	?>
	
		

        

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

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