Exemplo n.º 1
0
 /**
  * Display a listing of appointments
  *
  * @return Response
  */
 public function index()
 {
     if (Auth::user()->role == 'Doctor') {
         $appointments = Auth::user()->appointments()->get();
     } else {
         $appointments = Appointment::all();
     }
     return View::make('appointments.index', compact('appointments'));
 }
Exemplo n.º 2
0
 public function getAppointments()
 {
     $appointments = Appointment::all();
     $calendarAppointments = array();
     foreach ($appointments as $a) {
         $customer = Customer::find($a['customer_id']);
         $customer = $customer->first_name . ' ' . $customer->last_name;
         $event = array('title' => 'Appointment with ' . $customer, 'start' => $a['appointment_datetime']);
         array_push($calendarAppointments, $event);
     }
     return View::make('admin/appointments')->with('appointments', $calendarAppointments);
 }
Exemplo n.º 3
0
 /**
  * @before _secure
  */
 public function index()
 {
     $this->seo(array("title" => "Appointments Scheduled", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $appointments = array();
     $page = RequestMethods::get("page", 1);
     $limit = RequestMethods::get("limit", 10);
     $count = Appointment::count(array("user_id" => $this->user->id));
     $as = Appointment::all(array("user_id =?" => $this->user->id, "live = ?" => 1), array("id", "service_id", "start", "end", "patient_id"), "start", "asc", $limit, $page);
     foreach ($as as $a) {
         $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id", "organization_id", "charge"));
         $organization = Organization::first(array("id = ?" => $service->organization_id), array("id", "name"));
         $model = ucfirst($service->property);
         $item = $model::first(array("id = ?" => $service->property_id), array("title"));
         $patient = User::first(array("id = ?" => $a->patient_id), array("name"));
         array_push($appointments, array("item" => $item->title, "organization_id" => $organization->id, "organization_name" => $organization->name, "patient" => $patient->name, "start" => $a->start, "end" => $a->end, "id" => $a->id, "charge" => $service->charge));
     }
     $view->set("appointments", $appointments);
     $view->set("page", $page);
     $view->set("limit", $limit);
     $view->set("count", $count);
 }
Exemplo n.º 4
0
 public static function transactions($center, $member)
 {
     if ($centre_id == NULL) {
         $where = array("organization_id = ?" => $member->organization_id);
     } else {
         $where = array("organization_id = ?" => $member->organization_id, "centre_id = ?" => $center);
     }
     $appointments = \Appointment::all($where);
     $result = [];
     if ($member->designation == 'admin') {
         return $appointments;
     }
     if (!$center) {
         throw new \Exception("Invalid Arguments supplied", 1);
     }
     foreach ($appointments as $a) {
         if ($a->centre_id == $center) {
             $result[] = $a;
         }
     }
     return $result;
 }
Exemplo n.º 5
0
 /**
  * @before _secure, _vendor, _admin
  */
 public function payments()
 {
     $this->seo(array("title" => "Vendor Profile", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $where["organization_id = ?"] = $this->organization->id;
     $period = RequestMethods::get("period", "total");
     switch ($period) {
         case 'year':
             $year = strftime("%Y-%m-%d", strtotime('-1 year'));
             $where["created > ?"] = $year;
             break;
         case 'week':
             $week = strftime("%Y-%m-%d", strtotime('-1 year'));
             $where["created > ?"] = $week;
             break;
         case 'day':
             $day = strftime("%Y-%m-%d", strtotime('-1 day'));
             $where["created > ?"] = $day;
             break;
     }
     $centres = Centre::all(array("organization_id = ?" => $this->organization->id), array("id", "location_id"));
     $revenue = 0;
     $cash = 0;
     $online = 0;
     $appointments = Appointment::all($where);
     foreach ($appointments as $a) {
         $order = Order::first(array("id = ?" => $a->order_id), array("amount"));
         $revenue += $order->amount;
         switch ($order->mode) {
             case 'cash':
                 $cash += $order->amount;
                 break;
             default:
                 $online += $order->amount;
                 break;
         }
     }
     if (RequestMethods::get("action") == "invoice") {
         $this->paymentsInvoice($this->organization, $appointments, $revenue, $cash, $online, "show");
     }
     $view->set("appointments", $appointments);
     $view->set("period", $period);
     $view->set("revenue", $revenue);
     $view->set("cash", $cash);
     $view->set("online", $online);
     $view->set("centres", $centres);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $appointments = $this->appointment->all();
     return View::make('appointments.index', compact('appointments'));
 }
Exemplo n.º 7
0
 public function generateinvoice($order_id, $instamojo_id = "not found", $action = "gen")
 {
     if ($instamojo_id == "not found") {
         $this->redirect("/patient/profile");
     }
     $view = new Framework\View(array("file" => APP_PATH . "/application/views/layouts/others/invoice.html"));
     $order = Order::first(array("id = ?" => $order_id));
     $instamojo = Instamojo::first(array("id = ?" => $instamojo_id));
     $patient = User::first(array("id = ?" => $order->user_id));
     $appointments = Appointment::all(array("order_id = ?" => $order->id));
     $view->set("order", $order);
     $view->set("patient", $patient);
     $view->set("appointments", $appointments);
     $view->set("instamojo", $instamojo);
     if (!file_exists(APP_PATH . "/public/assets/uploads/files/orders/{$order->id}.pdf")) {
         $this->generatepdf($view->render(), $order->id);
     }
     if ($action == "show") {
         $this->redirect("/public/assets/uploads/files/orders/{$order->id}.pdf");
     }
 }
Exemplo n.º 8
0
     if (Input::get('id') !== null) {
         $appointments = Appointment::where('patient_id', Input::get('id'))->get();
     } else {
         $appointments = Appointment::all();
     }
     $flag = "test";
     return View::make('appointment_based_data.appointments', compact('appointments', 'flag'));
 });
 Route::get('app_proc', function () {
     $appointments = Appointment::has('diagonosticprocedure', '=', 0)->get();
     $flag = "proc";
     return View::make('appointment_based_data.appointments', compact('appointments', 'flag'));
 });
 Route::get('app_check_fee', function () {
     if (Auth::user()->role == "Accountant") {
         $appointments = Appointment::all();
     } else {
         $appointments = Appointment::has('checkupfee', '=', 0)->get();
     }
     $flag = "check_fee";
     return View::make('appointment_based_data.appointments', compact('appointments', 'flag'));
 });
 /* Route::get('app_view_vendor', function(){
        if(Auth::user()->role == "Accountant"){
            $vendor = Vendor::all();
       }else{
            $vendor = Vendor::has('vendor')->get();
        }
        $flag = "view_vendor";
        return View::make('vendors.index', compact('vendors', 'flag'));
    });*/
Exemplo n.º 9
0
 /**
  * @before _secure, _vendor
  */
 public function reports()
 {
     $this->seo(array("title" => "Test Report", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $centre_id = RequestMethods::get("centre_id", $this->member->centre_id);
     $appointments = Appointment::all(array("centre_id = ?" => $centre_id), array("id", "patient_id", "user_id", "service_id", "start"));
     $view->set("appointments", $appointments);
     if (RequestMethods::post("action") == "report") {
         $appt_id = RequestMethods::post("appointment_id");
         if (!array_key_exists($appt_id, $appointments)) {
             $view->set("message", "Invalid request!!");
             return;
         }
         $appt = $appointments[$appt_id];
         $job = Job::first(array("appointment_id = ?" => $appt->id));
         if (!$job) {
             $view->set("message", "Invalid Request!!");
             return;
         }
         // find emails
         $user = User::first(array("id = ?" => $appt->user_id), array("email"));
         $patient = User::first(array("id = ?" => $appt->patient_id), array("email"));
         if (!$user->email && !$patient->email) {
             $view->set("message", "No email to send message to");
             return;
         } elseif (!$patient->email) {
             $emails = $user->email;
         } else {
             $emails = array($user->email, $patient->email);
             $emails = array_unique($emails);
         }
         // upload file
         $file = $this->_upload('file', "files", array("extensions" => "pdf"));
         if (!$file) {
             $view->set("message", "File upload failed!!");
             return;
         }
         $file_path = APP_PATH . '/public/assets/uploads/files/' . $file;
         $name = $this->organization->name;
         Shared\Services\Mail::notify(array("emails" => $emails, "delivery" => "sendgrid", "template" => "sendReport", "lab" => $name, "apptime" => \Framework\StringMethods::datetime_to_text($appt->start), "subject" => RequestMethods::post("report_detail"), "attachment" => $file_path));
         unlink($file_path);
         $job->live = 1;
         $job->save();
         $view->set("message", "Sent Successfully");
     }
 }
Exemplo n.º 10
0
 /**
  * @before _secure, _doctor
  */
 public function appointments()
 {
     $this->seo(array("title" => "My Appointments", "view" => $this->getLayoutView()));
     $this->getLayoutView()->set("cal", true);
     $view = $this->getActionView();
     $appointments = array();
     $page = RequestMethods::get("page", 1);
     $limit = RequestMethods::get("limit", 10);
     $count = Appointment::count(array("user_id" => $this->user->id));
     $as = Appointment::all(array("user_id =?" => $this->user->id, "live = ?" => 1), array("id", "service_id", "start", "end", "patient_id"), "start", "asc", $limit, $page);
     foreach ($as as $a) {
         $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id", "organization_id", "charge"));
         $organization = Organization::first(array("id = ?" => $service->organization_id), array("id", "name"));
         $model = ucfirst($service->property);
         $item = $model::first(array("id = ?" => $service->property_id), array("title"));
         $patient = User::first(array("id = ?" => $a->patient_id), array("name"));
         array_push($appointments, array("item" => $item->title, "organization_id" => $organization->id, "organization_name" => $organization->name, "patient" => $patient->name, "start" => $a->start, "end" => $a->end, "id" => $a->id, "charge" => $service->charge));
     }
     $organization = Registry::get("session")->get("organization");
     if (RequestMethods::post("action") == "capacity") {
         \Slot::saveRecord($this->user, $organization);
         $view->set("message", "Slots Saved Successfully");
     }
     $view->set("appointments", $appointments);
     $days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
     $view->set("days", $days);
     $view->set("slots", Shared\Services\Doctor::slots($this->user));
 }
 /**
  * Display a listing of Appointments under the Currently Logged User.
  *
  * @return Response
  *
  */
 public function index()
 {
     $appointments = Appointment::all();
     return Response::json($appointments);
 }