예제 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getConfig()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $user = Sentry::getUser();
     $clinic = Clinic::where('user_id', $user->id)->first();
     $adress = Address::find($clinic->address_id);
     $province_id = City::find($adress->city_id)->province_id;
     $country_id = Province::find($province_id)->country_id;
     $option = $clinic->insurances;
     #$option      = Option::where('name', $clinic->id.'-clinic-insurance')->first();
     $array = array();
     if ($option) {
         $segs = explode(',', $option);
         $segok = '';
         foreach ($segs as $seg) {
             $very = Insurance::where('id', $seg)->first();
             if ($very) {
                 $array[] = array('value' => $very->id, 'text' => $very->name);
             }
         }
     }
     /**/
     $optionLang = Option::where('name', $clinic->id . '-clinic-lang')->first();
     if (!$option) {
         return View::make('clinic.config.config')->with('country_id', $country_id)->with('clinic', $clinic)->with('adress', $adress);
     } else {
         return View::make('clinic.config.config')->with('clinic', $clinic)->with('option', $array)->with('adress', $adress)->with('country_id', $country_id)->with('optionLang', $optionLang);
     }
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $vehicle = Vehicle::find($id);
     // LOGS
     $oldVehiclesStatus = $vehicle->vehicles_status;
     $newVehiclesStatus = Input::get('vehicles_status');
     $oldvehicleColor = $vehicle->color->id;
     $newVehicleColor = Input::get('vehicles_color');
     $oldVehicleUseType = $vehicle->vehicles_use_type;
     $newVehicleUseType = Input::get('vehicles_use_type');
     $vehicles_class = Input::get('vehicles_class');
     $oldVehiclesRegistrationNo = $vehicle->registration->registrations_no;
     $newVehiclesRegistrationNo = Input::get('registrations_no');
     $oldOdometer = $vehicle->vehicles_odometer;
     $newOdometer = Input::get('vehicles_odometer');
     // IF VEHICLE STATUS IS CHANGED, ADD LOG
     if ($oldVehiclesStatus != $newVehiclesStatus) {
         LogVehicleStatus::create(['log_vehicle_status_vehicle_id' => $id, 'log_vehicle_status_vehicle_status_id' => $newVehiclesStatus]);
     }
     // IF VEHICLE COLOR IS CHANGED, ADD LOG
     if ($oldvehicleColor != $newVehicleColor) {
         LogVehicleColor::create(['log_vehicle_color_vehicle_id' => $id, 'log_vehicle_color_color_id' => $newVehicleColor]);
     }
     // IF VEHICLE USE TYPE IS CHANGED, TAKE LOG (ALSO TAKING LOG OF ODOMETER AND INCREMENT SEQUENCE)
     if ($oldVehicleUseType != $newVehicleUseType) {
         LogVehicleUseType::create(['log_vehicle_use_type_vehicle_id' => $id, 'log_vehicle_use_type_use_type' => $newVehicleUseType, 'log_vehicle_use_type_registration_no' => $newVehiclesRegistrationNo]);
         // INCREMENTING SEQUENCE
         $vehicles_use_type_table_name = VehicleUseType::find($newVehicleUseType)->vehicle_use_types_table_name;
         $vehicles_sequence_col_name = $vehicles_use_type_table_name . '_sequence';
         $currentSequence = DB::table($vehicles_use_type_table_name)->find($vehicles_class)->{$vehicles_sequence_col_name};
         $newSequence = $currentSequence + 1;
         DB::table($vehicles_use_type_table_name)->where('id', $vehicles_class)->update([$vehicles_sequence_col_name => $newSequence]);
         // TAKING LOG OF ODOMETER
         $vehicles_odometer = Input::get('vehicles_odometer');
         LogVehicleOdometer::create(['log_vehicle_odometer_vehicle_id' => $id, 'log_vehicle_odometer_old_odometer' => $vehicles_odometer, 'log_vehicle_odometer_status' => 2]);
     } elseif ($oldOdometer != $newOdometer) {
         LogVehicleOdometer::create(['log_vehicle_odometer_vehicle_id' => $id, 'log_vehicle_odometer_old_odometer' => $newOdometer, 'log_vehicle_odometer_status' => 4]);
     }
     // BEGIN UPDATE VEHICLE DATA
     $vehicle = Input::only(['vehicles_use_type', 'vehicles_class', 'vehicles_color', 'vehicles_status', 'vehicles_odometer']);
     Vehicle::where('id', $id)->update($vehicle);
     // END UPDATE VEHICLE DATA
     // BEGIN OWNERS
     //OLD OWNERS
     $old_owners = Vehicle::find($id)->owners->lists('id');
     //UPDATED OLD OWNERS
     $updated_old_owners_index = Input::get('old_owners_index');
     $updated_owners_index_arr = array_filter(explode(',', $updated_old_owners_index));
     //DELETED OWNERS
     $deleted_owners = array_diff($old_owners, $updated_owners_index_arr);
     // DELETE EACH DELETED OWNER FROM DATABASE
     foreach ($deleted_owners as $deleted_owner_id) {
         VehicleDriverOwner::where('vehicle_driver_owners_vehicle_id', $id)->where('vehicle_driver_owners_driver_id', $deleted_owner_id)->delete();
     }
     //RETAINED OWNERS
     $retained_owners = array_intersect($old_owners, $updated_owners_index_arr);
     // UPDATE RETAINED OWNERS
     foreach ($retained_owners as $retained_owner) {
         $retained_owner_info['drivers_fname'] = Input::get('drivers_fname' . $retained_owner);
         $retained_owner_info['drivers_mname'] = Input::get('drivers_mname' . $retained_owner);
         $retained_owner_info['drivers_lname'] = Input::get('drivers_lname' . $retained_owner);
         $retained_owner_info['drivers_nin'] = Input::get('drivers_nin' . $retained_owner);
         $retained_owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $retained_owner);
         $retained_owner_info['drivers_street'] = Input::get('drivers_street' . $retained_owner);
         $retained_owner_info['drivers_city'] = Input::get('drivers_city' . $retained_owner);
         $retained_owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $retained_owner);
         $retained_owner_info['drivers_country'] = Input::get('drivers_country' . $retained_owner);
         $retained_owner_info['drivers_cell1'] = Input::get('drivers_cell1' . $retained_owner);
         $retained_owner_info['drivers_cell2'] = Input::get('drivers_cell2' . $retained_owner);
         $retained_owner_info['drivers_email'] = Input::get('drivers_email' . $retained_owner);
         $retained_owner_info['drivers_driving_status'] = Input::get('drivers_driving_status' . $retained_owner);
         Driver::find($retained_owner)->update($retained_owner_info);
     }
     // END OWNERS
     //BEGIN AUTHORIZED DRIVERS
     $old_authorized = Vehicle::find($id)->authorizedDrivers->lists('id');
     //UPDATED OLD AUTHORIZED DRIVERS
     $updated_old_authorized_index = Input::get('old_authorized_index');
     $updated_authorized_index_arr = array_filter(explode(',', $updated_old_authorized_index));
     //DELETED AUTHORIZED DRIVERS
     $deleted_authorized = array_diff($old_authorized, $updated_authorized_index_arr);
     //DELETE EACH DELETED AUTHORIZED DRIVER FROM DATABASE
     foreach ($deleted_authorized as $deleted_authorized_id) {
         VehicleDriverAuthorized::where('vehicle_driver_authorized_vehicle_id', $id)->where('vehicle_driver_authorized_driver_id', $deleted_authorized_id)->delete();
     }
     //RETAINED AUTHORIZED DRIVERS
     $retained_authorized = array_intersect($old_authorized, $updated_authorized_index_arr);
     // UPDATE RETAINED AUTHORIZED DRIVERS
     foreach ($retained_authorized as $retained_authorize) {
         $retained_authorized_info['drivers_fname'] = Input::get('authorized_fname' . $retained_authorize);
         $retained_authorized_info['drivers_mname'] = Input::get('authorized_mname' . $retained_authorize);
         $retained_authorized_info['drivers_lname'] = Input::get('authorized_lname' . $retained_authorize);
         $retained_authorized_info['drivers_nin'] = Input::get('authorized_nin' . $retained_authorize);
         $retained_authorized_info['drivers_license_no'] = Input::get('authorized_license_no' . $retained_authorize);
         $retained_authorized_info['drivers_street'] = Input::get('authorized_street' . $retained_authorize);
         $retained_authorized_info['drivers_city'] = Input::get('authorized_city' . $retained_authorize);
         $retained_authorized_info['drivers_po_box'] = Input::get('authorized_po_box' . $retained_authorize);
         $retained_authorized_info['drivers_country'] = Input::get('authorized_country' . $retained_authorize);
         $retained_authorized_info['drivers_cell1'] = Input::get('authorized_cell1' . $retained_authorize);
         $retained_authorized_info['drivers_cell2'] = Input::get('authorized_cell2' . $retained_authorize);
         $retained_authorized_info['drivers_email'] = Input::get('authorized_email' . $retained_authorize);
         $retained_authorized_info['drivers_driving_status'] = Input::get('authorized_driving_status' . $retained_authorize);
         Driver::find($retained_authorize)->update($retained_authorized_info);
     }
     //END AUTHORIZED DRIVERS
     // BEGIN NEW OWNERS
     $owners_index = Input::get('owners_index');
     $owners_index_arr = array_filter(explode(',', $owners_index));
     // LOOP THROUGH EACH OWNER AND ASSOCIATE WITH DRIVERS
     foreach ($owners_index_arr as $owners_index_id) {
         $drivers_license_no = Input::get('drivers_license_no' . $owners_index_id);
         if (trim($drivers_license_no) != "") {
             $drivers_status = Driver::where('drivers_license_no', $drivers_license_no)->first();
             // IF DRIVER DOESN'T EXISTS, CREATE DRIVER
             if ($drivers_status == NULL) {
                 $owner_info['drivers_fname'] = Input::get('drivers_fname' . $owners_index_id);
                 $owner_info['drivers_mname'] = Input::get('drivers_mname' . $owners_index_id);
                 $owner_info['drivers_lname'] = Input::get('drivers_lname' . $owners_index_id);
                 $owner_info['drivers_nin'] = Input::get('drivers_nin' . $owners_index_id);
                 $owner_info['drivers_license_no'] = Input::get('drivers_license_no' . $owners_index_id);
                 $owner_info['drivers_street'] = Input::get('drivers_street' . $owners_index_id);
                 $owner_info['drivers_city'] = Input::get('drivers_city' . $owners_index_id);
                 $owner_info['drivers_po_box'] = Input::get('drivers_po_box' . $owners_index_id);
                 $owner_info['drivers_country'] = Input::get('drivers_country' . $owners_index_id);
                 $owner_info['drivers_cell1'] = Input::get('drivers_cell1' . $owners_index_id);
                 $owner_info['drivers_cell2'] = Input::get('drivers_cell2' . $owners_index_id);
                 $owner_info['drivers_email'] = Input::get('drivers_email' . $owners_index_id);
                 $owner_info['drivers_driving_status'] = Input::get('drivers_driving_status' . $owners_index_id);
                 $insert_owner_into_driver_table = Driver::create($owner_info);
                 $owner_ids[] = $insert_owner_into_driver_table->id;
             } else {
                 $owner_ids[] = Driver::where('drivers_license_no', $drivers_license_no)->first()->id;
             }
         }
     }
     // LINK VEHICLE WITH NEW OWNERS
     if (!empty($owner_ids)) {
         foreach ($owner_ids as $owner_ids_fet) {
             $owner_ids_fet = (int) $owner_ids_fet;
             //VehicleDriverOwner::create(['vehicle_driver_owners_vehicle_id' => $id, 'vehicle_driver_owners_driver_id' => $owner_ids_fet]);
             Vehicle::find($id)->owners()->attach($owner_ids_fet);
         }
     }
     // END NEW OWNERS
     //BEGIN NEW AUTHORIZED DRIVERS
     $authorized_index = Input::get('authorized_index');
     // IF AUTHORIZED DRIVERS EXIST, ASSOCIATE WITH DRIVERS.(CHECKING USING LICENSE)
     if ($authorized_index != "") {
         $authorized_index_arr = explode(',', $authorized_index);
         foreach ($authorized_index_arr as $authorized_index_id) {
             $authorized_license_no = Input::get('authorized_license_no' . $authorized_index_id);
             $authorized_status = Driver::where('drivers_license_no', $authorized_license_no)->first();
             //IF DRIVER DOESN'T EXISTS, CREATE DRIVER
             if ($authorized_status == NULL) {
                 $authorized_info['drivers_fname'] = Input::get('authorized_fname' . $authorized_index_id);
                 $authorized_info['drivers_mname'] = Input::get('authorized_mname' . $authorized_index_id);
                 $authorized_info['drivers_lname'] = Input::get('authorized_lname' . $authorized_index_id);
                 $authorized_info['drivers_nin'] = Input::get('authorized_nin' . $authorized_index_id);
                 $authorized_info['drivers_license_no'] = Input::get('authorized_license_no' . $authorized_index_id);
                 $authorized_info['drivers_street'] = Input::get('authorized_street' . $authorized_index_id);
                 $authorized_info['drivers_city'] = Input::get('authorized_city' . $authorized_index_id);
                 $authorized_info['drivers_po_box'] = Input::get('authorized_po_box' . $authorized_index_id);
                 $authorized_info['drivers_country'] = Input::get('authorized_country' . $authorized_index_id);
                 $authorized_info['drivers_cell1'] = Input::get('authorized_cell1' . $authorized_index_id);
                 $authorized_info['drivers_cell2'] = Input::get('authorized_cell2' . $authorized_index_id);
                 $authorized_info['drivers_email'] = Input::get('authorized_email' . $authorized_index_id);
                 $authorized_info['drivers_driving_status'] = Input::get('authorized_driving_status' . $authorized_index_id);
                 $insert_authorized_into_driver_table = Driver::create($authorized_info);
                 $authorized_ids[] = $insert_authorized_into_driver_table->id;
             } else {
                 $authorized_ids[] = Driver::where('drivers_license_no', $authorized_license_no)->first()->id;
             }
         }
         // LINK VEHICLE WITH AUTHORIZED DRIVERS
         foreach ($authorized_ids as $authorized_ids_fet) {
             $authorized_ids_fet = (int) $authorized_ids_fet;
             //VehicleDriverAuthorized::create(['vehicle_driver_authorized_vehicle_id' => $id, 'vehicle_driver_authorized_driver_id' => $authorized_ids_fet]);
             Vehicle::find($id)->authorizedDrivers()->attach($authorized_ids_fet);
         }
     }
     // END NEW AUTHORIZED DRIVERS
     // BEGIN INSURANCE
     if (Input::get('insurances_company') != "") {
         $insurance_arr = Input::only('insurances_company', 'insurances_policy_no', 'insurances_exp_date', 'insurances_agent_fname', 'insurances_agent_lname', 'insurances_agent_cell', 'insurances_agent_city', 'insurances_agent_email');
         if (Insurance::where('insurances_vehicle_id', $id)->first()->id) {
             Insurance::where('insurances_vehicle_id', $id)->update($insurance_arr);
         } else {
             //$insurance_arr['insurances_vehicle_id'] = $id;
             //Insurance::create($insurance_arr);
             Vehicle::find($id)->insurance()->save($insurance_arr);
         }
     }
     // END INSURANCE
     // BEGIN LIEN HOLDER
     if (Input::get('lien_index')) {
         $lien_arr = Input::only('liens_collateral_id', 'liens_collateral_value', 'liens_bank_name', 'liens_bank_branch', 'liens_bank_street', 'liens_bank_city');
         if (Lien::where('liens_vehicle_id', $id)->first()->id) {
             Lien::where('liens_vehicle_id', $id)->update($lien_arr);
         } else {
             //$lien_arr['liens_vehicle_id'] = $id;
             //Lien::create($lien_arr);
             Vehicle::find($id)->lien()->save($lien_arr);
         }
     }
     // END LIEN HOLDER
     // BEGIN OLD FILES
     $old_documents_index = Vehicle::find($id)->documents->lists('id');
     $documents_index = explode(',', Input::get('documents_index'));
     $deleted_documents = array_diff($old_documents_index, $documents_index);
     if (!empty($deleted_documents)) {
         foreach ($deleted_documents as $deleted_document) {
             Document::find($deleted_document)->delete();
         }
     }
     // END OLD FILES
     // BEGIN NEW FILES
     $files_col = Input::file();
     $files_count = count(array_filter($files_col['files']));
     // IF FILES EXISTS
     if ($files_count) {
         foreach ($files_col['files'] as $files) {
             $filename_ar = explode('.', $files->getClientOriginalName());
             $document_ext = end($filename_ar);
             $path = public_path() . '/vehicledata/documents';
             // GENERATE RANDOM FILE NAME AND ADD EXTENSION
             $randName = md5(rand() * time());
             $document_name = $randName . '.' . $document_ext;
             // MOVE FILE AND ENTRY INTO DATABASE
             if ($files->move($path, $document_name)) {
                 //Document::create(['documents_vehicle_id' => $id, 'documents_name' => $document_name]);
                 Vehicle::find($id)->documents()->save(new Document(['documents_name' => $document_name]));
             }
         }
     }
     // END NEW FILES
     // BEGIN REGISTRATION
     if (isset($id) && $id != "") {
         $registrations_vehicle_id = $id;
         $registrations_no = Input::get('registrations_no');
         $registrations_licence_plate_no = Input::get('registrations_licence_plate_no');
         if ($registrations_no != "" && $registrations_licence_plate_no != "" && $registrations_vehicle_id != "") {
             $vehicles_use_type = Input::get('vehicles_use_type');
             $vehicles_class = Input::get('vehicles_class');
             if ($vehicles_use_type != "" && $vehicles_class != "") {
                 $vehicles_use_type_table_name = VehicleUseType::find($vehicles_use_type)->vehicle_use_types_table_name;
                 //REGISTRATION FEES
                 $vehicles_class_col_name = $vehicles_use_type_table_name . '_total';
                 $registrations_fees = DB::table($vehicles_use_type_table_name)->find($vehicles_class)->{$vehicles_class_col_name};
                 $registration_ar = compact('registrations_vehicle_id', 'registrations_no', 'registrations_licence_plate_no', 'registrations_fees');
                 Registration::where('registrations_vehicle_id', $id)->update($registration_ar);
                 return Redirect::route('vehicle.print', [$registrations_vehicle_id]);
             }
         }
     } else {
         echo "Nothing is saved because fields are not filled";
         die;
     }
     // END REGISTRATION
 }
 public function postGetCopay()
 {
     $query = Insurance::where('pid', '=', Session::get('pid'))->where('insurance_plan_active', '=', 'Yes')->get();
     if ($query) {
         $i = 0;
         $result = "";
         foreach ($query as $row) {
             if ($i > 0) {
                 $result .= "<br><br>";
             }
             $result .= 'Insurance: ' . $row->insurance_plan_name . '; ID: ' . $row->insurance_id_num . '; Group: ' . $row->insurance_group;
             if ($row->insurance_copay != '') {
                 $result .= '<br>Copay: ' . $row->insurance_copay;
             }
             if ($row->insurance_deductible != '') {
                 $result .= '<br>Deductible: ' . $row->insurance_deductible;
             }
             if ($row->insurance_comments != '') {
                 $result .= '<br>Comments: ' . $row->insurance_comments;
             }
             $i++;
         }
     } else {
         $result = "None.";
     }
     echo $result;
 }
