<!doctype html>
<html class="no-js" lang="zxx">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>NWP ENGINEERING DEPARTMENT - SRI LANKA</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<!-- Google Fonts -->
<link href="css/fonts.css" rel="stylesheet">
<!-- Bootstrap
<link rel="stylesheet" href="css/assets/bootstrap.min.css">
<!-- Fontawesome Icon -->
<link rel="stylesheet" href="css/assets/font-awesome.min.css">
<!-- Animate CSS -->
<link rel="stylesheet" href="css/assets/animate.css">
<!-- Mean Menu -->
<link rel="stylesheet" href="css/assets/meanmenu.min.css">
<!-- Owl Carousel -->
<link rel="stylesheet" href="css/assets/owl.carousel.min.css">
<!-- Magnific Popup -->
<link rel="stylesheet" href="css/assets/magnific-popup.css">
<!-- Custom Style -->
<link rel="stylesheet" href="css/assets/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/assets/responsive.css">
<link rel="stylesheet" href="backend/bootstrap/css/bootstrap.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="backend/plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="backend/dist/css/AdminLTE.min.css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-69018766-3"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-69018766-3');
</script>
<style>
@media screen and (max-width: 767px) {
.table-responsive {
	margin-bottom: 0;
	border: none;
}
.tbl {
	padding: 12px !important;
}
}
.tbl {
	padding: 25px;
	border: 1px solid #d9d9d9;
}
.reg_list {
	padding: 0px 0 20px;
}
</style>
</head>
<body>
<!-- Pre-Loader -->
<div id="page-preloader"><span class="spinner"></span></div>
<!-- End Pre-Loader --> 

<!-- Top Bar -->
<?php 
include 'common/top-bar.php';
include 'common/mobile-menu.php';
?>
<!-- End Top Bar --> 

<!-- Page Heading -->
<section class="p-heading text-center">
  <div class="container">
    <div class="page-bg">
      <div class="row">
        <div class="col-md-12">
          <div class="p-content">
            <h4>
              <?php if($lang == 1) { ?>
              	PROCUREMENT PLAN
              <?php } if($lang == 2) { ?>
       ප්‍රසම්පාදන සැලැස්ම
              <?php } if($lang == 3) { ?>
             கொள்முதல் திட்டம்
              <?php } ?>
            </h4>
            <ul class="list-unstyled list-inline">
              <li class="list-inline-item"><a href="home">
                <?php if($lang == 1) { ?>
                Home
                <?php } if($lang == 2) { ?>
                මුල් පිටුව
                <?php } if($lang == 3) { ?>
                முகப்பு
                <?php } ?>
                </a>
              </li>
              <li class="list-inline-item"><i class="fa fa-long-arrow-right" aria-hidden="true"></i>
                <?php if($lang == 1) { ?>
                	Procurement Plan
                <?php } if($lang == 2) { ?>
                ප්‍රසම්පාදන සැලැස්ම
                <?php } if($lang == 3) { ?>
               கொள்முதல் திட்டம்
                <?php } ?>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>
<!-- End Page Heading -->

<section class="reg_list">
  <div class="container">
    <div class="row">
      <div class="col-lg-12 col-md-12">
        <div class="tbl">
		  
		  <div class="row">
            <div class="col-lg-12 col-md-12">
              <form class="form-horizontal" name="form" id="form">
                <div class="form-group">
                  <div class="col-md-5 col-sm-5">
				  <label for="inputEmail3" class="col-sm-3 control-label">Select Year:</label>
                  <div class="col-sm-9">
                    <select class="form-control" name="year" id="year">
                      <option value=""></option>
                      <option value="2016">2016</option>
                      <option value="2017">2017</option>
                      <option value="2018" selected>2018</option>
                      <option value="2019">2019</option>
                      <option value="2020">2020</option>
                    </select>
                  </div>
                  </div>
				  <div class="col-md-7 col-sm-7">
				  <label for="inputEmail3" class="col-sm-5 control-label">Select Project Type:</label>
                  <div class="col-sm-7">
                    <select class="form-control" name="pro_type" id="pro_type" onChange="formHandler($(this).val())">
                      	<option value=""></option>
						<?php 
						$sql="SELECT * FROM project_type ORDER BY type ASC";
						$result=mysqli_query($conn, $sql);
						while ($row = mysqli_fetch_array($result)){ ?>
						<option value="<?php echo $row['id']; ?>"><?php echo $row['type']; ?></option>
						<?php } ?>
                    </select>
                  </div>
                  </div>
                </div>
              </form>
            </div>
          </div>
          <hr>
		  
			<?php 
			  if(isset($_GET['year']) && isset($_GET['type'])) {
				$type = htmlspecialchars(strip_tags(trim($_GET['type'])), ENT_QUOTES, 'UTF-8');
				$year = htmlspecialchars(strip_tags(trim($_GET['year'])), ENT_QUOTES, 'UTF-8');
				
				$st = "AND procurement_plan.pro_type = '$type'";
			  
			  } else {
				$year = date('Y'); 
				$st = '';
			  } 
			?>         
		  <div class="row">
            <div class="col-lg-12 col-md-12">
              <h4>PROCUREMENT PLAN - YEAR <?php echo $year; ?>
              <?php if(isset($_GET['type'])) { $sql_ty = mysqli_fetch_assoc(mysqli_query($conn, "SELECT type FROM project_type WHERE id='$type'"));echo ' ('.$sql_ty['type'].')'; } ?></h4>
            </div>
          </div>
		  <hr>		  
		  
          <div class="table-responsive">
        <table id="tabl_reg" class="table table-bordered table-striped">
          <thead>
            <tr>
            	<th>Ref. No</th>
              	<th>Description</th>
              	<th>Proc. Method</th>
              	<th>Status</th>
              	<th>Prep. Bidding Documents</th>
              	<th>App. Bidding Documents</th>
              	<th>Invite Bids</th>
              	<th>Bid Received/Opening</th>
              	<th>TEC Eva.</th>
              	<th>PC Approval</th>
              	<th>Issue Letter of Accept</th>
              	<th>Con Signed</th>
              	<th>Completion Period (Days)</th>
              	<th>Contract No/Amount/Name of the Contractor</th>
              	<th>Remarks</th>
            </tr>
          </thead>
          <tbody>
            <?php 
            $sql="SELECT
