public function save_vaccine() { $vaccine_id = $this->input->post('vaccine_id'); //Check if we are in editing mode first; if so, retrieve the edited record. if not, create a new one! if (strlen($vaccine_id) > 0) { $vaccine = Vaccines::getVaccine($vaccine_id); } else { $vaccine = new Vaccines(); } $vaccine->Name = $this->input->post("name"); $vaccine->Doses_Required = $this->input->post("doses_required"); $vaccine->Wastage_Factor = $this->input->post("wastage_factor"); $vaccine->Designation = $this->input->post("designation"); $vaccine->Formulation = $this->input->post("formulation"); $vaccine->Administration = $this->input->post("administration"); $vaccine->Presentation = $this->input->post("presentation"); $vaccine->Vaccine_Packed_Volume = $this->input->post("vaccine_packed_volume"); $vaccine->Diluents_Packed_Volume = $this->input->post("diluents_packed_volume"); $vaccine->Vaccine_Vial_Price = $this->input->post("vaccine_vial_price"); $vaccine->Vaccine_Dose_Price = $this->input->post("vaccine_dose_price"); $vaccine->Fridge_Compartment = $this->input->post("fridge_compartment"); $vaccine->Added_By = $this->session->userdata('user_id'); $vaccine->Timestamp = date('U'); $vaccine->Tray_Color = $this->input->post("tray_color"); $vaccine->save(); redirect("vaccine_management"); }
public function save_vaccine() { $vaccine = new Vaccines(); $vaccine -> Name = $this -> input -> post("name"); $vaccine -> Doses_Required = $this -> input -> post("doses_required"); $vaccine -> Wastage_Factor = $this -> input -> post("wastage_factor"); $vaccine -> Designation = $this -> input -> post("designation"); $vaccine -> Formulation = $this -> input -> post("formulation"); $vaccine -> Administration = $this -> input -> post("administration"); $vaccine -> Presentation = $this -> input -> post("presentation"); $vaccine -> Vaccine_Packed_Volume = $this -> input -> post("vaccine_packed_volume"); $vaccine -> Diluents_Packed_Volume = $this -> input -> post("diluents_packed_volume"); $vaccine -> Vaccine_Vial_Price = $this -> input -> post("vaccine_vial_price"); $vaccine -> Vaccine_Dose_Price = $this -> input -> post("vaccine_dose_price"); $vaccine -> Added_By = $this -> session -> userdata('user_id'); $vaccine -> Timestamp = date('U'); $vaccine -> Tray_Color = $this -> input -> post("tray_color"); $vaccine -> save(); redirect("vaccine_management"); }