<?php 
/*ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);*/
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_REQUEST["usersJSON"];
if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json,true);
//print_r($data);  
//Util arrays to create response JSON 
$a=array();

$district = $data[0]["district"];
//echo $data[0]->district;
$Location = $data[0]["Location"];
$kiosk_owner_name = $data[0]["kiosk_owner_name"];
$parmanent_add = $data[0]["parmanent_add"];
$owner_phn_no = $data[0]["owner_phn_no"];
$other_no = $data[0]["other_no"];
$owner_email_id = $data[0]["owner_email_id"];
$daily_trunover = $data[0]["daily_trunover"];
$iden_no = $data[0]['iden_no'];
$kiosk_center_loc = $data[0]["kiosk_center_loc"];
$kiosk_center_name = $data[0]["kiosk_center_name"];
$kiosk_contact = $data[0]['kiosk_contact'];
$kiosk_phn_no = $data[0]["kiosk_phn_no"];
$kiosk_email_id = $data[0]["kiosk_email_id"];
$kiosk_urban_add = $data[0]['kiosk_urban_add'];
$municipal_town = $data[0]["municipal_town"];
$ward_name = $data[0]['ward_name'];
$bank_acc_no = $data[0]["bank_acc_no"];
$bank_name = $data[0]['bank_name'];
$branch_name = $data[0]["branch_name"];

$both_names1 = $data[0]["both_names1"];
$permanent_add1 = $data[0]['permanent_add1'];
$owner_phn_no1 = $data[0]["owner_phn_no1"];

$other_phn_no1 = $data[0]["other_phn_no1"];
$owner_email_id1 = $data[0]['owner_email_id1'];
$sign_id_no1 = $data[0]["sign_id_no1"];


$both_names2 = $data[0]["both_names2"];
$permanent_add2 = $data[0]['permanent_add2'];
$owner_phn_no2 = $data[0]["owner_phn_no2"];

$other_phn_no2 = $data[0]["other_phn_no2"];
$owner_email_id2 = $data[0]['owner_email_id2'];
$sign_id_no2 = $data[0]["sign_id_no2"];

$phy_add_proof = $data[0]["phy_add_proof"];
$kiosk_photo_proof = $data[0]['kiosk_photo_proof'];
$owner_referee_id = $data[0]["owner_referee_id"];

$bank_acc_details = $data[0]["bank_acc_details"];
$trade_lic = $data[0]['trade_lic'];
$date_applied = $data[0]["date_applied"];

$deal_docs = $data[0]["deal_docs"];
$supplied_goods_amt = $data[0]['supplied_goods_amt'];
$charges_paid = $data[0]["charges_paid"];
$geerani_shop_approval=$data[0]["geerani_shop_approval"];
$date_approved=$data[0]["date_approved"];
$create_by=$data[0]["create_by"];
$salesperson_name=$data[0]["salesperson_name"];
//// get retailer basic details


//// store in db
$res = $db-> createRetailer($district,$Location,$kiosk_owner_name,$parmanent_add,$owner_phn_no,$other_no,$owner_email_id,$daily_trunover,$iden_no,$kiosk_center_loc,$kiosk_center_name,$kiosk_contact,$kiosk_phn_no,$kiosk_email_id,$kiosk_urban_add,$municipal_town,$ward_name,$bank_acc_no,$bank_name,$branch_name,$both_names1,$permanent_add1,$owner_phn_no1,$other_phn_no1,$owner_email_id1,$sign_id_no1,$both_names2,$permanent_add2,$owner_phn_no2,$other_phn_no2,$owner_email_id2,$sign_id_no2,$phy_add_proof,$kiosk_photo_proof,$owner_referee_id,$bank_acc_details,$trade_lic,$date_applied,$deal_docs,$supplied_goods_amt,$charges_paid,$geerani_shop_approval,$date_approved,$create_by,$salesperson_name);
//Based on inserttion, create JSON response     
array_push($a,$res);

echo json_encode($a); 
?>