<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{
include 'dbc.php';
$id=$_REQUEST["id"];
$month=$_POST["month"];
$subtypename=$_REQUEST["subtypename"];
$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$month = date("m",strtotime($month));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		
		
		 $my=$month_name . " " . $year;
		$sql5="SELECT * FROM chartofaccounts where acc_type='Cash' or acc_type='Bank' and user_id='$userid'";
$result5 = $conn->query($sql5);

?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
   <script>
function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[0];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>
</head>

<body>


    <!-- Left Panel -->

   <!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/receipt_menu.php") ?>

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                        <div class="card">
                            <div class="card-header"><strong>Sale Invoice </strong><small> Form</small></div>
                            <div class="card-body card-block">
							
							 <?php
include 'dbc.php';

$cname=$_REQUEST["cname"];
$userid=$_SESSION["userid"];
$from_date=$_POST["from_date"];
$to_date=$_POST["to_date"];

$sqlrec = "SELECT * FROM customer where user_id='$userid' and city='$cname' ORDER BY city";
$resultrec=$conn->query($sqlrec);
  
?>
                                <table id="myTable" class="table table-striped table-bordered">
                                    <thead>
									<?php
echo "<tr>";
echo "<th bgcolor=yellow> City Name </th>";
echo "<th bgcolor=yellow> Customer Name </th>";


echo "<th bgcolor=yellow> Date   </th>";
echo "<th bgcolor=yellow> Receipt Amount </th>";
echo "<th bgcolor=yellow> Cheque # </th>";
echo "<th bgcolor=yellow> Bank Details </th>";



echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
echo "<form name='form_update' method='post' action='Receipt_Cash_Against_Invoice.php'>\n";
while($students = $resultrec->fetch_assoc()) {

	echo '<tr>';
	echo "<td><h4>{$students['city']}<input type='hidden' name='city[$i]' value='{$students['city']}' /></h1></td>";
	echo "<td><h4>{$students['bname']}<input type='hidden' name='bname[$i]' value='{$students['bname']}' /></h1></td>";
	
	echo "<td><h4><input type='date' name='date[$i]' value='{$today}' /></h3></td>";
	echo "<td><h4><input type='text' name='sale_qty[$i]'  /></h3></td>";
	echo "<td><h4><input type='text' name='chequeno[$i]' /></h3></td>";
echo "<td><h4><input type='text' name='bankname[$i]'  /></h3></td>";
	
	

	 
	echo '</tr>';
	++$i;
}
?>
												
																
												<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">G/L Account</label></div>
                                                                    <div class="col-12 col-md-4">
                                                                        <select name="acc_name_dr" id="acc_name_dr" class="form-control">
                                                                            <?php
  while($user_data5=$result5->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data5['acc_name']; ?>"><? echo $user_data5["acc_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
                                                                    </div>
                                                                </div>
												
									
	
								
									<input type="text" id="myInput" onKeyUp="myFunction()" placeholder="Search for names.." title="Type in a name" class="form-control">
	
								
								
								
								
		
                                                    </div>
													<div class="card-footer">
                                                       <?php
echo '<tr>';
echo "<td><input type='submit' value='Receipt' /></td>";

echo '</tr>';
echo "</form>";
echo '</table>';
?>
                                                       
                                                    </div>
													
													
                                                </div>
                                            </div>

            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}

?>