<?php include("links/top.php");
$action=$_GET['action'];
?>
<?php
if($action=='delete'){
$id=$_GET['id'];

$del="delete from purchase_reports where id='$id'";
$DB->executeQuery($del);

header('Location:purchase_reports.php?action=list');
}
?>
<?php
if(isset($_POST['update'])){
$id=$_GET['id'];
extract($_POST);

$arr=array('delivery'  => $delivery,'updated' 	=> date('Y-m-d H:i:s'));
$DB->update('purchase_reports',$arr,"id='$id'");

header('Location: purchase_reports.php?action=list&oid='.$oid);
}
?>
		<div id="content">
			<div class="container">
				<div class="page-header">
					<div class="page-title">
						<h3>Purchase Reports Management</h3>
					</div>
				</div>
				<div class="row">

					<div class="col-md-12">
                     
					<div class="widget box">
                        <div class="widget-header">
                            <h4>Purchase Reports List</h4>
							</div>
                        <div class="widget-content">
                             <?php if($action=='list'){
								 $sno=1;
								$sel=executeQuery("select * from purchase_reports");
								?>

								<table class="table table-striped table-bordered table-hover table-checkable datatable">
									<thead>
										<tr>
											<!-- <th class="checkbox-column"><input type="checkbox" class="uniform"></th> -->
                                 <th>S.No</th>
								 <th>First Name</th>
                                 <th>Last Name</th>
                                 <th>Job Title</th>
                                 <th>Job Role</th>
                                 <th>Email</th>
                                 <th>Phone</th>
                                 <th>Company</th>
                                 <th>Country</th>
                                 <th>Organization</th>
                                 <th>Date</th>
										</tr>
									</thead>
									<tbody>
                                    <?php
								  $sno=1;
								 while($rec=getAssoc($sel)){
								 	
								 	?>
										<tr>
											<!--<td class="checkbox-column"><input type="checkbox" class="uniform"></td>-->
                                 <td><?php echo $sno;?></td>
                                 <td><?php echo $rec['fname'];?></td>
                                 <td><?php echo $rec['lname'];?></td>
                                 <td><?php echo $rec['jtitle'];?></td>
                                 <td><?php echo $rec['jrole'];?></td>
                                 <td><?php echo $rec['email'];?></td>
                                  <td><?php echo $rec['phone'];?></td>
                                   <td><?php echo $rec['company'];?></td>
                                   <td><?php echo $rec['country'];?></td>
                                    <td><?php echo $rec['organization'];?></td>
                                    
                                       <td><?php echo $rec['now'];?></td>
										</tr>
                                        <?php $sno++;}?>
									</tbody>
								</table>

                            <?php }?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
	<?php include("links/bottom.php");?>