<?php
error_reporting(0);
//ini_set('memory_limit', '1024M');
//error_reporting(0);
//set_time_limit(0);
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();
session_start();
session_cache_limiter('private');
$cache_limiter 	= session_cache_limiter();
session_cache_expire(60);
$cache_expire 	= session_cache_expire(); 
date_default_timezone_set('Asia/Manila'); 
$CURRENT_DATE 	= date('Y-m-d H:i:s');

include_once('../config/minho.php');
include_once('../config/autoloadClass.php');
$autoload	=	new autoloadClass();
$mecon		=	new condbClass(); 
$utility	=	new utilityClass();


$ctrDetails = 50000;
$b=1;
 for($a=0; $a<$ctrDetails; $a++){
   $detailsArr[] = array(
      'id' => $b,
      'pricelist_status' => 'pricestat'.$a,
      'detail_terms' =>  'terms'.$a,
      'phase' =>  'phase'.$a,
      'block' =>  'block'.$a,
      'lot' =>  'lot'.$a,
      'lot_size' =>  'lotsize'.$a,
      'lot_type' =>  'lottype'.$a,
      'floor_area' =>  'floorarea'.$a,
      'contract_price' =>  'contractprice'.$a,
      'loanable_amount' =>  'loanable_amount'.$a,
      'pf_net' =>  'pf_net'.$a,
      'pf_payable' =>  'pf_payable'.$a,
      'required_gross' =>  'required_gross'.$a,
      'amortization' =>  'amortization'.$a,
      'pricelist_id' =>  'pricelist_id'.$a 
    );
	$b++;
} 

$outputDetails 					= $detailsArr; 
$resultDetailsArr 				= array();
$resultDetailsArr['details']  	= $outputDetails;
$pricelistTableDetails			= json_encode($resultDetailsArr);
$mainArr						= array(); 
$output 						= ""; 
$mainArr['PricelistDetails']	=	$pricelistTableDetails;
//$mecon->query("SET wait_timeout=1200;");
$mainArr['Id']				=	$mecon->getNextId("Id","pricelist_test"); 
$output = $mecon->insertSingleQuery($mainArr,"pricelist_test");		
$resultArr 						=	array();
$resultArr['output']	  		=	$output;
echo json_encode($resultArr);