예제 #4
0
 protected function page_ccr($pid)
 {
     $data['patientInfo'] = Demographics::find($pid);
     $data['dob'] = date('m/d/Y', $this->human_to_unix($data['patientInfo']->DOB));
     $data['insuranceInfo'] = '';
     $query_in = Insurance::where('pid', '=', $pid)->where('insurance_plan_active', '=', 'Yes')->get();
     if ($query_in) {
         foreach ($query_in as $row_in) {
             $data['insuranceInfo'] .= $row_in->insurance_plan_name . '; ID: ' . $row_in->insurance_id_num . '; Group: ' . $row_in->insurance_group . '; ' . $row_in->insurance_insu_lastname . ', ' . $row_in->insurance_insu_firstname . '<br><br>';
         }
     }
     $body = 'Active Issues:<br />';
     $query = Issues::where('pid', '=', $pid)->where('issue_date_inactive', '=', '0000-00-00 00:00:00')->get();
     if ($query) {
         $body .= '<ul>';
         foreach ($query as $row) {
             $body .= '<li>' . $row->issue . '</li>';
         }
         $body .= '</ul>';
     } else {
         $body .= 'None.';
     }
     $body .= '<hr />Active Medications:<br />';
     $query1 = Rx_list::where('pid', '=', $pid)->where('rxl_date_inactive', '=', '0000-00-00 00:00:00')->where('rxl_date_old', '=', '0000-00-00 00:00:00')->get();
     if ($query1) {
         $body .= '<ul>';
         foreach ($query1 as $row1) {
             if ($row1->rxl_sig == '') {
                 $body .= '<li>' . $row1->rxl_medication . ' ' . $row1->rxl_dosage . ' ' . $row1->rxl_dosage_unit . ', ' . $row1->rxl_instructions . ' for ' . $row1->rxl_reason . '</li>';
             } else {
                 $body .= '<li>' . $row1->rxl_medication . ' ' . $row1->rxl_dosage . ' ' . $row1->rxl_dosage_unit . ', ' . $row1->rxl_sig . ' ' . $row1->rxl_route . ' ' . $row1->rxl_frequency . ' for ' . $row1->rxl_reason . '</li>';
             }
         }
         $body .= '</ul>';
     } else {
         $body .= 'None.';
     }
     $body .= '<hr />Immunizations:<br />';
     $query2 = Immunizations::where('pid', '=', $pid)->orderBy('imm_immunization', 'asc')->orderBy('imm_sequence', 'asc')->get();
     if ($query2) {
         $body .= '<ul>';
         foreach ($query2 as $row2) {
             $sequence = '';
             if ($row2->imm_sequence == '1') {
                 $sequence = ', first,';
             }
             if ($row2->imm_sequence == '2') {
                 $sequence = ', second,';
             }
             if ($row2->imm_sequence == '3') {
                 $sequence = ', third,';
             }
             if ($row2->imm_sequence == '4') {
                 $sequence = ', fourth,';
             }
             if ($row2->imm_sequence == '5') {
                 $sequence = ', fifth,';
             }
             $body .= '<li>' . $row2->imm_immunization . $sequence . ' given on ' . date('F jS, Y', $this->human_to_unix($row2->imm_date)) . '</li>';
         }
         $body .= '</ul>';
     } else {
         $body .= 'None.';
     }
     $body .= '<hr />Allergies:<br />';
     $query3 = Allergies::where('pid', '=', $pid)->where('allergies_date_inactive', '=', '0000-00-00 00:00:00')->get();
     if ($query3) {
         $body .= '<ul>';
         foreach ($query3 as $row3) {
             $body .= '<li>' . $row3->allergies_med . ' - ' . $row3->allergies_reaction . '</li>';
         }
         $body .= '</ul>';
     } else {
         $body .= 'No known allergies.';
     }
     $body .= '<br />Printed by ' . Session::get('displayname') . '.';
     $data['letter'] = $body;
     return View::make('pdf.ccr_page', $data);
 }
 public function postDemographicsList()
 {
     $practice_id = Session::get('practice_id');
     $pid = Session::get('pid');
     $row = Demographics::find($pid);
     $row_relate = Demographics_relate::where('pid', '=', $pid)->where('practice_id', '=', $practice_id)->first();
     $result = '';
     if ($row) {
         $result .= '<p class="tips"><strong>Address:</strong><br>' . $row->address . '<br>' . $row->city . ', ' . $row->state . ' ' . $row->zip . '</p>';
         $result .= '<p class="tips"><strong>Phone Numbers:</strong><br>Home: ' . $row->phone_home . '<br>Work: ' . $row->phone_work . '<br>Cell: ' . $row->phone_cell . '<br>Email: ' . $row->email . '</p>';
         $result .= '<p class="tips"><strong>Emergency Contact:</strong><br>Contact: ' . $row->emergency_contact . ', ' . $row->emergency_phone . '</p>';
         $gender = Session::get('gender');
         if ($gender == 'female') {
             if ($row->pregnant != 'no') {
                 $pregnant = 'Yes';
             } else {
                 $pregnant = 'No';
             }
             $result .= '<p class="tips"><strong>Other:</strong><br>Sexually Active: ' . ucfirst($row->sexuallyactive) . '<br>Tobacco Use: ' . ucfirst($row->tobacco) . '<br>Pregnant: ' . $pregnant . '</p>';
         } else {
             $result .= '<p class="tips"><strong>Other:</strong><br>Sexually Active: ' . ucfirst($row->sexuallyactive) . '<br>Tobacco Use: ' . ucfirst($row->tobacco) . '</p>';
         }
         $result .= '<p class="tips">Active since ' . $row->date . '</p>';
         if ($row_relate->id != '') {
             $result .= '<p class="tips">Online account is active.</p>';
         } else {
             $result .= '<p class="tips">No online account.</p>';
         }
         $schedule1 = Schedule::where('pid', '=', $pid)->where('status', '=', 'LMC')->get();
         $schedule2 = Schedule::where('pid', '=', $pid)->where('status', '=', 'DNKA')->get();
         $result .= '<p class="tips"><strong># Last minute cancellations: ' . count($schedule1) . '</strong></p>';
         $result .= '<p class="tips"><strong># Did not keep appointments: ' . count($schedule2) . '</strong></p>';
         $result .= '<p class="tips"><strong>Billing Notes:</strong><br>' . nl2br($row->billing_notes) . '</p>';
         $query1 = Insurance::where('pid', '=', $pid)->where('insurance_plan_active', '=', 'Yes')->get();
         if ($query1) {
             $result .= '<p class="tips"><strong>Active Insurance:</strong>';
             foreach ($query1 as $row1) {
                 $result .= '<br>' . $row1->insurance_plan_name . '; ID: ' . $row1->insurance_id_num . '; Group: ' . $row1->insurance_group;
                 if ($row1->insurance_copay != '') {
                     $result .= '; Copay: ' . $row1->insurance_copay;
                 }
                 if ($row1->insurance_deductible != '') {
                     $result .= '; Deductible: ' . $row1->insurance_deductible;
                 }
                 if ($row1->insurance_comments != '') {
                     $result .= '; Comments: ' . $row1->insurance_comments;
                 }
             }
             $result .= '</p>';
         }
         $result .= '<p class="tips"><strong>Credit Card on File: ';
         if ($row->creditcard_number != '') {
             $result .= 'Yes';
         } else {
             $result .= 'No';
         }
         $result .= '</strong></p>';
     } else {
         $result .= 'None available.';
     }
     echo $result;
 }
