public static function save_lab_commodities($data_array)
 {
     $o = new Lab_Commodity_Details();
     $o->fromArray($data_array);
     $o->save();
     return TRUE;
 }
示例#2
0
 public function lab_order_details($order_id, $msg = NULL)
 {
     $delivery = $this->uri->segment(3);
     $district = $this->session->userdata('district_id');
     $data['title'] = "Lab Commodity Order Details";
     // $data['content_view'] = "rtk/lab_order_details_v";
     $data['order_id'] = $order_id;
     $data['content_view'] = "rtk/rtk/dpp/fcdrr_report";
     $data['banner_text'] = "Lab Commodity Order Details";
     $data['lab_categories'] = Lab_Commodity_Categories::get_all();
     $data['detail_list'] = Lab_Commodity_Details::get_order($order_id);
     $result = $this->db->query('SELECT * 
                     FROM lab_commodity_details, counties, facilities, districts, lab_commodity_orders, lab_commodity_categories, lab_commodities
                     WHERE lab_commodity_details.facility_code = facilities.facility_code
                     AND counties.id = districts.county
                     AND facilities.facility_code = lab_commodity_orders.facility_code
                     AND lab_commodity_details.commodity_id = lab_commodities.id
                     AND lab_commodity_categories.id = lab_commodities.category
                     AND facilities.district = districts.id
                     AND lab_commodity_details.order_id = lab_commodity_orders.id
                     AND lab_commodity_orders.id = ' . $order_id . '');
     $data['all_details'] = $result->result_array();
     //       $data['all_details'] = Lab_Commodity_Orders::get_single_lab_order($order_id);// shida iko hapa
     $this->load->view("rtk/template", $data);
 }
示例#3
0
 function generate_lastpdf($id)
 {
     $query = $this->db->query('SELECT id
     FROM  `lab_commodity_orders` 
     where `id` = ' . $id . '
     LIMIT 0 , 1');
     foreach ($query->result_array() as $row) {
         $order_no = $row['id'];
     }
     $query1 = $this->db->query('SELECT * 
     FROM lab_commodity_orders, facilities, districts,counties
     WHERE lab_commodity_orders.district_id = districts.id
     AND counties.id = districts.county
     AND facilities.facility_code = lab_commodity_orders.facility_code
     AND lab_commodity_orders.id =' . $order_no . '');
     $lab_order = $query1->result_array();
     date_default_timezone_set("EUROPE/Moscow");
     $firstday = date('D dS M Y', strtotime("first day of previous month"));
     $lastday = date('D dS M Y', strtotime("last day of previous month"));
     $lastmonth = date('F', strtotime("last day of previous month"));
     $end_date = date('dS F Y', strtotime($lab_order[0]['end_date']));
     $beg_date = date('dS F Y', strtotime($lab_order[0]['beg_date']));
     $orderdate = $lab_order[0]['order_date'];
     $month = date('F', strtotime("-1 month {$orderdate}"));
     $html_title = "<div ALIGN=CENTER><img src='" . base_url() . "assets/img/coat_of_arms.png' height='70' width='70'style='vertical-align: top;' > </img></div>\n    <div style='text-align:center; font-size: 14px;display: block;font-weight: bold;'>RTK FCDRR Report for " . $lab_order[0]['facility_name'] . "  {$month}  2014</div>\n    <div style='text-align:center; font-family: arial,helvetica,clean,sans-serif;display: block; font-weight: bold; font-size: 14px;'>\n     Ministry of Health</div>\n     <div style='text-align:center; font-family: arial,helvetica,clean,sans-serif;display: block; font-weight: bold;display: block; font-size: 13px;'>Health Commodities Management Platform</div><hr />\n     <style>table.data-table {border: 1px solid #DDD;font-size: 13px;border-spacing: 0px;}\n        table.data-table th {border: none;color: #036;text-align: center;background-color: #F5F5F5;border: 1px solid #DDD;border-top: none;max-width: 450px;}\n        table.data-table td, table th {padding: 4px;}\n        table.data-table td {border: none;border-right: 1px solid #DDD;height: 30px;margin: 0px;border-bottom: 1px solid #DDD;}\n        .col5{background:#D8D8D8;}</style>";
     $table_head = '
     <table border="0" class="data-table" style="width: 100%; margin: 10px auto;">
         <tr>
             <td>Name of Facility:</td>
             <td colspan="2">' . $lab_order[0]['facility_name'] . '</td>
             <td colspan="3">Applicable to HIV Test Kits Only</td>
             <td colspan="4" style="text-align:center">Applicable to Malaria Testing Only</td>                  
         </tr>
         <tr>
             <td colspan="2" style="text-align:left">MFL Code:</td>
             <td>' . $lab_order[0]['facility_code'] . '</td>
             <td colspan="2" style="text-align:center">Type of Service</td>
             <td colspan="1" style="text-align:center">No. of Tests Done</td>
             <td colspan="1">Test</td>
             <td colspan="1">Category</td>
             <td colspan="1">No. of Tests Performed</td>
             <td colspan="1">No. Positive</td>
         </tr>
         <tr>
             <td colspan="2" style="text-align:left">District:</td>
             <td>' . $lab_order[0]['district'] . '</td>
             <td colspan="2">VCT</td>
             <td>' . $lab_order[0]['vct'] . '</td>
             <td rowspan="3">RDT</td>
             <td style="text-align:left">Patients&nbsp;<u>under</u> 5&nbsp;years</td>
             <td>' . $lab_order[0]['rdt_under_tests'] . '</td>
             <td>' . $lab_order[0]['rdt_under_pos'] . '</td>
         </tr>
         <tr>
             <td colspan="2" style="text-align:left">County:</td>                     
             <td>' . $lab_order[0]['county'] . '</td>
             <td colspan="2">PITC</td>
             <td>' . $lab_order[0]['pitc'] . '</td>
             <td style="text-align:left">Patients&nbsp;aged 5-14&nbsp;yrs</td>
             <td>' . $lab_order[0]['rdt_btwn_tests'] . '</td>
             <td>' . $lab_order[0]['rdt_btwn_pos'] . '</td>
         </tr>
         <tr><td colspan="2" style="text-align:right">Beginning:</td> 
             <td>' . $beg_date . '</td>
             <td colspan="2">PMTCT</td>
             <td>' . $lab_order[0]['pmtct'] . '</td>
             <td style="text-align:left">Patients&nbsp;<u>over</u> 14&nbsp;years</td>
             <td>' . $lab_order[0]['rdt_over_tests'] . '</td>
             <td>' . $lab_order[0]['rdt_over_pos'] . '</td>
         </tr>
         <tr>
             <td colspan="2" style="text-align:right">Ending:</td>
             <td>' . $end_date . '</td>
             <td colspan="2">Blood&nbsp;Screening</td>
             <td>' . $lab_order[0]['b_screening'] . '</td>
             <td rowspan="3">Microscopy</td>
             <td style="text-align:left">Patients&nbsp;<u>under</u> 5&nbsp;years</td>
             <td>' . $lab_order[0]['micro_under_tests'] . '</td>
             <td>' . $lab_order[0]['micro_under_pos'] . '</td>                          
         </tr>
         <tr>
             <td colspan="3"></td>
             <td colspan="2">Other&nbsp;(Please&nbsp;Specify)</td>
             <td>' . $lab_order[0]['other'] . '</td> 
             <td style="text-align:left">Patients&nbsp;aged 5-14&nbsp;yrs</td>
             <td>' . $lab_order[0]['micro_btwn_tests'] . '</td>
             <td>' . $lab_order[0]['micro_btwn_pos'] . '</td>
         </tr>
         <tr>
             <td colspan="3"></td>
             <td colspan="2">Specify&nbsp;Here:</td>
             <td>' . $lab_order[0]['specification'] . '</td>   
             <td style="text-align:left">Patients&nbsp;<u>over</u> 14&nbsp;years</td>
             <td>' . $lab_order[0]['micro_over_tests'] . '</td>
             <td>' . $lab_order[0]['micro_over_pos'] . '</td>
         </tr></table>';
     $table_head .= '<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: 20px;margin: 0px;border-bottom: 1px solid #DDD;}
         .col5{background:#D8D8D8;}</style></table>
         <table class="data-table" width="100%">
             <thead>
                 <tr>
                     <th rowspan="2"><strong>Commodity</strong></th>
                     <th rowspan="2"><strong>Unit of Issue</strong></th>
                     <th rowspan="2"><strong>Beginning Balance</strong></th>
                     <th rowspan="2"><strong>Quantity Received</strong></th>
                     <th rowspan="2"><strong>Quantity Used</strong></th>
                     <th rowspan="2"><strong>Tests Done</strong></th>
                     <th rowspan="2"><strong>Losses</strong></th>
                     <th colspan="2"><strong>Adjustments</strong></th>
                     <th rowspan="2"><strong>Closing Stock</strong></th>
                     <th rowspan="2"><strong>Qty Expiring <br />in 6 Months</strong></th>
                     <th rowspan="2"><strong>Days Out of <br />Stock</strong></th>
                     <th rowspan="2"><strong>Qty Requested</strong></th>
                 </tr>
                 <tr>
                     <th><strong>Positive</strong></th>
                     <th><strong>Negative</strong></th>
                 </tr>
             </thead>
             <tbody>';
     $detail_list = Lab_Commodity_Details::get_order($order_no);
     $table_body = '';
     foreach ($detail_list as $detail) {
         $table_body .= '<tr><td>' . $detail['commodity_name'] . '</td>';
         $table_body .= '<td>' . $detail['unit_of_issue'] . '</td>';
         $table_body .= '<td>' . $detail['beginning_bal'] . '</td>';
         $table_body .= '<td>' . $detail['q_received'] . '</td>';
         $table_body .= '<td>' . $detail['q_used'] . '</td>';
         $table_body .= '<td>' . $detail['no_of_tests_done'] . '</td>';
         $table_body .= '<td>' . $detail['losses'] . '</td>';
         $table_body .= '<td>' . $detail['positive_adj'] . '</td>';
         $table_body .= '<td>' . $detail['negative_adj'] . '</td>';
         $table_body .= '<td>' . $detail['closing_stock'] . '</td>';
         $table_body .= '<td>' . $detail['q_expiring'] . '</td>';
         $table_body .= '<td>' . $detail['days_out_of_stock'] . '</td>';
         $table_body .= '<td>' . $detail['q_requested'] . '</td></tr>';
     }
     $table_foot = '</tbody></table>';
     $table_foot .= '
                 <table border="0" style="width: 100%;border: 1px solid #DDD;">
                     <tr>
                         <td style="text-align:left">Explaination of Losses and Adjustments</td><td  style="width: 57%;">' . $lab_order[0]['explanation'] . '</td>
                     </tr>
                     <tr style="background: #ECE8FD;">
                         <td>(1) Daily Activity Register for Laboratory Reagents and Consumables (MOH 642):</td><td>' . $lab_order[0]['moh_642'] . '</td>
                     </tr>
                     <tr>
                         <td  >(2) F-CDRR for Laboratory Commodities (MOH 643):</b></td><td>' . $lab_order[0]['moh_643'] . '</td>
                     </tr>
                     <tr style="background: #ECE8FD;">                   
                         <td style="text-align:left">Compiled by: </td><td>' . $lab_order[0]['compiled_by'] . '</td>
                     </tr> 
                 </table>';
     $report_name = "Lab Commodities Order " . $order_no . " Details";
     $title = "Lab Commodities Order " . $order_no . " Details";
     $html_data = $html_title . $table_head . $table_body . $table_foot;
     $filename = "RTK FCDRR Report for " . $lab_order[0]['facility_name'] . "  {$lastmonth}  2014";
     return $html_data;
 }