当前位置: 首页>>代码示例>>PHP>>正文


PHP Facilities::get_all_on_HCMP方法代码示例

本文整理汇总了PHP中Facilities::get_all_on_HCMP方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::get_all_on_HCMP方法的具体用法?PHP Facilities::get_all_on_HCMP怎么用?PHP Facilities::get_all_on_HCMP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facilities的用法示例。


在下文中一共展示了Facilities::get_all_on_HCMP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ors_zinc_consumption_report

 public function ors_zinc_consumption_report()
 {
     //Set the current year
     $year = date("Y");
     $county_total = array();
     $excel_data = array();
     $excel_data = array('doc_creator' => "HCMP", 'doc_title' => ' consumption report ', 'file_name' => 'stock level report');
     $row_data = array();
     $column_data = array("County", "Sub-County", "Facility Code", "Facility Name", "Commodity Name", "Unit Cost(KES)", "Supplier", "Batch Number", "Quantity Consumed (Packs)", "Quantity Consumed (Units)", "Date Last Issued", "Days From Last Issue");
     $excel_data['column_data'] = $column_data;
     //the commodities variable will hold the values for the three commodities ie ORS and Zinc
     $commodities = array(51, 267, 36, 456);
     foreach ($commodities as $commodities) {
         $commodity_stock_level = array();
         //holds the data for the entire county
         //once it is done executing for one commodity it will reset to zero
         $commodity_total = array();
         //pick the commodity names and details
         //get the consumption for that commodity
         $commodity_consumption = facility_issues::get_consumption_report_ors_zinc($commodities);
         //Start building the excel file
         foreach ($commodity_consumption as $commodity_consumption) {
             //pick the facility code from the data
             $facility_code = $commodity_consumption["facility_code"];
             //get the last date of issue from the database
             $date_last_issue = Facilities::get_last_issue($facility_code);
             //ensure that if the date is null change the message
             $date_of_last_issue = $date_last_issue[0]['Date Last Issued'] != 0 ? date('j M, Y', strtotime($date_last_issue[0]['Date Last Issued'])) : "No Data Found";
             $days_since_last_issue = $date_last_issue[0]['Days From Last Issue'] != 0 ? $date_last_issue[0]['Days From Last Issue'] : 0;
             array_push($row_data, array($commodity_consumption["county"], $commodity_consumption["district"], $commodity_consumption["facility_code"], $commodity_consumption["facility_name"], $commodity_consumption["commodity_name"], $commodity_consumption["unit_cost"], $commodity_consumption["source_name"], $commodity_consumption["batch_no"], $commodity_consumption["total_packs"], $commodity_consumption["total_units"], $date_of_last_issue, $days_since_last_issue));
         }
     }
     $excel_data['row_data'] = $row_data;
     $excel_data['report_type'] = "download_file";
     $excel_data['file_name'] = "Consumption Report For Zinc & ORS";
     $excel_data['excel_title'] = "Consumption Report for Zinc sulphate Tablets  20mg and ORS sachet (for 500ml) low osmolality (100) & (50) as at " . date("jS F Y");
     //Start the email section of the report
     //Get the number of facilities using HCMP
     $no_of_facilities = Facilities::get_all_on_HCMP();
     $subject = "Consumption Report: Zinc sulphate Tablets  20mg and ORS sachet (for 500ml) low osmolality ";
     $message = "<p>Find attached an excel sheet with a Consumption Report for\n\tZinc Sulphate 20mg, ORS sachet (for 500ml) low osmolality (100 & 50) and ORS 4 Satchets & Zinc 10 Tablets 20 Mg as at " . date("jS F Y") . "</p>";
     $message .= "<p>Number of facilities using HCMP: " . $no_of_facilities . "</p>";
     $message .= $message_body;
     $message .= "\n\t<p>You may log onto health-cmp.or.ke for follow up.</p>\n\n\t<p>----</p>\n\n\t<p>HCMP</p>\n\n\t<p>This email was automatically generated. Please do not respond to this email address or it will be ignored.</p>";
     $report_type = "ors_report";
     $this->create_excel($excel_data, $report_type);
     //exit;
     //path for windows
     $handler = "./print_docs/excel/excel_files/" . $excel_data['file_name'] . ".xls";
     //path for Mac
     //$handler = "/Applications/XAMPP/xamppfiles/htdocs/hcmp/print_docs/excel/excel_files/" . $excel_data['file_name'] . ".xls";
     $email_address = "smutheu@clintonhealthaccess.org";
     $bcc = "karsanrichard@gmail.com,kelvinmwas@gmail.com";
     $this->hcmp_functions->send_email($email_address, $message, $subject, $handler, $bcc);
 }
开发者ID:HCMPKenya,项目名称:hcmp_demo,代码行数:55,代码来源:sms.php