예제 #6
0
 public function getConfigSave()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $data = array("insurance" => Input::get("insurance"), "lang" => Input::get("lang"));
     $rules = array("insurance" => 'required|min:1|max:100', "lang" => 'required|min:1|max:100');
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
     $validation = Validator::make(Input::all(), $rules, $messages);
     //si la validación falla redirigimos al formulario de registro con los errores
     //y con los campos que nos habia llenado el usuario
     if ($validation->fails()) {
         return Redirect::to('/clinic/config-data/')->withErrors($validation)->withInput();
     } else {
         $id = Doctor::doctorLogin();
         $doctor = Doctor::where('id', $id)->first();
         $lang = Option::where('name', $id . '-doctor-lang')->first();
         if ($lang) {
             $lang->key = Input::get("lang");
             $lang->save();
         } else {
             $langadd = new Option();
             $langadd->key = Input::get("lang");
             $langadd->name = $id . '-doctor-lang';
             $langadd->save();
         }
         $opcionSeg = Option::where('name', $id . '-doctor-insurance')->first();
         if ($opcionSeg) {
             $segs = explode(',', Input::get("insurance"));
             $segok = '';
             foreach ($segs as $seg) {
                 $very = Insurance::where('name', 'like', '%' . $seg . '%')->first();
                 if ($very) {
                     $segok = $segok . ',' . $seg;
                 }
             }
             $opcionSeg->key = $segok;
             $opcionSeg->save();
         } else {
             $segs = explode(',', Input::get("insurance"));
             $seguok = '';
             foreach ($segs as $seg) {
                 $very = Insurance::where('name', $seg)->first();
                 if ($very) {
                     $seguok = $seguok . ',' . $seg;
                 }
             }
             $addseg = new Option();
             $addseg->name = $id . '-doctor-insurance';
             $addseg->key = $seguok;
             $addseg->save();
         }
         return Redirect::back();
     }
 }