public function addLogBook() { $data = $this->form_values; $dose_no = $this->form_values['dose_no_of']; $temp = $this->form_values['temp']; $temp = base64_decode(substr($temp, 1, strlen($temp) - 1)); $temp = explode("|", $temp); $warehouse_id = $temp[0]; //$loc_id = $temp[1]; $rpt_date = $temp[1]; $is_new_rpt = $temp[2]; $tt = explode("-", $rpt_date); $yy = $tt[0]; $mm = $tt[1]; $dd = $tt[2]; $date = date("Y-m-d h:i:s"); $year_month = $yy . "-" . $mm; $vaccination_date = $yy . "-" . $mm . "-" . $this->form_values['day']; $user_id = $this->_user_id; $log_book = new LogBook(); $log_book->setName($this->form_values['name']); $log_book->setFatherName($this->form_values['father_name']); $log_book->setAge($this->form_values['age']); $log_book->setGender($this->form_values['gender']); $log_book->setContact($this->form_values['contact']); $log_book->setAddress($this->form_values['address']); //$refer_to_warehouseId = $this->_em->getRepository('Warehouses')->find($this->form_values['refer_to']); //$log_book->setReferToWarehouse($refer_to_warehouseId); $districtId = $this->_em->getRepository('Locations')->find($this->form_values['district']); $log_book->setDistrict($districtId); if (!empty($this->form_values['uc'])) { $ucId = $this->_em->getRepository('Locations')->find($this->form_values['uc']); $log_book->setUnionCouncil($ucId); } $log_book->setVaccinationDate(new \DateTime($vaccination_date)); //$log_book->setRefferTo(); //warehouseid from session $log_book->setRemarks($this->form_values['remarks']); $warehouse = $this->_em->getRepository('Warehouses')->find($warehouse_id); $log_book->setWarehouse($warehouse); $log_book->setCreatedDate(new \DateTime(App_Controller_Functions::dateToDbFormat($date))); $userId = $this->_em->getRepository('Users')->find($user_id); $log_book->setCreatedBy($userId); $this->_em->persist($log_book); $this->_em->flush(); $log_book_id = $log_book->getPkId(); foreach ($dose_no as $prodId => $value) { if ($value == "") { $value = NULL; } $log_book_item_doses = new LogBookItemDoses(); $logBook = $this->_em->getRepository('LogBook')->find($log_book_id); $log_book_item_doses->setLogBook($logBook); $itemPack = $this->_em->getRepository('ItemPackSizes')->find($prodId); $log_book_item_doses->setItemPackSize($itemPack); $log_book_item_doses->setDoses($value); $this->_em->persist($log_book_item_doses); $this->_em->flush(); } }
public function setGender($gender) { $this->__load(); return parent::setGender($gender); }