<?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');
}
$id=$_GET['id'];
?>
<!DOCTYPE html>
<html lang="en">
    <head>
      <?php include("link_head.php");?>  
    <!-- END HEAD -->
<script>
function myFunction() {
	var txt;
	var r = confirm("Are you sure to cancel!");
	if (r == true) {
		window.location.href="order-detail.php?id=<?php echo $id;?>";
	} 
}

</script>
	<style>
	::-webkit-scrollbar {
		display: none;
		overflow: hidden;
	}
	</style>
	<script>
	window.onscroll = function () {
	window.scrollTo(0,0);
	}
	</script>			
	</head>
	
    <body class="">
        <!-- BEGIN HEADER -->
		<?php include("header.php");?>
        <!-- END HEADER -->
		
        <!-- BEGIN CONTAINER -->
        <div class="container-fluid">
            <div class="page-content page-content-popup">
                
                <div class="page-sidebar-wrapper">
                    <!-- BEGIN SIDEBAR -->
                    <?php include("menu.php");?> 
				    <!-- END SIDEBAR -->
                </div>
                <div class="page-fixed-main-content">
                        <div class="row">
                            <div class="col-md-12">
                                <!-- BEGIN SAMPLE TABLE PORTLET-->
                                <div class="portlet">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-bell-o"></i>Edit Order Detail</div>
											<div class="actions">
										<?php /*
										echo $ver;
										$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='Pending'");
										
										 while($fetch_product=mysqli_fetch_assoc($res))
										 {	extract($fetch_product); */
										?>
										   <div class="form-group">
										   <a href="order-detail.php?id=<?php echo $id;?>"><button type="submit" style="padding:3px 10px;" class="btn btn-outline btn-circle blue btn-sm blue" name="searchd">Back </button></a>
											</div>
										<?php // } ?>
                                            </div>
                                    </div>
											
									<?php
									$pid=$_GET['tid'];
									$vars = array('id' => $id, 'tid' => $pid);
									$querystring = http_build_query($vars);
											
									$res = mysqli_query($con,"SELECT * FROM tbl_transaction_detail,tbl_transaction,tbl_master_customer,tbl_master_product where 
									tbl_transaction_detail.product_id=tbl_master_product.product_id and
									tbl_transaction_detail.transaction_id=tbl_transaction.transaction_id and
									tbl_transaction.customer_id=tbl_master_customer.customer_id and
									tbl_transaction_detail.txn_detail_id='$pid'");
									while($fetch_product1=mysqli_fetch_assoc($res))
									{
									?>
										
									<div class="portlet-body form" >
                                        <form method="post" name="form1" action="edit-order-detail-confirmation.php?<?=$querystring;?>" onsubmit="return Uploadfxn();" enctype="multipart/form-data">
                                            <div class="form-body">
											<div class="form-group">										
											<div class="col-md-4">
											 <label>Customer Name <span style="color:red;">*</span></label>
											 <input type="text" value="<?=$fetch_product1['customer_name']; ?>" class="form-control" placeholder="Customer Name" name="customer_name" onkeypress='return (event.charCode >= 95 && event.charCode <= 122) || (event.charCode >= 65 && event.charCode <= 90)' required readonly> 
											</div>
                                            
											
											<div class="col-md-4">
											<label>Product Name <span style="color:red;">*</span></label>
                                              <input type="text" value="<?=$fetch_product1['product_name']; ?>" class="form-control" placeholder="Product Name" onkeypress='return (event.charCode >= 95 && event.charCode <= 122) || (event.charCode >= 65 && event.charCode <= 90)' name="product_name" required readonly>
											</div>
											
											<div class="col-md-4">
											<label>Quantity <span style="color:red;">*</span></label>
                                             <input type="text" value="<?=$fetch_product1['quantity']; ?>" class="form-control" required placeholder="Quantity" onkeypress='return event.charCode >= 48 && event.charCode <= 57' maxlength="4" name="quantity">
											</div>
											
											</div>
											<br clear="all"><br>
											
											<div class="form-group">
											
											<div class="col-md-4">
											<label>MRP <span style="color:red;">*</span></label>
                                             <input type="text" value="<?=$fetch_product1['mrp']; ?>" class="form-control" required placeholder="MRP" name="mrp" onkeypress='return event.charCode >= 48 && event.charCode <= 57' readonly>
											</div>
											
											<div class="col-md-4">
											<label>Price <span style="color:red;">*</span></label>
                                             <input type="text" value="<?=$fetch_product1['price']; ?>" class="form-control" required placeholder="Price" name="price" onkeypress='return event.charCode >= 48 && event.charCode <= 57' readonly>
											</div>
											
											<!--
											<div class="col-md-4">
											<label>CGST<span style="color:red;">*</span></label>
                                            <input type="text" value="<?=$fetch_product1['cgst_amount']; ?>" class="form-control" placeholder="CGST AMOUNT" name="cgst_amount" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
											</div>
											
											<div class="col-md-4">
											<label>SGST<span style="color:red;">*</span></label>
                                            <input type="text" value="<?=$fetch_product1['sgst_amount']; ?>" class="form-control" placeholder="SGST AMOUNT" name="sgst_amount" onkeypress='return event.charCode >= 48 && event.charCode <= 57'>
											</div>
											-->
										<?php }  ?>
											</div>
											<br clear="all"><br>
                                            </div>
										
                                            <div class="form-actions">
											<?php if($user_role=="Admin") { ?>
                                                <button type="submit" name="sub" class="btn blue">Submit</button>
                                                <button type="button" onclick="myFunction();" name="subcancel" class="btn blue">Cancel</button>
											<?php } ?>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <!-- END SAMPLE TABLE PORTLET-->
                            </div>
						</div>
                    </div>		
                    <div class="clearfix"></div>
                    <!-- END DASHBOARD STATS 1-->
                    <!-- END PAGE BASE CONTENT -->
                </div>		
		    <!-- END CONTAINER -->
            <!-- BEGIN FOOTER -->
			<a href="#index" class="go2top">
                    <i class="icon-arrow-up"></i>
                </a>
                <!-- END FOOTER -->
			<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>
        </div>
        <!-- END CONTAINER -->
        <!-- BEGIN QUICK SIDEBAR -->
        <a href="javascript:;" class="page-quick-sidebar-toggler">
            <i class="icon-login"></i>
        </a>
        
        <!-- END QUICK SIDEBAR -->
        <!-- BEGIN QUICK NAV -->
        
        <div class="quick-nav-overlay"></div>
        <!-- END QUICK NAV -->
        
        <!-- BEGIN CORE PLUGINS -->
        <?php include("link_script.php");?>  
        <!-- END THEME LAYOUT SCRIPTS -->
        <script>
            $(document).ready(function()
            {
                $('#clickmewow').click(function()
                {
                    $('#radio1003').attr('checked', 'checked');
                });
            })
        </script>
    </body>
</html>