示例2: ors_zinc_report

 public function ors_zinc_report()
 {
     //Set the current year
     $year = date("Y");
     $county_total = array();
     $excel_data = array();
     $excel_data = array('doc_creator' => "HCMP", 'doc_title' => ' stock level report ', 'file_name' => 'stock level report');
     $row_data = array();
     $column_data = array("County", "Sub-County", "Facility Code", "Facility Name", "Commodity Name", "Unit Size", "Unit Cost(KES)", "Supplier", "Manufacturer", "Batch Number", "Expiry Date", "Stock at Hand (units)", "Stock at Hand (packs)", "AMC (units)", "AMC (packs)", "Stock at Hand MOS(packs)");
     $excel_data['column_data'] = $column_data;
     //the commodities variable will hold the values for the three commodities ie ORS and Zinc
     $commodities = array(51, 267, 36);
     foreach ($commodities as $commodities) {
         $commodity_stock_level = array();
         //holds the data for the entire county
         //once it is done executing for one commodity it will reset to zero
         $commodity_total = array();
         //pick the commodity names and details
         //$commodity_name = Commodities::get_commodity_name($commodities);
         //get the stock level for that commodity
         $commodity_stock_level = Facility_stocks::get_commodity_stock_level($commodities);
         //echo "<pre>";print_r($commodity_stock_level);exit;
         //Start buliding the excel file
         foreach ($commodity_stock_level as $commodity_stock_level) {
             array_push($row_data, array($commodity_stock_level["county"], $commodity_stock_level["subcounty"], $commodity_stock_level["facility_code"], $commodity_stock_level["facility_name"], $commodity_stock_level["commodity_name"], $commodity_stock_level["unit_size"], $commodity_stock_level["unit_cost"], $commodity_stock_level["supplier"], $commodity_stock_level["manufacture"], $commodity_stock_level["batch_no"], $commodity_stock_level["expiry_date"], $commodity_stock_level["balance_units"], $commodity_stock_level["balance_packs"], $commodity_stock_level["amc_units"], $commodity_stock_level["amc"], $commodity_stock_level["mos"]));
         }
         //Switch statement to build on the remaining part of the message body
         //get the number of facilities stocked out on a specific commodity
         $no_of_stock_outs = Facility_stocks::facilities_stocked_specific_commodity($commodities);
         //get the number of facilities reporting on a specific commodity
         $no_of_facilities_reporting = Facility_stocks::facilities_reporting_on_a_specific_commodity($commodities);
         //get the number of batches expiring within 3 months
         $no_of_batches = Facility_stocks::batches_expiring_specific_commodities($commodities);
         //echo "<pre>";print_r($no_of_stock_outs);exit;
         switch ($commodities) {
             case 51:
                 $message_body .= "<p>Number of Facilities Reporting on ORS Satchets (100):" . $no_of_facilities_reporting . "</p>";
                 $message_body .= "<p>Number of Facilities Stocked out on ORS Satchets (100): " . $no_of_stock_outs . "</p>";
                 $message_body .= "<p>Number of ORS (100) Batches expiring in the next 3 months: " . $no_of_batches . "</p>";
                 break;
             case 267:
                 $message_body .= "<p>Number of Facilities Reporting on ORS Satchets (50):" . $no_of_facilities_reporting . "</p>";
                 $message_body .= "<p>Number of Facilities Stocked out on ORS Satchets (50): " . $no_of_stock_outs . "</p>";
                 $message_body .= "<p>Number of ORS (50) Batches expiring in the next 3 months:  " . $no_of_batches . "</p>";
                 break;
             case 36:
                 $message_body .= "<p>Number of Facilities Reporting on Zinc Sulphate 20mg:" . $no_of_facilities_reporting . "</p>";
                 $message_body .= "<p>Number of Facilities Stocked out on Zinc Sulphate 20mg:" . $no_of_stock_outs . "</p>";
                 $message_body .= "<p>Number of Zinc Sulphate Batches expiring in the next 3 months:" . $no_of_batches . "</p>";
                 break;
         }
         //array_push($county_total,array($row_data));
     }
     $excel_data['row_data'] = $row_data;
     $excel_data['report_type'] = "download_file";
     $excel_data['file_name'] = "Stock_Level_Report";
     $excel_data['excel_title'] = "Stock Level Report for Zinc sulphate Tablets  20mg and ORS sachet (for 500ml) low osmolality (100) & (50) as at " . date("jS F Y");
     //Start the email section of the report
     //Get the number of facilities using HCMP
     $no_of_facilities = Facilities::get_all_on_HCMP();
     $subject = "Daily Stock Level Report: Zinc sulphate Tablets  20mg and ORS sachet (for 500ml) low osmolality ";
     $message = "Good Morning,\n\t\t\t\t<p>Find attached an excel sheet with a Stock Level Report for \n\t\t\t\tZinc Sulphate 20mg and ORS sachet (for 500ml) low osmolality (100 & 50) as at " . date("jS F Y") . "</p>";
     $message .= "<p>Number of facilities using HCMP: " . $no_of_facilities . "</p>";
     $message .= $message_body;
     $message .= "\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t<p>You may log onto health-cmp.or.ke for follow up.</p>\n\t\t\t\t\n\t\t\t\t<p>----</p>\n\t\t\t\t\n\t\t\t\t<p>HCMP</p>\n\t\t\t\t\n\t\t\t\t<p>This email was automatically generated. Please do not respond to this email address or it will be ignored.</p>";
     //echo $message;exit;
     $report_type = "ors_report";
     $this->create_excel($excel_data, $report_type);
     //path for windows
     $handler = "./print_docs/excel/excel_files/" . $excel_data['file_name'] . ".xls";
     //path for Mac
     //$handler = "/Applications/XAMPP/xamppfiles/htdocs/hcmp/print_docs/excel/excel_files/" . $excel_data['file_name'] . ".xls";
     $email_address = "smutheu@clintonhealthaccess.org,bwariari@clintonhealthaccess.org,amwaura@clintonhealthaccess.org,rkihoto@clintonhealthaccess.org";
     $bcc = "collinsojneg@gmail.com,kelvinmwas@gmail.com,nmaingi@strathmore.edu";
     $this->hcmp_functions->send_email($email_address, $message, $subject, $handler, $bcc);
 }
开发者ID:karsanrichard,项目名称:hcmp_test,代码行数:76,代码来源:sms.php


注:本文中的Facilities::get_all_on_HCMP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。