<?php
 
/*
 * Following code will list all the city
 */
 
// array for JSON response
$response = array();
 
 require_once __DIR__ . '/catchexception.php';
// include db connect class
require_once __DIR__ . '/db_config.php';
  
 
$paraimeino = urldecode($_POST['paraimeino']);
//  $paraimeino ='398bcd7a638d12b2'; 
try{
if ($paraimeino !="" ) {
    
    
    $paravanquery="SELECT *,'Insert' as  process from tblgeneralsettings";
      $resultmax=  pg_prepare($con,"paravanquery",$paravanquery);
      $data = [];
      $result = pg_execute($con,"paravanquery",$data);
    if (!empty($result)) {
        // check for empty result
        if (pg_num_rows($result) > 0) {
      // user node
          $response["Value"] = array();
 
          while ($row = pg_fetch_assoc($result)) {        
            $report = array();
               
            $report["autonum"] = $row["autonum"];
            $report["deletelocaldb"] = $row["deletelocaldb"];
            $report["portrait_app_latestversion"] = $row["portrait_app_latestversion"];
            $report["portrait_app_downloadurl"] = $row["portrait_app_downloadurl"];
            $report["portrait_app_downloadname"] = $row["portrait_app_downloadname"];
            $report["landscape_app_latestversion"]= $row["landscape_app_latestversion"];
            $report["landscape_app_downloadurl"] = $row["landscape_app_downloadurl"];
            $report["landscape_app_downloadname"] = $row["landscape_app_downloadname"];
            $report["keep_sales_data"] = intval($row["keep_sales_data"]);
            $report["restrict_no_of_bills_count"] = intval($row["restrict_no_of_bills_count"]);
            $report["restrict_bill_no"] = intval($row["restrict_bill_no"]);
                
            // push single product into final response array
              array_push($response["Value"], $report);
          }
            // success
            $response["success"] = 1;
 
            // echoing JSON response
            echo  json_encode($response,JSON_UNESCAPED_UNICODE);


        } else {
            // no user found
            $response["success"] = 0;
            $response["message"] = "No Report found";
 
            // echo no users JSON
            echo json_encode($response);
        }
    } else {
        // no user found
        $response["success"] = 0;
        $response["message"] = "No found";
 
        // echo no users JSON
        echo json_encode($response);
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";
 
     echo  json_encode($response,JSON_UNESCAPED_UNICODE);
  }
  mch_db_release($con);
}
//catch exception
catch(Exception $e) {
mch_db_release($con);
echo 'Message: ' .$e->getMessage();
}
?>
