<?php
session_start();
require_once 'db_connection.php'; 
$rowid = $_POST['rowid'];
$str = $_POST['str'];
$proid = $_POST['proid'];

$branchId = $_POST['branchId'];
$returnId = $_POST['returnId'];

$user_id = $_SESSION['user_id'];



$today = date('Y-m-d H:i:s');

	$sql3 = "UPDATE mobiletemporarycart SET return_qty= return_qty+$str, return_date='$today', return_user='$user_id' WHERE tempid='$rowid' ";
	if ($conn->query($sql3) === TRUE){
		echo "3";
			$sql4 = "UPDATE tbl_stock SET qty= qty+$str WHERE prid='$proid' AND branch_id='$branchId' ";
			if ($conn->query($sql4) === TRUE) {
				echo "4";
				$sql5 = "INSERT INTO `tbl_return_items`(`return_items_id`, `return_id`, `prid`, `qty`) VALUES (null,'$returnId','$proid','$str') ";
				if ($conn->query($sql5) === TRUE) {
					echo "5";
				}

			}

	}



?>