public function getDrugBinCard($drug_id = '', $ccc_id = '')
 {
     //CCC Store Name
     $ccc = CCC_store_service_point::getCCC($ccc_id);
     $ccc_name = $ccc['Name'];
     $pack_size = 0;
     //get drug information
     $drug = Drugcode::getDrug($drug_id, $ccc_id);
     $data['commodity'] = '';
     $data['unit'] = '';
     $drug_map = '';
     if ($drug) {
         $data['commodity'] = $drug['drug'];
         $drug_map = $drug['map'];
         $data['unit'] = $drug['drugunit'];
         $pack_size = $drug['pack_size'];
     }
     $total_stock = 0;
     //get batch information
     $drug_batches = array();
     $today = date('Y-m-d');
     $facility_code = $this->session->userdata('facility');
     $batches = Drugcode::getDrugBatches($drug_id, $ccc_id, $facility_code, $today);
     if ($batches) {
         //Check if batches exist
         foreach ($batches as $counter => $batch) {
             $drug_batches[$counter]['drug'] = $batches[$counter]['drugname'];
             $drug_batches[$counter]['packsize'] = $batches[$counter]['pack_size'];
             $drug_batches[$counter]['batchno'] = $batches[$counter]['batch_number'];
             $drug_batches[$counter]['balance'] = $batches[$counter]['balance'];
             $drug_batches[$counter]['expiry_date'] = $batches[$counter]['expiry_date'];
             $total_stock = $total_stock + $batches[$counter]['balance'];
         }
     }
     //Consumption
     $three_months_consumption = 0;
     $transaction_type = '';
     if (stripos($ccc_name, "pharmacy")) {
         $transaction_type = Transaction_Type::getTransactionType('dispense', 0);
         $transaction_type = $transaction_type['id'];
     } else {
         if (stripos($ccc_name, "store")) {
             $transaction_type = Transaction_Type::getTransactionType('issue', 0);
             $transaction_type = $transaction_type['id'];
         }
     }
     $consumption = Drug_Stock_Movement::getDrugConsumption($drug_id, $facility_code, $ccc_id, $transaction_type);
     foreach ($consumption as $value) {
         $three_months_consumption += $value['total_out'];
     }
     //3 Months consumption using facility orders
     $data['maximum_consumption'] = number_format($three_months_consumption);
     $data['avg_consumption'] = number_format($three_months_consumption / 3);
     $monthly_consumption = number_format($three_months_consumption / 3);
     $min_consumption = $three_months_consumption * 0.5;
     $data['minimum_consumption'] = number_format($min_consumption);
     $data['stock_val'] = $ccc_id;
     $data['hide_sidemenu'] = '';
     $data['total_stock'] = $total_stock;
     $data['batches'] = $drug_batches;
     $data['hide_side_menu'] = '1';
     $data['store'] = $ccc_name;
     $data['drug_id'] = $drug_id;
     $data['content_view'] = 'bin_card_v';
     $this->base_params($data);
 }