projects_reg.pro_name,
procurement_plan.pro_method,
procurement_plan.pro_st,
procurement_plan.bid_prep,
procurement_plan.bid_app,
procurement_plan.bid_invite,
procurement_plan.bid_open,
procurement_plan.TEC_eval,
procurement_plan.pc_app,
procurement_plan.issue_letter,
procurement_plan.con_sign,
procurement_plan.com_period,
procurement_plan.con_details,
procurement_plan.remarks
FROM
procurement_plan
Inner Join projects_reg ON procurement_plan.project = projects_reg.id
WHERE
procurement_plan.`year` =  '$year' ".$st;

              $result=mysqli_query($conn, $sql);
              $x = 0;
              while ($row = mysqli_fetch_array($result)){ $x++;
            ?>
            <tr>
              <td><?php echo $x; ?></td>
              <td><?php echo $row['pro_name']; ?></td>
              <td><?php echo $row['pro_method']; ?></td>
              <td><?php echo $row['pro_st']; ?></td>
              <td><?php echo $row['bid_prep']; ?></td>
              <td><?php echo $row['bid_app']; ?></td>
              <td><?php echo $row['bid_invite']; ?></td>
              <td><?php echo $row['bid_open']; ?></td>
              <td><?php echo $row['TEC_eval']; ?></td>
              <td><?php echo $row['pc_app']; ?></td>
              <td><?php echo $row['issue_letter']; ?></td>
              <td><?php echo $row['con_sign']; ?></td>
              <td><?php echo $row['com_period']; ?></td>
              <td><?php echo $row['con_details']; ?></td>
              <td><?php echo $row['remarks']; ?></td>
            </tr>
            <?php  } ?>
          </tbody>
        </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

<!-- Footer -->
<?php include 'common/footer.php'; ?>
<!-- End Footer --> 

<!-- =========================================
JavaScript Files
========================================== --> 

<!-- jQuery JS --> 
<script src="js/assets/vendor/jquery-1.12.4.min.js"></script> 
<!-- Poppers Js --> 
<script src="js/assets/popper.js"></script> 
<!-- Bootstrap 
<script src="js/assets/bootstrap.min.js"></script> 
<!-- Sticky Js --> 
<script src="js/assets/jquery.sticky.js"></script> 
<!-- WOW JS --> 
<script src="js/assets/wow.min.js"></script> 
<!-- Smooth Scroll --> 
<script src="js/assets/smooth-scroll.js"></script> 
<!-- Mean Menu --> 
<script src="js/assets/jquery.meanmenu.min.js"></script> 
<!-- News Ticker --> 
<script src="js/assets/jquery.newsticker.min.js"></script> 
<!-- Owl Carousel --> 
<script src="js/assets/owl.carousel.min.js"></script> 
<!-- Magnific Popup --> 
<script src="js/assets/jquery.magnific-popup.min.js"></script> 
<!-- Syotimer --> 
<script src="js/assets/jquery.syotimer.min.js"></script> 
<!-- Custom JS --> 
<script src="js/plugins.js"></script> 
<script src="js/custom.js"></script> 

<!-- Bootstrap 3.3.5 --> 
<script src="backend/bootstrap/js/bootstrap.min.js"></script> 
<!-- DataTables --> 
<script src="backend/plugins/datatables/jquery.dataTables.min.js"></script> 
<script src="backend/plugins/datatables/dataTables.bootstrap.min.js"></script>  

<script src='js/pdf_export/dataTables.buttons.min.js'></script> 
<script src='js/pdf_export/buttons.html5.min.js'></script> 
<script src='js/pdf_export/buttons.bootstrap.min.js'></script> 
<script src='js/pdf_export/jszip.min.js'></script> 
<script src='js/pdf_export/pdfmake.min.js'></script> 
<script src='js/pdf_export/vfs_fonts.js'></script> 
<script src="js/pdf_export/pdf_export_procum.js"></script> 

<script>
$(function () {
  $("#tabl_reg").DataTable();
});

function formHandler(id){
  var year = $('#year').val();
  window.location.href = 'procurement-plan?type='+id+'&year='+year;
}

</script>

</body>
</html>