<?php require_once('../auth/auth.php'); ?>
<?php 
if(isset($_POST['g_coid'])){
   $g_coid    	= $_POST['g_coid'];
   $g_bid     	= $_POST['g_bid'];
   $g_brid    	= $_POST['g_brid'];
   $item_gid  	= $_POST['item_gid'];
   $item_cid  	= $_POST['item_cid'];
   $item_brnd 	= $_POST['item_brnd'];
   $price_type  = $_POST['price_type'];
   $plus  	    = $_POST['plus'];

   if(isset($_POST['parcent'])) {
     $parcent = $_POST['parcent'];
     mysqli_query($conn,"UPDATE `item` SET $price_type = ($price_type $plus (($price_type*$parcent)/100)),min_sales=mrp_sales WHERE coid='$g_coid' AND bid='$bid' AND brid='$g_brid' AND pgid='$item_gid' AND pcid='$item_cid' AND pbid='$item_brnd'") or die(mysqli_error($conn));
   } else if (isset($_POST['amount'])){
   	$amount = $_POST['amount'];
     mysqli_query($conn,"UPDATE `item` SET $price_type = ($price_type $plus $amount),min_sales=mrp_sales WHERE coid='$g_coid' AND bid='$bid' AND brid='$g_brid' AND pgid='$item_gid' AND pcid='$item_cid' AND pbid='$item_brnd'") or die(mysqli_error($conn));
   }

 }
?>