<?php 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
include("../opendb.php");
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='inde.php'; </script>";
 return;
}

?>
<style>
td,th,body{font-size:14;font-family:'arial narrow';letter-spacing:1}
</style>
<title>PSN EICHER</title>  
    <script type="text/javascript" src="../scripts/jquery-latest.js"></script>
	<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<body background="../back_ground.jpg">
<br><br>
<center>
<table class="container"><tr><td>
<center>
<?
if(isset($_POST['show']))
{
    $fromdt = $_REQUEST['fromdt'];
    $todt = $_REQUEST['todt'];
    print "<table border = '1'>";
    print "<tr><th>Ref<th>Date</th><th>Bank<th>Details</th><th>Widrawals</th><th>Deposits</th><th>Balance<th>Claim Details";
    $invre=mysqli_query($db,"select id,date,partic,dramt,cramt,allocat_branch,jvno,entrydate,allocat_branch,type,no from psnindia_gen4psnauto_psn_psndb.upentry where brcode='PSN236' and date >= '$fromdt' and date <='$todt'");
    while($row=mysqli_fetch_array($invre))
    {
        print "<tr><td>$row[id]</td><td>$row[date]</td><td>$row[type]</td><td>$row[partic]</td><td align='right'>$row[dramt]</td><td align='right'>$row[cramt]</td><td>$row[no]</td><td align='center'>";
        if($row['jvno']>0)
        {
            $distext='Updated on '.$row['entrydate'].' '.$row['allocat_branch'];
            echo $distext;
            if(((strtolower($user)=='sreejith')&&($row['allocat_branch']=='PSN AUTOMOBILES PRIVATE LTD')) || ((strtolower($user)=='thomas')&&($row['allocat_branch']=='PSN AUTOMOBILES PRIVATE LTD')))
            {
                print "<input type=button value='Claim' name='claim' onclick='popupfn1($row[0])'> &nbsp&nbsp&nbsp";
            }
        }
        else
        {
            print "<input type=button value='Claim' name='claim' onclick='popupfn($row[0])'> &nbsp&nbsp&nbsp";
            print "<input type=button value='Delete' name='delete' onclick='popupfn_del($row[0])'>";
        }
        print "</td>";
    }
    print "</table>";
}
?>
<form action='<?Print $PHP_SELF?>' method='post'>
<table border=1 width=250 >
<tr bgcolor='green'><td colspan=2 align=center> <font color='white'>SELECT DATE FOR THE BANK STATEMENT</font></td></tr>
<tr><td>From</td><td><input type=date name=fromdt value='<?print date("Y-m-d",time());?>' size=3>
</td></tr>
<tr><td>To</td><td><input type=date name=todt value='<?print date("Y-m-d",time());?>' size=3>
</td></tr>
<tr><td colspan=2 align=center><input type=submit value='Show' name='show'></td></tr>
</table>
</form>
</td></tr></table>
<script>
function popupfn(str)
{
	window.open("showacdtls.php?recrdid="+str,'scrollbars=yes','menubar=0,resizable=1,width=950,height=950');	
}
function popupfn_del(str)
{
	window.open("acdtls_del.php?recrdid="+str,'scrollbars=yes','menubar=0,resizable=1,width=50,height=50');	
}
function popupfn1(str)
{
	window.open("showacdtls1.php?recrdid="+str,'scrollbars=yes','menubar=0,resizable=1,width=950,height=950');	
}
</script>
