<?php
session_start();
require_once 'db_connection.php'; 
$transfer_id = $_POST['transfer_id'];
$quantity = $_POST['quantity'];
$product_id = $_POST['product_id'];
$agency = $_POST['agency'];
$user_id = $_SESSION['emid'];

$sql = "DELETE FROM mobileagency_stock WHERE transfer_id='$transfer_id' AND  transfer_by='$user_id' AND stock_transfer_order=0 ";

if ($conn->query($sql) === TRUE) {
  echo "1";
  $sql2 = "UPDATE mobileproducts SET qty=qty+'$quantity' WHERE prid='$product_id'";
	if ($conn->query($sql2) === TRUE) { }

$sql4 = "UPDATE mobileproducts_agency SET qty=qty-'$quantity' WHERE prid='$product_id' AND agency_id='$agency'";
			if ($conn->query($sql4) === TRUE) { }

}

?>