public function ajaxAction() { $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'getuser')); // var_dump($getuser); $id_user = $getuser->id; $action = $this->params()->fromQuery('action'); $code = $this->params()->fromQuery('code'); date_default_timezone_set('Asia/Ho_Chi_Minh'); $date = date('Y/m/d h:i:s a', time()); // if(!isset($action) and !isset($code) ) if (isset($action) and $action == 'apply') { // save Oder + Ordetails + Custommer + // Return Oder_id ==> // Tracking_id = Oder_id + 2015 + 1000 +"EVT." $data = $this->params()->fromPost('data'); if (isset($data)) { $_data = @json_decode($data); // save Visa --> save Person -> Save Invoice -->return id_invoice $visa = new Visa(); $data_visa = array('visa_type' => $_data->visa_type, 'text_visatype' => $_data->text_visatype, 'is_emb' => $_data->is_emb, 'is_urgently' => $_data->is_urgently, 'date_arrival' => $_data->date_arrival, 'date_exit' => $_data->date_exit, 'arrival_time' => $_data->arrival_time, 'flight_number' => $_data->flight_number, 'private_letter' => $_data->invoice->private_letter, 'fasttrack' => $_data->invoice->fasttrack, 'pickup' => $_data->invoice->pickup, 'purpose' => $_data->purpose, 'arrival_port' => $_data->arrival_port, 'location' => $_data->location, 'text_location' => $_data->text_location, 'text_express' => $_data->text_express, 'promotion_discount' => $_data->promotion_discount, 'discount_value' => $_data->invoice->discount_value, 'discount_amount' => $_data->invoice->discount_amount, 'express' => $_data->invoice->express, 'service' => $_data->invoice->service, 'email_discount' => $_data->invoice->email_discount, 'number_of' => $_data->invoice->number_of, 'promotion_code' => $_data->promotion_code); // var_dump($save_visa); // echo "</pre>"; // print_r($data_visa); // echo "</pre>"; // die; $visa->exchangeArray($data_visa); $save_visa = $this->getServiceLocator()->get('VisaTable')->save($visa); if ($save_visa == 0) { echo "Not save visa! Error"; die; } $_id_visa = $save_visa; // save Invoice $invoice = new Invoice(); $data_Invoice = array('tracking_id' => '', 'total' => $_data->invoice->total, 'visa_id' => $_id_visa, 'status_pay' => 0); $invoice->exchangeArray($data_Invoice); $check_invoice_id = $this->getServiceLocator()->get('InvoiceTable')->save($invoice); if ($check_invoice_id == 0) { echo "Not save Invoice! Error"; die; } // Save Person $person = new Persons(); $data_person = array('name' => $_data->persons[0]->name, 'gender' => $_data->persons[0]->gender, 'birthday' => $_data->persons[0]->birthday, 'national' => $_data->persons[0]->national, 'passport' => $_data->persons[0]->passport, 'passport_exp' => $_data->persons[0]->passport_exp, 'user_id' => $id_user, 'invoice_id' => $check_invoice_id, 'primary_email' => $_data->primary_email, 'secondary_email' => $_data->secondary_email, 'primary_pass' => $_data->primary_pass, 'visa_id' => $_id_visa); $person->exchangeArray($data_person); $check_person = $this->getServiceLocator()->get('PersonsTable')->save($person); if ($check_person == 0) { echo "Not save person! Error"; die; } // Tracking_id = Oder_id + 2015 + 1000 +"EVT." : EVT.12443436059898 $_tracking_id = 12015 + $check_invoice_id; $tracking_id = "EVT." . $_tracking_id; // update tracking_id for invoice $check_updat_tracking = $this->getServiceLocator()->get('InvoiceTable')->update_tracking_id($check_invoice_id, $tracking_id); echo $tracking_id; die; } else { echo "Not exits data action apply"; die; } } if (isset($action)) { // getDiscountCode if ($action == 'getDiscountCode' and isset($code) and $code != '') { echo '0'; die; // khuyen mai dat la 0% } // getServerTime if ($action == 'getServerTime') { echo $date; die; } // getServiceFee if ($action == 'getServiceFee') { echo '[{"key":"fee_1ms","value":"19"},{"key":"fee_1mm","value":"25"},{"key":"fee_3ms","value":"30"},{"key":"fee_3mm","value":"138"},{"key":"fee_emb_1ms","value":"21"},{"key":"fee_emb_1mm","value":"27"},{"key":"fee_emb_3ms","value":"32"},{"key":"fee_emb_3mm","value":"138"},{"key":"fee_trv","value":"30"},{"key":"fee_st_1ms","value":"45"},{"key":"fee_st_1mm","value":"65"},{"key":"fee_st_3ms","value":"45"},{"key":"fee_st_3mm","value":"95"},{"key":"fee_st_emb_1ms","value":"N\\/A"},{"key":"fee_st_emb_1mm","value":"N\\/A"},{"key":"fee_st_emb_3ms","value":"N\\/A"},{"key":"fee_st_emb_3mm","value":"N\\/A"},{"key":"fee_st_trv","value":"5"},{"key":"fee_6mm","value":"210"},{"key":"fee_st_6mm","value":"135"},{"key":"fee_1mm_full","value":"25"},{"key":"fee_st_1mm_full","value":"95"}]'; die; } // getCountry if ($action == 'getCountry') { echo '[ { "id": "1", "name": "Afghanistan", "is_normal": "0" }, { "id": "2", "name": "Albania", "is_normal": "1" }, { "id": "3", "name": "Algeria", "is_normal": "0" }, { "id": "4", "name": "American", "is_normal": "1" }, { "id": "5", "name": "Andorra", "is_normal": "1" }, { "id": "6", "name": "Angola", "is_normal": "0" }, { "id": "7", "name": "Anguilla", "is_normal": "0" }, { "id": "8", "name": "Antarctica", "is_normal": "0" }, { "id": "9", "name": "Antigua & Barbuda", "is_normal": "0" }, { "id": "10", "name": "Argentina", "is_normal": "1" }, { "id": "11", "name": "Armenia", "is_normal": "1" }, { "id": "12", "name": "Aruba", "is_normal": "0" }, { "id": "13", "name": "Australia", "is_normal": "1" }, { "id": "14", "name": "Austria", "is_normal": "1" }, { "id": "15", "name": "Azerbaijan", "is_normal": "1" }, { "id": "16", "name": "Bahamas", "is_normal": "0" }, { "id": "17", "name": "Bahrain", "is_normal": "0" }, { "id": "18", "name": "Bangladesh", "is_normal": "0" }, { "id": "19", "name": "Barbados", "is_normal": "0" }, { "id": "20", "name": "Belarus", "is_normal": "1" }, { "id": "21", "name": "Belgium", "is_normal": "1" }, { "id": "22", "name": "Belize", "is_normal": "1" }, { "id": "23", "name": "Benin", "is_normal": "0" }, { "id": "24", "name": "Bermuda", "is_normal": "0" }, { "id": "25", "name": "Bhutan", "is_normal": "1" }, { "id": "26", "name": "Bolivia", "is_normal": "1" }, { "id": "27", "name": "Bosnia", "is_normal": "1" }, { "id": "28", "name": "Botswana", "is_normal": "0" }, { "id": "29", "name": "Bouvet", "is_normal": "0" }, { "id": "30", "name": "Brazil", "is_normal": "1" }, { "id": "31", "name": "British (UK)", "is_normal": "1" }, { "id": "32", "name": "Brunei Darussalam", "is_normal": "1" }, { "id": "33", "name": "Bulgaria", "is_normal": "1" }, { "id": "34", "name": "Burkina Faso", "is_normal": "0" }, { "id": "35", "name": "Burma", "is_normal": "1" }, { "id": "36", "name": "Burundi", "is_normal": "0" }, { "id": "37", "name": "Cambodia", "is_normal": "1" }, { "id": "38", "name": "Cameroon", "is_normal": "0" }, { "id": "39", "name": "Canada", "is_normal": "1" }, { "id": "40", "name": "Cape Verde", "is_normal": "0" }, { "id": "41", "name": "Cayman Islands", "is_normal": "0" }, { "id": "42", "name": "Central African Rep.", "is_normal": "0" }, { "id": "43", "name": "Chad", "is_normal": "0" }, { "id": "44", "name": "Chile", "is_normal": "1" }, { "id": "45", "name": "China", "is_normal": "1" }, { "id": "46", "name": "Christmas Island", "is_normal": "0" }, { "id": "47", "name": "Cocos Islands", "is_normal": "0" }, { "id": "48", "name": "Colombia", "is_normal": "1" }, { "id": "49", "name": "Comoros", "is_normal": "0" }, { "id": "50", "name": "Congo Democratic Rep.", "is_normal": "0" }, { "id": "51", "name": "Congo Republic", "is_normal": "0" }, { "id": "52", "name": "Cook Islands", "is_normal": "0" }, { "id": "53", "name": "Costa Rica", "is_normal": "1" }, { "id": "54", "name": "Cote D \'Ivoire", "is_normal": "0" }, { "id": "55", "name": "Croatia", "is_normal": "1" }, { "id": "56", "name": "Cuba", "is_normal": "1" }, { "id": "57", "name": "Cyprus", "is_normal": "1" }, { "id": "58", "name": "Czech Republic", "is_normal": "1" }, { "id": "59", "name": "Denmark", "is_normal": "1" }, { "id": "60", "name": "Djibouti", "is_normal": "0" }, { "id": "61", "name": "Dominica", "is_normal": "1" }, { "id": "62", "name": "Dominican Republic", "is_normal": "1" }, { "id": "63", "name": "Dutch", "is_normal": "1" }, { "id": "64", "name": "Ecuador", "is_normal": "1" }, { "id": "65", "name": "Egypt", "is_normal": "0" }, { "id": "66", "name": "El Salvador", "is_normal": "1" }, { "id": "67", "name": "Equatorial Guinea", "is_normal": "0" }, { "id": "68", "name": "Eritrea", "is_normal": "0" }, { "id": "69", "name": "Estonia", "is_normal": "1" }, { "id": "70", "name": "Ethiopia", "is_normal": "0" }, { "id": "71", "name": "Falkland Islands", "is_normal": "0" }, { "id": "72", "name": "Faroe Islands", "is_normal": "0" }, { "id": "73", "name": "Fiji", "is_normal": "1" }, { "id": "74", "name": "Finland", "is_normal": "1" }, { "id": "75", "name": "France", "is_normal": "1" }, { "id": "76", "name": "French Guiana", "is_normal": "0" }, { "id": "77", "name": "French Polynesia", "is_normal": "0" }, { "id": "78", "name": "Gabon", "is_normal": "0" }, { "id": "79", "name": "Gambia", "is_normal": "0" }, { "id": "80", "name": "Georgia", "is_normal": "0" }, { "id": "81", "name": "Germany", "is_normal": "1" }, { "id": "82", "name": "Ghana", "is_normal": "0" }, { "id": "83", "name": "Gibraltar", "is_normal": "0" }, { "id": "84", "name": "Greece", "is_normal": "1" }, { "id": "85", "name": "Greenland", "is_normal": "1" }, { "id": "86", "name": "Grenada", "is_normal": "0" }, { "id": "87", "name": "Guadeloupe", "is_normal": "0" }, { "id": "88", "name": "Guam", "is_normal": "1" }, { "id": "89", "name": "Guatemala", "is_normal": "1" }, { "id": "90", "name": "Guinea", "is_normal": "0" }, { "id": "91", "name": "Guinea-Bissau", "is_normal": "0" }, { "id": "92", "name": "Guyana", "is_normal": "0" }, { "id": "93", "name": "Haiti", "is_normal": "0" }, { "id": "94", "name": "Heard & Mcdonald Is.", "is_normal": "0" }, { "id": "95", "name": "Holland", "is_normal": "1" }, { "id": "96", "name": "Honduras", "is_normal": "1" }, { "id": "97", "name": "Hong Kong", "is_normal": "1" }, { "id": "98", "name": "Hungary", "is_normal": "1" }, { "id": "99", "name": "Iceland", "is_normal": "1" }, { "id": "100", "name": "India", "is_normal": "1" }, { "id": "101", "name": "Indonesia", "is_normal": "1" }, { "id": "102", "name": "Iran", "is_normal": "0" }, { "id": "103", "name": "Iraq", "is_normal": "0" }, { "id": "104", "name": "Ireland", "is_normal": "1" }, { "id": "105", "name": "Israel", "is_normal": "1" }, { "id": "106", "name": "Italy", "is_normal": "1" }, { "id": "107", "name": "Jamaica", "is_normal": "0" }, { "id": "108", "name": "Japan", "is_normal": "1" }, { "id": "109", "name": "Jordan", "is_normal": "0" }, { "id": "110", "name": "Kazakhstan", "is_normal": "1" }, { "id": "111", "name": "Kenya", "is_normal": "0" }, { "id": "112", "name": "Keeling Islands", "is_normal": "0" }, { "id": "113", "name": "Kiribati", "is_normal": "0" }, { "id": "114", "name": "Kosovo", "is_normal": "0" }, { "id": "115", "name": "Kuwait", "is_normal": "0" }, { "id": "116", "name": "Kyrgyzstan", "is_normal": "1" }, { "id": "117", "name": "Laos", "is_normal": "1" }, { "id": "118", "name": "Latvia", "is_normal": "1" }, { "id": "119", "name": "Lebanon", "is_normal": "0" }, { "id": "120", "name": "Lesotho", "is_normal": "0" }, { "id": "121", "name": "Liberia", "is_normal": "0" }, { "id": "122", "name": "Libya", "is_normal": "0" }, { "id": "123", "name": "Liechtenstein", "is_normal": "1" }, { "id": "124", "name": "Lithuania", "is_normal": "1" }, { "id": "125", "name": "Luxembourg", "is_normal": "1" }, { "id": "126", "name": "Macau", "is_normal": "1" }, { "id": "127", "name": "Macedonia", "is_normal": "1" }, { "id": "128", "name": "Madagascar", "is_normal": "0" }, { "id": "129", "name": "Malawi", "is_normal": "0" }, { "id": "130", "name": "Malaysia", "is_normal": "1" }, { "id": "131", "name": "Maldives", "is_normal": "1" }, { "id": "132", "name": "Mali", "is_normal": "0" }, { "id": "133", "name": "Malta", "is_normal": "1" }, { "id": "134", "name": "Malvinas", "is_normal": "1" }, { "id": "135", "name": "Marshall Islands", "is_normal": "0" }, { "id": "136", "name": "Martinique", "is_normal": "0" }, { "id": "137", "name": "Mauritania", "is_normal": "0" }, { "id": "138", "name": "Mauritius", "is_normal": "0" }, { "id": "139", "name": "Mayotte", "is_normal": "0" }, { "id": "140", "name": "Mexico", "is_normal": "1" }, { "id": "141", "name": "Micronesia", "is_normal": "0" }, { "id": "142", "name": "Moldova", "is_normal": "1" }, { "id": "143", "name": "Monaco", "is_normal": "0" }, { "id": "144", "name": "Mongolia", "is_normal": "1" }, { "id": "145", "name": "Montserrat", "is_normal": "0" }, { "id": "146", "name": "Morocco", "is_normal": "0" }, { "id": "147", "name": "Mozambique", "is_normal": "0" }, { "id": "148", "name": "Myanmar", "is_normal": "1" }, { "id": "149", "name": "Namibia", "is_normal": "0" }, { "id": "150", "name": "Nauru", "is_normal": "0" }, { "id": "151", "name": "Nepal", "is_normal": "0" }, { "id": "152", "name": "Netherlands", "is_normal": "1" }, { "id": "153", "name": "Netherlands Antilles", "is_normal": "1" }, { "id": "154", "name": "New Caledonia", "is_normal": "0" }, { "id": "155", "name": "New Zealand", "is_normal": "1" }, { "id": "156", "name": "Nicaragua", "is_normal": "1" }, { "id": "157", "name": "Niger", "is_normal": "0" }, { "id": "158", "name": "Nigeria", "is_normal": "0" }, { "id": "159", "name": "Niue", "is_normal": "0" }, { "id": "160", "name": "Norfolk Island", "is_normal": "0" }, { "id": "161", "name": "North Korea", "is_normal": "0" }, { "id": "162", "name": "Northern Mariana Is.", "is_normal": "0" }, { "id": "163", "name": "Norway", "is_normal": "1" }, { "id": "164", "name": "Oman", "is_normal": "0" }, { "id": "165", "name": "Pakistan", "is_normal": "0" }, { "id": "166", "name": "Palau", "is_normal": "0" }, { "id": "167", "name": "Palestine", "is_normal": "0" }, { "id": "168", "name": "Panama", "is_normal": "1" }, { "id": "169", "name": "Papua New Guinea", "is_normal": "1" }, { "id": "170", "name": "Paraguay", "is_normal": "1" }, { "id": "171", "name": "Peru", "is_normal": "1" }, { "id": "172", "name": "Philippines", "is_normal": "1" }, { "id": "173", "name": "Pitcairn Islands", "is_normal": "0" }, { "id": "174", "name": "Poland", "is_normal": "1" }, { "id": "175", "name": "Portugal", "is_normal": "1" }, { "id": "176", "name": "Puerto Rico", "is_normal": "1" }, { "id": "177", "name": "Qatar", "is_normal": "0" }, { "id": "178", "name": "Reunion Islands", "is_normal": "0" }, { "id": "179", "name": "Romania", "is_normal": "1" }, { "id": "180", "name": "Russian Federation", "is_normal": "1" }, { "id": "181", "name": "Rwanda", "is_normal": "0" }, { "id": "182", "name": "Saint Barthelemy", "is_normal": "0" }, { "id": "183", "name": "Saint Helena", "is_normal": "0" }, { "id": "184", "name": "Saint Kitts and Nevis", "is_normal": "0" }, { "id": "185", "name": "Saint Lucia", "is_normal": "0" }, { "id": "186", "name": "Saint Martin", "is_normal": "0" }, { "id": "187", "name": "Saint Pierre & Miquelon", "is_normal": "0" }, { "id": "188", "name": "Saint Vincent & Grenadines", "is_normal": "0" }, { "id": "189", "name": "Samoa", "is_normal": "0" }, { "id": "190", "name": "San Marino", "is_normal": "0" }, { "id": "191", "name": "Sao Tome & Principe", "is_normal": "0" }, { "id": "192", "name": "Saudi Arabia", "is_normal": "0" }, { "id": "193", "name": "Senegal", "is_normal": "0" }, { "id": "194", "name": "Serbia", "is_normal": "1" }, { "id": "195", "name": "Seychelles", "is_normal": "0" }, { "id": "196", "name": "Sierra Leone", "is_normal": "0" }, { "id": "197", "name": "Singapore", "is_normal": "1" }, { "id": "198", "name": "Slovakia", "is_normal": "1" }, { "id": "199", "name": "Slovenia", "is_normal": "1" }, { "id": "200", "name": "Solomon Islands", "is_normal": "0" }, { "id": "201", "name": "Somalia", "is_normal": "0" }, { "id": "202", "name": "South Africa", "is_normal": "1" }, { "id": "203", "name": "South Korea", "is_normal": "0" }, { "id": "204", "name": "South Georgia Is.", "is_normal": "0" }, { "id": "205", "name": "South Sandwich Is.", "is_normal": "0" }, { "id": "206", "name": "Spain", "is_normal": "1" }, { "id": "207", "name": "Sri Lanka", "is_normal": "0" }, { "id": "208", "name": "Sudan", "is_normal": "0" }, { "id": "209", "name": "Suriname", "is_normal": "0" }, { "id": "210", "name": "Swaziland", "is_normal": "0" }, { "id": "211", "name": "Sweden", "is_normal": "1" }, { "id": "212", "name": "Switzerland", "is_normal": "1" }, { "id": "213", "name": "Syria", "is_normal": "0" }, { "id": "214", "name": "Taiwan", "is_normal": "1" }, { "id": "215", "name": "Tajikistan", "is_normal": "1" }, { "id": "216", "name": "Tanzania", "is_normal": "0" }, { "id": "217", "name": "Thailand", "is_normal": "1" }, { "id": "218", "name": "Timor-Leste", "is_normal": "0" }, { "id": "219", "name": "Togo", "is_normal": "0" }, { "id": "220", "name": "Tokelau", "is_normal": "0" }, { "id": "221", "name": "Tonga", "is_normal": "0" }, { "id": "222", "name": "Trinidad & Tobago", "is_normal": "1" }, { "id": "223", "name": "Tunisia", "is_normal": "0" }, { "id": "224", "name": "Turkey", "is_normal": "0" }, { "id": "225", "name": "Turkmenistan", "is_normal": "1" }, { "id": "226", "name": "Turks & Caicos Islands", "is_normal": "0" }, { "id": "227", "name": "Tuvalu", "is_normal": "0" }, { "id": "228", "name": "Uganda", "is_normal": "0" }, { "id": "229", "name": "Ukraine", "is_normal": "1" }, { "id": "230", "name": "United Arab Emirates", "is_normal": "0" }, { "id": "231", "name": "United Kingdom", "is_normal": "1" }, { "id": "232", "name": "United States", "is_normal": "1" }, { "id": "233", "name": "Uruguay", "is_normal": "1" }, { "id": "234", "name": "Uzbekistan", "is_normal": "1" }, { "id": "235", "name": "Vanuatu", "is_normal": "0" }, { "id": "236", "name": "Venezuela", "is_normal": "1" }, { "id": "237", "name": "Vietnam", "is_normal": "0" }, { "id": "238", "name": "Virgin Islands, UK", "is_normal": "0" }, { "id": "239", "name": "Virgin Islands, U.S", "is_normal": "0" }, { "id": "240", "name": "Wallis & Futuna", "is_normal": "0" }, { "id": "241", "name": "Western Sahara", "is_normal": "0" }, { "id": "242", "name": "Yemen", "is_normal": "0" }, { "id": "243", "name": "Zambia", "is_normal": "0" }, { "id": "244", "name": "Zimbabwe", "is_normal": "0" } ]'; die; } } }
public function statusAction() { $view = new ViewModel(); $id = $this->params()->fromRoute('id', 0); $status = $this->params()->fromRoute('status', 0); $VisaTable = $this->getServiceLocator()->get('VisaTable'); if ($id == 0) { return $this->redirect()->toRoute('Visa', array('controller' => 'Visa', 'action' => 'list')); } else { $exchange_data = array(); $exchange_data['id'] = $id; $exchange_data['status'] = $status; $Visa = new Visa(); $Visa->exchangeArray($exchange_data); $checkupdate = $VisaTable->savestatus($Visa); $view->id = $id; $view->check = $checkupdate; return $view; } }