<?php
include("../../../include/startup.php"); 
if(isset($_REQUEST['action']) && $_REQUEST['action']=='delete_return_item'){
	$returnArray = array();
	$return_item_mapping_id = $_REQUEST['return_item_mapping_id'];
	$delete_sql = "DELETE FROM returns_notes_mapping WHERE id = '$return_item_mapping_id'";
	if(mysqli_query($conn,$delete_sql)){
		$returnArray["status"] = "success";
	}else{
		$returnArray["status"] = "failure";
	}
	
	echo json_encode($returnArray);
	die;
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'get_po_item_by_po_id') {
	$dataArray = array();
	$purchase_order_id = $_REQUEST['purchase_order_id'];

	$sql = "SELECT part_number FROM purchase_order_items_mapping WHERE po_id = '$purchase_order_id' ";
	$rs = mysqli_query($conn, $sql);
	if (mysqli_num_rows($rs) > 0) {
		while ($row = mysqli_fetch_assoc($rs)) {
			
			$dataArray[$row['part_number']] = ucfirst($gsi->getPartNumberById($row['part_number']));
		}
		print utility::createList($dataArray, "map_part_no[]", $map_part_no, "100%", "Please Select", false, "form-control map_part_no select2", "", "");
	} else {
		echo "<p style='padding: 5px 0px;font-style: italic;font-size: 12px; line-height: 1;'>There is no Part list in this P/O.</p>";
	}
}
die;
?>