<?php
// array for JSON response
  $response= array();

    // include db connect class
    require_once __DIR__ . '/../DBConnect.php';
if(isset($_POST['ClientID'])){
	$clientid=$_POST['ClientID'];

      $sql = "SELECT * FROM QRSalePur2 where ClientID= ".$clientid;
     $stmt = $conn->prepare($sql);
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
	if($result!=null &&  $result>0){
        $response["QRSalePur2"] = array();
       
	foreach($result as $row) { 
         
$QRSalePur2["ID"] = $row["ID"];          
$QRSalePur2["SalePur1ID"] = $row["SalePur1ID"];  
$QRSalePur2["ItemSerial"] = $row["ItemSerial"];  
$QRSalePur2["EntryType"] = $row["EntryType"];                                          
$QRSalePur2["Item3NameID"] = $row["Item3NameID"]; 
$QRSalePur2["ItemDescription"] = $row["ItemDescription"];
$QRSalePur2["QtyAdd"] = $row["QtyAdd"];                                  
$QRSalePur2["QtyLess"] = $row["QtyLess"];                                 
$QRSalePur2["Qty"] = $row["Qty"];                                     
$QRSalePur2["Price"] = $row["Price"];                                   
$QRSalePur2["Total"] = $row["Total"];                                   
$QRSalePur2["Location"] = $row["Location"];                                           
$QRSalePur2["ClientID"] = $row["ClientID"];    
$QRSalePur2["ClientUserID"] = $row["ClientUserID"];
$QRSalePur2["NetCode"] = $row["NetCode"];                                            
$QRSalePur2["SysCode"] = $row["SysCode"];                                            
$QRSalePur2["UpdatedDate"] = $row["UpdatedDate"];
$QRSalePur2["OrderStatus"] = $row["OrderStatus"];                                     
$QRSalePur2["AddItemTime"] = $row["AddItemTime"];                                   
$QRSalePur2["Color"] = $row["Color"];                                   
$QRSalePur2["Model"] = $row["Model"];                                           
$QRSalePur2["Brand"] = $row["Brand"];    
$QRSalePur2["Size"] = $row["Size"];
$QRSalePur2["Other"] = $row["Other"];                                            
$QRSalePur2["PurPrice"] = $row["PurPrice"];                                            
$QRSalePur2["SoldPrice"] = $row["SoldPrice"];
$QRSalePur2["SoldClientUserID"] = $row["SoldClientUserID"];                                            
$QRSalePur2["SalePur1IDForSale"] = $row["SalePur1IDForSale"];                                            
$QRSalePur2["SaleTime"] = $row["SaleTime"];
          // push single product into final response array
          array_push($response["QRSalePur2"], $QRSalePur2);
        }
	
        // success
         $response["success"] = 1;
      $response["message"] = "Success ";
        // echoing JSON response
        echo json_encode($response);
      }else{
		  // success
         $response["success"] = 0;
        $response["message"] = "ClientID Not Exist";
        // echoing JSON response
        echo json_encode($response);
	 }
}else {
        // success
        $response["success"] = 0;
        $response["message"] = "Set ClietnID ";
        // echoing JSON response
    		echo json_encode($response);
      }
?>
