public function additionalsupplyrequestAction()
 {
     $value = $this->_request->getParam('examinationmaterials');
     $SupplyexaminationmaterialModel = new SupplyexaminationmaterialModel();
     $supplyexaminationmaterialData = $SupplyexaminationmaterialModel->fetchAll($SupplyexaminationmaterialModel->getSupplyExaminationMaterialByRequestExamination($value));
     $responce = new stdClass();
     $index = 0;
     foreach ($supplyexaminationmaterialData as $row) {
         $subtotal = $row->vlchargeprice * $row->nrquantity;
         $responce->rows[$index]['id'] = $row->cdsupply;
         $responce->rows[$index]['cell'] = array($row->cdsupply, $row->nmsupply, $row->cdsupplycentre, $row->idsupplycentre, str_replace(".", ",", $row->vlchargeprice), $row->nrquantity, str_replace(".", ",", $subtotal));
         $index++;
     }
     $this->view->additionalsupplyrequest = $responce;
 }
 public function dadossupplyexaminationmaterialAction()
 {
     $this->_helper->layout->disableLayout();
     $page = $this->_request->getParam("page", 1);
     $limit = $this->_request->getParam("rows");
     $cdexaminationmaterial = $this->_request->getParam("cdexaminationmaterial");
     $supplyMaterialModel = new SupplyexaminationmaterialModel();
     $supplyexaminationData = $supplyMaterialModel->fetchAll($supplyMaterialModel->getSupplyExaminationByExaminationMaterial($cdexaminationmaterial));
     $count = count($supplyexaminationData);
     if ($count > 0 && $limit != 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     //  $examinationData = $examinationModel->fetchAll(null, "$sidx $sord", $limit, ($page*$limit-$limit));
     $responce = new stdClass();
     $responce->page = $page;
     $responce->total = $total_pages;
     $responce->records = $count;
     $i = 0;
     foreach ($supplyexaminationData as $row) {
         $row->fgbilling == 1 ? $billingtext = 'Sim' : ($billingtext = 'Não');
         $responce->rows[$i]['id'] = $i + 1;
         $responce->rows[$i]['cell'] = array($row->cdsupply, $row->nmsupply, $row->nmmeasurementunit, $row->nrquantity, $row->cdsupplycentre, $row->idsupplycentre, $billingtext);
         $i++;
     }
     $this->view->dadossupplymaterial = $responce;
 }