<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start();
$ver = $_SESSION['distributor_user_id'];
$user_role= $_SESSION['user_role'];  
if(!isset($_SESSION["distributor_user_id"])){
   header('location:https://tarkashcorp.appexperts.net/index.php');
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
      <?php include("link_head.php");?>  
    <!-- END HEAD -->

<!--  <style>
		::-webkit-scrollbar {
			display: none;
			overflow: hidden;
		}
	  </style>
<!--  <script>
		window.onscroll = function () {
		window.scrollTo(0,0);
		}
	  </script>-->
	  
	</head>
    <body class="" onload="changecolor8();">
        <!-- BEGIN HEADER -->
		<?php include("header.php");?>
        <!-- END HEADER -->
		
        <!-- BEGIN CONTAINER -->
        <div class="container-fluid">
            <div class="page-content page-content-popup" style="margin-top:18px; max-height:542px;">
                <div class="page-content-fixed-header">
                    <!-- BEGIN BREADCRUMBS 
                    <ul class="page-breadcrumb">
                        <li>
                            <a href="#">Dashboard</a>
                        </li>
                        <li>Admin Dashboard</li>
                    </ul>
                    <!-- END BREADCRUMBS -->  
                </div>
                <div class="page-sidebar-wrapper">
                    <!-- BEGIN SIDEBAR -->
                    <?php include("menu.php");?> 
				    <!-- END SIDEBAR -->
                </div>
				
				<?php
				
						date_default_timezone_set('Asia/Calcutta');
						$cdate1  = date("Y-m-d");
						
						if(isset($_POST['searchd']))
						{
							$txn_date_from=$_POST['txn_date_from'];
							$txn_date_to=$_POST['txn_date_to'];
							
							$res ="select * from tbl_master_customer,tbl_transaction where tbl_transaction.customer_id=tbl_master_customer.customer_id and tbl_master_customer.distributor_id='$ver' && tbl_transaction.transaction_status='Reject'";
							
							if($txn_date_from!="")
							{
							 $res=$res." && tbl_transaction.cancel_date>='$txn_date_from' && tbl_transaction.cancel_date<='$txn_date_to'";	
							}
							$res = mysqli_query($con,$res);							
						}
						else
						{  
							$res = mysqli_query($con,"select * from tbl_master_customer,tbl_transaction where tbl_transaction.customer_id=tbl_master_customer.customer_id and tbl_master_customer.distributor_id='$ver' && tbl_transaction.transaction_status='Reject' and tbl_transaction.cancel_date='$cdate1'");
						}
					?> 
					
                <div class="page-fixed-main-content" style="margin-bottom:-10px;">
					<div class="row">
						<div class="col-md-12">
							<!-- BEGIN SAMPLE TABLE PORTLET-->
							<div class="portlet">
							
							<div class="portlet-title" style="padding:0; margin:0;">
							  <div class="col-md-4" style="padding:0px;">
							   <span style="font-size:16px; font-weight:600;"><i class="fa fa-bell-o"></i>&nbsp; All Rejected Orders</span>
							 </div>
							 <div class="col-md-8" style="padding:0; margin:0;">
							 <div class="col-md-3" style="padding:0; margin:0;"></div>
								<form method="post" name="searchdate">
								 <div class="col-md-2" style="padding:0px;"></div>
								 <div class="col-md-3" style="padding:0px;">
								  <div class="form-group" style="padding-top:0; margin-bottom:0; padding-bottom:0;">
								   <input type="date"  class="form-control" name="txn_date_from" value="<?php if(isset($_POST['txn_date_from'])){ echo $txn_date_from; } else { echo date("Y-m-d"); }?>" max="<?=date("Y-m-d")?>" style="font-size:12px; padding-left:5px; padding-right:0;"/>
								  </div>
								 </div>
								 
								 <div class="col-md-3" style="padding:0px;">
								  <div class="form-group" style="padding:0; margin:0;">
								   <input type="date"  class="form-control" name="txn_date_to" value="<?php if(isset($_POST['txn_date_to'])){ echo $txn_date_to; } else { echo date("Y-m-d"); }?>" max="<?=date("Y-m-d")?>" style="font-size:12px; padding-left:5px; padding-right:0;" />
								  </div>
								 </div>
								 
								 <div class="col-md-1" style="padding-left:0px;">
								  <div class="form-group" style="padding-top:0; margin-bottom:0; padding-bottom:0;">
								   <button type="submit" class="btn green" name="searchd"> <i class="fa fa-search"></i></button>
								  </div>
								 </div>
								</form>
							 </div>
							</div>
							<div class="scroller portlet-body" style="padding-bottom:0; margin-bottom:0.8%; height:390px; overflow-Y:scroll; overflow-X:hidden; padding-top:0;">
								<div class="table-scrollable" style="padding-top:0; margin-bottom:0; padding-bottom:0; padding-top:0;">
									<table class="table table-striped table-bordered table-advance table-hover" style="padding-top:0; margin-bottom:0; padding-bottom:0; padding-top:0;">
										<thead>
										<tr>
											<th><b>#</b></th>
											<th><b>Bill No.</b></th>
											<th><b>Customer Name</b></th>
											<th><b>Total Quantity</b></th>
											<th><b>Total Amount</b></th>
											<th><b>Transaction Date</b></th>
											<th><b>Reject Date</b></th>
											<th><b>Remark</b></th>
									<!--	<th><b>Status</b></th>-->
											<!--<?php //if($user_role=="All") { ?>
											<th><b>Action</b></th>
											<?php //} ?>-->
										</tr>
										</thead>
										<tbody>
										<?php
										$c=1;
										if(mysqli_num_rows($res)>0)
										{
										 while($fetch_product=mysqli_fetch_assoc($res))
										 {	extract($fetch_product);
										?>
										<tr>
											<td title="S.No."><?php echo $c++; ?></td>
											<td><?=$customer_transaction_id; ?></td>
											<td><?=$customer_name; ?></td>
											<td><?=$total_quantity; ?></td>
											<td><?=$total_amount; ?></td>
											<td><?=$transaction_date; ?></td>
											<td><?=$cancel_date; ?></td>
											<td><?=$remark; ?></td>
									<!--	<td><?=$transaction_status; ?></td>-->
											<!--<?php // if($user_role=="Admin") { ?>
											<td>
											<a href="order-detail.php?id=<?php echo $transaction_id;?>" class="btn btn-outline btn-circle btn-sm blue" title="Order Detail"><i class="fa fa-align-justify"></i></a>
											<?php // if($status=='Deactive') { ?>
											  <a href="pending-orders-status.php?id=<?php echo $transaction_id;?>" onClick="return confirm('Are you sure to edit this status')" class="btn btn-outline btn-circle red btn-sm blue" name="accept">Accept</a>
											<?php // } else { ?>
											  <a href="pending-orders-status1.php?id=<?php echo $transaction_id;?>" onClick="return confirm('Are you sure to edit this status')" class="btn btn-outline btn-circle red btn-sm blue" name="reject">Reject</a>
											<?php // } ?>
											</td>
											<?php // } ?>-->
											</tr>
											<?php } } else { echo "No Data Available"; } ?>
										</tbody>
									</table>
								</div>
							</div>
								
								<?php 
								if(!isset($_POST['searchd']))
								{ /*
									$res1  = mysqli_query($con,"select * from tbl_acc_m_bank where distributor_id='$ver' and status in ('Active','Deactive')");
									$cou = mysqli_num_rows($res1); 
									$total_pages = $cou/10;
									$total_pages =ceil($total_pages);
									echo " <ul class='pagination pagination-sm no-margin pull-right'><li><a href='user-detail.php'>".'First'."</a></li> ";
									for ($i=1; $i<=$total_pages; $i++) { 
												echo "<li><a href='user-detail.php?page=".$i."'>".$i."</a> </li>";
									}; 
									echo "<li><a href='user-detail.php?page=".$total_pages."'>".'Last'."</a></li></ul> "; */
								}
								?>
									
							</div>
							<!-- END SAMPLE TABLE PORTLET-->
						</div>   
					</div>
				</div>				
            </div>
			<div class="copyright-v2" style="padding:3px; margin-top:-18px;"> 
		    <?=date("Y")?> &copy; Tarkashcorp Developed By <a target="_blank" href="http://www.belltechnology.in">Bell Technology</a>
           </div>
        </div>
        <!-- END CONTAINER -->
        <!--[if lt IE 9]>
<script src="../assets/global/plugins/respond.min.js"></script>
<script src="../assets/global/plugins/excanvas.min.js"></script> 
<script src="../assets/global/plugins/ie8.fix.min.js"></script> 
<![endif]-->
        <!-- BEGIN CORE PLUGINS -->
        <script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
        <script src="../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
        <!-- END CORE PLUGINS -->
        <!-- BEGIN THEME GLOBAL SCRIPTS -->
        <script src="../assets/global/scripts/app.min.js" type="text/javascript"></script>
        <!-- END THEME GLOBAL SCRIPTS -->
        <!-- BEGIN THEME LAYOUT SCRIPTS -->
        <script src="../assets/layouts/layout6/scripts/layout.min.js" type="text/javascript"></script>
        <script src="../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
        <script src="../assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
        <!-- END THEME LAYOUT SCRIPTS -->
        <script>
            $(document).ready(function()
            {
                $('#clickmewow').click(function()
                {
                    $('#radio1003').attr('checked', 'checked');
                });
            })
        </script>
    </body>

</html>