Example #1
0
 /**
  * @before _secure, _vendor
  */
 public function create()
 {
     $this->seo(array("title" => "Create Lab", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "medicallab") {
         unset($_POST['action']);
         $department = RequestMethods::post("department", array());
         if (empty($department)) {
             $view->set("errors", "Please select a department!!");
             return;
         }
         $centres = Framework\ArrayMethods::reArray($_POST);
         $data = $this->_saveCenters($centres, $department);
         $view->set($data);
     }
 }
Example #2
0
 protected function _saveAllCharges()
 {
     if (RequestMethods::post("action") == "saveAll") {
         unset($_POST['action']);
         $charges = Framework\ArrayMethods::reArray($_POST);
         $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("id", "location_id"));
         $locations = Location::all(array(), array("id", "area_id", "city_id"));
         foreach ($charges as $c) {
             if (!$c['charge'] || (int) $c['charge'] < 0) {
                 continue;
             }
             $this->_saveCharge($centres, $locations, array('test_id' => $c['test'], 'charge' => $c['charge'], 'service_id' => $c['service']));
         }
         return array("success" => "Saved successfully!!");
     } else {
         return array();
     }
 }