<?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');
}
?>
<?php
if(isset($_POST['sub']))
{   
	$customer_name=$_POST['customer_name'];
	$product_name=$_POST['product_name'];
    $quantity=$_POST['quantity'];
	$mrp=$_POST['mrp'];
	$price=$_POST['price'];
	$cgst_amount=$_POST['cgst_amount'];
	$sgst_amount=$_POST['sgst_amount'];
}

//$id=$_GET['id1'];

$id=$_GET['id'];
$tid=$_GET['tid'];

$vars = array('' => $id, 'tid' => $tid);
$querystring = http_build_query($vars);
?>
<!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 Confirmation</div>
											<div class="actions">
										
                                            </div>
                                    </div>
									
                                    <div class="portlet-body form" >
                                        <form method="post" name="form1" enctype="multipart/form-data">
                                            <div class="form-body">
											<div class="form-group">
											
											<div class="col-md-4">
											<label>Customer Name</label>
											<input type="text" value="<?=$customer_name; ?>" name="customer_name" placeholder="Customer Name" class="form-control" readonly>
											</div>
                                            
											
											<div class="col-md-4">
											<label>Product Name</label>
                                              <input type="text" value="<?=$product_name; ?>" name="product_name" placeholder="Product Name" class="form-control" readonly> 
											</div>
											
											<div class="col-md-4">
											<label>Quantity</label>
                                             <input type="text" value="<?=$quantity; ?>" name="quantity" placeholder="Quantity" class="form-control" readonly> 
											</div>
											
											</div>
											<br clear="all"><br>
											
											<div class="form-group">
											
											<div class="col-md-4">
											<label>MRP</label>
                                             <input type="text" value="<?=$mrp; ?>" name="mrp" placeholder="MRP" class="form-control" readonly>
											</div>
											
											<div class="col-md-4">
											<label>Price</label>
                                             <input type="text" value="<?=$price; ?>" name="price" placeholder="Price" class="form-control" readonly>
											</div>
											
											<!--
											<div class="col-md-4">
											<label>CGST AMOUNT</label>
                                            <input type="text" value="<?=$cgst_amount; ?>" name="cgst_amount" placeholder="CGST AMOUNT" class="form-control" readonly>
											</div>
											
											<div class="col-md-4">
											<label>SGST AMOUNT</label>
                                            <input type="text" value="<?=$sgst_amount; ?>" name="sgst_amount" placeholder="SGST AMOUNT" class="form-control" readonly>
											</div>
											-->
											</div>
											<br clear="all"><br>
                                            </div>
											
										
                                            <div class="form-actions">
											<?php if($user_role=="Admin") { ?>
                                               <p>Are you sure to edit order detail!</p> 
											   <button type="submit" name="sub1" class="btn blue">Ok</button>
											   <button type="submit" name="sub11" class="btn blue">Back</button>
											   <button type="submit" name="subcancel" class="btn blue" onClick="return confirm('Are you sure to cancel!')">Cancel</button>
											<?php } ?>
                                            </div>
                                        </form>
										
										<?php
										if(isset($_POST['sub11']))
										{ 
//										$id=$_GET['id1'];
										header("location:edit-order-detail.php?id".$querystring); 
										}
										if(isset($_POST['subcancel']))
										{ 
										header("location:order-detail.php?id=".$id);
										}
										if(isset($_POST['sub1']))
										{
											$customer_name=$_POST['customer_name'];
											$product_name=$_POST['product_name'];
											$quantity=$_POST['quantity'];
											$mrp=$_POST['mrp'];
											$price=$_POST['price'];
											$cgst_amount=$_POST['cgst_amount'];
											$sgst_amount=$_POST['sgst_amount'];
											
											date_default_timezone_set('Asia/Calcutta');
											$cdate  = date("Y-m-d")." ".date('H:i:sa');
											$scro=date("Y-m-d");
											$scri=date('H:i:s');
														 
											$insert_order_detail=mysqli_query($con,"UPDATE tbl_transaction_detail set quantity='$quantity', price='$price', cgst_amount='$cgst_amount', sgst_amount='$sgst_amount' where txn_detail_id='$tid'");
											  
											if($insert_order_detail)
											{
											   header("location:order-detail.php?id=".$id);
											}
										
										}
										?>
										
                                    </div>
                                </div>
                                <!-- END SAMPLE TABLE PORTLET-->
                            </div>
						</div>
                    </div>
                    <div class="clearfix"></div>
                    <!-- END DASHBOARD STATS 1-->
                    <!-- END PAGE BASE CONTENT -->
           </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>		
		    <!-- END CONTAINER -->
            <!-- BEGIN FOOTER -->
			<a href="#index" class="go2top">
                    <i class="icon-arrow-up"></i>
                </a>
                <!-- END FOOTER -->
            </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>