<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
$dfrom=$_REQUEST[dfrom];
  ?>
    
     <script type="text/javascript" src="../scripts/jquery-latest.js"></script>
<link href="../css/form.css" type="text/css" rel="stylesheet" media="screen" />
    
    <table class='report'>
    <TR><TD COLSPAN=2 ALIGN=CENTER><b> PSN AUTOMOTIVE MARKETING P LTD </b><BR>
	 <?print $brrow[braddr].",".$brrow[brcity].",<br><u> PH - ".$brrow[brphone]?></u>
    TIN: <?print $brrow[tin]?>, CST: <?print $brrow[cstno]?>&nbsp;
    </td></tr>
   
    <tr><td COLSPAN=2 ALIGN=CENTER>
    <?print "<h4><br>CASH BALANCE AS ON ".datetohtml($dfrom);
    print "<tr><th>Branch</th><th>Manual Cash</th><th>System Cash</th><th>Variance</th><th>Br.InCharge Sign</th><th>Br.Acc.Sign</th><th>2000</th><th>500</th><th>200</th><th>100</th><th>50</th><th>20</th><th>10</th><th>Coins</th><th>Total</th><th>Short/ Excess</th><th>Remarks</th><th>Uploaded</th>";
    print "<form id='category' name='category' method='POST' action='updbal.php'>";
    $asres=mysqli_query($db,"select * from dailycash where asondate = '$dfrom'");
    $mbal=0;
    $i=1;
    while($asrow=mysqli_fetch_array($asres))
    {
        $slres=mysqli_query($db,"select id from dailycashupld where brcode='$asrow[1]' and date = '$asrow[5]'");
        $slrow=mysqli_fetch_array($slres);   
        $mphoto = "No";
        $mfile="";
        if($slrow[0]>0)
        {
            $mphoto = "Yes";
            $mfile  = "http://psnauto.in/amplcash/upldcash/$asrow[1]_$asrow[5].jpg";
        }
        print "<tr><td>$asrow[brname]</td><td>$asrow[phycashbal]</td><td>$asrow[syscashbal]</td><td>$asrow[variange]</td><td>$asrow[brinchrsign]</td><td>$asrow[braccsign]</td>";
        print "<td>$asrow[curr_2000]</td><td>$asrow[curr_500]</td><td>$asrow[curr_200]</td><td>$asrow[curr_100]</td>";
        print "<td>$asrow[curr_50]</td><td>$asrow[curr_20]</td>";
        print "<td>$asrow[curr_10]</td><td>$asrow[coins]</td><td>$asrow[curr_total]</td><td>$asrow[short_excess]</td><td>$asrow[remarks]</td><td>$mphoto";
        
        print "</td>";
        $i++;
    }
    ?>
    </td></tr>
    
    </table>
    </form>
 