<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

?>
<!--
<a href='../ledge.php' target='m'>Create Ledger</a>

<input type=button value='SHOW TB' onClick=document.location='trialb.php' style={font-weight:bold}> 

<p>&nbsp;</p>
-->
<style>
body,td{font-family:verdana;font-size:12;color:black;}
th{background-color:c1d799}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<script>

var cnamear=[];
var dcommar=[];
var modar=[];

function valid()
{
submitOK="true";
 if(document.f1.panno.value.length<=0)
 {
   submitOK="false";
   alert('Invalid PanNo.');
return false;

 }

 if(document.f1.cname.value.length<=0)
 {
   submitOK="false";
   alert('Invalid customer.');
return false;
 }

if(document.f1.amtpaid.value.length<=0)
 {
   submitOK="false";
   alert('Invalid Amount.');
return false;
 }

if(document.f1.tdsamt.value.length<=0)
 {
   submitOK="false";
   alert('Invalid Tdsamt.');
return false;
 }

 if(document.f1.section.value.length<=0)
 {
   submitOK="false";
   alert('Invalid Section.');
return false;
 }

 if(document.f1.branch1.value.length<=0)
 {
   submitOK="false";
   alert('Invalid Branch.');
return false;
 }

 calccr();
 calcdr();

 if(document.f1.tdamt.value!=document.f1.tcamt.value)
{
  {alert('Dr, Cr Amount mis-match'); submitOK="false";}
}

 if(document.f1.tdamt.value<=0)
{
  {alert('Invalid amount'); submitOK="false";}
}


if(submitOK=="true")
   return true;
  else
   return false;

  }

function getcname()
{ 

 document.f1.panno.value=dcommar[document.f1.cname.selectedIndex];
 document.f1.dcode.value=modar[document.f1.cname.selectedIndex];

}


function calc()
{
var taxper=parseFloat(document.f1.rate.value);
 tax=parseFloat(document.f1.amtpaid.value)*parseFloat(document.f1.rate.value)/100;
 document.f1.tdsamt.value=(tax).toFixed(2);
 }
</script>

</head>

<body>

<form name='f1' action='<?print $PHP_SELF?>' onSubmit="return valid()">


<?
include("../opendb.php");
include("../test.php");


if($sprint)
{ 

//***********************
$depodate=$y.'-'.$m.'-'.$d;
$sql="update tdstrans set bsrcode='$bsrcode',taxdepodt='$depodate',chequeno='$chequeno',challanno='$challan' where tdsno='$tdsno'";
mysqli_query($db,$sql) or die(mysqli_error());

log_entry($brcode,$user,$REMOTE_ADDR,"Tds entry- $tdsno");
print "<font color=green>Data has been posted</font><br>";

}


$rs=mysqli_query($db,"select * from tdstrans where brcode='$brcode' and tdsno='$tdsno' ")or die(mysqli_error());
 $p_row=mysqli_fetch_row($rs);
     $pno=$p_row[0];


?>
<table cellspacing=1 cellpadding=5 bgcolor=lightsteelblue>
<th colspan=8 style={background-color:lightsteelblue}><h3>TDS DETAILS</h3></th>
<tr><td>TDS No </td><td><input type=text readonly name='tdsno' value='<?print $pno?>' size=8 style={background-color:silver}></td><td>Branch</td><td><select name='branch1'>

<?
$empre1=mysqli_query($db,"select brname from br_master where brcode='$brcode' and brname='$p_row[19]'");

 while($emprow1=mysqli_fetch_row($empre1))
 {
  print "<option>$emprow1[0]</option>";
 }
?>
</select>
</td>
<td>Section</td><td><select name='section'>
<?
$empre=mysqli_query($db,"select corpname from section where branch='$brcode' and corpname='$p_row[7]'");

 while($emprow=mysqli_fetch_row($empre))
 {
  print "<option>$emprow[0]</option>";
 }
?>
</select>
</td>
</tr>

<?
$c=1;

$msres=mysqli_query($db,"select custname,acname,corporate from pan_master where custname='$p_row[2]'")or die('errr'.mysqli_error());
$msrow=mysqli_fetch_array($msres)


?>
</td>

<td>Customer</td><td><input type=text name='cname' value='<?print $msrow[0]?>' readonly size=10></td>
<td>PAN.NO</td><td><input type=text name='panno' value='<?print $msrow[1]?>'readonly size=10></td>
<td>Deductee Code</td><td><input type=text name='dcode' value='<?print $msrow[2]?>'readonly size=12></td></tr>
<tr><td>Principal Amount</td><td><input type=text name='amtpaid' value='<?print $p_row[4]?>'readonly size=12 onChange=calc()></td>
<td>TaxRate </td><td><input type=text name='rate' value='<?print $p_row[5]?>' size=12 value='2' readonly onChange=calc()></td>
<td>TDS Amount </td><td><input type=text name='tdsamt' value='<?print $p_row[6]?>' readonly size=12></td>
</tr>
<td>BSR Code </td><td><input type=text name='bsrcode' size=12 value='bsr0012'></td>
</tr><tr>
<td>ChallanNo </td><td><input type=text name='challan' value='<?print $p_row[20]?>' size=12 ></td>


<td>ChequeNo </td><td><input type=text name='chequeno' value='<?print $p_row[13]?>' size=12 ></td>
<td>Date(dd-mm-yyyy) </td><td><input type=text name='d' size=2 value='<?print date("d",time())?>'>
 <input type=text name='m' size=2 value='<?print date("m",time())?>'>
<input type=text name='y' size=4 value='<?print date("Y",time())?>'>
</td>
</tr>




</table>
<Hr><input type=submit value='    UPDATE    ' name='sprint'>
</form>

</body>
</html>
