public function district_order_details($delivery, $facility_code = null, $for_facility = null, $rejected_order = null, $view = null) { $data['title'] = "Order detail View"; $data['content_view'] = isset($for_facility) ? "facility/facility_data/facility_orders/facility_update_order_v" : "district/moh_orderdetail_v"; $data['banner_text'] = "Order detail View"; $data['link'] = "home"; $data['view'] = $view; $data['rejected_order'] = $rejected_order; $data['drug_name'] = Drug::get_drug_name(); $data['quick_link'] = "moh_order_v"; $data['order_details'] = ordertbl::get_details($delivery)->toArray(); $data['detail_list'] = Orderdetails::get_order($delivery); $this->load->view("template", $data); }
public function get_expiry() { //$option=$this->uri->segment(3); $i = $_POST['interval']; $facility = $this->session->userdata('news'); $drug_name = Drug::get_drug_name(); $title = 'test'; switch ($i) { case '6_months': //for 6 months $date = date('Y-m-d', strtotime('+6 months')); $date1 = date('Y-m-d'); $report = Facility_Stock::getStockouts($date, $facility, $date1); $report_name = "Drugs Expiring in next 6 Months "; break; case '2_months': //for 3 months $date = date('Y-m-d', strtotime('+2 month')); $date1 = date('Y-m-d'); $report = Facility_Stock::getStockouts($date, $facility, $date1); $report_name = "Drugs Expiring in next 2 Months "; break; case '12_months': //for a year $date = date('Y-m-d', strtotime('+12 month')); $date1 = date('Y-m-d'); $report = Facility_Stock::getStockouts($date, $facility, $date1); $report_name = "Drugs Expiring in next 1 Year "; break; default: $data['stockouts'] = Facility_Stock::expiries($facility); $report_name = "Drugs Expiring in next 1 Year "; } /**************************************set the style for the table****************************************/ $html_data = '<style>table.data-table {border: 1px solid #DDD;margin: 10px auto;border-spacing: 0px;} table.data-table th {border: none;color: #036;text-align: center;background-color: #F5F5F5;border: 1px solid #DDD;border-top: none;max-width: 450px;} table.data-table td, table th {padding: 4px;} table.data-table td {border: none;border-left: 1px solid #DDD;border-right: 1px solid #DDD;height: 30px;margin: 0px;border-bottom: 1px solid #DDD;} .col5{background:#C9C299;}</style>'; $html_data1 = ''; /*****************************setting up the report*******************************************/ $html_data1 .= '<table class="data-table"><thead> <tr > <th ><strong>Kemsa Code</strong></th> <th><strong>Description</strong></th> <th><strong>Unit size</strong></th> <th><strong>Unit Cost</strong></th> <th><strong>Batch No</strong></th> <th><strong>Expiry Date</strong></th> <th ><strong><b>Units</b></strong></th> <th ><strong><b>Stock Worth(Ksh)</b></strong></th> </tr> </thead><tbody>'; /*******************************begin adding data to the report*****************************************/ foreach ($report as $drug) { foreach ($drug->Code as $d) { $name = $d->Drug_Name; $code = $d->Kemsa_Code; $unitS = $d->Unit_Size; $unitC = $d->Unit_Cost; } $calc = $drug->balance; $html_data1 .= '<tr><td>' . $code . '</td> <td>' . $name . '</td> <td>' . $unitS . '</td> <td>' . $unitC . '</td> <td >' . $drug->batch_no . '</td> <td>' . $drug->expiry_date . '</td> <td >' . $drug->balance . '</td> <td >' . $calc * $unitC . '</td> </tr>'; /***********************************************************************************************/ } $html_data1 .= '</tbody></table>'; $html_data .= $html_data1; //$this->generate_pdf($report_name,$title,$html_data); $this->getpdf($report_name, $title, $html_data); }
public function historical_stock_take() { $facility_code = $this->session->userdata('news'); $data['title'] = "Provide Historical Stock Data"; $data['content_view'] = "facility/historical_stock_v"; $data['banner_text'] = "Provide Historical Stock Data"; $data['quick_link'] = "load_stock"; $data['link'] = "home"; $data['drugs'] = Drug::getAll(); $data['drug_name'] = Drug::get_drug_name(); $data['drug_categories'] = Drug_Category::getAll(); $data['historical_data'] = Historical_Stock::load_historical_stock($facility_code); $data['quick_link'] = "update_stock_level"; $this->load->view("template", $data); }