public function init() { $cold_chain = new Model_ColdChain(); $result1 = $cold_chain->getLocationsName(); $this->_list["asset_id"][''] = "Select Location"; if ($result1) { foreach ($result1 as $row1) { $this->_list["asset_id"][$row1['pkId']] = $row1['assetId']; } } $non_ccm_loc = new Model_NonCcmLocations(); $result2 = $non_ccm_loc->getLocationsName(); $this->_list["non_ccm_location_id"][''] = "Select Location"; if ($result2) { foreach ($result2 as $row2) { $this->_list["non_ccm_location_id"][$row2['pkId']] = $row2['locationName']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function init() { $cold_chain = new Model_ColdChain(); $result = $cold_chain->getListing(); foreach ($result as $coldchain) { $this->_list["coldchain"][$coldchain['pk_id']] = $coldchain['asset_id'] . "-" . $coldchain['ccm_asset_type_id']; } foreach ($this->_fields as $col => $name) { switch ($col) { case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "stockDetailId": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "product": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "rem_quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "qty": case "batch_id": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => ""), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function init() { $cold_chain = new Model_ColdChain(); $result3 = $cold_chain->getLocationsName(); $this->_list["asset_id"][''] = "Select Location"; if ($result3) { foreach ($result3 as $row3) { $this->_list["asset_id"][$row3['pkId']] = $row3['assetId']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "item_pack_size_id": case "stock_batch_id": case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } foreach ($this->_hidden as $col => $name) { switch ($col) { // case "asset_name": // // $this->addElement("hidden", $col); // $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); // break; default: break; } } }
public function addTransport() { date_default_timezone_set('Asia/karachi'); $form_values = $this->form_values; // App_Controller_Functions::pr($form_values); $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $cold_chain = new ColdChain(); //$asset_type = $this->_em->getRepository('CcmAssetTypes')->find(11); $cold_chain->setAssetId($form_values['asset_id']); $cold_chain->setAutoAssetId(App_Controller_Functions::generateCcemUniqueAssetId(Model_CcmAssetTypes::TRANSPORT)); //$status_list = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); //$cold_chain->setCcmStatusList($status_list); //$cold_chain->setStakeholderId($stakeholder); $stakeholder = $this->_em->getRepository('Stakeholders')->find($form_values['source_id']); $cold_chain->setSource($stakeholder); if ($form_values['ccm_asset_sub_type_id']) { $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']))); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $wh_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $cold_chain->setWarehouse($wh_id); } $cold_chain->setCreatedBy($user_id); $cold_chain->setCreatedDate(App_Tools_Time::now()); $cold_chain->setModifiedBy($user_id); $cold_chain->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($cold_chain); $this->_em->flush(); $last_ccm_id = $cold_chain->getPkId(); $ccm_vehicles = new CcmVehicles(); $cold_chain_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $ccm_vehicles->setCcm($cold_chain_id); $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->setCreatedBy($user_id); $ccm_vehicles->setCreatedDate(App_Tools_Time::now()); $ccm_vehicles->setModifiedBy($user_id); $ccm_vehicles->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_vehicles); $this->_em->flush(); $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $cold_chian_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $ccm_status_history->setCcm($cold_chian_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $warehouse_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $ccm_status_history->setWarehouse($warehouse_id); } else { $warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $ccm_status_history->setWarehouse($warehouse_id); } $ccm_status_list_id = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); $ccm_status_history->setCcmStatusList($ccm_status_list_id); $asset_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::TRANSPORT); $ccm_status_history->setCcmAssetType($asset_id); if (!empty($form_values['reason'])) { $reason = $this->_em->getRepository('CcmStatusList')->find($form_values['reason']); $ccm_status_history->setReason($reason); } if (!empty($form_values['reason'])) { $utilization = $this->_em->getRepository('CcmStatusList')->find($form_values['utilization']); $ccm_status_history->setUtilization($utilization); } $ccm_status_history->setCreatedBy($user_id); $ccm_status_history->setCreatedDate(App_Tools_Time::now()); $ccm_status_history->setModifiedBy($user_id); $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_model = new Model_ColdChain(); $cold_chain_model->updateCcmStatusHistory($last_ccm_id, $ccm_history_id); // $placements_locations = new PlacementLocations(); // $location_type = $this->_em->getRepository('ListDetail')->find(30); // $placements_locations->setLocationType($location_type); // $placements_locations->setLocationId(Model_CcmAssetTypes::TRANSPORT); // $this->_em->persist($placements_locations); // $this->_em->flush(); }
function transferStockVaccinesAction() { $this->_helper->layout->setLayout("ajax"); $form = new Form_TransferStockVaccines(); $form->addHidden(); $form->readFields(); //$placement = new Model_Placements(); $loc_name = new Model_ColdChain(); $placement_id = $this->_request->getParam('placement_id'); $placement = $this->_em->find("PlacementSummary", $placement_id); $batch_numer = $placement->getStockBatch()->getNumber(); $item_name = $placement->getStockBatch()->getStakeholderItemPackSize()->getItemPackSize()->getItemName(); $asset_name = $loc_name->getAssetByLocation($placement->getPlacementLocation()->getPkId()); $form->item_pack_size_id->setValue($item_name); $form->stock_batch_id->setValue($batch_numer); $form->id->setValue($placement_id); $this->view->form = $form; $this->view->available_qty = $placement->getQuantity(); $this->view->vvm = $placement->getVvmStage()->getPkId(); $this->view->asset_name = $asset_name; $this->view->bin_id = $placement->getPlacementLocation()->getPkId(); $this->view->bin_location_id = $placement->getPlacementLocation()->getLocationId(); /* $this->view->bin_id = $bin_id; $this->view->non_ccm_id = $non_ccm_id; $this->view->quantity_per_pack = $quantity_per_pack; $this->view->totqty = $totqty[$placement_id]; */ }
public function addVoltageRegulator() { //$ccm_model = new CcmModels(); $form_values = $this->form_values; // App_Controller_Functions::pr($form_values); $cold_chain = new ColdChain(); $model_id = $this->_em->getRepository('CcmModels')->find($form_values['catalogue_id']); $cold_chain->setCcmModel($model_id); $asset_type = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::VOLTAGEREGULATOR); $cold_chain->setCcmAssetType($asset_type); $cold_chain->setQuantity($form_values['quantity']); $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $cold_chain->setCreatedBy($user_id); $cold_chain->setCreatedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y")))); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $wh_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $cold_chain->setWarehouse($wh_id); } $this->_em->persist($cold_chain); $this->_em->flush(); $cold_chain_id = $cold_chain->getPkId(); $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $cold_chian_id = $this->_em->getRepository('ColdChain')->find($cold_chain_id); $ccm_status_history->setCcm($cold_chian_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $warehouse_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $ccm_status_history->setWarehouse($warehouse_id); } else { $warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $ccm_status_history->setWarehouse($warehouse_id); } $asset1_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::VOLTAGEREGULATOR); $ccm_status_history->setCcmAssetType($asset1_id); $ccm_status_history->setWorkingQuantity($form_values['quantity']); $this->_em->persist($ccm_status_history); $this->_em->flush(); $cold_chain_model = new Model_ColdChain(); $ccm_history_id = $ccm_status_history->getPkId(); $cold_chain_model->updateCcmStatusHistory($cold_chain_id, $ccm_history_id); }
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 searchRefrigeratorAction() { $arr_data = array(); $form = new Form_SearchRefrigerator(); $identity = App_Auth::getInstance(); if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $cold_chain = new Model_ColdChain(); $data = $form->getValues(); $data['warehouse'] = $this->_request->warehouse; $data['office'] = $this->_request->office; $data['combo1'] = $this->_request->combo1; $cold_chain->form_values = $data; $cold_chain->form_values['warehouse'] = $this->_request->warehouse; $arr_data = $cold_chain->searchRefrigerator(); $form->office_id->setValue($data['office']); $form->combo1_id->setValue($data['combo1']); $form->warehouse_id->setValue($data['warehouse']); $form->model_id->setValue($data['ccm_model_id']); } } else { $form->placed_at->setValue(1); $form->office_id->setValue($identity->getUserLevel($identity->getIdentity())); $role_id = $this->_identity->getRoleId(); //echo $role_id; //exit; if ($role_id != 11) { $form->combo1_id->setValue($identity->getUserProvinceId()); } $form->warehouse_id->setValue($this->_identity->getWarehouseId()); } $this->view->form = $form; $this->view->result = $arr_data; $base_url = Zend_Registry::get('baseurl'); $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos.js'); }
public function addColdRoom() { // 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->setCreatedBy($user_id); $ccm_model->setCreatedDate(App_Tools_Time::now()); $ccm_model->setModifiedBy($user_id); $ccm_model->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($ccm_model); $this->_em->flush(); // $cold_chain = new ColdChain(); // $cold_chain->setAssetId($form_values['asset_id']); // // $cold_chain->setAutoAssetId(App_Controller_Functions::generateCcemUniqueAssetId($form_values['ccm_asset_sub_type_id'])); // //$status_list = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); // //$cold_chain->setCcmStatusList($status_list); // $model_id = $this->_em->getRepository('CcmModels')->find($form_values['ccm_model_id']); // $cold_chain->setCcmModel($model_id); // $asset_type = $this->_em->getRepository('CcmAssetTypes')->find($form_values['ccm_asset_sub_type_id']); // $cold_chain->setCcmAssetType($asset_type); // $auto_gen_id = App_Controller_Functions::generateCcemUniqueAssetId(Model_CcmAssetTypes::COLDROOM); // $cold_chain->setAutoAssetId($auto_gen_id); // // $cold_chain->setWorkingSince(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values['working_since']))); // $user_id_1 = $this->_em->getRepository('Users')->find($this->_user_id); // $cold_chain->setCreatedBy($user_id_1); // $cold_chain->setCreatedDate(App_Tools_Time::now()); // if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { // $wh_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); // $cold_chain->setWarehouse($wh_id); // } // $this->_em->persist($cold_chain); // $this->_em->flush(); $cold_chain = new ColdChain(); $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($form_values['ccm_asset_sub_type_id']); $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']))); $auto_gen_id = App_Controller_Functions::generateCcemUniqueAssetId(Model_CcmAssetTypes::COLDROOM); $cold_chain->setAutoAssetId($auto_gen_id); $source_id = $this->_em->getRepository('Stakeholders')->find($form_values['source_id']); $cold_chain->setSource($source_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $wh_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $cold_chain->setWarehouse($wh_id); } $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $cold_chain->setCreatedBy($created_by); $cold_chain->setCreatedDate(App_Tools_Time::now()); $cold_chain->setModifiedBy($created_by); $cold_chain->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($cold_chain); $this->_em->flush(); $last_ccm_id = $cold_chain->getPkId(); // App_Controller_Functions::pr($this->form_values); $cold_rooms = new CcmColdRooms(); $backup_generator = $this->_em->getRepository('ListDetail')->find($form_values['backup_generator']); $cold_rooms->setBackupGenerator($backup_generator); $ccm_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $cold_rooms->setCcm($ccm_id); $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->setCreatedBy($user_id); $cold_rooms->setCreatedDate(App_Tools_Time::now()); $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); } $cold_rooms->setCreatedBy($user_id); $cold_rooms->setCreatedDate(App_Tools_Time::now()); $cold_rooms->setModifiedBy($user_id); $cold_rooms->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($cold_rooms); $this->_em->flush(); $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $cold_chian_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $ccm_status_history->setCcm($cold_chian_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $warehouse_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $ccm_status_history->setWarehouse($warehouse_id); } else { $warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $ccm_status_history->setWarehouse($warehouse_id); } $ccm_status_list_id = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); $ccm_status_history->setCcmStatusList($ccm_status_list_id); $asset_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::COLDROOM); $ccm_status_history->setCcmAssetType($asset_id); if (!empty($form_values['reason'])) { $reason = $this->_em->getRepository('CcmStatusList')->find($form_values['reason']); $ccm_status_history->setReason($reason); } if (!empty($form_values['utilization'])) { $utilization = $this->_em->getRepository('CcmStatusList')->find($form_values['utilization']); $ccm_status_history->setUtilization($utilization); } $ccm_status_history->setCreatedBy($user_id); $ccm_status_history->setCreatedDate(App_Tools_Time::now()); $ccm_status_history->setModifiedBy($user_id); $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_model = new Model_ColdChain(); $cold_chain_model->updateCcmStatusHistory($last_ccm_id, $ccm_history_id); $placements_locations = new PlacementLocations(); $location_type = $this->_em->getRepository('ListDetail')->find(Model_PlacementLocations::LOCATIONTYPE_CCM); $placements_locations->setLocationType($location_type); $placements_locations->setLocationBarcode($auto_gen_id); $placements_locations->setLocationId($last_ccm_id); $placements_locations->setCreatedBy($user_id); $placements_locations->setCreatedDate(App_Tools_Time::now()); $placements_locations->setModifiedBy($user_id); $placements_locations->setModifiedDate(App_Tools_Time::now()); $this->_em->persist($placements_locations); $this->_em->flush(); $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(); } }
public function getNonCcmLocationsAction() { $wh_id = $this->_request->getParam('wh_id'); if ($wh_id) { $nonccm = new Model_ColdChain(); $result = $nonccm->getNonCCMLocations($wh_id); } echo Zend_Json::encode($result); }
public function ajaxGetBatchColdchainAction() { $this->_helper->layout->disableLayout(); if (isset($this->_request->batch) && !empty($this->_request->batch)) { //Generate Purpose(activity_id) combo $pick_from = new Model_ColdChain(); $pick_from->form_values = array('batch' => $this->_request->batch); $this->view->combo = $pick_from->getColdchainByBatch(); } }
public function addIcePack() { // App_Controller_Functions::pr($this->form_values); $ccm_model_id = $this->form_values['ccm_model_id']; foreach ($ccm_model_id as $index => $model_id) { $form_values = $this->form_values; $quantity = $this->form_values['quantity']; $cold_chain = new ColdChain(); $cold_chain->setQuantity($quantity[$index]); $asset_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::ICEPACKS); $cold_chain->setCcmAssetType($asset_id); $m_id = $this->_em->getRepository('CcmModels')->find($model_id); $cold_chain->setCcmModel($m_id); $created_by = $this->_em->getRepository('Users')->find($this->_user_id); $cold_chain->setCreatedBy($created_by); if (!empty($this->form_values['warehouse'])) { $w_id = $this->form_values['warehouse']; $warehouse = $this->_em->getRepository('Warehouses')->find($w_id); $cold_chain->setWarehouse($warehouse); } $cold_chain->setCreatedDate(new \DateTime(date("Y-m-d"))); $this->_em->persist($cold_chain); $this->_em->flush(); $cold_chain_id = $cold_chain->getPkId(); $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $cold_chian_id = $this->_em->getRepository('ColdChain')->find($cold_chain_id); $ccm_status_history->setCcm($cold_chian_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $warehouse_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $ccm_status_history->setWarehouse($warehouse_id); } else { $warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $ccm_status_history->setWarehouse($warehouse_id); } $asset1_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::ICEPACKS); $ccm_status_history->setCcmAssetType($asset1_id); $ccm_status_history->setWorkingQuantity($quantity[$index]); $this->_em->persist($ccm_status_history); $this->_em->flush(); $cold_chain_model = new Model_ColdChain(); $ccm_history_id = $ccm_status_history->getPkId(); $cold_chain_model->updateCcmStatusHistory($cold_chain_id, $ccm_history_id); } // $placements_locations = new PlacementLocations(); // $location_type = $this->_em->getRepository('ListDetail')->find(30); // $placements_locations->setLocationType($location_type); // $placements_locations->setLocationId(Model_CcmAssetTypes::ICEPACKS); // $this->_em->persist($placements_locations); // $this->_em->flush(); }
public function addGenerator() { $form_values = $this->form_values; // App_Controller_Functions::pr($form_values); $ccm_model = $this->_em->getRepository('CcmModels')->find($form_values['ccm_model_id']); $user_id = $this->_em->getRepository('Users')->find($this->_user_id); $ccm_model->setModifiedBy($user_id); $ccm_model->setModifiedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y")))); $ccm_model->setNoOfPhases($form_values['no_of_phases']); $this->_em->persist($ccm_model); $this->_em->flush(); $cold_chain = new ColdChain(); $cold_chain->setAssetId($form_values['asset_id']); //$status_list = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); //$cold_chain->setCcmStatusList($status_list); $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::GENERATOR); $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->setCreatedBy($user_id); $source_id = $this->_em->getRepository('Stakeholders')->find($form_values['source_id']); $cold_chain->setSource($source_id); $auto_gen_id = App_Controller_Functions::generateCcemUniqueAssetId(Model_CcmAssetTypes::GENERATOR); $cold_chain->setAutoAssetId($auto_gen_id); $cold_chain->setCreatedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y")))); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $wh_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $cold_chain->setWarehouse($wh_id); } $this->_em->persist($cold_chain); $this->_em->flush(); $last_ccm_id = $cold_chain->getPkId(); $generators = new CcmGenerators(); $power_source = $this->_em->getRepository('ListDetail')->find($form_values['power_source']); $generators->setPowerSource($power_source); $generators->setPowerRating($form_values['power_rating']); $generators->setUseFor($form_values['use_for']); $generators->setAutomaticStartMechanism($form_values['automatic_start']); $ccm_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $generators->setCcm($ccm_id); $generators->setCreatedBy($user_id); $generators->setCreatedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y")))); $generators->setModifiedBy($user_id); $generators->setModifiedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y")))); $this->_em->persist($generators); $this->_em->flush(); $ccm_status_history = new CcmStatusHistory(); $ccm_status_history->setStatusDate(new \DateTime(date("Y-m-d h:i"))); $cold_chian_id = $this->_em->getRepository('ColdChain')->find($last_ccm_id); $ccm_status_history->setCcm($cold_chian_id); if (!empty($form_values['warehouse']) && $form_values['placed_at'] == 1) { $warehouse_id = $this->_em->getRepository('Warehouses')->find($form_values['warehouse']); $ccm_status_history->setWarehouse($warehouse_id); } else { $warehouse_id = $this->_em->getRepository('Warehouses')->find($this->_identity->getWarehouseId()); $ccm_status_history->setWarehouse($warehouse_id); } $ccm_status_list_id = $this->_em->getRepository('CcmStatusList')->find($form_values['ccm_status_list_id']); $ccm_status_history->setCcmStatusList($ccm_status_list_id); $asset_id = $this->_em->getRepository('CcmAssetTypes')->find(Model_CcmAssetTypes::GENERATOR); $ccm_status_history->setCcmAssetType($asset_id); if (!empty($form_values['reasons'])) { $reason = $this->_em->getRepository('CcmStatusList')->find($form_values['reasons']); $ccm_status_history->setReason($reason); } if (!empty($form_values['utilizations'])) { $utilization = $this->_em->getRepository('CcmStatusList')->find($form_values['utilizations']); $ccm_status_history->setUtilization($utilization); } $this->_em->persist($ccm_status_history); $this->_em->flush(); $ccm_history_id = $ccm_status_history->getPkId(); $cold_chain_model = new Model_ColdChain(); $cold_chain_model->updateCcmStatusHistory($last_ccm_id, $ccm_history_id); // $placements_locations = new PlacementLocations(); // $location_type = $this->_em->getRepository('ListDetail')->find(30); // $placements_locations->setLocationType($location_type); // $placements_locations->setLocationId(Model_CcmAssetTypes::GENERATOR); // $this->_em->persist($placements_locations); // $this->_em->flush(); }
public function inventoryListOfAllColdChainEquipmentByFacilityAction() { //ccem proposed list 3.21 (46) $this->_helper->layout->setLayout('reports'); $search_form = new Form_ReportsSearch(); $refrigerator_list = array(); $coldroom_list = array(); $coldbox_list = array(); $icepack_list = array(); $voltageregulator_list = array(); $generator_list = array(); $cold_chain = new Model_ColdChain(); $form_values['office'] = $this->_request->getParam('office', ''); $form_values['combo1'] = $this->_request->getParam('combo1', ''); $form_values['combo2'] = $this->_request->getParam('combo2', ''); $form_values['warehouse'] = $this->_request->getParam('warehouse', ''); if ($this->_request->isPost()) { if ($search_form->isValid($this->_request->getPost())) { $form_values = array_merge($form_values, $search_form->getValues()); $cold_chain->form_values = $form_values; $refrigerator_list = $cold_chain->getAllNonQuantityRefAsets(); $coldroom_list = $cold_chain->getAllNonQuantityColdRoomAsets(); $coldbox_list = $cold_chain->getAllNonQuantityColdBoxAsets(); $icepack_list = $cold_chain->getAllNonQuantityIcePackAsets(); $voltageregulator_list = $cold_chain->getAllNonQuantityVoltageRegulatorAsets(); $generator_list = $cold_chain->getAllNonQuantityGeneratorAsets(); } } $this->view->main_heading = "CCEM Reports"; $this->view->report_title = "Inventory List of All Cold Chain Equipment By Facility"; $this->view->refrigerator_list = $refrigerator_list; $this->view->coldroom_list = $coldroom_list; $this->view->coldbox_list = $coldbox_list; $this->view->icepack_list = $icepack_list; $this->view->voltageregulator_list = $voltageregulator_list; $this->view->generator_list = $generator_list; $this->view->form_values = $form_values; /* switch ($this->_user_level) { case 1: case 2: case 3: case 4: case 5: case 6: $this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo_all_coldchain_equipment.js'); break; } */ $this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo_all_coldchain_equipment.js'); }
public function init() { //Generate WareHouses Combo $warehouse = new Model_Warehouses(); $result1 = $warehouse->getSupplierWarehouses(); foreach ($result1 as $wh) { $this->_list["from_warehouse_id"][$wh['pk_id']] = $wh['warehouse_name']; } //Generate Purpose(activity_id) combo $stk_activities = new Model_StakeholderActivities(); $result4 = $stk_activities->getAllStakeholderActivitiesIssues(); if ($result4) { $stakeholder_id = $result4[0]['pkId']; foreach ($result4 as $stk_activity) { $this->_list["activity_id"][$stk_activity['pkId']] = $stk_activity['activity']; } } // Generate Status Combo $this->_list["status"]['Received'] = 'Received'; $this->_list["status"]['Pre Shipment Alert'] = 'Pre Shipment Alert'; $this->_list["status"]['PO'] = 'PO'; $this->_list["status"]['Tender'] = 'Tender'; //Generate Products(items) Combo $sips = new Model_StakeholderItemPackSizes(); $sips->form_values['stakeholder_id'] = $stakeholder_id; $result2 = $sips->getAllProductsByStakeholderType(); $this->_list["item_id"][""] = "Select"; if ($result2) { //$item_id = $result2[0]['item_pack_size_id']; foreach ($result2 as $item) { $this->_list["item_id"][$item['item_pack_size_id']] = $item['item_name']; } } $this->_list["vvm_stage"][""] = "NA"; $this->_list["manufacturer_id"][""] = "Select"; //Generate manufacturer Combo /* $stakeholder_items = new Model_Stakeholders(); $stakeholder_items->form_values['item_id'] = $item_id; $associated = $stakeholder_items->getManufacturerByProduct(); if ($associated) { foreach ($associated as $row) { $this->_list["manufacturer_id"][$row['pkId']] = $row['stakeholderName']; } } */ //Generate VVM Type Combo $vvmtypes = new Model_VvmTypes(); $result3 = $vvmtypes->getAll(); $this->_list["vvm_type_id"][''] = 'Select'; foreach ($result3 as $vvmtype) { $this->_list["vvm_type_id"][$vvmtype['pk_id']] = $vvmtype['vvm_type_name']; } //Generate Asset Sub Type Combo $cold_chain = new Model_ColdChain(); $cold_chain->form_values = array('type_id' => '1,3'); $result3 = $cold_chain->getColdchainByAssetType(); $this->_list["cold_chain"][''] = "Select Cold Chain"; foreach ($result3 as $assetsubtype) { $this->_list["cold_chain"][$assetsubtype['pk_id']] = $assetsubtype['asset_name'] . " - " . $assetsubtype['make_name']; } //Generate Campaigns Combo /* $campaigns = new Model_Campaigns(); $result4 = $campaigns->allCampaignsFutureDate(); $this->_list["campaign_id"][''] = "Select"; foreach ($result4 as $campaign_one) { $this->_list["campaign_id"][$campaign_one['pkId']] = $campaign_one['campaignName']; } */ foreach ($this->_fields as $col => $name) { switch ($col) { case "transaction_reference": case "number": case "unit_price": case "quantity": $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "comments": $this->addElement("textarea", $col, array("attribs" => array("class" => "form-control", "rows" => "2"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "shipment_date": case "production_date": case "expiry_date": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; case "transaction_number": $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array())); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } //if ($col == "manufacturer_id") { // $attribute_class = "col-md-2 form-control input-small"; //} else { $attribute_class = "form-control"; //} if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "{$attribute_class}"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); } } foreach ($this->_hidden as $col => $name) { switch ($col) { case "hdn_transaction_date": $this->addElement("hidden", $col); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } } }
public function ajaxGetPlacementLocationsAction() { $this->_helper->layout->disableLayout(); $detail_id = $this->_request->id; $p = $this->_request->p; $stock_master = new Model_StockMaster(); $stock_master->form_values['$detail_id'] = $detail_id; $result = $stock_master->getIssueDetail(); $item_category_id = $result['item_category_id']; if ($item_category_id == 1) { $cold_chain_loc = new Model_ColdChain(); $ccm_locations = $cold_chain_loc->getLocationsName(); $this->view->locations = $ccm_locations; } else { $non_ccm_loc = new Model_NonCcmLocations(); $non_ccm_locations = $non_ccm_loc->getLocationsName(); $this->view->locations = $non_ccm_locations; } $this->view->item_cat_id = $item_category_id; $this->view->result = $result; $this->view->p = $p; $this->view->detail_id = $detail_id; }