<?php include("../../include/dbconnect.php");?>
<title>Invoice Payment Entry</title>
<body background = 'blater01.gif'  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font ><b>Invoice Payment Details</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>

<?php 
foreach($_POST as $p=>$t)
{
	$_POST[$p] = trim($t);
}
$myCustomer = $_POST['Customer'];
?>
<table border=0 cellpadding=3 cellspacing=4 width="590">
<form name='myForm02' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
<tr><td >
<font class="sbd"><b>Select  Company</b></font>
</td>
<td colspan=2>
<select name= seller>
<?php $query="select distinct compcode,name from company order by name ";
      $query=stripslashes($query);
      $result=mysql_query($query) or
      die( mysql_error() );
      
      while ( $row= mysql_fetch_row($result))
      {
          echo "<option value='$row[0]'>";
	  echo $row[1];
	  echo "\n";
      }
?>
</select>
</td></tr>
<?php
$result=mysql_query("select bcode,name,unit from buy order by name") or die(mysql_error());
?> 
  <tr> 
    <td nowrap ><font class="sbd"><b>Cusomter Name </b></font></td>
    <td width="418">   <SELECT name='Customer' onChange="javascript:submit();">
<?php	
while($row = mysql_fetch_row($result))
{
if(isset($myCustomer) && eregi("$myCustomer", $row[0]))
  {
    $temp = $row[1].'&nbsp; '.$row[2];
	echo "<option selected value=\"$row[0]\">$temp";
  }
  else
  {
       $temp = $row[1].'&nbsp; '.$row[2];
       echo "<option value=\"$row[0]\">$temp";      
  }
}
echo "</select>";
//echo "$Customer";
?>

</SELECT>
</td>
</form>

<form name='myForm03' method='POST' action="vinod.php">

<tr><td nowrap ><font class="sbd"><b>Select Bank A/c</b></font></td>
<td colspan=2>
<select name=accno>
<?php $bkquery=" select distinct bankcode, accno from bankacc ";
      $result=mysql_query($bkquery) or die( mysql_error() );
	  	  echo "<option selected value=' '> Select Bank Account";
      while ( $row= mysql_fetch_row($result))
      {
	  	$temp = $row[0].'&nbsp;&nbsp;Acc No:'.$row[1];
          echo "<option value='$row[1]'>$temp";
         
	  echo "\n";	  
      }
?>
</select>  
</td></tr>

<?php
$custQuery=mysql_query("select record,invno,date,dbamt from custledger where bcode= '$myCustomer' and paystatus='No' ") or die(mysql_error());
?>
<tr> 
    <td nowrap ><font class="sbd"><b>Invoice Details</b></font></td>
    <td> <SELECT name='invno[]' multiple size="5" multiple >
<?php
     echo "<option selected value=\" 0\"> Select Invoice No";
    while($row = mysql_fetch_row($custQuery))
    {
			$temp = 'Inv No'.$row[1].'&nbsp;Dt&nbsp;'.$row[2].'&nbsp;Amt:&nbsp;'.$row[3];
            echo "<option value=\"$row[0]\">$temp";        
    }
?>
    </SELECT>
    </td>
  </tr>
  <td nowrap></div>

<tr> 
    <td nowrap ><font class="sbd"><b>Mode of Payment</b></font></td>
    <td> <select name="paymode">
 <option selected>Select Payment Mode</option>
 <option>Cheque</option>
 <option>DD</option>
 <option>Cash</option>
 </select></td>
</tr>

<?php
 $mycount = count($invno);	
?> 
<?php
$bankQuery=mysql_query("select bankcode, bankname from bank order by bankname") or die(mysql_error());
?>

<tr> 
     <td nowrap ><font class="sbd"><b>Select Bank</b></font></td>
    <td> <SELECT name='bankno[]' >
<?php
    echo "<option selected value=\" 0\"> Select Bank Name No";
    while($row = mysql_fetch_row($bankQuery))
    {
	 $temp = $row[1];
     echo "<option value=\"$row[0]\">$temp";       
	 }
?>
    </SELECT>
</td>
</tr>
<tr>
<td nowrap> <font class="sbd"><b>Cheque / DD No</b></font></td>
<td><input name="chequeno" type="text" onKeyPress="return event.keyCode!=13" size="10" maxlength="10"></td></tr>


<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>

<? // echo $sdt;
if(empty($sdt))
{
  $sdt=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
}?>
<tr>
<td nowrap> 
<font class="sbd"><b>Cheque / DD Date</b></font></td>
<td>
<INPUT NAME="sdt" TYPE="text" class="text_box_button" VALUE="<?=$sdt?>" SIZE="15" readonly  >
 <A HREF="#" onClick="cal.select(document.myForm03.sdt,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> <BR>
 </td>
</tr>

<tr>
<td nowrap> <font class="sbd"><b>Cheque / DD Amount</b></font></td>
<td><input name="chequeamt" type="text" onKeyPress="return event.keyCode!=13"value= 0.00 size="10" maxlength="10"></td></tr>


<? if(empty($ddt))
{
  $ddt=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
}?>
<tr>
<td nowrap> 
<font class="sbd"><b>Deposit Date</b></font></td>
<td>
<INPUT NAME="ddt" TYPE="text" class="text_box_button" VALUE="<?=$ddt?>" SIZE="15" readonly  >
 <A HREF="#" onClick="cal.select(document.myForm03.ddt,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> <BR>
 </td>
</tr>


<? if(empty($rdt))
{
  $rdt=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
}?>
<tr>
<td nowrap> 
<font class="sbd"><b>Received Date</b></font></td>
<td>
<INPUT NAME="rdt" TYPE="text" class="text_box_button" VALUE="<?=$rdt?>" SIZE="15" readonly  >
 <A HREF="#" onClick="cal.select(document.myForm03.rdt,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> <BR>
 </td>
</tr>



<tr>
<td nowrap> <font class="sbd"><b>Customer Ledger</b></font></td>
<td><input type="checkbox" name="Party_Ledger" value="Yes" CHECKED></td></tr>
<tr>
<td nowrap> <font class="sbd"><b>Bank Ledger</b></font></td>
<td><input type="checkbox" name="Bank_Ledger" value="Yes" CHECKED></td>
</tr>


<table cellpading=0 cellspacing=10 width= 50>
<tr>
<td><div align="center">
  <input type =submit name="submit" value = "Submit" >
</div></td>
</tr>

</table>
</table>
<br><br><font size=1><center><a href= "../../index.html">Return to index page</center></font>