<?php
require 'config_db.php';
$data = json_decode(file_get_contents('php://input'), true);
$type = $data['type'];
$scheme = strip_tags(mysqli_real_escape_string($con, $data['scheme']));
$multiple = strip_tags(mysqli_real_escape_string($con, $data['multiple']));

if ($type == '') {
    $returnArr = array("ResponseCode" => "401", "Result" => "false", "ResponseMsg" => "Something Went wrong try again !");
} else if ($type >= 1) {

    $cy = $con->query("select * from installment_entry where scheme=$scheme and status=1 Order by id ASC");

    $chit_details = array();
    $all_chit_details = array();

    while ($row = $cy->fetch_assoc()) {
        $chit_details['id'] = $row['id'];
        $chit_details['scheme'] = $row['scheme'];
        $chit_details['installment_number'] = $row['installment_number'];
        $chit_details['installment_amount'] = $row['installment_amount'] * $multiple;
        $chit_details['available_amount'] = $row['available_amount'] * $multiple;
        $all_chit_details[] = $chit_details;
    }

    $returnArr = array(
        "ResponseCode" => "200",
        "Result" => "true",
        "ResponseMsg" => "Success",
        "data" => $all_chit_details
    );
}

echo json_encode($returnArr);
mysqli_close($con);
?>