public function updateAction() { if ($this->_request->getPost()) { $form_values = $this->_request->getPost(); $make = $this->_em->getRepository("CcmMakes")->find($form_values['make_id']); $make->setCcmMakeName($form_values['ccm_make_name']); $created_by = $this->_em->find('Users', $this->_userid); $make->setModifiedBy($created_by); $make->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($make); $this->_em->flush(); } $this->_redirect("/cadmin/manage-makes"); }
public function addMake() { $ccm_makes = new CcmMakes(); $ccm_makes->setTransactionReference($this->form_values['transaction_reference']); $ccm_makes->setTransactionNumber($trans_no); $created_by = $this->_em->find('Users', $this->_user_id); $ccm_makes->setCreatedBy($created_by); $ccm_makes->setCreatedDate(App_Tools_Time::now()); $ccm_makes->setModifiedBy($created_by); $ccm_makes->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_makes); $this->_em->flush(); return $stock_master->getPkId(); }
public function addReportDatesAction() { $form = new Form_Iadmin_UpdateCluster(); if ($this->_request->isPost()) { $form_values = $this->_request->getPost(); if ($form_values['search'] == 'search') { $warehouses = new Model_Warehouses(); $warehouses->form_values = $form_values; $form->province->setValue($form_values['province']); $form->province_hidden->setValue($form_values['province']); $form->district_hidden->setValue($form_values['district']); $form->user_hidden->setValue($form_values['user']); $warehouse_data = $warehouses->getAllWarehousesReportDate(); $this->view->data = $warehouse_data; } else { $form_values_submit = $this->_request->getPost(); if ($form_values_submit['check'] != "") { foreach ($form_values_submit['check'] as $warehouse_id) { $warehouses_db = $this->_em->getRepository('Warehouses')->find($warehouse_id); if ($form_values_submit['from_edit'] != "") { $warehouses_db->setFromEdit(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values_submit['from_edit']))); } if ($form_values_submit['starting_on'] != "") { $warehouses_db->setStartingOn(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values_submit['starting_on']))); } if ($form_values_submit['working_uptil'] != "") { $warehouses_db->setWorkingUptill(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values_submit['working_uptil']))); } } $created_by = $this->_em->find('Users', $this->_user_id); $warehouses_db->setCreatedBy($created_by); $warehouses_db->setCreatedDate(App_Tools_Time::now()); $warehouses_db->setModifiedBy($created_by); $warehouses_db->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($warehouses_db); $this->_em->flush(); } } } $this->view->form = $form; }
public function addProcurements() { $data = $this->form_values; // App_Controller_Functions::pr($data); $shipments = new Shipments(); $shipmentHistory = new ShipmentHistory(); $shipments->setReferenceNumber($data['transaction_reference']); $item_id = $this->_em->getRepository('ItemPackSizes')->find($data['item_id']); $shipments->setItemPackSize($item_id); $shipments->setShipmentDate(new \DateTime(App_Controller_Functions::dateToDbFormat($data['shipment_date']))); $shipments->setShipmentQuantity($data['quantity']); $funding_source_id = $this->_em->getRepository('Warehouses')->find($data['from_warehouse_id']); $shipments->setFundingSource($funding_source_id); $activity_id = $this->_em->getRepository('StakeholderActivities')->find($data['activity_id']); $shipments->setStakeholderActivity($activity_id); $warhouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $shipments->setWarehouse($warhouse_id); $shipments->setCreatedDate(new \DateTime(date("Y-m-d"))); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $shipments->setCreatedBy($created_by); $shipments->setModifiedBy($created_by); $shipments->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($shipments); $this->_em->flush(); $id = $shipments->getPkId(); $shipment_id = $this->_em->getRepository('Shipments')->find($id); $shipmentHistory->setShipment($shipment_id); $shipmentHistory->setStatus($data['status']); $shipmentHistory->setReferenceNumber($data['transaction_reference']); $shipmentHistory->setCreatedDate(new \DateTime(date("Y-m-d"))); //$created_by = $this->_em->getRepository('Users')->find($this->_user_id); $shipmentHistory->setCreatedBy($created_by); $shipmentHistory->setModifiedBy($created_by); $shipmentHistory->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($shipmentHistory); $this->_em->flush(); $shipment_history_id = $shipmentHistory->getPkId(); return $shipment_history_id; }
public function changePasswordDocAction() { $this->_helper->layout->setLayout('doc'); if ($this->_request->isPost()) { $this->m_strPass = base64_encode($this->_request->new_pass); $this->m_login = $this->_userid; $users = $this->_em->getRepository('Users')->find($this->_userid); $users->setPassword($this->m_strPass); $created_by = $this->_em->find('Users', $this->_user_id); $users->setModifiedBy($created_by); $users->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($users); $this->_em->flush(); // $rs = $this->Update(); // $strMsg = "Password changed sucessfully"; $this->redirect("/index/change-password-doc?e=1"); } }
public function ajaxChangeStatusAction() { $this->_helper->layout->disableLayout(); $row = $this->_em->getRepository("CcmModels")->find($this->_request->getParam('id')); if ($this->_request->getParam('ajaxaction') == 'active') { $row->setStatus('1'); } else { if ($this->_request->getParam('ajaxaction') == 'deactive') { $row->setStatus('0'); } } $created_by = $this->_em->find('Users', $this->_user_id); $row->setModifiedBy($created_by); $row->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($row); $this->_em->flush(); $this->view->ajaxaction = $this->_request->getParam('ajaxaction'); }
public function stakeholderItemsAction() { $form = new Form_Iadmin_StakeholderItem(); if ($this->_request->isPost()) { $form_values = $this->_request->getPost(); $stakeholder_id = $form_values['stakeholder']; $stakeholders = new Model_Stakeholders(); $stakeholder_item_id = $this->_em->getRepository("StakeholderItemPackSizes")->findBy(array('stakeholder' => $stakeholder_id)); foreach ($stakeholder_item_id as $stakeholder_id_a) { $stk_id = $this->_em->find('StakeholderItemPackSizes', $stakeholder_id_a->getPkId()); $this->_em->remove($stk_id); $this->_em->flush(); } foreach ($form_values['items'] as $stakeholderItemId) { $stakeholder_items = new StakeholderItemPackSizes(); $item_pack_size_id = $this->_em->find('ItemPackSizes', $stakeholderItemId); $stakeholder_items->setItemPackSize($item_pack_size_id); $stakeholders = $this->_em->find('Stakeholders', $stakeholder_id); $stakeholder_items->setStakeholder($stakeholders); $created_by = $this->_em->find('Users', $this->_user_id); $stakeholder_items->setModifiedBy($created_by); $stakeholder_items->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($stakeholder_items); $this->_em->flush(); } $this->_redirect("/iadmin/manage-stakeholders/stakeholder-items?e=1"); } $this->view->form = $form; }
public function updateLocationTypeAction() { if ($this->_request->getPost()) { $form_values = $this->_request->getPost(); $locationType = $this->_em->getRepository("LocationTypes")->find($form_values['location_type_id']); $locationType->setLocationTypeName($form_values['location_type_name']); $geo_level = $this->_em->getRepository('GeoLevels')->find($form_values['geo_level_id']); $locationType->setGeoLevel($geo_level); $created_by = $this->_em->find('Users', $this->_userid); $locationType->setModifiedBy($created_by); $locationType->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($locationType); $this->_em->flush(); } $this->_redirect("/iadmin/manage-locations/location-type?success=2"); }
public function updateCampaignTypeAction() { if ($this->_request->getPost()) { $form_values = $this->_request->getPost(); $campaign_type = $this->_em->getRepository("CampaignTypes")->find($form_values['campaign_type_id']); $campaign_type->setCamapignTypeName($form_values['campaign_type_name']); $createdBy = $this->_em->getRepository('Users')->find($this->_userid); $campaign_type->setModifiedBy($createdBy); $campaign_type->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($campaign_type); $this->_em->flush(); } $this->_redirect("/campaign/manage-campaigns/campaign-types?success=2"); }
public function setPriorityBatchesStatus() { $product_id = $this->form_values['product_id']; $wh_id = $this->_identity->getWarehouseId(); $stacked = Model_StockBatch::STACKED; $finised = Model_StockBatch::FINISHED; $em = Zend_Registry::get('doctrine'); $em->getConnection()->beginTransaction(); try { $this->_em = Zend_Registry::get('doctrine'); $str_upd_fin = "UPDATE stock_batch_warehouses" . "SET `stock_batch_warehouses.status` = '{$finised}' " . "INNER JOIN pack_info ON stock_batch_warehouses.pack_info_id = pack_info.pk_id" . "INNER JOIN stakeholder_item_pack_sizes ON pack_info.stakeholder_item_pack_size_id = stakeholder_item_pack_sizes.pk_id " . "WHERE stock_batch_warehouses.quantity = 0 " . "and stakeholder_item_pack_sizes.item_pack_size_id = {$product_id} " . "and stock_batch_warehouses.warehouse_id={$wh_id}"; $row_finish = $this->_em->getConnection()->prepare($str_upd_fin); $row_finish->execute(); $str_upd_stack = "UPDATE stock_batch_warehouses SET " . "`status` = '{$stacked}' " . "INNER JOIN pack_info ON stock_batch_warehouses.pack_info_id = pack_info.pk_id" . "INNER JOIN stakeholder_item_pack_sizes ON pack_info.stakeholder_item_pack_size_id = stakeholder_item_pack_sizes.pk_id " . "WHERE stock_batch_warehouses.quantity > 0 " . "and stakeholder_item_pack_sizes.item_pack_size_id = {$product_id} " . "and stock_batch_warehouses.warehouse_id={$wh_id}"; $row_stack = $this->_em->getConnection()->prepare($str_upd_stack); $row_stack->execute(); $current_date = new DateTime(date("Y-m-d")); $today = $current_date->format("Y-m-d"); $month3 = $current_date->modify("+3 months"); $after3month = $month3->format("Y-m-d"); $month12 = $current_date->modify("+12 months"); $afteryear = $month12->format("Y-m-d"); $str_qry = "SELECT\n stock_batch_warehouses.pk_id as batch_id,\n stock_batch_warehouses.`status`,\n stock_batch_warehouses.quantity\n FROM\n stock_batch\n INNER JOIN stock_batch_warehouses ON stock_batch.pk_id = stock_batch_warehouses.stock_batch_id\n INNER JOIN pack_info ON stock_batch.pack_info_id = pack_info.pk_id\n INNER JOIN stakeholder_item_pack_sizes ON pack_info.stakeholder_item_pack_size_id = stakeholder_item_pack_sizes.pk_id\n INNER JOIN item_pack_sizes ON stakeholder_item_pack_sizes.item_pack_size_id = item_pack_sizes.pk_id\n LEFT JOIN placements ON placements.stock_batch_warehouse_id = stock_batch_warehouses.pk_id\n INNER JOIN placement_locations ON placements.placement_location_id = placement_locations.pk_id\n INNER JOIN cold_chain ON placement_locations.location_id = cold_chain.pk_id\n WHERE\n stock_batch_warehouses.warehouse_id = {$wh_id} AND\n item_pack_sizes.item_category_id = 1\n AND\n (placements.vvm_stage = 2 OR\n (placements.vvm_stage = 1 AND\n DATE_FORMAT(stock_batch.expiry_date,'%Y-%m-%d')\n BETWEEN '{$today}' AND '{$after3month}')) AND\n stakeholder_item_pack_sizes.item_pack_size_id = {$product_id}\n GROUP BY\n stock_batch_warehouses.pk_id\n HAVING\n quantity > 0\n ORDER BY\n item_pack_sizes.list_rank, stock_batch.expiry_date"; $this->_em = Zend_Registry::get('doctrine'); $row = $this->_em->getConnection()->prepare($str_qry); $row->execute(); $result = $row->fetchAll(); if (count($result) > 0) { foreach ($result as $res) { $stock_batch = $this->_table->find($res['batch_id']); if (count($stock_batch) >= 1) { $stock_batch->setStatus(Model_StockBatch::RUNNING); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $stock_batch->setModifiedBy($created_by); $stock_batch->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($stock_batch); $this->_em->flush(); // return true; } } } else { $str_qry1 = "SELECT\n stock_batch_warehouses.pk_id as batch_id,\n stock_batch_warehouses.`status`,\n stock_batch_warehouses.quantity\n FROM\n stock_batch\n INNER JOIN stock_batch_warehouses ON stock_batch.pk_id = stock_batch_warehouses.stock_batch_id\n INNER JOIN pack_info ON stock_batch.pack_info_id = pack_info.pk_id\n INNER JOIN stakeholder_item_pack_sizes ON pack_info.stakeholder_item_pack_size_id = stakeholder_item_pack_sizes.pk_id\n INNER JOIN item_pack_sizes ON stakeholder_item_pack_sizes.item_pack_size_id = item_pack_sizes.pk_id\n LEFT JOIN placements ON placements.stock_batch_warehouse_id = stock_batch_warehouses.pk_id\n INNER JOIN placement_locations ON placements.placement_location_id = placement_locations.pk_id\n INNER JOIN cold_chain ON placement_locations.location_id = cold_chain.pk_id\n WHERE\n stock_batch_warehouses.warehouse_id = {$wh_id} AND\n item_pack_sizes.item_category_id = 1\n AND\n placements.vvm_stage = 1 AND\n DATE_FORMAT(\n stock_batch.expiry_date,\n '%Y-%m-%d'\n ) BETWEEN '{$after3month}' AND '{$afteryear}' AND\n stakeholder_item_pack_sizes.item_pack_size_id = {$product_id}\n GROUP BY\n stock_batch_warehouses.pk_id\n HAVING\n stock_batch_warehouses.quantity > 0\n ORDER BY\n item_pack_sizes.list_rank, stock_batch.expiry_date"; $this->_em = Zend_Registry::get('doctrine'); $row1 = $this->_em->getConnection()->prepare($str_qry1); $row1->execute(); $result2 = $row1->fetchAll(); foreach ($result2 as $res) { $stock_batch = $this->_table->find($res['batch_id']); if (count($stock_batch) >= 1) { $stock_batch->setStatus(Model_StockBatch::RUNNING); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $stock_batch->setModifiedBy($created_by); $stock_batch->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($stock_batch); $this->_em->flush(); // return true; } } } $em->getConnection()->commit(); } catch (Exception $e) { $em->getConnection()->rollback(); $em->close(); } }
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'])) { $log_book->setUnionCouncilId($this->form_values['uc']); } $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(App_Tools_Time::now()); $log_book->setModifiedDate(App_Tools_Time::now()); $userId = $this->_em->getRepository('Users')->find($user_id); $log_book->setCreatedBy($userId); $log_book->setModifiedBy($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); $user = $this->_em->getRepository('Users')->find($this->_user_id); $log_book_item_doses->setModifiedBy($user); $log_book_item_doses->setCreatedBy($user); $log_book_item_doses->setCreatedDate(App_Tools_Time::now()); $log_book_item_doses->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($log_book_item_doses); $this->_em->flush(); } }
public function updateHfSessions($wh_id, $report_date, $fix_plan_sessions, $fix_actually_held_sessions, $outreach_plan_sessions, $outreach_actually_held_sessions) { $rep_date = explode('-', $report_date); $str_qry_hf = "SELECT hf_sessions.pk_id\n FROM\n hf_sessions\n where\n hf_sessions.warehouse_id ='" . $wh_id . "' \n and DATE_FORMAT(hf_sessions.reporting_start_date, '%Y-%m-%d') = '" . $report_date . "' "; $this->_em = Zend_Registry::get('doctrine'); $row_hf = $this->_em->getConnection()->prepare($str_qry_hf); $row_hf->execute(); $result_hf_edit = $row_hf->fetchAll(); $hf_session_id = $result_hf_edit[0]['pk_id']; if (!empty($hf_session_id)) { $hf_sessions = $this->_em->getRepository('HfSessions')->find($hf_session_id); } else { $hf_sessions = new HfSessions(); } $warehouse_status = $this->_em->getRepository('ListDetail')->find(Model_ListDetail::WAREHOUSE_STATUS_REPORTING); $hf_sessions->setWarehouseStatus($warehouse_status); $hf_sessions->setFixedPlannedSessions($fix_plan_sessions); $hf_sessions->setFixedActuallyHeldSessions($fix_actually_held_sessions); $hf_sessions->setOutreachPlannedSessions($outreach_plan_sessions); $hf_sessions->setOutreachActuallyHeldSessions($outreach_actually_held_sessions); $hf_sessions->setReportingStartDate(new \DateTime(App_Controller_Functions::dateToDbFormat($report_date))); $warehouse_id = $this->_em->getRepository('Warehouses')->find($wh_id); $hf_sessions->setWarehouse($warehouse_id); $user = $this->_em->getRepository('Users')->find($this->_user_id); $hf_sessions->setModifiedBy($user); $hf_sessions->setCreatedBy($user); $hf_sessions->setCreatedDate(App_Tools_Time::now()); $hf_sessions->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($hf_sessions); $this->_em->flush(); }
public function updatePlacement() { $form_values = $this->form_values; $non_ccm_location = $this->_table->find($form_values['placement_id']); $area = $this->_em->find("ListDetail", $form_values['area']); $row = $this->_em->find("ListDetail", $form_values['row']); $rack = $this->_em->find("ListDetail", $form_values['rack']); $rack_information_id = $this->_em->find("RackInformation", $form_values['rack_information_id']); $pallet = $this->_em->find("ListDetail", $form_values['pallet']); $level = $this->_em->find("ListDetail", $form_values['level']); $non_ccm_location->setArea($area); $non_ccm_location->setRow($row); $non_ccm_location->setRack($rack); $non_ccm_location->setRackInformation($rack_information_id); $non_ccm_location->setPallet($pallet); $non_ccm_location->setLevel($level); $locationName = $area->getListValue() . $row->getListValue() . $rack->getListValue() . $pallet->getListValue() . $level->getListValue(); $non_ccm_location->setLocationName($locationName); $str_sql = $this->_em->createQueryBuilder()->select('ncl.locationName')->from("NonCcmLocations", "ncl")->where("ncl.locationName = '{$locationName}'"); $result = $str_sql->getQuery()->getResult(); $created_by = $this->_em->find('Users', $this->_user_id); if (count($result) > 0) { return 0; } else { $non_ccm_location->setLocationName($locationName); $warehouse_id = $this->_identity->getWarehouseId(); $warehouse = $this->_em->find("Warehouses", $warehouse_id); $non_ccm_location->setWarehouse($warehouse); $non_ccm_location->setModifiedBy($created_by); $non_ccm_location->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($non_ccm_location); $this->_em->flush(); $location_id = $non_ccm_location->getPkId(); $placement_location = new PlacementLocations(); $placement_location->setLocationId($location_id); $placement_location->setLocationBarcode($locationName); $loctype_id = $this->_em->find("ListDetail", Model_PlacementLocations::LOCATIONTYPE_NONCCM); $placement_location->setLocationType($loctype_id); $placement_location->setModifiedBy($created_by); $placement_location->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($placement_location); $this->_em->flush(); return 1; } }
public function deleteAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $warehouse_id = $this->_request->getParam("warehouse_id"); $warehouse_status = $this->_request->getParam("status"); $warehouses = $this->_em->getRepository("Warehouses")->find($warehouse_id); //$this->_em->remove($warehouses $msg = ""; if ($warehouse_status == 1) { $warehouses->setStatus(0); $msg = 'Store has been de-activated!'; } else { if ($warehouse_status == 0) { $warehouses->setStatus(1); $msg = 'Store has been activated!'; } } $created_by = $this->_em->find('Users', $this->_user_id); $warehouses->setModifiedBy($created_by); $warehouses->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($warehouses); echo $msg; return $this->_em->flush(); }
public function addStockMasterTemp($array) { // App_Controller_Functions::pr($array); $to_warehouse_id = $array['hdn_receive_warehouse_id']; $from_warehouse_id = $this->_identity->getWarehouseId(); $transaction_date = App_Controller_Functions::dateToDbFormat($array['transaction_date']); $str_qry = "SELECT stock_master.pk_id\n FROM\n stock_master\n where\n stock_master.to_warehouse_id='{$to_warehouse_id}'\n and stock_master.from_warehouse_id = '{$from_warehouse_id}'\n and stock_master.draft=1 and stock_master.transaction_type_id = 2 AND DATE_FORMAT(\n stock_master.transaction_date,\n '%Y-%m-%d'\n ) = '{$transaction_date}' "; $this->_em = Zend_Registry::get('doctrine'); $row = $this->_em->getConnection()->prepare($str_qry); $row->execute(); $result = $row->fetchAll(); $stock_master_id = $result[0]['pk_id']; $detail = $this->_em->getRepository("StockDetail")->findBy(array("stockMaster" => $stock_master_id)); if (count($detail) > 0) { $master = $detail[0]->getStockMaster(); foreach ($detail as $row) { $this->_em->remove($row); } $this->_em->remove($master); $this->_em->flush(); } $stock_master = new StockMaster(); $type = $array['transaction_type_id']; $time_arr = explode(' ', $array['transaction_date']); $time = date('H:i:s', strtotime($time_arr[1] . $time_arr[2])); $stock_master->setTransactionDate(new \DateTime(App_Controller_Functions::dateToDbFormat($time_arr[0]) . '' . $time)); $tran_type = $this->_em->getRepository('TransactionTypes')->find($type); $stock_master->setTransactionType($tran_type); $stock_master->setTransactionReference($array['transaction_reference']); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $stock_master->setCreatedBy($created_by); $stock_master->setModifiedBy($created_by); $stock_master->setParentId(0); $stock_master->setCreatedDate(App_Tools_Time::now()); $stock_master->setModifiedDate(App_Tools_Time::now()); $activity_id = $this->_em->getRepository('StakeholderActivities')->find($array['hdn_activity_id']); $stock_master->setStakeholderActivity($activity_id); if (!empty($array['campaign_id'])) { $stock_master->setCampaignId($array['campaign_id']); } if (!empty($array['dispatch_by'])) { $stock_master->setDispatchBy($array['dispatch_by']); } //$trans = $this->getTransactionNumber($type, $array['transaction_date']); if ($type == 1) { $from_warehouse_id = $this->_em->getRepository('Warehouses')->find($array['from_warehouse_id']); $stock_master->setFromWarehouse($from_warehouse_id); $to_warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $stock_master->setToWarehouse($to_warehouse_id); } else { if ($type == 2) { $from_warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $stock_master->setFromWarehouse($from_warehouse_id); $to_warehouse_id = $this->_em->getRepository('Warehouses')->find($array['hdn_receive_warehouse_id']); $stock_master->setToWarehouse($to_warehouse_id); } } $stock_master->setComments($array['comments']); $stock_master->setTransactionNumber('TEMP'); $stock_master->setDraft(1); $this->_em->persist($stock_master); $this->_em->flush(); $id = $stock_master->getPkId(); //echo $id; //exit; return $id; }
public function addStockDetailTemp($array) { $em = Zend_Registry::get('doctrine'); $action = Zend_Registry::get("action"); $form_values = $array; $end = $form_values['counter']; $row_array = array(); // App_Controller_Functions::pr($array); for ($i = 0; $i < $end; $i++) { $row = $form_values["rows" . $i]; // App_Controller_Functions::pr($row); $quantity = str_replace(",", "", $row['quantity']); if ($quantity > 0) { $stock_detail = new StockDetail(); $type = $array['transaction_type_id']; $type1 = $type; $quantity = str_replace(",", "", $row['quantity']); if ($type == Model_TransactionTypes::TRANSACTION_ISSUE) { $quantity = "-" . $quantity; } $stock_id = $array['stock_master_id']; $stock_master_id = $this->_em->getRepository('StockMaster')->find($stock_id); $stock_detail->setStockMaster($stock_master_id); $row_item = $this->_em->getRepository('ItemPackSizes')->find($row['item_pack_size_id']); $item_unit = $row_item->getItemUnit()->getPkId(); if (!empty($item_unit)) { $item_unit_id = $this->_em->getRepository('ItemUnits')->find($item_unit); $stock_detail->setItemUnit($item_unit_id); } $stock_detail->setQuantity($quantity); if ($array['type'] != 's') { $stock_detail->setTemporary(1); } if ($action == 'ajax-stock-issue-temp') { list($location, $vvm) = explode("|", trim($row['hdn_vvm_stage'])); if ($vvm == 0) { $row['hdn_vvm_stage'] = 0; } else { if (!empty($vvm)) { $row['hdn_vvm_stage'] = $vvm; } else { $row['hdn_vvm_stage'] = $location; } } } $vvms = $this->_em->getRepository("VvmStages")->find($row['hdn_vvm_stage']); $stock_detail->setVvmStage($vvms); //$type = $array['transaction_type_id']; $stock_detail->setAdjustmentType("{$type}"); //$stock_detail->setStakeholderItem($array['manufacturer_id']); if ($type == 1) { $str_sql = $this->_em->createQueryBuilder()->select("sbw.pkId")->from('StockBatchWarehouses', 'sbw')->join('sbw.stockBatch', 'sb')->join('sb.packInfo', 'pi')->join('pi.stakeholderItemPackSize', 'sip')->where("sip.itemPackSize = '" . $row['item_id'] . "' ")->andWhere("sb.number = '" . $row['number'] . "' ")->andWhere("sbw.warehouse = '" . $this->_identity->getWarehouseId() . "' "); //this IF is for stock receive $row_q = $str_sql->getQuery()->getResult(); $stock_batch_id = $this->_em->getRepository('StockBatchWarehouses')->find($row_q['0']['pkId']); $stock_detail->setStockBatchWarehouse($stock_batch_id); $stock_detail->setIsReceived(1); } else { if ($type == 2) { //this ELSE IF is for stock issue $stock_batch_id = $this->_em->getRepository('StockBatchWarehouses')->find($row['number']); $stock_detail->setStockBatchWarehouse($stock_batch_id); $stock_detail->setIsReceived(0); } } $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $stock_detail->setModifiedBy($created_by); $stock_detail->setModifiedDate(App_Tools_Time::now()); $stock_detail->setCreatedBy($created_by); $stock_detail->setCreatedDate(App_Tools_Time::now()); $this->_em->persist($stock_detail); $this->_em->flush(); $query = "SELECT AdjustQty(" . $stock_batch_id->getPkId() . "," . $this->_identity->getWarehouseId() . ") FROM DUAL"; $str_sql = $em->getConnection()->prepare($query); $str_sql->execute(); } } // App_Controller_Functions::pr($row_array); return $stock_detail->getPkId(); }
public function updateAction() { $form = new Form_Iadmin_Roles(); $form->addHidden(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $role_id = $form->id->getValue(); $role = $this->_em->getRepository("Roles")->find($role_id); $role->setRoleName($form->role_name->getValue()); $role->setDescription($form->description->getValue()); $category_id = $this->_em->find('ListDetail', $form->category_id->getValue()); $role->setCategory($category_id); $role->setStatus($form->status->getValue()); $user_id = $this->_em->find('Users', $this->_userid); $role->setModifiedBy($user_id); $role->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($role); $this->_em->flush(); } } $this->_redirect("/iadmin/manage-roles"); }
public function updateColdRoom() { // App_Controller_Functions::pr($this->form_values); $form_values = $this->form_values; $ccm_model = $this->_em->getRepository('CcmModels')->find($form_values['ccm_model_id']); $ccm_model->setAssetDimensionLength($form_values['asset_dimension_length']); $ccm_model->setAssetDimensionWidth($form_values['asset_dimension_width']); $ccm_model->setAssetDimensionHeight($form_values['asset_dimension_height']); if ($form_values['ccm_asset_sub_type_id'] == Model_CcmAssetTypes::SUBFREEZERROOM) { //for -20'C Freezer room $ccm_model->setTemperatureType(1); $ccm_model->setNetCapacity20($form_values['net_capacity']); $ccm_model->setGrossCapacity20($form_values['gross_capacity']); } elseif ($form_values['ccm_asset_sub_type_id'] == Model_CcmAssetTypes::SUBCOLDROOM) { //for +4'C Cold room $ccm_model->setTemperatureType(0); $ccm_model->setNetCapacity4($form_values['net_capacity']); $ccm_model->setGrossCapacity4($form_values['gross_capacity']); } $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $ccm_model->setModifiedBy($user_id); $ccm_model->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_model); $this->_em->flush(); $cold_chain = $this->_em->getRepository('ColdChain')->find($form_values['ccm_id']); $cold_chain->setAssetId($form_values['asset_id']); $model_id = $this->_em->getRepository('CcmModels')->find($form_values['ccm_model_id']); $cold_chain->setCcmModel($model_id); $asset_type = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::COLDROOM); $cold_chain->setCcmAssetType($asset_type); // $cold_chain->setSerialNumber($form_values['serial_number']); $cold_chain->setWorkingSince(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values['working_since']))); $cold_chain->setModifiedBy($user_id); $cold_chain->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($cold_chain); $this->_em->flush(); $c_room = $this->_em->getRepository('CcmColdRooms')->findBy(array('ccm' => $form_values['ccm_id'])); $cold_rooms = $this->_em->getRepository('CcmColdRooms')->find($c_room[0]->getPkId()); $backup_generator = $this->_em->getRepository('ListDetail')->find($form_values['backup_generator']); $cold_rooms->setBackupGenerator($backup_generator); $asset_sub_type_id = $this->_em->getRepository('CcmAssetTypes')->find($form_values['ccm_asset_sub_type_id']); $cold_rooms->setCcmAssetSubType($asset_sub_type_id); $cold_rooms->setCoolingSystem($form_values['cooling_system']); $cold_rooms->setHasVoltage($form_values['has_voltage']); $cold_rooms->setModifiedBy($user_id); $cold_rooms->setModifiedDate(App_Tools_Time::now()); if (!empty($form_values['refrigerator_gas_type'])) { $refrigerator_gas_type = $this->_em->getRepository('ListDetail')->find($form_values['refrigerator_gas_type']); $cold_rooms->setRefrigeratorGasType($refrigerator_gas_type); } if (!empty($form_values['temperature_recording_system'])) { $temperature_recording_system = $this->_em->getRepository('ListDetail')->find($form_values['temperature_recording_system']); $cold_rooms->setTemperatureRecordingSystem($temperature_recording_system); } if (!empty($form_values['type_recording_system'])) { $type_recording_system = $this->_em->getRepository('ListDetail')->find($form_values['type_recording_system']); $cold_rooms->setTypeRecordingSystem($type_recording_system); } $ware_house = $form_values['warehouse']; if (!empty($ware_house)) { $qry = "SELECT REPUpdateCapacity({$ware_house}) from DUAL"; $row = $this->_em->getConnection()->prepare($qry); $row->execute(); $qry1 = "SELECT REPUpdateRequirement({$ware_house}) from DUAL"; $row1 = $this->_em->getConnection()->prepare($qry1); $row1->execute(); } }
/** * Update logged_at with current datetime * * @param string $login */ protected function _addLoginTime() { $userId = $this->getIdentity(); $em = Zend_Registry::get('doctrine'); $user_login = new UserLoginLog(); $user_login->setIpAddress($_SERVER['REMOTE_ADDR']); $user_login->setLoginTime(App_Tools_Time::now()); $user = $em->getRepository('Users')->find($userId); $user_login->setUser($user); $em->persist($user_login); $em->flush(); }
public function addNewMakeModel() { // $this->form_values['ccm_make_popup']; $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $ccm_make = new CcmMakes(); $ccm_make->setCcmMakeName($this->form_values['ccm_make_popup']); $ccm_make->setCreatedBy($created_by); $ccm_make->setModifiedBy($created_by); $ccm_make->setCreatedDate(App_Tools_Time::now()); $ccm_make->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_make); $this->_em->flush(); $ccm_make_i = $ccm_make->getPkId(); $ccm_model = new CcmModels(); $ccm_voltage_regulator = new CcmVoltageRegulators(); $ccm_make_id = $this->_em->getRepository('CcmMakes')->find($ccm_make_i); $ccm_model->setCcmMake($ccm_make_id); $ccm_model->setCcmModelName($this->form_values['ccm_model_popup']); $ccm_model->setCatalogueId($this->form_values['catalogue_id_popup']); if (!empty($this->form_values['asset_dimension_height_popup'])) { $ccm_model->setAssetDimensionHeight($this->form_values['asset_dimension_height_popup']); } if (!empty($this->form_values['asset_dimension_length_popup'])) { $ccm_model->setAssetDimensionLength($this->form_values['asset_dimension_length_popup']); } if (!empty($this->form_values['asset_dimension_width_popup'])) { $ccm_model->setAssetDimensionWidth($this->form_values['asset_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['internal_dimension_width_popup'])) { $ccm_model->setInternalDimensionWidth($this->form_values['internal_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['storage_dimension_width_popup'])) { $ccm_model->setStorageDimensionWidth($this->form_values['storage_dimension_width_popup']); } if (!empty($this->form_values['net_capacity_4'])) { $ccm_model->setNetCapacity4($this->form_values['net_capacity_4']); } if (!empty($this->form_values['cold_life'])) { $ccm_model->setColdLife($this->form_values['cold_life']); } if (!empty($this->form_values['ccm_asset_type_id_popup'])) { $asset_id_m = $this->_em->getRepository('CcmAssetTypes')->find($this->form_values['ccm_asset_type_id_popup']); $ccm_model->setCcmAssetType($asset_id_m); } if (!empty($this->form_values['cfc_free'])) { $ccm_model->setCfcFree($this->form_values['cfc_free']); } if (!empty($this->form_values['is_pis_pqs'])) { $ccm_model->setIsPqs($this->form_values['is_pis_pqs']); } if (!empty($this->form_values['no_of_phases'])) { $ccm_model->setNoOfPhases($this->form_values['no_of_phases']); } if (!empty($this->form_values['refrigerator_gas_type'])) { $refrigerator_gas_type = $this->_em->getRepository('ListDetail')->find($this->form_values['refrigerator_gas_type']); $ccm_model->setGasType($refrigerator_gas_type); } if (!empty($this->form_values['product_price'])) { $ccm_model->setProductPrice($this->form_values['product_price']); } if (!empty($this->form_values['power_source'])) { $power_source = $this->_em->getRepository('ListDetail')->find($this->form_values['power_source']); $ccm_model->setPowerSource($power_source); } if (!empty($this->form_values['gross_capacity_4_popup'])) { $ccm_model->setGrossCapacity20($this->form_values['gross_capacity_4_popup']); } if (!empty($this->form_values['gross_capacity_4_popup'])) { $ccm_model->setGrossCapacity4($this->form_values['gross_capacity_4_popup']); } if (!empty($this->form_values['net_capacity_20_popup'])) { $ccm_model->setNetCapacity20($this->form_values['net_capacity_20_popup']); } if (!empty($this->form_values['net_capacity_4_popup'])) { $ccm_model->setNetCapacity4($this->form_values['net_capacity_4_popup']); } if (!empty($this->form_values['nominal_voltage'])) { $ccm_voltage_regulator->setNominalVoltage($this->form_values['nominal_voltage']); } if (!empty($this->form_values['continous_power'])) { $ccm_voltage_regulator->setContinousPower($this->form_values['continous_power']); } if (!empty($this->form_values['frequency'])) { $ccm_voltage_regulator->setFrequency($this->form_values['frequency']); } if (!empty($this->form_values['input_voltage_range'])) { $ccm_voltage_regulator->setInputVoltageRange($this->form_values['input_voltage_range']); } if (!empty($this->form_values['output_voltage_range'])) { $ccm_voltage_regulator->setOutputVoltageRange($this->form_values['output_voltage_range']); } $ccm_model->setStatus(1); $ccm_model->setCreatedBy($created_by); $ccm_model->setModifiedBy($created_by); $ccm_model->setCreatedDate(App_Tools_Time::now()); $ccm_model->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_model); $this->_em->flush(); //$ccm_model_i = $ccm_model->getPkId(); // return $ccm_model_i; }
public function detailBarcode() { $form_values = $this->form_values; $item_packsizes = $this->_table->find($form_values['barcode_id']); $item_packsizes->setItemName($form_values['item_pack_size_id']); // $item_packsizes->setGtin($form_values['gtin']); // $item_packsizes->setBatch($form_values['batch']); // $item_packsizes->setExpiry($form_values['expiry']); // $item_packsizes->setGtinStartPosition($form_values['gtin_start_position']); // $item_packsizes->setBatchNoStartPosition($form_values['batch_no_start_position']); // $item_packsizes->setExpiryDateStartPosition($form_values['expiry_date_start_position']); // $item_packsizes->setGtinEndPosition($form_values['gtin_end_position']); // $item_packsizes->setBatchNoEndPosition($form_values['batch_no_end_position']); // $item_packsizes->setExpiryDateEndPosition($form_values['expiry_date_end_position']); $item_packsizes->setPackSizeDescription($form_values['pack_size_description']); $item_packsizes->setLength($form_values['length']); $item_packsizes->setWidth($form_values['width']); $item_packsizes->setHeight($form_values['height']); //$expiry_date_format = $this->_em->find("ListDetail", $form_values['expiry_date_format']); //$item_packsizes->setExpiryDateFormat($expiry_date_format); $item_packsizes->setQuantityPerPack($form_values['quantity_per_pack']); $item_packsizes->setVolumPerVial($form_values['volume_per_unit_net']); // $item_packsizes->setPrePrintedBarcode($form_values['pre_printed_barcode']); $created_by = $this->_em->find('Users', $this->_user_id); $item_packsizes->setCreatedBy($created_by); $item_packsizes->setCreatedDate(App_Tools_Time::now()); $item_packsizes->setModifiedBy($created_by); $item_packsizes->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($item_packsizes); return $this->_em->flush(); }
public function updateStockPlacement($data, $placement_type) { // batch_id|placement_loc_id|vvm_stage_id|qty, batch_id|placement_loc_id|vvm_stage_id|qty,batch_id|placement_loc_id|vvm_stage_id|qty $placement_info = explode(",", $data); App_Controller_Functions::pr($data); // Get each placement batch, location,vvm stage and qty. foreach ($placement_info as $info) { $ids = explode("|", $info); // batch_id|placement_loc_id|vvm_stage_id|qty // get stock batch $stock_batch = $this->_em->getRepository("StockBatchWarehouses")->find($ids['0']); // get placement location $placement_location = $this->_em->getRepository("PlacementLocations")->find($ids['1']); // Get transaction type i.e stock picking. $plc_transaction_type = $this->_em->find("ListDetail", $placement_type); // Get user id. $user_id = $this->_em->find("Users", $this->_user_id); $placement = new Placements(); $placement->setPlacementLocation($placement_location); $placement->setStockBatchWarehouse($stock_batch); $placement->setPlacementTransactionType($plc_transaction_type); $placement->setCreatedBy($user_id); $placement->setCreatedDate(App_Tools_Time::now()); $placement->setModifiedBy($user_id); $placement->setModifiedDate(App_Tools_Time::now()); $vvms = $this->_em->getRepository("VvmStages")->find($ids['2']); $placement->setVvmStage($vvms); // get qty if ($placement_type == Model_PlacementLocations::PLACEMENT_TRANSACTION_TYPE_P) { $qty = $ids['3']; } elseif ($placement_type == Model_PlacementLocations::PLACEMENT_TRANSACTION_TYPE_PICK) { $qty = -1 * $ids['3']; } $placement->setQuantity($qty); $this->_em->persist($placement); } $this->_em->flush(); return true; }
public function updateColdChainStatus() { date_default_timezone_set('Asia/karachi'); $cc_id = $this->form_values['ccm_id']; $created_by = $this->_em->find('Users', $this->_user_id); foreach ($cc_id as $index => $ccm_id) { $working_status = $this->form_values['working_status']; $temperature = $this->form_values['temperature']; $ccmAssetId = $this->form_values['asset_id']; $reason = $this->form_values['reason']; $utilization = $this->form_values['utilization']; $wh_id = $this->form_values['wh_id']; $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setTemperatureAlarm($temperature[$index]); $cold_chain_id = $this->_em->getRepository('ColdChain')->find($ccm_id); $ccm_status_history->setCcm($cold_chain_id); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $warehouse_id = $this->_em->getRepository('Warehouses')->find($wh_id); $ccm_status_history->setWarehouse($warehouse_id); $work_status = $this->_em->getRepository('CcmStatusList')->find($working_status[$index]); $ccm_status_history->setCcmStatusList($work_status); $ccm_asset_type = $this->_em->getRepository('CcmAssetTypes')->find($ccmAssetId[$index]); $ccm_status_history->setCcmAssetType($ccm_asset_type); if (empty($reason[$index])) { $reason_id = $this->_em->getRepository('CcmStatusList')->find(1); $ccm_status_history->setReason($reason_id); } else { $reason_id = $this->_em->getRepository('CcmStatusList')->find($reason[$index]); $ccm_status_history->setReason($reason_id); } if (empty($utilization[$index])) { $utilization_id = $this->_em->getRepository('CcmStatusList')->find(1); $ccm_status_history->setUtilization($utilization_id); } else { $utilization_id = $this->_em->getRepository('CcmStatusList')->find($utilization[$index]); $ccm_status_history->setUtilization($utilization_id); } $ccm_status_history->setCreatedBy($created_by); $ccm_status_history->setModifiedBy($created_by); $ccm_status_history->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_status_history); $this->_em->flush(); $ccm_history_id = $ccm_status_history->getPkId(); $cold_chain = new Model_ColdChain(); $cold_chain->updateCcmStatusHistory($ccm_id, $ccm_history_id); } $ccm_id_q = $this->form_values['ccm_id_q']; foreach ($ccm_id_q as $index => $ccm_id_quantity) { $work_quantity = $this->form_values['work_quantity']; $comments = $this->form_values['comments']; $asset_id_q = $this->form_values['asset_id_q']; $wh_id = $this->form_values['wh_id']; $ccm_status = new CcmStatusHistory(); $cold_chain_id_q = $this->_em->getRepository('ColdChain')->find($ccm_id_quantity); $ccm_status->setCcm($cold_chain_id_q); $ccm_status->setWorkingQuantity($work_quantity[$index]); $ccm_status->setComments($comments[$index]); $ccm_status->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $warehouse_id = $this->_em->getRepository('Warehouses')->find($wh_id); $ccm_status->setWarehouse($warehouse_id); $ccm_asset_type_q = $this->_em->getRepository('CcmAssetTypes')->find($asset_id_q[$index]); $ccm_status->setCcmAssetType($ccm_asset_type_q); $ccm_status->setCreatedBy($created_by); $ccm_status->setModifiedBy($created_by); $ccm_status->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_status); $this->_em->flush(); $history_id = $ccm_status->getPkId(); $cold_chain = new Model_ColdChain(); $cold_chain->updateCcmStatusHistory($ccm_id_quantity, $history_id); } $ccm_id_histroy = $this->form_values['ccm_id_q']; foreach ($ccm_id_histroy as $index => $ccm_id_quantity) { $work_quantity = $this->form_values['work_quantity']; $total_quantity = $this->form_values['total_quantity']; $wh_id = $this->form_values['wh_id']; $ccm_history = new CcmHistory(); $quantity = $total_quantity[$index] - $work_quantity[$index]; $ccm_history->setQuantity($quantity); $ccm_history->setCreatedDate(new \DateTime(date("Y-m-d"))); $action_id = $this->_em->getRepository('ListDetail')->find(26); $ccm_history->setAction($action_id); $ccm_id = $this->_em->getRepository('ColdChain')->find($ccm_id_quantity); $ccm_history->setCcm($ccm_id); $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $ccm_history->setCreatedBy($user_id); $warehouse_id = $this->_em->getRepository('Warehouses')->find($wh_id); $ccm_history->setWarehouse($warehouse_id); $ccm_history->setCreatedBy($created_by); $ccm_history->setModifiedBy($created_by); $ccm_history->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_history); } $this->_em->flush(); }
public function updateAction() { if ($this->_request->getPost()) { //App_Controller_Functions::pr($this->_request->getPost()); $form_values = $this->_request->getPost(); $asset = $this->_em->getRepository("CcmAssetTypes")->find($form_values['asset_id']); $parent_id = $this->_em->getRepository('CcmAssetTypes')->find($form_values['asset_type']); $asset->setParent($parent_id); $asset->setAssetTypeName($form_values['asset_sub_type']); $created_by = $this->_em->find('Users', $this->_userid); $asset->setModifiedBy($created_by); $asset->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($asset); $this->_em->flush(); } $this->_redirect("/cadmin/manage-asset-sub-types"); }
public function updateAction() { $form = new Form_Cadmin_User(); $form->addFields(); $form->addHidden(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $user_id = $form->id->getValue(); // File Upload Start $file_path = $form->photo->getFileName(); $file_ext = substr($file_path, -3); $file_name = $user_id . "." . $file_ext; $form->photo->addFilter('Rename', array('target' => UPLOAD_PATH . "/" . $file_name, 'overwrite' => true)); $form->photo->receive(); // File Upload End $user = $this->_em->getRepository("Users")->find($user_id); $role_id = $this->_em->find('Roles', $form->role->getValue()); $user->setRole($role_id); $user->setCellNumber($form->phone->getValue()); if ($user->getPassword() == base64_encode($form->old_password->getValue())) { $user->setPassword(base64_encode($form->new_password->getValue())); } $user->setDesignation($form->designation->getValue()); $user->setDepartment($form->department->getValue()); $user->setAddress($form->address->getValue()); $user->setPhoto($file_name); $created_by = $this->_em->find('Users', $this->_user_id); $user->setModifiedBy($created_by); $user->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($user); $this->_em->flush(); $warehouse = $this->_request->getPost('warehouse2'); if (!empty($warehouse)) { $user_wh = $this->_em->getRepository("WarehouseUsers")->findOneBy(array("user" => $user->getPkId())); if (count($user_wh) > 0) { $warehouse_id = $this->_em->find('Warehouses', $warehouse); $user_wh->setWarehouse($warehouse_id); $user_wh->setModifiedBy($created_by); $user_wh->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($user_wh); $this->_em->flush(); } } } } $this->_redirect("/cadmin/manage-users"); }
public function updateAction() { $form = new Form_Iadmin_MessagesAdd(); $form->addHidden(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $id = $form->id->getValue(); $hp = $this->_em->getRepository("HelpMessages")->find($id); $resource_id = $this->_em->find('Resources', $form->page_name->getValue()); $hp->setResource($resource_id); $hp->setDescription($form->description->getValue()); $hp->setStatus($form->status->getValue()); $created_by = $this->_em->find('Users', $this->_user_id); $hp->setModifiedBy($created_by); $hp->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($hp); $this->_em->flush(); } } $this->_redirect("/iadmin/manage-help-messages"); }
public function updateTransport() { $form_values = $this->form_values; $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $cold_chain = $this->_em->getRepository('ColdChain')->find($form_values['ccm_id']); $stakeholder = $this->_em->getRepository('Stakeholders')->find($form_values['source_id']); $cold_chain->setSource($stakeholder); $asset_type = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::TRANSPORT); $cold_chain->setCcmAssetType($asset_type); $model_id = $this->_em->getRepository('CcmModels')->find($form_values['ccm_model_id']); $cold_chain->setCcmModel($model_id); $cold_chain->setManufactureYear(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values['manufacture_year']))); $cold_chain->setModifiedBy($user_id); $cold_chain->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($cold_chain); $this->_em->flush(); $vechicles = $this->_em->getRepository('CcmVehicles')->findBy(array('ccm' => $form_values['ccm_id'])); $ccm_vehicles = $this->_em->getRepository('CcmVehicles')->find($vechicles[0]->getPkId()); $ccm_asset_sub_type = $this->_em->getRepository('CcmAssetTypes')->find($form_values['ccm_asset_sub_type_id']); $ccm_vehicles->setCcmAssetSubType($ccm_asset_sub_type); $ccm_vehicles->setRegistrationNo($form_values['registration_no']); $ccm_vehicles->setUsedForEpi($form_values['used_for_epi']); if ($form_values['fuel_type_id']) { $fuel_type_id = $this->_em->getRepository('ListDetail')->find($form_values['fuel_type_id']); $ccm_vehicles->setFuelType($fuel_type_id); } $ccm_vehicles->setComments($form_values['comments']); $ccm_vehicles->setModifiedBy($user_id); $ccm_vehicles->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_vehicles); $this->_em->flush(); }
public function updateCampaignData() { $form_values = $this->form_values; $campaign_data = $this->_em->find('CampaignData', $form_values['campaign_pk_id']); $item_id = $this->_em->find('ItemPackSizes', $form_values['item_id']); $campaign_data->setItemPackSize($item_id); $wh_id = $this->_em->find('Warehouses', $form_values['wh_id']); $campaign_data->setWarehouse($wh_id); $campaign_data->setCampaignDay($form_values['campaign_day']); $campaign_data->setDailyTarget($form_values['daily_target']); $campaign_data->setHouseholdVisited($form_values['household_visited']); $campaign_data->setMultipleFamilyHousehold($form_values['multiple_family_household']); $campaign_data->setTargetAgeSixMonths($form_values['target_age_six_months']); $campaign_data->setTargetAgeSixtyMonths($form_values['target_age_sixty_months']); $campaign_data->setTotalCoverage($form_values['total_coverage']); $campaign_data->setRefusalCovered($form_values['refusal_covered']); $campaign_data->setCoverageMobileChildren($form_values['coverage_mobile_children']); $campaign_data->setCoverageNotAccessible($form_values['coverage_not_accessible']); $campaign_data->setRecordNotAccessible($form_values['record_not_accessible']); $campaign_data->setRecordRefusal($form_values['record_refusal']); $campaign_data->setReportedWithWeakness($form_values['reported_with_weakness']); $campaign_data->setZeroDoses($form_values['zero_dose']); $campaign_data->setTeamsReported($form_values['teams_reported']); $campaign_data->setInaccessibleCoverage($form_values['inaccessible_coverage']); $campaign_data->setVialsGiven($form_values['vials_given']); $campaign_data->setVialsUsed($form_values['vials_used']); $campaign_data->setVialsReturned($form_values['vials_returned']); $campaign_data->setVialsExpired($form_values['vials_expired']); $campaign_data->setReconSyrWasted($form_values['recon_syr_wasted']); $campaign_data->setAdSyrWasted($form_values['ad_syr_wasted']); $user_id = $this->_em->find('Users', $this->_identity->getIdentity()); $campaign_data->setModifiedDate(App_Tools_Time::now()); $campaign_data->setModifiedBy($user_id); $dist_id = $this->_em->find('Locations', $form_values['district_id']); $campaign_data->setDistrict($dist_id); $this->_em->persist($campaign_data); $this->_em->flush(); }
public function addGatepass() { $form_values = $this->form_values; $gp_master = new GatepassMaster(); if (!empty($form_values['vehicle_other'])) { $gp_vehicle = $this->_em->getRepository("GatepassVehicles")->findOneBy(array("vehicleType" => $form_values['vehicle_type_id'], "number" => $form_values['vehicle_other'])); if (count($gp_vehicle) == 0) { $gp_vehicle = new GatepassVehicles(); $gp_vehicle->setNumber($form_values['vehicle_other']); $gvehicle = $this->_em->getRepository("ListDetail")->find($form_values['vehicle_type_id']); $gp_vehicle->setVehicleType($gvehicle); $this->_em->persist($gp_vehicle); $this->_em->flush(); } $form_values['gatepass_vehicle_id'] = $gp_vehicle->getPkId(); } if (!empty($form_values['gatepass_vehicle_id'])) { $gatepass_vehicle_id = $this->_em->find("GatepassVehicles", $form_values['gatepass_vehicle_id']); $gp_master->setGatepassVehicle($gatepass_vehicle_id); } if (!empty($form_values['transaction_date'])) { $gp_master->setTransactionDate(new \DateTime(date("Y-m-d h:i"))); } $number = substr(number_format(time() * rand(), 0, '', ''), 0, 10); $gp_master->setNumber($number); $warehouse_id = $this->_identity->getWarehouseId(); $warehouse_id = $this->_em->find("Warehouses", $warehouse_id); $gp_master->setWarehouse($warehouse_id); $created_by = $this->_em->find('Users', $this->_user_id); $gp_master->setCreatedBy($created_by); $gp_master->setCreatedDate(App_Tools_Time::now()); $gp_master->setModifiedBy($created_by); $gp_master->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($gp_master); $this->_em->flush(); $gp_master_id = $gp_master->getPkId(); $stock_detail = new Model_StockDetail(); $count1 = 1; $detailId = array(); foreach ($form_values['quantity'] as $key => $value) { $value1 = $value; if (!empty($value1)) { list($stm, $stcmaster) = explode('_', $key); $res_rec = $stock_detail->quantityDataByStcBatch($stm, $stcmaster); $dataArr = array(); foreach ($res_rec as $res) { $detail_pkid = $res['pkId']; $detail_qty = abs($res['quantity']); $dataArr[$detail_pkid] = $detail_qty; } while ($value1 > 0) { $arr = $stock_detail->getClosest($dataArr, $value); $qty = $value1; $value1 = $value1 - $arr[1]; if ($value1 > 0) { $detailId[$arr[0]] = (int) $arr[1]; } else { $detailId[$arr[0]] = (int) $qty; } } } } $gp_m_id = $this->_em->getRepository('GatepassMaster')->find($gp_master_id); foreach ($detailId as $detId => $quantity) { $gp_detail = new GatepassDetail(); $stock_d_id = $this->_em->getRepository('StockDetail')->find($detId); $gp_detail->setStockDetail($stock_d_id); $gp_detail->setQuantity($quantity); $gp_detail->setGatepassMaster($gp_m_id); $created_by = $this->_em->find('Users', $this->_user_id); $gp_detail->setCreatedBy($created_by); $gp_detail->setCreatedDate(App_Tools_Time::now()); $gp_detail->setModifiedBy($created_by); $gp_detail->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($gp_detail); $this->_em->flush(); } }
public function updateBarcode() { $form_values = $this->form_values; $stakeholder_item_pack = $this->_table->find($form_values['barcode_id']); $barcode_type = $this->_em->find("ListDetail", $form_values['barcode_type']); $stakeholder_item_pack->setBarcodeType($barcode_type); $stakeholder_id = $this->_em->find("Stakeholders", $form_values['stakeholder_id']); $stakeholder_item_pack->setStakeholder($stakeholder_id); $item_pack_id = $this->_em->find("ItemPackSizes", $form_values['item_pack_size_id']); $stakeholder_item_pack->setItemPackSize($item_pack_id); // $stakeholder_item_pack->setGtin($form_values['gtin']); // $stakeholder_item_pack->setBatch($form_values['batch']); // $stakeholder_item_pack->setExpiry($form_values['expiry']); $stakeholder_item_pack->setItemGtin($form_values['item_gtin']); // $stakeholder_item_pack->setGtinStartPosition($form_values['gtin_start_position']); // $stakeholder_item_pack->setBatchNoStartPosition($form_values['batch_no_start_position']); // $stakeholder_item_pack->setExpiryDateStartPosition($form_values['expiry_date_start_position']); // $stakeholder_item_pack->setExpiryDateFormat($form_values['expiry_date_format']); // $stakeholder_item_pack->setGtinEndPosition($form_values['gtin_end_position']); // $stakeholder_item_pack->setBatchNoEndPosition($form_values['batch_no_end_position']); // $stakeholder_item_pack->setExpiryDateEndPosition($form_values['expiry_date_end_position']); $stakeholder_item_pack->setPackSizeDescription($form_values['pack_size_description']); $stakeholder_item_pack->setLength($form_values['length']); $stakeholder_item_pack->setWidth($form_values['width']); $stakeholder_item_pack->setHeight($form_values['height']); $stakeholder_item_pack->setQuantityPerPack($form_values['quantity_per_pack']); // $stakeholder_item_pack->setVolumePerUnitNet($form_values['volume_per_unit_net']); // $stakeholder_item_pack->setPrePrintedBarcode($form_values['pre_printed_barcode']); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $stakeholder_item_pack->setModifiedBy($created_by); $stakeholder_item_pack->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($stakeholder_item_pack); return $this->_em->flush(); }