本文整理汇总了PHP中Facilities::getCodeFacility方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::getCodeFacility方法的具体用法?PHP Facilities::getCodeFacility怎么用?PHP Facilities::getCodeFacility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facilities
的用法示例。
在下文中一共展示了Facilities::getCodeFacility方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMOHForm
public function getMOHForm($type = "711", $period_start = "", $period_end)
{
$this->load->library('PHPExcel');
$dir = "Export";
if ($type == "711") {
$template = "711_template";
} else {
if ($type == "731") {
$template = "731_template";
}
}
$inputFileType = 'Excel5';
$inputFileName = $_SERVER['DOCUMENT_ROOT'] . '/ADT/assets/' . $template . '.xls';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
/*Delete all files in export folder*/
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $object) {
if ($object != "." && $object != "..") {
unlink($dir . "/" . $object);
}
}
} else {
mkdir($dir);
}
//Facility Info
$year = date('Y', strtotime($period_start));
$facility = Facilities::getCodeFacility($this->session->userdata("facility"));
if ($type == "711") {
$month = date('F', strtotime($period_start));
$objPHPExcel->getActiveSheet()->SetCellValue('C7', $facility->name);
$objPHPExcel->getActiveSheet()->SetCellValue('A9', $facility->facilitycode);
$objPHPExcel->getActiveSheet()->SetCellValue('C9', $facility->Parent_District->Name);
$objPHPExcel->getActiveSheet()->SetCellValue('H9', $month);
$objPHPExcel->getActiveSheet()->SetCellValue('J9', $year);
$data_array = $this->get_711($period_start);
} else {
if ($type == "731") {
$month = date('M', strtotime($period_start));
$objPHPExcel->getActiveSheet()->SetCellValue('B3', $facility->name);
$objPHPExcel->getActiveSheet()->SetCellValue('M3', $facility->facilitycode);
$objPHPExcel->getActiveSheet()->SetCellValue('G3', $facility->Parent_District->Name);
$objPHPExcel->getActiveSheet()->SetCellValue('I3', $month);
$objPHPExcel->getActiveSheet()->SetCellValue('K3', $year);
$data_array = $this->get_731($period_start);
}
}
foreach ($data_array as $mydata) {
foreach ($mydata as $column => $value) {
$objPHPExcel->getActiveSheet()->SetCellValue($column, $value);
}
}
//Generate file
ob_start();
$period_start = date("F-Y", strtotime($period_start));
$original_filename = "MOH " . $type . " form for (" . $period_start . ").xls";
$filename = $dir . "/" . urldecode($original_filename);
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save($filename);
$objPHPExcel->disconnectWorksheets();
unset($objPHPExcel);
if (file_exists($filename)) {
$filename = str_replace("#", "%23", $filename);
redirect($filename);
}
}
示例2: create_order
public function create_order($type = "cdrr", $order_type, $content_array = array())
{
$data['hide_generate'] = 0;
$data['hide_save'] = 0;
$data['hide_btn'] = 0;
$data['stand_alone'] = 0;
if ($type == "cdrr") {
$this->session->set_userdata("order_go_back", "cdrr");
$data['hide_side_menu'] = 0;
$data['options'] = "none";
if ($order_type == 0) {
//satellite
$data['page_title'] = "Satellite Facility(F-CDRR)";
$data['banner_text'] = "Satellite Facility(F-CDRR)";
$facility = $this->input->post("satellite_facility", TRUE);
if ($facility == null) {
$facility = $this->session->userdata("facility");
} else {
$data['hide_generate'] = 1;
}
} else {
if ($order_type == 1) {
//standalone
$data['page_title'] = "Stand-alone(F-CDRR)";
$data['banner_text'] = "Stand-alone(F-CDRR)";
$facility = $this->session->userdata("facility");
$data['stand_alone'] = 1;
} else {
if ($order_type == 2) {
//dispensing_point
$data['page_title'] = "Central Dispensing Point(F-CDRR)";
$data['banner_text'] = "Central Dispensing Point(F-CDRR)";
$facility = $this->session->userdata("facility");
$order_type = 0;
} else {
//aggregate
$data['page_title'] = "Central Aggregate(D-CDRR)";
$data['banner_text'] = "Central Aggregate(D-CDRR)";
$data['hide_generate'] = 2;
$facility = $this->session->userdata("facility");
}
}
}
if (!empty($content_array)) {
$cdrr_array = $content_array;
$data['cdrr_array'] = $cdrr_array['cdrr_array'];
$data['status_name'] = strtolower($cdrr_array['cdrr_array'][0]['status_name']);
$facility_id = $cdrr_array['cdrr_array'][0]['facility_id'];
$data['facility_id'] = $facility_id;
$facilities = Sync_Facility::getCode($facility_id, $order_type);
$facility = $facilities['code'];
$code = $cdrr_array['cdrr_array'][0]['code'];
$code = $this->getDummyCode($code, $order_type);
$data['options'] = $cdrr_array['options'];
if ($data['options'] == "view") {
$data['hide_save'] = 1;
}
$data['hide_btn'] = 1;
$cdrr_id = $cdrr_array['cdrr_array'][0]['cdrr_id'];
$data['cdrr_id'] = $cdrr_id;
$data['logs'] = Cdrr_Log::getLogs($cdrr_id);
if ($data['options'] == "view" || $data['options'] == "update") {
if ($data['status_name'] == "prepared" || $data['status_name'] == "review") {
$data['option_links'] = "<li class='active'><a href='" . site_url("order/view_order/cdrr/" . $cdrr_id) . "'>view</a></li><li><a href='" . site_url("order/update_order/cdrr/" . $cdrr_id) . "'>update</a></li><li><a class='delete' href='" . site_url("order/delete_order/cdrr/" . $cdrr_id) . "'>delete</a></li>";
} else {
$data['option_links'] = "<li class='active'><a href='" . site_url("order/view_order/cdrr/" . $cdrr_id) . "'>view</a></li>";
}
}
if ($code == 0) {
$and = "";
} else {
$and = "AND ci.resupply !='0'";
}
if ($cdrr_array['options'] == "update") {
$data['commodities'] = Sync_Drug::getActiveList();
} else {
$sql = "SELECT sd.id,CONCAT_WS('] ',CONCAT_WS(' [',name,abbreviation),CONCAT_WS(' ',strength,formulation)) as Drug,unit as Unit_Name,packsize as Pack_Size,category_id as Category\n\t\t\t FROM cdrr_item ci\n\t\t\t LEFT JOIN sync_drug sd ON sd.id=ci.drug_id\n\t\t\t WHERE ci.cdrr_id='{$cdrr_id}'\n\t\t\t AND(sd.category_id='1' OR sd.category_id='2' OR sd.category_id='3')";
$query = $this->db->query($sql);
$data['commodities'] = $query->result();
}
} else {
$period_start = date('Y-m-01', strtotime(date('Y-m-d') . "-1 month"));
$period_end = date('Y-m-t', strtotime(date('Y-m-d') . "-1 month"));
$code = $this->getActualCode($order_type, $type);
$facilities = Sync_Facility::getId($facility, $order_type);
$duplicate = $this->check_duplicate($code, $period_start, $period_end, $facilities['id'], $type);
$data['commodities'] = Sync_Drug::getActiveList();
$data['duplicate'] = $duplicate;
}
$facilities = Sync_Facility::getId($facility, $order_type);
$data['facility_id'] = $facilities['id'];
$data['facility_object'] = Facilities::getCodeFacility($facility);
$data['content_view'] = "orders/cdrr_template";
$data['report_type'] = $order_type;
$data['stores'] = CCC_store_service_point::getStoreGroups();
$this->base_params($data);
} else {
if ($type == "maps") {
$this->session->set_userdata("order_go_back", "fmaps");
$data['o_type'] = "FMAP";
//.........这里部分代码省略.........
示例3: aggregate_download
public function aggregate_download($period_begin, $facility_id, $cdrr_id, $fmaps_id, $facility_code)
{
$this->load->library('PHPExcel');
$dir = "Export";
$template = "order_merge";
$inputFileType = 'Excel5';
$inputFileName = $_SERVER['DOCUMENT_ROOT'] . '/ADT/assets/' . $template . '.xls';
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
//get satellite facilities
$central_site = array('id' => $facility_id);
$satellites = Sync_Facility::getSatellitesDetails($central_site['id']);
$details = Facilities::getCodeFacility($facility_code);
$facility_name = $details->name;
$district = $details->Parent_District->Name;
//1.0 set worksheet index for cdrrs
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
$highestColumm = $objPHPExcel->setActiveSheetIndex(0)->getHighestColumn();
$highestRow = $objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$arr = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
$drug_count = 15;
$drug_gap = 8;
//range of satellites letters
$start_column = 'F';
$columns = array($start_column);
$current = $start_column;
while ($current != $highestColumm) {
$columns[] = ++$current;
}
//loop through the drugs
while ($drug_count <= $highestRow) {
$drug_name = trim($arr[$drug_count]['A']);
//drug exceptions that drug_id cannot be found
$exceptions = array('Abacavir (ABC) liquid 20mg/ml' => 20, 'Lamivudine (3TC) liquid 10mg/ml' => 26, 'Lopinavir/ritonavir (LPV/r) liquid 80/20mg/ml' => 28, 'Nevirapine (NVP) Susp 10mg/ml' => 30, 'Nevirapine (NVP) Susp 10mg/ml (For PMTCT only)' => 141, 'Zidovudine (AZT) liquid 10mg/ml' => 35, 'Cotrimoxazole Suspension 240mg/5ml' => 38, 'Diflucan Suspension 50mg/5ml' => 41, 'Amphotericin B 50mg IV Injection' => 45);
$pack_size = (int) str_ireplace(array('Packs', 'of', 'tablets', 'Bottle', 'ml', 'capsules', 'Tablets', 'Pack', 'Vials'), array(''), trim($arr[$drug_count]['B']));
$drug_id = $this->getMappedDrug($drug_name, $pack_size);
//get drug_id for exception drugs
if (array_key_exists($drug_name, $exceptions)) {
$drug_id = $exceptions[$drug_name];
}
//if drug_id is not null
if ($drug_id != null) {
//loop through satellite facilities
foreach ($satellites as $index => $satellite) {
//write satellite name and level
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . '10', $satellite['name']);
$pos = stripos($satellite['keph_level'], "Level");
if ($pos !== false) {
$level = str_ireplace(array('Level'), array(''), $satellite['keph_level']);
} else {
$level = '';
}
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . '11', $level);
$facility_id = $satellite['id'];
//query to pull data about the drug
$sql = "SELECT *\n\t\t\t\t\t\t\tFROM cdrr c\n\t\t\t\t\t\t\tLEFT JOIN cdrr_item ci ON ci.cdrr_id=c.id\n\t\t\t\t\t\t\tWHERE c.facility_id='{$facility_id}'\n\t\t\t\t\t\t\tAND c.period_begin='{$period_begin}'\n\t\t\t\t\t\t\tAND ci.drug_id='{$drug_id}'\n\t\t\t\t\t\t\tORDER BY c.id desc\n\t\t\t\t\t\t\tLIMIT 1";
$query = $this->db->query($sql);
$orders = $query->result_array();
foreach ($orders as $order) {
//loop through order transactions and write them to excel
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . $drug_count, $order['balance']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 1), $order['received']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 2), $order['dispensed_units']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 3), $order['losses']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 4), $order['adjustments']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 5), $order['count']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 6), $order['out_of_stock']);
$objPHPExcel->getActiveSheet()->SetCellValue($columns[$index] . ($drug_count + 7), $order['resupply']);
}
}
}
$drug_count += $drug_gap;
}
//write to file(B5-central site name,C7-period_begin,J7-period_end)
$objPHPExcel->getActiveSheet()->SetCellValue('B5', $facility_name);
$objPHPExcel->getActiveSheet()->SetCellValue('J5', $district);
$objPHPExcel->getActiveSheet()->SetCellValue('C7', date('d/m/Y', strtotime($period_begin)));
$objPHPExcel->getActiveSheet()->SetCellValue('J7', date('t/m/Y', strtotime($period_begin)));
//2.0 set worksheet index for maps
$objWorksheet = $objPHPExcel->setActiveSheetIndex(1);
$highestColumm = $objPHPExcel->setActiveSheetIndex(1)->getHighestColumn();
$highestRow = $objPHPExcel->setActiveSheetIndex(1)->getHighestRow();
$arr = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
$regimen_count = 16;
//range of satellites letters
$start_column = 'E';
$columns = array($start_column);
$current = $start_column;
while ($current != $highestColumm) {
$columns[] = ++$current;
}
//loop through the regimens
while ($regimen_count < 100) {
if ($regimen_count != 24) {
//remove row 24
$regimen_code = trim($arr[$regimen_count]['A']);
if ($regimen_code != '') {
$regimen_id = '';
$regimen_id = Sync_Regimen::getId($regimen_code);
if ($regimen_id != "") {
//.........这里部分代码省略.........