public function save_general() { $batch_save_data = array('default_tax_1_rate' => parse_decimals($this->input->post('default_tax_1_rate')), 'default_tax_1_name' => $this->input->post('default_tax_1_name'), 'default_tax_2_rate' => parse_decimals($this->input->post('default_tax_2_rate')), 'default_tax_2_name' => $this->input->post('default_tax_2_name'), 'tax_included' => $this->input->post('tax_included') != NULL, 'receiving_calculate_average_price' => $this->input->post('receiving_calculate_average_price') != NULL, 'lines_per_page' => $this->input->post('lines_per_page'), 'default_sales_discount' => $this->input->post('default_sales_discount'), 'notify_horizontal_position' => $this->input->post('notify_horizontal_position'), 'notify_vertical_position' => $this->input->post('notify_vertical_position'), 'custom1_name' => $this->input->post('custom1_name'), 'custom2_name' => $this->input->post('custom2_name'), 'custom3_name' => $this->input->post('custom3_name'), 'custom4_name' => $this->input->post('custom4_name'), 'custom5_name' => $this->input->post('custom5_name'), 'custom6_name' => $this->input->post('custom6_name'), 'custom7_name' => $this->input->post('custom7_name'), 'custom8_name' => $this->input->post('custom8_name'), 'custom9_name' => $this->input->post('custom9_name'), 'custom10_name' => $this->input->post('custom10_name')); $result = $this->Appconfig->batch_save($batch_save_data); $success = $result ? TRUE : FALSE; echo json_encode(array('success' => $success, 'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully'))); }
public function check_numeric() { $result = TRUE; foreach ($this->input->get() as $str) { $result = parse_decimals($str); } echo $result !== FALSE ? 'true' : 'false'; }
public function save($giftcard_id = -1) { $giftcard_data = array('record_time' => date('Y-m-d H:i:s'), 'giftcard_number' => $this->input->post('giftcard_number'), 'value' => parse_decimals($this->input->post('value')), 'person_id' => $this->input->post('person_id') == '' ? NULL : $this->input->post('person_id')); if ($this->Giftcard->save($giftcard_data, $giftcard_id)) { $giftcard_data = $this->xss_clean($giftcard_data); //New giftcard if ($giftcard_id == -1) { echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('giftcards_successful_adding') . ' ' . $giftcard_data['giftcard_number'], 'id' => $giftcard_data['giftcard_id'])); } else { echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('giftcards_successful_updating') . ' ' . $giftcard_data['giftcard_number'], 'id' => $giftcard_id)); } } else { $giftcard_data = $this->xss_clean($giftcard_data); echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('giftcards_error_adding_updating') . ' ' . $giftcard_data['giftcard_number'], 'id' => -1)); } }
public function edit_item($item_id) { $data = array(); $this->form_validation->set_rules('price', 'lang:items_price', 'required|callback_numeric'); $this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|callback_numeric'); $this->form_validation->set_rules('discount', 'lang:items_discount', 'required|callback_numeric'); $description = $this->input->post('description'); $serialnumber = $this->input->post('serialnumber'); $price = parse_decimals($this->input->post('price')); $quantity = parse_decimals($this->input->post('quantity')); $discount = parse_decimals($this->input->post('discount')); $item_location = $this->input->post('location'); if ($this->form_validation->run() != FALSE) { $this->receiving_lib->edit_item($item_id, $description, $serialnumber, $quantity, $discount, $price); } else { $data['error'] = $this->lang->line('receivings_error_editing_item'); } $this->_reload($data); }
public function save_inventory($item_id = -1) { $employee_id = $this->Employee->get_logged_in_employee_info()->person_id; $cur_item_info = $this->Item->get_info($item_id); $location_id = $this->input->post('stock_location'); $inv_data = array('trans_date' => date('Y-m-d H:i:s'), 'trans_items' => $item_id, 'trans_user' => $employee_id, 'trans_location' => $location_id, 'trans_comment' => $this->input->post('trans_comment'), 'trans_inventory' => parse_decimals($this->input->post('newquantity'))); $this->Inventory->insert($inv_data); //Update stock quantity $item_quantity = $this->Item_quantity->get_item_quantity($item_id, $location_id); $item_quantity_data = array('item_id' => $item_id, 'location_id' => $location_id, 'quantity' => $item_quantity->quantity + parse_decimals($this->input->post('newquantity'))); if ($this->Item_quantity->save($item_quantity_data, $item_id, $location_id)) { $message = $this->xss_clean($this->lang->line('items_successful_updating') . ' ' . $cur_item_info->name); echo json_encode(array('success' => TRUE, 'message' => $message, 'id' => $item_id)); } else { $message = $this->xss_clean($this->lang->line('items_error_adding_updating') . ' ' . $cur_item_info->name); echo json_encode(array('success' => FALSE, 'message' => $message, 'id' => -1)); } }