<?php
include('../headertop.php');
//include('../datepicker.php');
include('../db.php');

$disp = '';
$pagetitle = 'Construction Expenses Bulk Entries';
//$disp .=' <div class="col-md-6">';

$q = "select * from project where type='ct'";
$res = mysqli_query($dbcon,$q) or die(mysqli_error($dbcon,$q));
if(mysqli_num_rows($res)<1)
{
$disp .= 'No projects. First create a project';
include('../template.php');
exit;
}

if(isset($_REQUEST['sm']))
$disp .= '<div class="smdiv">'.$_REQUEST['sm'].'</div>';
else
$disp .= '<div class="smdiv">Add Bulk Construction Expenses</div>';

$disp .='<form role="form" id="bulkexpense" method="post" action="bulkexpense2.php" enctype="multipart/form-data" >
                                    <div class="row">
                                <div class="col-md-6">
                                    <h3>Fill all required fields(*) and click Submit</h3>
									
									<div id="photo" style="margin-bottom:15px">
											
											</div>
                                    
                                        <div class="form-group">
                                            <label>Project Name *</label>
                                            <select id="project" name="project" data-validation="required" class="form-control" />
											<option value=""></option>';
											
							while($row = mysqli_fetch_array($res))
	{
	$disp .= '<option value="'.$row['id'].'">'.$row['project_name'].'</option>';
	}	
						
											
		$disp .= '</select></div>
                                       <div class="form-group" >
                                            <label> Upload CSV File *</label>
                                           <input type="file"  class="form-control" name="csvfile" data-validation="required"    />
                                        </div>
									   
									   </div>
										
										<div class="col-md-9" style="text-align:center"><button type="submit" class="btn btn-primary" name="bulkexpensesubmit">Submit Button</button>
                                        
										</form></div>
                                    </div>';
									
									
                                    ?>
                                    <script>
                                    $.validate({
  form : '#bulkexpense'
});
</script>


<script>
		$(function() {
		
			$("#project").change(function() {
				//$("#text-two").load("textdata/" + $(this).val() + ".txt");
				$("#photo").load("getphoto.php?choice=" + $("#project").val());
			});
			
			

		});
		
		
		
	</script>
    
    <?php
	include('../template.php');
	include('../header.php');
	?>			
								
