setJavascript ("/js/jquery.form.js"); $htmlhead->setJavascript ("/js/jquery.validate.js"); $htmlhead->setJavascript ("/js/additional-methods.js"); $htmlhead->setJavascript ("/js/autoNumeric-1.5.1.js"); $htmlhead->setJavascript ("/js/autoLoader.js"); $htmlhead->setJavascript ("/module/insurance/kasko_classic_logic.js"); $post = (!empty ($_SESSION['post']) AND (sizeof ($_SESSION['post']) > 0)) ? $_SESSION['post'] : $userinfo; if (msg::checkConfirm()) { $error = msg::getConfirm(); } if (msg::checkError()) { $error = msg::getError(); } $id = is_numeric ($_GET['id']) ? $_GET['id'] : false ; if (($id != false) AND (isset ($_SESSION['id']))) { $kasko = new kasko; $kasko->sql_link = $sql; $post = $kasko->getOrderInfo($id, $_SESSION['id']); $post = array_merge($post, $userinfo); $htmlhead->setJavascript ("/module/insurance/save_kasko_logic.js"); } $signin = (isset ($_SESSION['signin']) AND ($_SESSION['signin'] === true)) ? 'true' : 'false' ; $lang_id = constant ("LANG"); $query = "SELECT * FROM `kasko_country` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $area_value['key'][$k]=$v['key']; $area_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_city` WHERE (`lang` = '{$lang_id}') AND (`country`='1') ORDER BY `id` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $city_value['key'][$k]=$v['id']; $city_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_brand_auto` WHERE (`lang` = '{$lang_id}') ORDER BY `id` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $brandavto_value['key'][$k]=$v['id']; $brandavto_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_type_auto` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $type_auto_value['key'][$k]=$v['key']; $type_auto_value['value'][$k]=$v['name']; } /*$query = "SELECT * FROM `kasko_release_year` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { if ($v['key'] < 12) { $release_year_value['key'][$k]=$v['key']; $release_year_value['value'][$k]=$v['name']; } }*/ if(constant("LANG") == 'ua') $y = ' рік'; else $y = ' год'; for($i = 1; $i < 10; $i++){ $release_year_value['key'][$i]=$i; $year = 2015 - $i + 1; $release_year_value['value'][$i]=$year . $y; } $query = "SELECT * FROM `kasko_risktype` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $risktype_value['key'][$k]=$v['key']; $risktype_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_franchise` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $franchise_value['key'][$k]=$v['key']; $franchise_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_use_conditions` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $use_conditions_value['key'][$k]=$v['key']; $use_conditions_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_calc_variant` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $insur_calc_variant_value['key'][$k]=$v['key']; $insur_calc_variant_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_deterioration` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $change_calc_variant_value['key'][$k]=$v['key']; $change_calc_variant_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_period` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $timeInsur_value['key'][$k]=$v['key']; $timeInsur_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_territory` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $territory_value['key'][$k]=$v['key']; $territory_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_type_client` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $type_client_value['key'][$k]=$v['key']; $type_client_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_dvivers` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $dvivers_value['key'][$k]=$v['key']; $dvivers_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_park` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $park_value['key'][$k]=$v['key']; $park_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_dvivers_old` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $dvivers_old_value['key'][$k]=$v['key']; $dvivers_old_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `kasko_type_pay` WHERE (`lang` = '{$lang_id}') ORDER BY `key` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $type_pay_value['key'][$k]=$v['key']; $type_pay_value['value'][$k]=$v['name']; } $query = "SELECT * FROM `tooltip` WHERE (`lang` = '{$lang_id}') AND (`calculatorId` = '2') ORDER BY `id` ASC"; $a = $sql->QuickResult ( $query ); foreach ($a as $k=>$v) { $tooltip_value[$v['itemId']] = $v['value']; } for ($i = 1; $i <= 31; $i++) { $count_day[] = $i; } for ($i = date( "Y"); $i >= (date( "Y")-80); $i--) { $count_year[] = $i; } $smarty->assign ("post",$post); $smarty->assign ("error",$error); $smarty->assign ("type_auto_value",$type_auto_value); $smarty->assign ("brandavto_value",$brandavto_value); $smarty->assign("release_year_value",$release_year_value); $smarty->assign("risktype_value",$risktype_value); $smarty->assign("franchise_value",$franchise_value); $smarty->assign("type_franchise_value",$type_franchise_value); $smarty->assign("glass_franchise_value",$glass_franchise_value); $smarty->assign("insursum_damage_value",$insursum_damage_value); $smarty->assign("use_conditions_value",$use_conditions_value); $smarty->assign("transport_cost1_value",$transport_cost1_value); $smarty->assign("transport_cost2_value",$transport_cost2_value); $smarty->assign("insur_calc_variant_value",$insur_calc_variant_value); $smarty->assign("change_calc_variant_value",$change_calc_variant_value); $smarty->assign("timeInsur_value",$timeInsur_value); $smarty->assign("territory_value",$territory_value); $smarty->assign("type_client_value",$type_client_value); $smarty->assign("dvivers_value",$dvivers_value); $smarty->assign("park_value",$park_value); $smarty->assign("dvivers_old_value",$dvivers_old_value); $smarty->assign("area_value",$area_value); $smarty->assign("city_value",$city_value); $smarty->assign("type_pay_value",$type_pay_value); $smarty->assign ("count_day",$count_day); $smarty->assign ("count_year",$count_year); $smarty->assign ("count_month",array(1,2,3,4,5,6,7,8,9,10,11,12)); $smarty->assign("tooltip_value",$tooltip_value); $smarty->assign ("signin",$signin); $smarty->display ("insurance/kaskoclassic.tpl"); $_SESSION['post'] = false; ?>