Пример #1
0
 public function potentialExpiries()
 {
     //New
     $facility_c = $this->session->userdata('news');
     $data['title'] = "Stock";
     $data['content_view'] = "potentialExp";
     $data['banner_text'] = "Potential Expiries";
     $data['link'] = "order_management";
     $data['stocks'] = Facility_Stock::expiries($facility_c);
     //$data['tester']=Drug::getSome();
     $data['quick_link'] = "stock_view";
     $this->load->view("template", $data);
 }
 public function county_potential_expiries($facility_code = NULL)
 {
     if (!isset($facility_code)) {
         $facility_c = $this->session->userdata('news');
     } else {
         $facility_c = $facility_code;
     }
     $data['title'] = "Potential Expiries";
     $data['content_view'] = "county/county_potential_expiries_v";
     $data['banner_text'] = "Expired Products";
     $data['report'] = Facility_Stock::expiries($facility_c);
     $data['mycount'] = count(Facility_Stock::expiries($facility_c));
     $data['expired'] = Districts::get_district_expiries($date, $district);
     $data['potential_expiries'] = Counties::get_potential_expiry_summary($county);
     $data['table_body2'] = "";
     if (count($data['expired'])) {
         foreach ($data['expired'] as $item) {
             $data['table_body2'] .= "<tr>\n\t\t\t<td>" . $item['facility_code'] . "</td>\n\t\t\t<td>" . $item['facility_name'] . "</td>\n\t\t\t<td>" . $item['balance'] . "</td>\n\t\t\t<td><a href=" . site_url('stock_expiry_management/expired/' . $item['facility_code']) . " class='link'>View</a></td>\n\t\t\t</tr>";
         }
     } else {
         $data['table_body2'] = "<div id='notification'>No records found</div>";
     }
     $this->load->view("template", $data);
 }
Пример #3
0
    public function gen_pdf()
    {
        $timeinterval = $_POST['timer'];
        $facility_c = $this->session->userdata('news');
        $report = Facility_Stock::expiries($facility_c, $timeinterval);
        $report_name = 'Potential Expiries ' . $facility_c . ' Next ' . $timeinterval . 'Months';
        $title = 'test';
        /**************************************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><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;
                $thedate = $drug->expiry_date;
                $formatme = new DateTime($thedate);
                $myvalue = $formatme->format('d M Y');
                $html_data1 .= '<tr>
		 
		 					<td>' . $code . '</td>
		 					<td>' . $name . '</td>
		 					<td>' . $unitS . '</td>
							<td>' . $unitC . '</td>
							<td>' . $drug->batch_no . '</td>
							<td>' . $myvalue . '</td>
							<td>' . $drug->balance . '</td>
							<td >' . $calc * $unitC . '</td>
							
							
							</tr>';
                /***********************************************************************************************/
            }
        }
        $html_data1 .= '</tbody></table>';
        $html_data .= $html_data1;
        $date = new DateTime();
        $interval = new DateInterval('P' . $timeinterval . 'M');
        $date->add($interval);
        $formateddate = $date->format('M-d-Y') . "\n";
        $this->generatePE_pdf($report_name, $title, $html_data, $facility_c, $timeinterval, $formateddate);
    }