<?php
require 'config_db.php';
$customer_chit_details = array();
$all_customer_chit_details = array();

$cy = $con->query("select * from customers_chit");
$insert = false;
while ($row = $cy->fetch_assoc()) {
	$id = $row['id'];
	$cus_name = $row['cus_name'];
	$cus_id = $row['cus_id'];
	$scheme = $row['scheme'];
	$installment_number = $row['installment_number'];
	$installment_balance_amount= $row['installment_balance_amount'];
	$customer_status = $row['customer_status'];

    $insert_sub_sql = "insert into last_installment_details(
                `id`,`cus_name`, `cus_id`,`scheme`,`installment_number`,`installment_balance_amount`,`status`)
            values(
                '$id','$cus_name','$cus_id','$scheme','$installment_number','$installment_balance_amount','$customer_status')";
    $result_sub = $con->query($insert_sub_sql);
    $insert = true;
}
if ($insert)
    $returnArr = array("ResponseCode" => "200", "Result" => "true", "ResponseMsg" => "Sync Success");
else
    $returnArr = array("ResponseCode" => "201", "Result" => "false", "ResponseMsg" => "Failure");
echo json_encode($returnArr);
mysqli_close($con);
?>