<?php
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
    print "<script> alert('Session timed out'); parent.document.location='index.php'; </script>";
    return;
}
$cname=$_REQUEST['cname'];
$debitamt=$_REQUEST['debitamt'];
include("opendb.php");
if($debitamt>0)
{
   $sq=mysqli_query($db,"select jvno,partic from journal2 where brcode='$brcode' and partic='$cname' and cramt='$debitamt' and j_type='BR' order by jvno desc");   
}
else
{
$sq=mysqli_query($db,"select jvno,partic from journal2 where brcode='$brcode' and partic='$cname' and j_type='BR' order by jvno desc");  
}
print "<option value='select'>-select-</option>";
while($rw=mysqli_fetch_array($sq))
{
        ?>
        <option value='<? echo $rw[0] ?>'><? echo $rw[0] ?></option>
        <?
}
?>