/** * Get client financial payment info * @param type $data */ public static function get_client_financial_payment_info($data) { session_start(); $_SESSION['id'] = $data['client_id']; // Client Info $client_info = ORM::factory('ClientPersonalInfo', $data['client_id'])->as_array(); // Monthly Payments $mp1 = Controller_Helper_Agent::get_g27(); $mp3 = Controller_Helper_Agent::get_g26(); $mp2 = $mp3 - $mp1; // Years To Freedom $yf1 = Controller_Helper_Agent::get_g41(); $yf3 = Controller_Helper_Agent::get_h41(); $yf2 = $yf3 - $yf1; // Total Interest Cost $tic1 = Controller_Helper_Agent::get_g35(); $tic3 = Controller_Helper_Agent::get_h35(); $tic2 = $tic3 - $tic1; // Increased Monthly CashFlow $imc = Controller_Helper_Agent::get_g28(); //Lost Wealth by Giving into old schedule $lws = $mp3 * $yf2 * 12; //Letter Calculations $duration = Controller_Helper_Agent::get_h41(); $pi = Controller_Helper_Agent::get_h36(); $goi = Controller_Helper_Agent::get_l22(); $df = Controller_Helper_Agent::get_i9(); $sd = Controller_Helper_Agent::get_i41(); $sip = Controller_Helper_Agent::get_i35(); $pc = Controller_Helper_Agent::get_h40(); $response = array("client_info" => $client_info, "monthly_payments" => array("mp1" => is_nan($mp1) ? "NaN" : round($mp1), "mp2" => is_nan($mp2) ? "NaN" : round($mp2), "mp3" => is_nan($mp3) ? "NaN" : round($mp3)), "years_to_freedom" => array("yf1" => is_nan($yf1) ? "NaN" : number_format($yf1, 1), "yf2" => is_nan($yf2) ? "NaN" : number_format($yf2, 1), "yf3" => is_nan($yf3) ? "NaN" : number_format($yf3, 1)), "total_interest_cost" => array("tic1" => is_nan($tic1) ? "NaN" : round($tic1), "tic2" => is_nan($tic2) ? "NaN" : round($tic2), "tic3" => is_nan($tic3) ? "NaN" : round($tic3)), "imc" => is_nan($imc) ? "NaN" : round($imc), "lws" => is_nan($lws) ? "NaN" : round($lws), "lc" => array("duration" => is_nan($duration) ? "NaN" : number_format($duration, 1), "pi" => is_nan($pi) ? "NaN" : round($pi), "goi" => is_nan($goi) ? "NaN" : round($goi), "df" => $df, "sd" => is_nan($sd) ? "NaN" : number_format($sd, 1), "sip" => is_nan($sip) ? "NaN" : round($sip), "pc" => is_nan($pc) ? "NaN" : round($pc), "ror" => is_nan($lws) ? "NaN" : round($lws))); return $response; session_destroy(); }