public function register($id = '') { $booking_action = ''; $this->setViewData('action', 'insert'); $action = $this->request_param('action'); if ($action == 'update') { $this->set_request_object('booking'); $this->set_booking_data(); $this->set_order_data(); $this->unset_request_object(); $booking = $this->request_data['booking']; $orders = $this->request_data['order']; $booking['booking_status'] = $this->request_array('booking_status', 'booking'); $this->Model_booking->update_booking($id, $booking); if ($orders) { foreach ($orders as $order) { $order_id = $order['order_id']; unset($order['order_id']); $this->Model_booking->update_order($order_id, $order); } } $this->redirectTO(admin_base_url('order/update/' . $id), "The Booking successfully updated."); } elseif ($action == 'insert') { $booking = $this->request_param('booking'); $this->setViewData('data_object', $booking); $this->set_request_object('booking'); $this->set_booking_data(); $this->set_order_data(); $this->unset_request_object(); if ($this->check_errors()) { $this->errors_response(); } else { $booking_data = $this->request_data['booking']; $order_data = $this->request_data['order']; $booking_data['invoice_id'] = $this->Model_booking->get_unique_invice_id(10); $booking_id = $this->Model_booking->register($booking_data); $order_ids = $this->Model_booking->register_orders($booking_id, $order_data); $this->redirectTO(admin_base_url('order/lists'), "The order successfully placed."); } } $this->setViewData('panel_heading', "Order info"); $this->setViewData('action', "insert"); $this->add_style('assets/vendors/timepicker/jquery.timepicker.css'); $this->add_script('assets/vendors/timepicker/jquery.timepicker.min.js', true); $this->add_style('assets/vendors/autocomplete/autocomplete.css'); $this->add_script('assets/vendors/autocomplete/jquery.autocomplete.min.js', true); $this->add_auto_load_script('google_map'); $this->add_auto_load_script('booking', true); $this->setViewData('timeframes', $this->Model_order->getDatas(TBL_TIMEFRAME_MASTER)); $this->setViewData('special_types', key_value_pair($this->Model_order->getDatas(TBL_SPECIAL_TYPE_MASTER), 'id', 'name', array('' => 'Select Special type'))); $this->setViewData('capacity_types', key_value_pair($this->Model_order->getDatas(TBL_TONNAGE_MASTER), 'id', 'name', array('' => 'Select capicity type'))); $this->setViewData('cities', key_value_pair($this->Model_order->getDatas(TBL_MASTER_CITY), 'id', 'name', array('' => 'Select City'))); $this->setViewData('states', key_value_pair($this->Model_order->getDatas(TBL_MASTER_STATE), 'id', 'name', array('' => 'Select State'))); $this->setViewData('booking_statuses', $this->status->get_booking_status_array()); $this->setViewData('booking_action', $booking_action); if ($id) { $this->setViewData('action', 'update'); $data = $this->Model_booking->get_order($id); $dates = $this->Model_booking->getDatas(TBL_ORDERS, array('booking_no' => $id), array('pickup_date', 'id')); $d = array(); if ($dates) { foreach ($dates as $date) { $d[$date['id']] = $date['pickup_date']; } } $data['booking_date'] = $d; $this->setViewData('data_object', $data); } $this->render_view('register', 'order'); }
private function set_entry_data() { $this->setViewData('special_types', key_value_pair($this->Model_vehical->getDatas(TBL_SPECIAL_TYPE_MASTER), 'id', 'name')); $this->setViewData('tonnage_array', key_value_pair($this->Model_vehical->getDatas(TBL_TONNAGE_MASTER), 'id', 'name')); }
private function set_entry_data() { $this->setViewData('agencies', key_value_pair($this->Model_labour->getDatas(TBL_AGENCIES), 'id', 'name')); }
private function process_ratecard($id = '') { $action = 'insert'; if ($id) { $rate_cards = $this->Model_common->getData(TBL_RATE_CARD, array('id' => $id)); $action = 'update'; } $rate_card_array = array(); $cities = $this->Model_defination->get_cities(); $rate_card_array['city'] = form_dropdown('rate_card[city]', key_value_pair($cities, 'id', 'name', array('' => "Select city")), isset($rate_cards['city']) ? $rate_cards['city'] : '', 'required'); $cities = $this->Model_defination->getDatas(TBL_SPECIAL_TYPE_MASTER); $rate_card_array['special_type'] = form_dropdown('rate_card[special_type]', key_value_pair($cities, 'id', 'name', array('' => "Select special type")), isset($rate_cards['special_type']) ? $rate_cards['special_type'] : '', 'required'); $cities = $this->Model_defination->getDatas(TBL_TONNAGE_MASTER); $rate_card_array['size'] = form_dropdown('rate_card[size]', key_value_pair($cities, 'id', 'name', array('' => "Select size")), isset($rate_cards['size']) ? $rate_cards['size'] : '', 'required'); $rate_card_array['mode'] = form_dropdown('rate_card[mode]', array(1 => "KM Based"), isset($rate_cards['mode']) ? $rate_cards['mode'] : '', 'required'); $rate_card_array['mode_unit'] = form_input('rate_card[mode_unit]', isset($rate_cards['mode_unit']) ? $rate_cards['mode_unit'] : '', ''); $rate_card_array['mode_unit_cost'] = form_input('rate_card[mode_unit_cost]', isset($rate_cards['mode_unit_cost']) ? $rate_cards['mode_unit_cost'] : '', ''); $rate_card_array['waiting_hour_unit'] = form_input('rate_card[waiting_hour_unit]', isset($rate_cards['waiting_hour_unit']) ? $rate_cards['waiting_hour_unit'] : '', ''); $rate_card_array['wating_hour_cost'] = form_input('rate_card[wating_hour_cost]', isset($rate_cards['wating_hour_cost']) ? $rate_cards['wating_hour_cost'] : '', ''); $rate_card_array['free_wating_time'] = form_input('rate_card[free_wating_time]', isset($rate_cards['free_wating_time']) ? $rate_cards['free_wating_time'] : '', ''); $rate_card_array['km_limit'] = form_input('rate_card[km_limit]', isset($rate_cards['km_limit']) ? $rate_cards['km_limit'] : '', ''); $rate_card_array['additional_km_unit'] = form_input('rate_card[additional_km_unit]', isset($rate_cards['additional_km_unit']) ? $rate_cards['additional_km_unit'] : '', ''); $rate_card_array['additional_km_cost'] = form_input('rate_card[additional_km_cost]', isset($rate_cards['additional_km_cost']) ? $rate_cards['additional_km_cost'] : '', ''); $rate_card_array['special_type_multiplier'] = form_input('rate_card[special_type_multiplier]', isset($rate_cards['special_type_multiplier']) ? $rate_cards['special_type_multiplier'] : '', ''); $rate_card_array['labour_rate'] = form_input('rate_card[labour_rate]', isset($rate_cards['labour_rate']) ? $rate_cards['labour_rate'] : '', ''); $rate_card_array['action'] = ''; $rate_card_array['action'] .= form_hidden('action', $action, ''); $rate_card_array['action'] .= form_submit('submit', 'Save', 'class="btn btn-primary"'); $this->setViewData('rate_card', $rate_card_array); }
public function update_place() { $this->loadS_model('defination'); $type = $this->request('type'); $id = $this->request('id'); $data = $this->Model_defination->get_place_data($type, $id); $data['panel_heading_' . $type] = ucfirst($type) . ' info'; $data['states'] = key_value_pair($this->Model_defination->get_states(), 'id', 'name'); $data['countries'] = key_value_pair($this->Model_defination->get_countries(), 'id', 'name'); $this->load_view($type, 'defination', $data); }
public function metadatas() { $this->setSuccess(); $this->setData('meta', key_value_pair($this->Model_common->getDatas(TBL_METAS))); $this->setData('tonnage', $this->Model_common->getDatas(TBL_TONNAGE_MASTER)); $this->setData('special_types', $this->Model_common->getDatas(TBL_SPECIAL_TYPE_MASTER)); $this->setData('cities', $this->Model_common->getDatas(TBL_MASTER_CITY)); $this->setData('ccountry', $this->Model_common->getDatas(TBL_MASTER_COUNTRY)); $this->setData('state', $this->Model_common->getDatas(TBL_MASTER_STATE)); $this->setData('banks', array(array('id' => 1, 'name' => 'State Bank of India'), array('id' => 2, 'name' => 'United Bank Of India'), array('id' => 3, 'name' => 'Bank of India'), array('id' => 4, 'name' => 'Allahabad Bank'))); $html_text = "<p><span style='font-size: medium;'>Friends earn Rs 200 </span></p><p><span style='font-size: large;'>Friend Rides,<strong>you earn Rs.200</strong></span></p><p><span style='font-size: medium;'>Share your referal code 0XD48KL</span></p>"; $this->setData('banner_text', $html_text); $time_frame = $this->Model_common->getDatas(TBL_TIMEFRAME_MASTER); if ($time_frame) { foreach ($time_frame as $key => $time) { $time_frame[$key]['start'] = date('h a', strtotime($time['start'])); $time_frame[$key]['end'] = date('h a', strtotime($time['end'])); } } $this->setData('timeframes', $time_frame); $this->response(); }