<?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;
}
include("opendb.php");
$cname=$_REQUEST[cname];
$invno=$_REQUEST[invno];
$dwnamt=$_REQUEST[dwnamt];
$brnchtp=$_REQUEST[brnchtp];

	
$tot_payment=0;
$outstanding=0;
$mri_cname = substr($cname,-9);
$mle_cname = substr($cname,0,5);


   $sql=mysqli_query($db,"select cramt from crnote where brcode='$brcode' and partic='$cname' and dbno='$invno'");
   $res=mysqli_fetch_array($sql);

    $adv=$res[0];


   if((mysqli_num_rows($sql)<=0)||($res[0]==''))
    {
      $adv=0; 
    }



 

?>
<input type='hidden' name='advamtnw' id='advamtnw' value='<? echo $adv ?>'>