本文整理汇总了PHP中Facilities::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::getType方法的具体用法?PHP Facilities::getType怎么用?PHP Facilities::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facilities
的用法示例。
在下文中一共展示了Facilities::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<div class="span12">
<ul class="nav nav-tabs">
<li id="cdrr_btn" class="active">
<a href="#cdrrs">my CDRRs</a>
</li>
<li id="maps_btn">
<a href="#maps">my MAPs</a>
</li>
<!-- new section added for the offline modules -->
<!-- <li id="download_templates">
<a href="">CDRRs and MAPs TEMPLATES</a>
</li> -->
<a href="#download_templates" role="button" id="updates_messagesbtn" class="btn btn-info" data-toggle="modal"> Download Templates</a>
<!--ensure it shows when its a central site-->
<?php
$facility_type = Facilities::getType($this->session->userdata("facility"));
if ($facility_type > 1 && $supplier_name === "kemsa") {
?>
<li id="aggregate_btn">
<a href="#aggregate">my Aggregates</a>
</li>
<?php
}
?>
</ul>
</div>
</div>
<!-- modal that has the links to the cdrrs and the maps -->
<div id="download_templates" class="modal hide fade" tabindex="-1" role="dialog" aria-lebelledby"download_templates" aria-hidden="true">
示例2: getItems
public function getItems()
{
//Default row values
$row = array('beginning_balance' => 0, 'received_from' => 0, 'dispensed_to_patients' => 0, 'losses' => 0, 'adjustments' => 0, 'adjustments_neg' => 0, 'physical_stock' => 0, 'expiry_qty' => 0, 'expiry_month' => "--", 'stock_out' => 0, 'resupply' => 0);
//Set parameters
$param = array("drug_id" => $this->input->post("drug_id"), "period_begin" => $this->input->post("period_begin"), "facility_id" => $this->input->post("facility_id"), "code" => $this->input->post("code"), "stores" => $this->input->post("stores"));
$code = $param['code'];
$facility_id = $param['facility_id'];
$period_begin = date('Y-m-01', strtotime($param['period_begin']));
$period_end = date('Y-m-t', strtotime($param['period_begin']));
$stores = $param['stores'];
$stores = implode(",", $stores);
$stores = str_replace("multiselect-all,", "", $stores);
$drug_id = $param['drug_id'];
//get packsize
$drug = Sync_Drug::getPackSize($drug_id);
$pack_size = $drug['packsize'];
//check whether a satellite,standalone or central site
$facility_code = $this->session->userdata("facility");
$facility_type = Facilities::getType($facility_code);
$row['beginning_balance'] = $this->getBeginningBalance($param);
$row['pack_size'] = $pack_size;
$row = $this->getOtherTransactions($param, $row);
if ($row['stock_out'] == null) {
$row['stock_out'] = 0;
}
if ($facility_type > 1) {
//central site
if ($code == "D-CDRR") {
//reported_consumed & reported_stock_on_hand
$reported_consumed = 0;
$reported_count = 0;
$satellites = Sync_Facility::getSatellites($facility_id);
foreach ($satellites as $satellite) {
$satellite_site = $satellite['id'];
$sql = "SELECT ci.drug_id,SUM(ci.dispensed_units) as consumed,SUM(ci.count) as phy_count\n\t\t\t\t\t\t FROM cdrr c\n\t\t\t\t\t\t LEFT JOIN cdrr_item ci ON ci.cdrr_id=c.id\n\t\t\t\t\t\t WHERE c.period_begin='{$period_begin}' \n\t\t\t\t\t\t AND c.period_end='{$period_end}'\n\t\t\t\t\t\t AND ci.drug_id='{$drug_id}'\n\t\t\t\t\t\t AND c.status LIKE '%approved%'\n\t\t\t\t\t\t AND c.facility_id='{$satellite_site}'\n\t\t\t\t\t\t GROUP BY ci.drug_id";
$query = $this->db->query($sql);
$results = $query->result_array();
if (!$results) {
//if satellite did not report use previous period
$start_date = date('Y-m-01', strtotime($period_begin . "-1 month"));
$end_date = date('Y-m-t', strtotime($period_end . "-1 month"));
$sql = "SELECT ci.drug_id,SUM(ci.dispensed_units) as consumed,SUM(ci.count) as phy_count\n\t\t\t\t\t FROM cdrr c\n\t\t\t\t\t LEFT JOIN cdrr_item ci ON ci.cdrr_id=c.id\n\t\t\t\t\t WHERE c.period_begin='{$start_date}' \n\t\t\t\t\t\t\t AND c.period_end='{$end_date}'\n\t\t\t\t\t\t\t AND ci.drug_id='{$drug_id}'\n\t\t\t\t\t\t\t AND c.facility_id='{$satellite_site}'\n\t\t\t\t\t\t\t GROUP BY ci.drug_id";
$query = $this->db->query($sql);
$results = $query->result_array();
}
if ($results) {
$reported_consumed += @$results[0]['consumed'];
$reported_count += @$results[0]['phy_count'];
}
}
//append to json array
$row['reported_consumed'] = $reported_consumed;
$row['reported_physical_stock'] = $reported_count;
//get issued to satellites as dispensed_to patients
$sql = "SELECT SUM(dsm.quantity_out) AS total \n\t\t\t FROM drug_stock_movement dsm\n\t\t\t LEFT JOIN drugcode d ON d.id=dsm.drug\n\t\t\t LEFT JOIN sync_drug sd ON d.map=sd.id\n\t\t\t LEFT JOIN transaction_type t ON t.id=dsm.transaction_type\n\t\t\t WHERE dsm.transaction_date \n\t\t\t BETWEEN '{$period_begin}' \n\t\t\t AND '{$period_end}' \n\t\t\t AND sd.id = '{$drug_id}'\n\t\t\t AND t.name LIKE '%issue%'\n\t\t\t AND dsm.ccc_store_sp IN({$stores})";
$query = $this->db->query($sql);
$results = $query->result_array();
$row['dispensed_to_patients'] = 0;
if ($results) {
if ($results[0]['total'] != null) {
$row['dispensed_to_patients'] = $results[0]['total'];
}
}
}
}
// Changes made on DCDRR
if ($code == "D-CDRR") {
foreach ($row as $i => $v) {
$exempted_columns = array('expiry_month', 'beginning_balance', 'reported_consumed', 'reported_physical_stock');
if (!in_array($i, $exempted_columns)) {
$row[$i] = round(@$v / @$pack_size);
}
}
//Get Physical Count
$row['physical_stock'] = $row['beginning_balance'] + $row['received_from'] - $row['dispensed_to_patients'] - $row['losses'] + $row['adjustments'];
//Get Resupply
$row['resupply'] = $row['reported_consumed'] * 3 - $row['physical_stock'];
} else {
$row['physical_stock'] = $row['beginning_balance'] + $row['received_from'] - $row['dispensed_to_patients'] - $row['losses'] + $row['adjustments'];
$row['resupply'] = $row['dispensed_to_patients'] * 3 - $row['physical_stock'];
}
if ($code == "F-CDRR_packs") {
foreach ($row as $i => $v) {
if ($i != "expiry_month" && $i != "dispensed_to_patients" && $i != "beginning_balance") {
$row[$i] = round(@$v / @$pack_size);
}
}
$row['dispensed_packs'] = 0;
if ($row['dispensed_to_patients'] > 0) {
$row['dispensed_packs'] = round(@$row['dispensed_to_patients'] / @$pack_size);
}
}
echo json_encode($row);
}
示例3: stock_transaction
public function stock_transaction($stock_type = 1)
{
$data['hide_side_menu'] = 1;
$facility_code = $this->session->userdata('facility');
$user_id = $this->session->userdata('user_id');
$access_level = $this->session->userdata('user_indicator');
if ($access_level == "facility_administrator") {
$transaction_type = Transaction_Type::getAll();
} else {
$transaction_type = Transaction_Type::getAllNonAdjustments();
}
$drug_source = Drug_Source::getAll();
$facility_detail = facilities::getSupplier($facility_code);
$drug_destination = Drug_Destination::getAll();
//Check facility type(satelitte, standalone or central)
$facility_type = Facilities::getType($facility_code);
$get_list = array();
$data['list_facility'] = "";
if ($facility_type == 0) {
//Satellite
$central_code = facilities::getCentralCode($facility_code);
$get_list = facilities::getCentralName($central_code);
$data['list_facility'] = "Central Site";
} else {
if ($facility_type == 1) {
//Standalone
$get_list = array();
$data['list_facility'] = "";
} else {
if ($facility_type > 1) {
//Central
$get_list = facilities::getSatellites($facility_code);
$data['list_facility'] = "Satelitte Sites";
}
}
}
$name = CCC_store_service_point::getCCC($stock_type);
$name = $name['Name'];
$data['supplier_name'] = $facility_detail->supplier->name;
$data['picking_lists'] = "";
$data['get_list'] = $get_list;
$data['user_id'] = $user_id;
$data['facility'] = $facility_code;
$data['stock_type'] = $stock_type;
$data['transaction_types'] = $transaction_type;
$data['drug_sources'] = $drug_source;
$data['drug_destinations'] = $drug_destination;
$data['store'] = strtoupper($name);
$data['content_view'] = "stock_transaction_v";
$this->base_params($data);
}