/**
  * @param \Madkom\RegistryApplication\Domain\CarManagement\Insurances\Insurance $newInsurance
  *
  * @return true|false
  */
 public function checkForDuplicates(array $existingInsurance, Insurance $newInsurance)
 {
     /** @var \Madkom\RegistryApplication\Domain\CarManagement\Insurances\Insurance $insurance */
     foreach ($existingInsurance as $insurance) {
         if ($newInsurance->getDateFrom() <= $insurance->getDateTo() && $newInsurance->getType() === $insurance->getType()) {
             return true;
         }
         if ($newInsurance->getId() === $insurance->getId()) {
             return true;
         }
     }
     return false;
 }
 /**
  * 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);
     }
 }
Example #3
0
 public function getVisitCheckOutCharges(stdClass $params)
 {
     $invoice = array();
     $insurance = $this->insurance->getPatientPrimaryInsuranceByPid($params->pid);
     if ($insurance !== false) {
         $invoice[] = array('code' => 'COPAY', 'name' => 'COPAY', 'amountOriginal' => $insurance['copay'], 'amount' => $insurance['copay']);
     } else {
         $services = $this->services->getCptByEid($params->eid);
         foreach ($services['rows'] as $service) {
             $row['code'] = $service['code'];
             $row['name'] = $service['code_text_medium'];
             $row['amountOriginal'] = $service['status'] == 0 ? '00.00' : $service['charge'];
             $row['amount'] = $row['amountOriginal'];
             $invoice[] = $row;
         }
     }
     return $invoice;
 }
Example #4
0
 public function actionDeactivate()
 {
     Yii::app()->setImport(['application.modules.cargo.models.*']);
     $condition = new CDbCriteria();
     $condition->addCondition('TO_DAYS(NOW()) - TO_DAYS(`deleted_status_date`) > 15');
     Product::model()->updateAll(['deleted_status' => Product::DEL_SATUS_ARCHIVE], $condition);
     Cargo::model()->updateAll(['deleted_status' => Cargo::DEL_SATUS_ARCHIVE], $condition);
     Reis::model()->updateAll(['deleted_status' => Reis::DEL_SATUS_ARCHIVE], $condition);
     Sklad::model()->updateAll(['deleted_status' => Sklad::DEL_SATUS_ARCHIVE], $condition);
     Custom::model()->updateAll(['deleted_status' => Custom::DEL_SATUS_ARCHIVE], $condition);
     Insurance::model()->updateAll(['deleted_status' => Insurance::DEL_SATUS_ARCHIVE], $condition);
     SpecialTechnique::model()->updateAll(['deleted_status' => SpecialTechnique::DEL_SATUS_ARCHIVE], $condition);
 }
 public function actionList($company_id = 0)
 {
     if ($company_id == 0) {
         $company_id = Yii::app()->getUser()->getProfile()->company_id;
     }
     Yii::import('insurance.models.*');
     $criteria = new CDbCriteria();
     $criteria->with = ['user' => ['joinType' => 'INNER JOIN', 'condition' => 'user.company_id = :company_id']];
     $criteria->addCondition('deleted_status != :deleted_status');
     $criteria->params = [':company_id' => $company_id, ':deleted_status' => Insurance::DEL_SATUS_DELETED];
     $criteria->order = 'insurance_id DESC';
     $this->render('list', ['insurance' => Insurance::model()->findAll($criteria), 'company_id' => $company_id]);
 }
 public function actionActivate($id)
 {
     $model = Insurance::model()->findByPk($id);
     if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $model->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->insurance != '1' || $model->user_id != Yii::app()->user->id)) {
         throw new CHttpException(403);
     }
     if ($model === null) {
         throw new CHttpException(404, 'Указанная запись не найдена');
     }
     $model->deleted_status = Insurance::DEL_SATUS_ACTIVE;
     $model->deleted_status_date = date('Y-m-d H:i:s');
     $model->update();
     Yii::app()->user->setFlash('success', Yii::t('CabinetModule.default', 'Предложение успешно активированно.'));
     $this->redirect('/cabinet/insurance');
 }
Example #7
0
 private function setInsuranceData()
 {
     if (isset($this->phkRequestData['insurance_id']) && !isset($this->phkRequestData['insurance_text'])) {
         App::import("Model", "Insurance");
         $insurance = new Insurance();
         $result = $insurance->find("first", array('conditions' => array('Insurance.id' => $this->phkRequestData['insurance_id'])));
         if (count($result)) {
             $this->phkRequestData['insurance_id'] = $result['Insurance']['id'];
             $this->phkRequestData['insurance_text'] = $result['Insurance']['title'];
         }
     }
 }
$lang_tables[] = 'departments.php';
define('LANG_FILE', 'aufnahme.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_encounter.php';
require_once $root_path . 'include/care_api_classes/class_person.php';
require_once $root_path . 'include/care_api_classes/class_insurance.php';
require_once $root_path . 'include/care_api_classes/class_ward.php';
require_once $root_path . 'include/care_api_classes/class_globalconfig.php';
if (!$_SESSION['sess_parent_mod']) {
    $_SESSION['sess_parent_mod'];
}
# Create objects
$encounter_obj = new Encounter($encounter_nr);
$person_obj = new Person();
$insurance_obj = new Insurance();
$thisfile = basename($_SERVER['PHP_SELF']);
if ($_COOKIE['ck_login_logged' . $sid]) {
    $breakfile = $root_path . 'modules/news/start_page.php' . URL_APPEND;
} else {
    $breakfile = 'aufnahme_pass.php' . URL_APPEND . '&target=entry';
}
//$breakfile='aufnahme_pass.php'.URL_APPEND;
$GLOBAL_CONFIG = array();
$glob_obj = new GlobalConfig($GLOBAL_CONFIG);
/* Get the patient global configs */
$glob_obj->getConfig('patient_%');
$glob_obj->getConfig('person_foto_path');
$updatefile = 'aufnahme_start.php';
/* Default path for fotos. Make sure that this directory exists! */
$default_photo_path = $root_path . 'fotos/registration';
Example #9
0
$thisfile = basename($_SERVER['PHP_SELF']);
$breakfile = 'patient.php';
$newdata = 1;
$target = 'archiv';
if (!AUTOSHOW_ONERESULT) {
    include $root_path . 'include/care_api_classes/class_encounter.php';
    include $root_path . 'include/care_api_classes/class_ward.php';
    include $root_path . 'include/care_api_classes/class_insurance.php';
    /* Create encounter object */
    $encounter_obj = new Encounter();
    /* Load the wards info */
    $ward_obj = new Ward();
    $items = 'nr,name';
    $ward_info =& $ward_obj->getAllWardsItemsObject($items);
    /* Create new person's insurance object */
    $insurance_obj = new Insurance();
    /* Get the insurance classes */
    $insurance_classes =& $insurance_obj->getInsuranceClassInfoObject($root_path . 'include/care_api_classes/class_nr,name,LD_var');
    /* Get all encounter classes */
    $encounter_classes = $encounter_obj->AllEncounterClassesObject();
    if (!$GLOBAL_CONFIG['patient_service_care_hide']) {
        /* Get the care service classes*/
        $care_service = $encounter_obj->AllCareServiceClassesObject();
    }
    if (!$GLOBAL_CONFIG['patient_service_room_hide']) {
        /* Get the room service classes */
        $room_service = $encounter_obj->AllRoomServiceClassesObject();
    }
    if (!$GLOBAL_CONFIG['patient_service_att_dr_hide']) {
        /* Get the attending doctor service classes */
        $att_dr_service = $encounter_obj->AllAttDrServiceClassesObject();
Example #10
0
    $ward_obj = new Ward();
    $current_ward_name = $ward_obj->WardName($encounter['current_ward_nr']);
} elseif ($encounter['encounter_class_nr'] == 2) {
    # Get ward name
    include_once $root_path . 'include/care_api_classes/class_department.php';
    $dept_obj = new Department();
    //$current_dept_name=$dept_obj->FormalName($current_dept_nr);
    $current_dept_LDvar = $dept_obj->LDvar($encounter['current_dept_nr']);
    if (isset(${$current_dept_LDvar}) && !empty(${$current_dept_LDvar})) {
        $current_dept_name = ${$current_dept_LDvar};
    } else {
        $current_dept_name = $dept_obj->FormalName($encounter['current_dept_nr']);
    }
}
require_once $root_path . 'include/care_api_classes/class_insurance.php';
$insurance_obj = new Insurance();
$classpath = $root_path . 'classes/phppdf/';
$fontpath = $classpath . 'fonts/';
# Load and create pdf object
include $classpath . 'class.ezpdf.php';
$pdf = new Cezpdf();
$logo = $root_path . 'gui/img/logos/lopo/care_logo.png';
$arlogo = $root_path . 'gui/img/logos/lopo/ar/care_logo.png';
//added  by Waleed Fathalla at 06/03/2004
$pidbarcode = $root_path . 'cache/barcodes/pn_' . $encounter['pid'] . '.png';
$encbarcode = $root_path . 'cache/barcodes/en_' . $enc . '.png';
# Patch for empty file names 2004-05-2 EL
if (empty($encounter['photo_filename'])) {
    $idpic = $root_path . 'fotos/registration/_nothing_';
} else {
    $idpic = $root_path . 'fotos/registration/' . $encounter['photo_filename'];
Example #11
0
 include_once $root_path . 'include/care_api_classes/class_insurance.php';
 require_once $root_path . 'include/care_api_classes/class_department.php';
 # Create encounter object
 $encounter_obj = new Encounter();
 # Load the wards info
 $ward_obj = new Ward();
 $items = 'nr,name';
 $ward_info =& $ward_obj->getAllWardsItemsObject($items);
 # Load the departments info
 $dept_obj = new Department();
 $medical_depts = $dept_obj->getAllMedical();
 # Get all encounter classes
 $encounter_classes = $encounter_obj->AllEncounterClassesObject();
 # Get the insurance classes */
 # Create new person�s insurance object */
 $insurance_obj = new Insurance();
 $insurance_classes =& $insurance_obj->getInsuranceClassInfoObject('class_nr,LD_var,name');
 /* Load the discharge types */
 $discharge_types =& $encounter_obj->getDischargeTypesData();
 if (!$GLOBAL_CONFIG['patient_service_care_hide']) {
     # Get the care service classes
     $care_service = $encounter_obj->AllCareServiceClassesObject();
 }
 if (!$GLOBAL_CONFIG['patient_service_room_hide']) {
     # Get the room service classes
     $room_service = $encounter_obj->AllRoomServiceClassesObject();
 }
 if (!$GLOBAL_CONFIG['patient_service_att_dr_hide']) {
     # Get the attending doctor service classes
     $att_dr_service = $encounter_obj->AllAttDrServiceClassesObject();
 }
Example #12
0
?>
</fieldset>
<?php 
$address = new ArcAddress();
$address->filter = "id_addr";
$address->id = $rec[0]["id_addr"];
$address->build();
$education = new Education();
$education->filter = "id_hr_emp";
$education->id = $rec[0]["id_hr_emp"];
$education->build();
$certification = new Certification();
$certification->filter = "id_hr_emp";
$certification->id = $rec[0]["id_hr_emp"];
$certification->build();
$insurance = new Insurance();
$insurance->filter = "id_hr_emp";
$insurance->id = $rec[0]["id_hr_emp"];
$insurance->build();
?>
 
</form>
<script type="text/javascript">
oREC = '{"oRec":[{"module":"05","filter":"id_hr_emp","recid":"<?php 
echo $_POST["id_hr_emp"];
?>
","formname":"frmEmp"}]}';
<?php 
echo $icoCollapse;
echo $icoPreview;
?>
Example #13
0
 protected function billing_save_common($insurance_id_1, $insurance_id_2, $eid)
 {
     DB::table('billing')->where('eid', '=', $eid)->delete();
     $this->audit('Delete');
     $pid = Session::get('pid');
     $practiceInfo = Practiceinfo::find(Session::get('practice_id'));
     $encounterInfo = Encounters::find($eid);
     $bill_complex = $encounterInfo->bill_complex;
     $row = Demographics::find($pid);
     if ($insurance_id_1 == '0' || $insurance_id_1 == '') {
         $data0 = array('eid' => $eid, 'pid' => $pid, 'insurance_id_1' => $insurance_id_1, 'insurance_id_2' => $insurance_id_2, 'bill_complex' => $bill_complex);
         DB::table('billing')->insert($data0);
         $this->audit('Add');
         $data_encounter = array('bill_submitted' => 'Done');
         DB::table('encounters')->where('eid', '=', $eid)->update($data_encounter);
         $this->audit('Update');
         return 'Billing Saved!';
         exit(0);
     }
     $data_encounter = array('bill_submitted' => 'No');
     DB::table('encounters')->where('eid', '=', $eid)->update($data_encounter);
     $this->audit('Update');
     $result1 = Insurance::find($insurance_id_1);
     $bill_Box11C = $result1->insurance_plan_name;
     $bill_Box11C = $this->string_format($bill_Box11C, 29);
     $bill_Box1A = $result1->insurance_id_num;
     $bill_Box1A = $this->string_format($bill_Box1A, 29);
     $bill_Box4 = $result1->insurance_insu_lastname . ', ' . $result1->insurance_insu_firstname;
     $bill_Box4 = $this->string_format($bill_Box4, 29);
     $result2 = Addressbook::find($result1->address_id);
     if ($result2->insurance_plan_type == 'Medicare') {
         $bill_Box1 = "X                                            ";
         $bill_Box1P = 'Medicare';
     }
     if ($result2->insurance_plan_type == 'Medicaid') {
         $bill_Box1 = "       X                                     ";
         $bill_Box1P = 'Medicaid';
     }
     if ($result2->insurance_plan_type == 'Tricare') {
         $bill_Box1 = "              X                              ";
         $bill_Box1P = 'Tricare';
     }
     if ($result2->insurance_plan_type == 'ChampVA') {
         $bill_Box1 = "                     X                       ";
         $bill_Box1P = 'ChampVA';
     }
     if ($result2->insurance_plan_type == 'Group Health Plan') {
         $bill_Box1 = "                            X                ";
         $bill_Box1P = 'Group Health Plan';
     }
     if ($result2->insurance_plan_type == 'FECA') {
         $bill_Box1 = "                                   X         ";
         $bill_Box1P = 'FECA';
     }
     if ($result2->insurance_plan_type == 'Other') {
         $bill_Box1 = "                                            X";
         $bill_Box1P = 'Other';
     }
     $bill_payor_id = $result2->insurance_plan_payor_id;
     $bill_payor_id = $this->string_format($bill_payor_id, 5);
     if ($result2->street_address2 == '') {
         $bill_ins_add1 = $result2->street_address1;
     } else {
         $bill_ins_add1 = $result2->street_address1 . ', ' . $result2->street_address2;
     }
     $bill_ins_add1 = $this->string_format($bill_ins_add1, 29);
     $bill_ins_add2 = $result2->city . ', ' . $result2->state . ' ' . $result2->zip;
     $bill_ins_add2 = $this->string_format($bill_ins_add2, 29);
     if ($result2->insurance_plan_assignment == 'Yes') {
         $bill_Box27 = "X     ";
         $bill_Box27P = "Yes";
     } else {
         $bill_Box27 = "     X";
         $bill_Box27P = "No";
     }
     if ($result1->insurance_relationship == 'Self') {
         $bill_Box6 = "X              ";
         $bill_Box6P = "SelfBox6";
     }
     if ($result1->insurance_relationship == 'Spouse') {
         $bill_Box6 = "     X         ";
         $bill_Box6P = "Spouse";
     }
     if ($result1->insurance_relationship == 'Child') {
         $bill_Box6 = "         X     ";
         $bill_Box6P = "Child";
     }
     if ($result1->insurance_relationship == 'Other') {
         $bill_Box6 = "              X";
         $bill_Box6P = "Other";
     }
     $bill_Box7A = $result1->insurance_insu_address;
     $bill_Box7A = $this->string_format($bill_Box7A, 29);
     $bill_Box7B = $result1->insurance_insu_city;
     $bill_Box7B = $this->string_format($bill_Box7B, 23);
     $bill_Box7C = $result1->insurance_insu_state;
     $bill_Box7C = $this->string_format($bill_Box7C, 4);
     $bill_Box7D = $result1->insurance_insu_zip;
     $bill_Box7D = $this->string_format($bill_Box7D, 12);
     $bill_Box11 = $result1->insurance_group;
     $bill_Box11 = $this->string_format($bill_Box11, 29);
     $bill_Box11A1 = $this->human_to_unix($result1->insurance_insu_dob);
     $bill_Box11A1 = date('m d Y', $bill_Box11A1);
     if ($result1->insurance_insu_gender == 'm') {
         $bill_Box11A2 = "X       ";
         $bill_Box11A2P = 'M';
     } elseif ($result1->insurance_insu_gender == 'f') {
         $bill_Box11A2 = "       X";
         $bill_Box11A2P = 'F';
     } else {
         $bill_Box11A2 = "        ";
         $bill_Box11A2P = 'U';
     }
     if ($insurance_id_2 == '' || $insurance_id_2 == '0') {
         $bill_Box9D = '';
         $bill_Box9 = '';
         $bill_Box9A = '';
         $bill_Box9B1 = '          ';
         $bill_Box9B2 = '       ';
         $bill_Box9B2P = '';
         $bill_Box9C = "";
         $bill_Box11D = '     X';
         $bill_Box11DP = 'No';
     } else {
         $result3 = Insurance::find($insurance_id_2);
         $bill_Box9D = $result3->insurance_plan_name;
         $bill_Box9 = $result3->insurance_insu_lastname . ', ' . $result3->insurance_insu_firstname;
         $bill_Box9A = $result3->insurance_group;
         $bill_Box9B1 = $this->human_to_unix($result3->insurance_insu_dob);
         $bill_Box9B1 = date('m d Y', $bill_Box9B1);
         if ($result3->insurance_insu_gender == 'm') {
             $bill_Box9B2 = "X      ";
             $bill_Box9B2P = 'M';
         } elseif ($result3->insurance_insu_gender == 'f') {
             $bill_Box9B2 = "      X";
             $bill_Box9B2P = 'F';
         } else {
             $bill_Box9B2 = "       ";
             $bill_Box9B2P = 'U';
         }
         $bill_Box11D = 'X     ';
         $bill_Box11DP = 'Yes';
         if ($row->employer != '') {
             $bill_Box9C = $row->employer;
         } else {
             $bill_Box9C = "";
         }
     }
     $bill_Box9D = $this->string_format($bill_Box9D, 28);
     $bill_Box9 = $this->string_format($bill_Box9, 28);
     $bill_Box9A = $this->string_format($bill_Box9A, 28);
     $bill_Box9C = $this->string_format($bill_Box9C, 28);
     $bill_Box2 = $row->lastname . ', ' . $row->firstname;
     $bill_Box2 = $this->string_format($bill_Box2, 28);
     $bill_Box3A = $this->human_to_unix($row->DOB);
     $bill_Box3A = date('m d Y', $bill_Box3A);
     if ($row->sex == 'm') {
         $bill_Box3B = "X     ";
         $bill_Box3BP = 'M';
     } elseif ($row->sex == 'f') {
         $bill_Box3B = "     X";
         $bill_Box3BP = 'F';
     } else {
         $bill_Box3B = "      ";
         $bill_Box3BP = 'U';
     }
     if ($row->marital_status == 'Single') {
         $bill_Box8A = "X            ";
         $bill_Box8AP = 'SingleBox8';
     } else {
         if ($row->marital_status == 'Married') {
             $bill_Box8A = "      X      ";
             $bill_Box8AP = 'Married';
         } else {
             $bill_Box8A = "            X";
             $bill_Box8AP = 'Other';
         }
     }
     if ($row->employer != '') {
         $bill_Box8B = "X            ";
         $bill_Box8BP = "EmployedBox8";
         $bill_Box11B = $row->employer;
     } else {
         $bill_Box8B = "             ";
         $bill_Box8BP = "";
         $bill_Box11B = "";
     }
     $bill_Box11B = $this->string_format($bill_Box11B, 29);
     $bill_Box5A = $row->address;
     $bill_Box5A = $this->string_format($bill_Box5A, 28);
     $bill_Box5B = $row->city;
     $bill_Box5B = $this->string_format($bill_Box5B, 24);
     $bill_Box5C = $row->state;
     $bill_Box5C = $this->string_format($bill_Box5C, 3);
     $bill_Box5D = $row->zip;
     $bill_Box5D = $this->string_format($bill_Box5D, 12);
     $bill_Box5E = $row->phone_home;
     $bill_Box5E = $this->string_format($bill_Box5E, 14);
     $bill_Box10 = $encounterInfo->encounter_condition;
     $bill_Box10 = $this->string_format($bill_Box10, 19);
     $work = $encounterInfo->encounter_condition_work;
     if ($work == 'Yes') {
         $bill_Box10A = "X      ";
         $bill_Box10AP = 'Yes';
     } else {
         $bill_Box10A = "      X";
         $bill_Box10AP = 'No';
     }
     $auto = $encounterInfo->encounter_condition_auto;
     if ($auto == 'Yes') {
         $bill_Box10B1 = "X      ";
         $bill_Box10B1P = 'Yes';
         $bill_Box10B2 = $encounterInfo->encounter_condition_auto_state;
     } else {
         $bill_Box10B1 = "      X";
         $bill_Box10B1P = 'No';
         $bill_Box10B2 = "";
     }
     $bill_Box10B2 = $this->string_format($bill_Box10B2, 3);
     $other = $encounterInfo->encounter_condition_other;
     if ($other == 'Yes') {
         $bill_Box10C = "X      ";
         $bill_Box10CP = "Yes";
     } else {
         $bill_Box10C = "      X";
         $bill_Box10CP = 'No';
     }
     $provider = $encounterInfo->encounter_provider;
     $user_row = User::where('displayname', '=', $provider)->where('group_id', '=', '2')->first();
     $result4 = Providers::find($user_row->id);
     $npi = $result4->npi;
     if ($encounterInfo->referring_provider != 'Primary Care Provider' || $encounterInfo->referring_provider != '') {
         $bill_Box17 = $this->string_format($encounterInfo->referring_provider, 26);
         $bill_Box17A = $this->string_format($encounterInfo->referring_provider_npi, 17);
     } else {
         if ($encounterInfo->referring_provider != 'Primary Care Provider') {
             $bill_Box17 = $this->string_format('', 26);
             $bill_Box17A = $this->string_format('', 17);
         } else {
             $bill_Box17 = $this->string_format($provider, 26);
             $bill_Box17A = $this->string_format($npi, 17);
         }
     }
     $bill_Box21A = $practiceInfo->icd;
     if ($result2->insurance_box_31 == 'n') {
         $bill_Box31 = $this->string_format($provider, 21);
     } else {
         $provider2 = User::find($encounterInfo->user_id);
         $provider2a = $provider2->lastname . ", " . $provider2->firstname;
         $bill_Box31 = $this->string_format($provider2a, 21);
     }
     $bill_Box33B = $this->string_format($provider, 29);
     $pos = $encounterInfo->encounter_location;
     $bill_Box25 = $practiceInfo->tax_id;
     $bill_Box25 = $this->string_format($bill_Box25, 15);
     $bill_Box26 = $this->string_format($pid . '_' . $eid, 14);
     $bill_Box32A = $practiceInfo->practice_name;
     $bill_Box32A = $this->string_format($bill_Box32A, 26);
     $bill_Box32B = $practiceInfo->street_address1;
     if ($practiceInfo->street_address2 != '') {
         $bill_Box32B .= ', ' . $practiceInfo->street_address2;
     }
     $bill_Box32B = $this->string_format($bill_Box32B, 26);
     $bill_Box32C = $practiceInfo->city . ', ' . $practiceInfo->state . ' ' . $practiceInfo->zip;
     $bill_Box32C = $this->string_format($bill_Box32C, 26);
     if ($result2->insurance_box_32a == 'n') {
         $bill_Box32D = $practiceInfo->npi;
     } else {
         $provider3 = Providers::find($encounterInfo->user_id);
         $bill_Box32D = $provider3->npi;
     }
     $bill_Box32D = $this->string_format($bill_Box32D, 10);
     $bill_Box33A = $practiceInfo->phone;
     $bill_Box33A = $this->string_format($bill_Box33A, 14);
     $bill_Box33C = $practiceInfo->billing_street_address1;
     if ($practiceInfo->billing_street_address2 != '') {
         $bill_Box33C .= ', ' . $practiceInfo->billing_street_address2;
     }
     $bill_Box33C = $this->string_format($bill_Box33C, 29);
     $bill_Box33D = $practiceInfo->billing_city . ', ' . $practiceInfo->billing_state . ' ' . $practiceInfo->billing_zip;
     $bill_Box33D = $this->string_format($bill_Box33D, 29);
     $result5 = DB::table('billing_core')->where('eid', '=', $eid)->where('cpt', 'NOT LIKE', "sp%")->orderBy('cpt_charge', 'desc')->get();
     $num_rows5 = count($result5);
     if ($num_rows5 > 0) {
         $result6 = Assessment::find($eid);
         $bill_Box21_1 = $this->string_format($result6->assessment_icd1, 8);
         $bill_Box21_2 = $this->string_format($result6->assessment_icd2, 8);
         $bill_Box21_3 = $this->string_format($result6->assessment_icd3, 8);
         $bill_Box21_4 = $this->string_format($result6->assessment_icd4, 8);
         $bill_Box21_5 = $this->string_format($result6->assessment_icd5, 8);
         $bill_Box21_6 = $this->string_format($result6->assessment_icd6, 8);
         $bill_Box21_7 = $this->string_format($result6->assessment_icd7, 8);
         $bill_Box21_8 = $this->string_format($result6->assessment_icd8, 8);
         $bill_Box21_9 = $this->string_format($result6->assessment_icd9, 8);
         $bill_Box21_10 = $this->string_format($result6->assessment_icd10, 8);
         $bill_Box21_11 = $this->string_format($result6->assessment_icd11, 8);
         $bill_Box21_12 = $this->string_format($result6->assessment_icd12, 8);
         $i = 0;
         foreach ($result5 as $key5 => $value5) {
             $cpt_charge5[$key5] = $value5->cpt_charge;
         }
         array_multisort($cpt_charge5, SORT_DESC, $result5);
         while ($i < $num_rows5) {
             $cpt_final[$i] = (array) $result5[$i];
             $cpt_final[$i]['dos_f'] = str_replace('/', '', $cpt_final[$i]['dos_f']);
             $cpt_final[$i]['dos_f'] = $this->string_format($cpt_final[$i]['dos_f'], 8);
             $cpt_final[$i]['dos_t'] = str_replace('/', '', $cpt_final[$i]['dos_t']);
             $cpt_final[$i]['dos_t'] = $this->string_format($cpt_final[$i]['dos_t'], 8);
             $cpt_final[$i]['pos'] = $this->string_format($pos, 5);
             $cpt_final[$i]['cpt'] = $this->string_format($cpt_final[$i]['cpt'], 6);
             $cpt_final[$i]['modifier'] = $this->string_format($cpt_final[$i]['modifier'], 11);
             $cpt_final[$i]['unit1'] = $cpt_final[$i]['unit'];
             $cpt_final[$i]['unit'] = $this->string_format($cpt_final[$i]['unit'], 5);
             $cpt_final[$i]['cpt_charge'] = number_format($cpt_final[$i]['cpt_charge'], 2, ' ', '');
             $cpt_final[$i]['cpt_charge1'] = $cpt_final[$i]['cpt_charge'];
             $cpt_final[$i]['cpt_charge'] = $this->string_format($cpt_final[$i]['cpt_charge'], 8);
             $cpt_final[$i]['npi'] = $this->string_format($npi, 11);
             $cpt_final[$i]['icd_pointer'] = $this->string_format($cpt_final[$i]['icd_pointer'], 4);
             $i++;
         }
         if ($num_rows5 < 6) {
             $array['dos_f'] = $this->string_format('', 8);
             $array['dos_t'] = $this->string_format('', 8);
             $array['pos'] = $this->string_format('', 5);
             $array['cpt'] = $this->string_format('', 6);
             $array['modifier'] = $this->string_format('', 11);
             $array['unit1'] = '0';
             $array['unit'] = $this->string_format('', 5);
             $array['cpt_charge1'] = '0';
             $array['cpt_charge'] = $this->string_format('', 8);
             $array['npi'] = $this->string_format('', 11);
             $array['icd_pointer'] = $this->string_format('', 4);
             $cpt_final = array_pad($cpt_final, 6, $array);
         }
         $bill_Box28 = $cpt_final[0]['cpt_charge1'] * $cpt_final[0]['unit1'] + $cpt_final[1]['cpt_charge1'] * $cpt_final[1]['unit1'] + $cpt_final[2]['cpt_charge1'] * $cpt_final[2]['unit1'] + $cpt_final[3]['cpt_charge1'] * $cpt_final[3]['unit1'] + $cpt_final[4]['cpt_charge1'] * $cpt_final[4]['unit1'] + $cpt_final[5]['cpt_charge1'] * $cpt_final[5]['unit1'];
         $bill_Box28 = number_format($bill_Box28, 2, ' ', '');
         $bill_Box28 = $this->string_format($bill_Box28, 9);
         $bill_Box29 = $this->string_format('0 00', 8);
         $bill_Box30 = $this->string_format($bill_Box28, 8);
         $data1 = array('eid' => $eid, 'pid' => $pid, 'insurance_id_1' => $insurance_id_1, 'insurance_id_2' => $insurance_id_2, 'bill_complex' => $bill_complex, 'bill_Box11C' => $bill_Box11C, 'bill_payor_id' => $bill_payor_id, 'bill_ins_add1' => $bill_ins_add1, 'bill_ins_add2' => $bill_ins_add2, 'bill_Box1' => $bill_Box1, 'bill_Box1P' => $bill_Box1P, 'bill_Box1A' => $bill_Box1A, 'bill_Box2' => $bill_Box2, 'bill_Box3A' => $bill_Box3A, 'bill_Box3B' => $bill_Box3B, 'bill_Box3BP' => $bill_Box3BP, 'bill_Box4' => $bill_Box4, 'bill_Box5A' => $bill_Box5A, 'bill_Box6' => $bill_Box6, 'bill_Box6P' => $bill_Box6P, 'bill_Box7A' => $bill_Box7A, 'bill_Box5B' => $bill_Box5B, 'bill_Box5C' => $bill_Box5C, 'bill_Box8A' => $bill_Box8A, 'bill_Box8AP' => $bill_Box8AP, 'bill_Box7B' => $bill_Box7B, 'bill_Box7C' => $bill_Box7C, 'bill_Box5D' => $bill_Box5D, 'bill_Box5E' => $bill_Box5E, 'bill_Box8B' => $bill_Box8B, 'bill_Box8BP' => $bill_Box8BP, 'bill_Box7D' => $bill_Box7D, 'bill_Box9' => $bill_Box9, 'bill_Box11' => $bill_Box11, 'bill_Box9A' => $bill_Box9A, 'bill_Box10' => $bill_Box10, 'bill_Box10A' => $bill_Box10A, 'bill_Box10AP' => $bill_Box10AP, 'bill_Box11A1' => $bill_Box11A1, 'bill_Box11A2' => $bill_Box11A2, 'bill_Box11A2P' => $bill_Box11A2P, 'bill_Box9B1' => $bill_Box9B1, 'bill_Box9B2' => $bill_Box9B2, 'bill_Box9B2P' => $bill_Box9B2P, 'bill_Box10B1' => $bill_Box10B1, 'bill_Box10B1P' => $bill_Box10B1P, 'bill_Box10B2' => $bill_Box10B2, 'bill_Box11B' => $bill_Box11B, 'bill_Box9C' => $bill_Box9C, 'bill_Box10C' => $bill_Box10C, 'bill_Box10CP' => $bill_Box10CP, 'bill_Box9D' => $bill_Box9D, 'bill_Box11D' => $bill_Box11D, 'bill_Box11DP' => $bill_Box11DP, 'bill_Box17' => $bill_Box17, 'bill_Box17A' => $bill_Box17A, 'bill_Box21A' => $bill_Box21A, 'bill_Box21_1' => $bill_Box21_1, 'bill_Box21_2' => $bill_Box21_2, 'bill_Box21_3' => $bill_Box21_3, 'bill_Box21_4' => $bill_Box21_4, 'bill_Box21_5' => $bill_Box21_5, 'bill_Box21_6' => $bill_Box21_6, 'bill_Box21_7' => $bill_Box21_7, 'bill_Box21_8' => $bill_Box21_8, 'bill_Box21_9' => $bill_Box21_9, 'bill_Box21_10' => $bill_Box21_10, 'bill_Box21_11' => $bill_Box21_11, 'bill_Box21_12' => $bill_Box21_12, 'bill_DOS1F' => $cpt_final[0]['dos_f'], 'bill_DOS1T' => $cpt_final[0]['dos_t'], 'bill_DOS2F' => $cpt_final[1]['dos_f'], 'bill_DOS2T' => $cpt_final[1]['dos_t'], 'bill_DOS3F' => $cpt_final[2]['dos_f'], 'bill_DOS3T' => $cpt_final[2]['dos_t'], 'bill_DOS4F' => $cpt_final[3]['dos_f'], 'bill_DOS4T' => $cpt_final[3]['dos_t'], 'bill_DOS5F' => $cpt_final[4]['dos_f'], 'bill_DOS5T' => $cpt_final[4]['dos_t'], 'bill_DOS6F' => $cpt_final[5]['dos_f'], 'bill_DOS6T' => $cpt_final[5]['dos_t'], 'bill_Box24B1' => $cpt_final[0]['pos'], 'bill_Box24B2' => $cpt_final[1]['pos'], 'bill_Box24B3' => $cpt_final[2]['pos'], 'bill_Box24B4' => $cpt_final[3]['pos'], 'bill_Box24B5' => $cpt_final[4]['pos'], 'bill_Box24B6' => $cpt_final[5]['pos'], 'bill_Box24D1' => $cpt_final[0]['cpt'], 'bill_Box24D2' => $cpt_final[1]['cpt'], 'bill_Box24D3' => $cpt_final[2]['cpt'], 'bill_Box24D4' => $cpt_final[3]['cpt'], 'bill_Box24D5' => $cpt_final[4]['cpt'], 'bill_Box24D6' => $cpt_final[5]['cpt'], 'bill_Modifier1' => $cpt_final[0]['modifier'], 'bill_Modifier2' => $cpt_final[1]['modifier'], 'bill_Modifier3' => $cpt_final[2]['modifier'], 'bill_Modifier4' => $cpt_final[3]['modifier'], 'bill_Modifier5' => $cpt_final[4]['modifier'], 'bill_Modifier6' => $cpt_final[5]['modifier'], 'bill_Box24E1' => $cpt_final[0]['icd_pointer'], 'bill_Box24E2' => $cpt_final[1]['icd_pointer'], 'bill_Box24E3' => $cpt_final[2]['icd_pointer'], 'bill_Box24E4' => $cpt_final[3]['icd_pointer'], 'bill_Box24E5' => $cpt_final[4]['icd_pointer'], 'bill_Box24E6' => $cpt_final[5]['icd_pointer'], 'bill_Box24F1' => number_format($cpt_final[0]['cpt_charge'] * $cpt_final[0]['unit'], 2, ' ', ''), 'bill_Box24F2' => number_format($cpt_final[1]['cpt_charge'] * $cpt_final[1]['unit'], 2, ' ', ''), 'bill_Box24F3' => number_format($cpt_final[2]['cpt_charge'] * $cpt_final[2]['unit'], 2, ' ', ''), 'bill_Box24F4' => number_format($cpt_final[3]['cpt_charge'] * $cpt_final[3]['unit'], 2, ' ', ''), 'bill_Box24F5' => number_format($cpt_final[4]['cpt_charge'] * $cpt_final[4]['unit'], 2, ' ', ''), 'bill_Box24F6' => number_format($cpt_final[5]['cpt_charge'] * $cpt_final[5]['unit'], 2, ' ', ''), 'bill_Box24G1' => $cpt_final[0]['unit'], 'bill_Box24G2' => $cpt_final[1]['unit'], 'bill_Box24G3' => $cpt_final[2]['unit'], 'bill_Box24G4' => $cpt_final[3]['unit'], 'bill_Box24G5' => $cpt_final[4]['unit'], 'bill_Box24G6' => $cpt_final[5]['unit'], 'bill_Box24J1' => $cpt_final[0]['npi'], 'bill_Box24J2' => $cpt_final[1]['npi'], 'bill_Box24J3' => $cpt_final[2]['npi'], 'bill_Box24J4' => $cpt_final[3]['npi'], 'bill_Box24J5' => $cpt_final[4]['npi'], 'bill_Box24J6' => $cpt_final[5]['npi'], 'bill_Box25' => $bill_Box25, 'bill_Box26' => $bill_Box26, 'bill_Box27' => $bill_Box27, 'bill_Box27P' => $bill_Box27P, 'bill_Box28' => $bill_Box28, 'bill_Box29' => $bill_Box29, 'bill_Box30' => $bill_Box30, 'bill_Box31' => $bill_Box31, 'bill_Box32A' => $bill_Box32A, 'bill_Box32B' => $bill_Box32B, 'bill_Box32C' => $bill_Box32C, 'bill_Box32D' => $bill_Box32D, 'bill_Box33A' => $bill_Box33A, 'bill_Box33B' => $bill_Box33B, 'bill_Box33C' => $bill_Box33C, 'bill_Box33D' => $bill_Box33D, 'bill_Box33E' => $bill_Box32D);
         DB::table('billing')->insert($data1);
         $this->audit('Add');
         unset($cpt_final[0]);
         unset($cpt_final[1]);
         unset($cpt_final[2]);
         unset($cpt_final[3]);
         unset($cpt_final[4]);
         unset($cpt_final[5]);
         if ($num_rows5 > 6 && $num_rows5 < 11) {
             $k = 6;
             foreach ($cpt_final as $k => $v) {
                 $l = $k - 6;
                 $cpt_final[$l] = $cpt_final[$k];
                 unset($cpt_final[$k]);
                 $k++;
             }
             $num_rows6 = count($cpt_final);
             if ($num_rows6 < 6) {
                 $array1['dos_f'] = $this->string_format('', 8);
                 $array1['dos_t'] = $this->string_format('', 8);
                 $array1['pos'] = $this->string_format('', 5);
                 $array1['cpt'] = $this->string_format('', 6);
                 $array1['modifier'] = $this->string_format('', 11);
                 $array1['unit1'] = '0';
                 $array1['unit'] = $this->string_format('', 5);
                 $array1['cpt_charge1'] = '0';
                 $array1['cpt_charge'] = $this->string_format('', 8);
                 $array1['npi'] = $this->string_format('', 11);
                 $array1['icd_pointer'] = $this->string_format('', 4);
                 $cpt_final = array_pad($cpt_final, 6, $array1);
             }
             $bill_Box28 = $cpt_final[0]['cpt_charge1'] * $cpt_final[0]['unit1'] + $cpt_final[1]['cpt_charge1'] * $cpt_final[1]['unit1'] + $cpt_final[2]['cpt_charge1'] * $cpt_final[2]['unit1'] + $cpt_final[3]['cpt_charge1'] * $cpt_final[3]['unit1'] + $cpt_final[4]['cpt_charge1'] * $cpt_final[4]['unit1'] + $cpt_final[5]['cpt_charge1'] * $cpt_final[5]['unit1'];
             $bill_Box28 = number_format($bill_Box28, 2, ' ', '');
             $bill_Box28 = $this->string_format($bill_Box28, 9);
             $bill_Box29 = $this->string_format('0 00', 8);
             $bill_Box30 = $this->string_format($bill_Box28, 8);
             $data2 = array('eid' => $eid, 'pid' => $pid, 'insurance_id_1' => $insurance_id_1, 'insurance_id_2' => $insurance_id_2, 'bill_complex' => $bill_complex, 'bill_Box11C' => $bill_Box11C, 'bill_payor_id' => $bill_payor_id, 'bill_ins_add1' => $bill_ins_add1, 'bill_ins_add2' => $bill_ins_add2, 'bill_Box1' => $bill_Box1, 'bill_Box1P' => $bill_Box1P, 'bill_Box1A' => $bill_Box1A, 'bill_Box2' => $bill_Box2, 'bill_Box3A' => $bill_Box3A, 'bill_Box3B' => $bill_Box3B, 'bill_Box3BP' => $bill_Box3BP, 'bill_Box4' => $bill_Box4, 'bill_Box5A' => $bill_Box5A, 'bill_Box6' => $bill_Box6, 'bill_Box6P' => $bill_Box6P, 'bill_Box7A' => $bill_Box7A, 'bill_Box5B' => $bill_Box5B, 'bill_Box5C' => $bill_Box5C, 'bill_Box8A' => $bill_Box8A, 'bill_Box8AP' => $bill_Box8AP, 'bill_Box7B' => $bill_Box7B, 'bill_Box7C' => $bill_Box7C, 'bill_Box5D' => $bill_Box5D, 'bill_Box5E' => $bill_Box5E, 'bill_Box8B' => $bill_Box8B, 'bill_Box8BP' => $bill_Box8BP, 'bill_Box7D' => $bill_Box7D, 'bill_Box9' => $bill_Box9, 'bill_Box11' => $bill_Box11, 'bill_Box9A' => $bill_Box9A, 'bill_Box10' => $bill_Box10, 'bill_Box10A' => $bill_Box10A, 'bill_Box10AP' => $bill_Box10AP, 'bill_Box11A1' => $bill_Box11A1, 'bill_Box11D' => $bill_Box11D, 'bill_Box11DP' => $bill_Box11DP, 'bill_Box11A2' => $bill_Box11A2, 'bill_Box11A2P' => $bill_Box11A2P, 'bill_Box9B1' => $bill_Box9B1, 'bill_Box9B2' => $bill_Box9B2, 'bill_Box9B2P' => $bill_Box9B2P, 'bill_Box10B1' => $bill_Box10B1, 'bill_Box10B1P' => $bill_Box10B1P, 'bill_Box10B2' => $bill_Box10B2, 'bill_Box11B' => $bill_Box11B, 'bill_Box9C' => $bill_Box9C, 'bill_Box10C' => $bill_Box10C, 'bill_Box10CP' => $bill_Box10CP, 'bill_Box9D' => $bill_Box9D, 'bill_Box11D' => $bill_Box11D, 'bill_Box11DP' => $bill_Box11DP, 'bill_Box17' => $bill_Box17, 'bill_Box17A' => $bill_Box17A, 'bill_Box21A' => $bill_Box21A, 'bill_Box21_1' => $bill_Box21_1, 'bill_Box21_2' => $bill_Box21_2, 'bill_Box21_3' => $bill_Box21_3, 'bill_Box21_4' => $bill_Box21_4, 'bill_Box21_5' => $bill_Box21_5, 'bill_Box21_6' => $bill_Box21_6, 'bill_Box21_7' => $bill_Box21_7, 'bill_Box21_8' => $bill_Box21_8, 'bill_Box21_9' => $bill_Box21_9, 'bill_Box21_10' => $bill_Box21_10, 'bill_Box21_11' => $bill_Box21_11, 'bill_Box21_12' => $bill_Box21_12, 'bill_DOS1F' => $cpt_final[0]['dos_f'], 'bill_DOS1T' => $cpt_final[0]['dos_t'], 'bill_DOS2F' => $cpt_final[1]['dos_f'], 'bill_DOS2T' => $cpt_final[1]['dos_t'], 'bill_DOS3F' => $cpt_final[2]['dos_f'], 'bill_DOS3T' => $cpt_final[2]['dos_t'], 'bill_DOS4F' => $cpt_final[3]['dos_f'], 'bill_DOS4T' => $cpt_final[3]['dos_t'], 'bill_DOS5F' => $cpt_final[4]['dos_f'], 'bill_DOS5T' => $cpt_final[4]['dos_t'], 'bill_DOS6F' => $cpt_final[5]['dos_f'], 'bill_DOS6T' => $cpt_final[5]['dos_t'], 'bill_Box24B1' => $cpt_final[0]['pos'], 'bill_Box24B2' => $cpt_final[1]['pos'], 'bill_Box24B3' => $cpt_final[2]['pos'], 'bill_Box24B4' => $cpt_final[3]['pos'], 'bill_Box24B5' => $cpt_final[4]['pos'], 'bill_Box24B6' => $cpt_final[5]['pos'], 'bill_Box24D1' => $cpt_final[0]['cpt'], 'bill_Box24D2' => $cpt_final[1]['cpt'], 'bill_Box24D3' => $cpt_final[2]['cpt'], 'bill_Box24D4' => $cpt_final[3]['cpt'], 'bill_Box24D5' => $cpt_final[4]['cpt'], 'bill_Box24D6' => $cpt_final[5]['cpt'], 'bill_Modifier1' => $cpt_final[0]['modifier'], 'bill_Modifier2' => $cpt_final[1]['modifier'], 'bill_Modifier3' => $cpt_final[2]['modifier'], 'bill_Modifier4' => $cpt_final[3]['modifier'], 'bill_Modifier5' => $cpt_final[4]['modifier'], 'bill_Modifier6' => $cpt_final[5]['modifier'], 'bill_Box24E1' => $cpt_final[0]['icd_pointer'], 'bill_Box24E2' => $cpt_final[1]['icd_pointer'], 'bill_Box24E3' => $cpt_final[2]['icd_pointer'], 'bill_Box24E4' => $cpt_final[3]['icd_pointer'], 'bill_Box24E5' => $cpt_final[4]['icd_pointer'], 'bill_Box24E6' => $cpt_final[5]['icd_pointer'], 'bill_Box24F1' => number_format($cpt_final[0]['cpt_charge'] * $cpt_final[0]['unit'], 2, ' ', ''), 'bill_Box24F2' => number_format($cpt_final[1]['cpt_charge'] * $cpt_final[1]['unit'], 2, ' ', ''), 'bill_Box24F3' => number_format($cpt_final[2]['cpt_charge'] * $cpt_final[2]['unit'], 2, ' ', ''), 'bill_Box24F4' => number_format($cpt_final[3]['cpt_charge'] * $cpt_final[3]['unit'], 2, ' ', ''), 'bill_Box24F5' => number_format($cpt_final[4]['cpt_charge'] * $cpt_final[4]['unit'], 2, ' ', ''), 'bill_Box24F6' => number_format($cpt_final[5]['cpt_charge'] * $cpt_final[5]['unit'], 2, ' ', ''), 'bill_Box24G1' => $cpt_final[0]['unit'], 'bill_Box24G2' => $cpt_final[1]['unit'], 'bill_Box24G3' => $cpt_final[2]['unit'], 'bill_Box24G4' => $cpt_final[3]['unit'], 'bill_Box24G5' => $cpt_final[4]['unit'], 'bill_Box24G6' => $cpt_final[5]['unit'], 'bill_Box24J1' => $cpt_final[0]['npi'], 'bill_Box24J2' => $cpt_final[1]['npi'], 'bill_Box24J3' => $cpt_final[2]['npi'], 'bill_Box24J4' => $cpt_final[3]['npi'], 'bill_Box24J5' => $cpt_final[4]['npi'], 'bill_Box24J6' => $cpt_final[5]['npi'], 'bill_Box25' => $bill_Box25, 'bill_Box26' => $bill_Box26, 'bill_Box27' => $bill_Box27, 'bill_Box27P' => $bill_Box27P, 'bill_Box28' => $bill_Box28, 'bill_Box29' => $bill_Box29, 'bill_Box30' => $bill_Box30, 'bill_Box31' => $bill_Box31, 'bill_Box32A' => $bill_Box32A, 'bill_Box32B' => $bill_Box32B, 'bill_Box32C' => $bill_Box32C, 'bill_Box32D' => $bill_Box32D, 'bill_Box33A' => $bill_Box33A, 'bill_Box33B' => $bill_Box33B, 'bill_Box33C' => $bill_Box33C, 'bill_Box33D' => $bill_Box33D, 'bill_Box33E' => $bill_Box32D);
             DB::table('billing')->insert($data2);
             $this->audit('Add');
             unset($cpt_final[0]);
             unset($cpt_final[1]);
             unset($cpt_final[2]);
             unset($cpt_final[3]);
             unset($cpt_final[4]);
             unset($cpt_final[5]);
         }
     } else {
         return "No CPT charges filed. Billing not saved.";
         exit(0);
     }
     return 'Billing saved and waiting to be submitted!';
 }
Example #14
0
 /**
  * Method getRecordTarget()
  *
  * The recordTarget records the administrative and demographic data of the patient whose health information
  * is described by the clinical document; each recordTarget must contain at least one patientRole element
  *
  * @return array
  */
 private function getRecordTarget()
 {
     $patientData = $this->patientData;
     $Insurance = new Insurance();
     $insuranceData = $Insurance->getPatientPrimaryInsuranceByPid($this->pid);
     $PatientContactRecord = $this->PatientContacts->getSelfContact($this->pid);
     $recordTarget['patientRole']['id'] = ['@attributes' => ['root' => '2.16.840.1.113883.19.5', 'extension' => $patientData['pid']]];
     // If the Self Contact information address is set, include it in the CCD
     if (isset($PatientContactRecord['street_mailing_address'])) {
         $recordTarget['patientRole']['addr'] = $this->addressBuilder('HP', $PatientContactRecord['street_mailing_address'], $PatientContactRecord['city'], $PatientContactRecord['state'], $PatientContactRecord['zip'], $PatientContactRecord['country'], date('Ymd'));
     }
     // If the Self Contact information phone is present, include it in the CCD
     if (isset($PatientContactRecord['phone_use_code']) && isset($PatientContactRecord['phone_area_code']) && isset($PatientContactRecord['phone_local_number'])) {
         $recordTarget['patientRole']['telecom'] = $this->telecomBuilder($PatientContactRecord['phone_use_code'] . $PatientContactRecord['phone_area_code'] . $PatientContactRecord['phone_local_number'], 'HP');
     }
     // Patient Name
     $recordTarget['patientRole']['patient']['name'] = ['@attributes' => ['use' => 'L']];
     $recordTarget['patientRole']['patient']['name']['given'][] = $patientData['fname'];
     if ($patientData['mname'] != '') {
         $recordTarget['patientRole']['patient']['name']['given'][] = $patientData['mname'];
     }
     $recordTarget['patientRole']['patient']['name']['family'] = $patientData['lname'];
     if ($patientData['title'] != '') {
         $recordTarget['patientRole']['patient']['name']['suffix'] = ['@attributes' => ['qualifier' => 'TITLE'], '@value' => isset($patientData['title']) ? $patientData['title'] : ''];
     }
     // values are M, F, or UM more info...
     // http://phinvads.cdc.gov/vads/ViewValueSet.action?id=8DE75E17-176B-DE11-9B52-0015173D1785
     $recordTarget['patientRole']['patient']['administrativeGenderCode'] = ['@attributes' => ['code' => $patientData['sex'], 'codeSystemName' => 'AdministrativeGender', 'codeSystem' => '2.16.840.1.113883.5.1']];
     // Patient Sex
     if ($patientData['sex'] == 'F') {
         $recordTarget['patientRole']['patient']['administrativeGenderCode']['@attributes']['displayName'] = 'Female';
     } elseif ($patientData['sex'] == 'M') {
         $recordTarget['patientRole']['patient']['administrativeGenderCode']['@attributes']['displayName'] = 'Male';
     }
     // Patient Date of Birth
     $recordTarget['patientRole']['patient']['birthTime'] = ['@attributes' => ['value' => preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) \\d{2}:\\d{2}:\\d{2}/', '$1$2$3', $patientData['DOB'])]];
     if (isset($patientData['marital_status']) && $patientData['marital_status'] != '') {
         $recordTarget['patientRole']['patient']['maritalStatusCode'] = ['@attributes' => ['code' => $patientData['marital_status'], 'codeSystemName' => 'MaritalStatusCode', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(12, $patientData['marital_status']), 'codeSystem' => '2.16.840.1.113883.5.2']];
     } else {
         $recordTarget['patientRole']['patient']['maritalStatusCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'MaritalStatusCode', 'codeSystem' => '2.16.840.1.113883.5.2']];
     }
     // Patient Race
     if (isset($patientData['race']) && $patientData['race'] != '') {
         $recordTarget['patientRole']['patient']['raceCode'] = ['@attributes' => ['code' => $patientData['race'], 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(14, $patientData['race']), 'codeSystem' => '2.16.840.1.113883.6.238']];
     } else {
         $recordTarget['patientRole']['patient']['raceCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'codeSystem' => '2.16.840.1.113883.6.238']];
     }
     // Patient Ethnicity
     if (isset($patientData['ethnicity']) && $patientData['ethnicity'] != '') {
         $recordTarget['patientRole']['patient']['ethnicGroupCode'] = ['@attributes' => ['code' => $patientData['ethnicity'] == 'H' ? '2135-2' : '2186-5', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(59, $patientData['ethnicity']), 'codeSystem' => '2.16.840.1.113883.6.238']];
     } else {
         $recordTarget['patientRole']['patient']['ethnicGroupCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'codeSystem' => '2.16.840.1.113883.6.238']];
     }
     $recordTarget['patientRole']['patient']['birthplace']['place']['addr'] = $this->addressBuilder(false, false, false, false, false, '');
     // Patient Prefered language
     if (isset($patientData['language']) && $patientData['language'] != '') {
         $recordTarget['patientRole']['patient']['languageCommunication']['languageCode']['@attributes']['code'] = $patientData['language'];
     } else {
         $recordTarget['patientRole']['patient']['languageCommunication']['languageCode']['@attributes']['nullFlavor'] = 'NI';
     }
     $org = [];
     $org['id']['@attributes'] = ['root' => '2.16.840.1.113883.4.6', 'assigningAuthorityName' => 'CCD-Author'];
     $org['name']['prefix'] = $this->facility['name'];
     $org['telecom'] = $this->telecomBuilder($this->facility['phone'], 'WP');
     $org['addr'] = $this->addressBuilder('WP', $this->facility['address'] . ' ' . $this->facility['address_cont'], $this->facility['city'], $this->facility['state'], $this->facility['postal_code'], $this->facility['country_code']);
     $recordTarget['patientRole']['providerOrganization'] = $org;
     unset($Patient, $patientData, $Insurance, $insuranceData);
     return $recordTarget;
 }
if(file_exists("../cache/barcodes/pn_".$pn."_bclabel_".$lang.".png"))
{
    $im = ImageCreateFrompng("../cache/barcodes/pn_".$pn."_bclabel_".$lang.".png");
    Imagepng($im);
}
else
{
*/
include_once $root_path . 'include/care_api_classes/class_ward.php';
$obj = new Ward();
if ($obj->loadEncounterData($en)) {
    $result =& $obj->encounter;
}
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_insurance.php';
$ins_obj = new Insurance();
$fen = $en;
/*// get orig data
	    $dbtable="care_admission_patient";
	    $sql="SELECT * FROM $dbtable WHERE patnum='$pn' ";
	    if($ergebnis=$db->Execute($sql))
       	{
			if($rows=$ergebnis->RecordCount())
				{
					$result=$ergebnis->FetchRow();
					if($edit&&$result['discharge_date']) $edit=0;
				}
		}
		else {print "<p>$sql$LDDbNoRead"; exit;}*/
include_once $root_path . 'include/inc_date_format_functions.php';
# Get location data
Example #16
0
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
define('LANG_FILE', 'finance.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
# Load the insurance object
require_once $root_path . 'include/care_api_classes/class_insurance.php';
$ins_obj = new Insurance();
switch ($retpath) {
    case 'list':
        $breakfile = 'insurance_co_list.php' . URL_APPEND;
        break;
    case 'search':
        $breakfile = 'insurance_co_search.php' . URL_APPEND;
        break;
    default:
        $breakfile = 'insurance_co_manage.php' . URL_APPEND;
}
if (isset($firm_id) && $firm_id && ($row = $ins_obj->getFirmInfo($firm_id))) {
    $firm = $row->FetchRow();
    $edit = true;
} else {
    // Redirect to search function
 public function postGetInsuranceInfo()
 {
     $insurance_id_1 = Input::get('insurance_id_1');
     $insurance_id_2 = Input::get('insurance_id_2');
     if ($insurance_id_1 != '') {
         if ($insurance_id_1 == '0') {
             $arr['result1'] = 'Self pay; no insurance.';
             $arr['result2'] = 'None chosen.';
         } else {
             $result1 = Insurance::find($insurance_id_1);
             if ($result1) {
                 $arr['result1'] = $result1->insurance_plan_name;
             } else {
                 $arr['result1'] = 'None chosen.';
             }
         }
     } else {
         $arr['result1'] = 'None chosen.';
     }
     if ($insurance_id_2 != '') {
         $result2 = Insurance::find($insurance_id_2);
         if ($result2) {
             $arr['result2'] = $result2->insurance_plan_name;
         } else {
             $arr['result2'] = 'None chosen.';
         }
     } else {
         $arr['result2'] = 'None chosen.';
     }
     echo json_encode($arr);
 }
Example #18
0
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
define('LANG_FILE', 'finance.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
/* Load the insurance object */
require_once $root_path . 'include/care_api_classes/class_insurance.php';
$ins_obj = new Insurance();
//$db->debug=1;
switch ($retpath) {
    case 'list':
        $breakfile = 'insurance_co_list.php' . URL_APPEND;
        break;
    case 'search':
        $breakfile = 'insurance_co_search.php' . URL_APPEND;
        break;
    default:
        $breakfile = 'insurance_co_manage.php' . URL_APPEND;
}
if (!isset($mode)) {
    $mode = '';
    $edit = true;
} else {
 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();
     }
 }
 /**
  *  обавить
  * @param int $id
  * @param null $delivery
  * @throws CException
  * @throws CHttpException
  */
 public function actionAdd($id = 0, $delivery = null)
 {
     if (!empty($id)) {
         $Cargo = Cargo::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != \UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Cargo->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->cargo != '1' || $Cargo->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $AddressesForm = $Cargo->getAddressForm();
         $CostForm = $Cargo->getCostForm();
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != \UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->cargo != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $Cargo = new Cargo();
         $AddressesForm = new AddressesForm();
         if (isset($delivery)) {
             $product = Product::model()->findByPk($delivery);
             $AddressesForm->from_1_name = $product->getEavAttribute('adres_name');
             $AddressesForm->from_1_address_lat = $product->getEavAttribute('adres_adress_lat');
             $AddressesForm->from_1_address_long = $product->getEavAttribute('adres_adress_long');
             $AddressesForm->from_1_ind = '';
         }
         $CostForm = new CostForm();
     }
     $contacts = User::getContact();
     $Cargo->contact_id = Yii::app()->user->id;
     if (!empty($_POST)) {
         $Cargo->setAttributes($_POST['Cargo'], false);
         $AddressesForm->setAttributes($_POST['AddressesForm'], false);
         if ($Cargo->price_asc == '0') {
             $CostForm->setAttributes($_POST['CostForm'], false);
         }
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $valid = $AddressesForm->validate();
         $valid = $Cargo->validate() && $CostForm->validate() && $valid && $contentValid;
         if (!$valid) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($Cargo, $AddressesForm, $CostForm, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($Cargo, $AddressesForm, $CostForm));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $Cargo->user_id = User::createFakeUser($ContentManager);
                 $Cargo->contact_id = $Cargo->user_id;
             }
             $Cargo->save();
             $_POST['Cargo']['type_transport'] = '';
             if (isset($Cargo->transport_type_id)) {
                 switch ($Cargo->transport_type_id) {
                     case 20:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['sea_transport'];
                         break;
                     case 21:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['zhd_transport'];
                         break;
                     case 22:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['air_transport'];
                         break;
                     case 72:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['river_transport'];
                         break;
                     default:
                         break;
                 }
             }
             $Cargo->setRelations($_POST['Cargo']);
             $Cargo->setAddress($AddressesForm);
             $Cargo->setCost($CostForm);
             $Cargo->autosearch();
             if ($_POST['Cargo']['customs_clearance'] == 1) {
                 if ($_POST['AddressesForm']['from_1_ind'] == 'RU') {
                     $_POST['AddressesForm']['from_1_ind'] = 'RUS';
                 }
                 if ($_POST['AddressesForm']['to_1_ind'] == 'RU') {
                     $_POST['AddressesForm']['to_1_ind'] = 'RUS';
                 }
                 if ($_POST['AddressesForm']['from_1_ind'] == 'CH') {
                     $_POST['AddressesForm']['from_1_ind'] = 'CHE';
                 }
                 if ($_POST['AddressesForm']['to_1_ind'] == 'CH') {
                     $_POST['AddressesForm']['to_1_ind'] = 'CHE';
                 }
                 $from = DictionaryData::model()->findByAttributes(['code' => $_POST['AddressesForm']['from_1_ind']]);
                 $to = DictionaryData::model()->findByAttributes(['code' => $_POST['AddressesForm']['to_1_ind']]);
                 $Custom = new Custom();
                 $Custom->type_id = $_POST['Cargo']['name_id'];
                 $Custom->packing_id = $_POST['Cargo']['packing_id'];
                 $Custom->country_from = isset($from) ? $from->id : 0;
                 $Custom->country_to = isset($to) ? $to->id : 0;
                 $Custom->weight_netto = $_POST['Cargo']['weight'];
                 $Custom->weight_brutto = $_POST['Cargo']['weight'];
                 $Custom->volume = $_POST['Cargo']['volume'];
                 $Custom->date_from = $_POST['Cargo']['when_from'];
                 $Custom->date_to = $_POST['Cargo']['when_to'];
                 $Custom->user_id = Yii::app()->user->id;
                 $Custom->contact_id = $_POST['Cargo']['contact_id'];
                 $Custom->save();
                 $Custom->autosearch();
             }
             if ($_POST['Cargo']['cargo_insurance'] == 1) {
                 $addrId = Yii::app()->db->createCommand()->select('address_id')->from('site_cargo_address u')->where('cargo_id=:cargo_id', array(':cargo_id' => $Cargo->cargo_id))->order('cargo_id ASC')->limit(1)->queryRow();
                 $addr = Address::model()->findByPk($addrId);
                 $Insurance = new Insurance();
                 $Insurance->category_id = 147;
                 $Insurance->address_id = $addr->address_id;
                 $Insurance->description = '';
                 $Insurance->contact_id = $_POST['Cargo']['contact_id'];
                 $Insurance->create = date('Y-m-d H:i:s');
                 $Insurance->user_id = Yii::app()->user->id;
                 $Insurance->date_to = $_POST['Cargo']['when_to'] != '' ? $_POST['Cargo']['when_to'] : '0000-00-00';
                 $Insurance->save();
                 $Insurance->autosearch();
             }
             echo CJSON::encode(array('status' => '500', 'redirect' => '/cargoaddsuccess/' . $Cargo->cargo_id));
             Yii::app()->end();
         }
     }
     $DictionaryData = \DictionaryData::model()->findAll('group_id=3');
     $this->render('add', ['Cargo' => $Cargo, 'addreses' => $AddressesForm, 'CostForm' => $CostForm, 'contacts' => $contacts, 'ContentManager' => $ContentManager, 'DictionaryData' => $DictionaryData]);
 }
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </span>
                                </div>
                                <label class="control-label">Hasta </label>
                                <div class='form-group input-group date datetimepicker2' >
                                    <input parsley-required="true" name="end" type='text' placeholder="Día-Mes-Año" class="form-control" />
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </span>
                                </div>

		            			<div class="form-group ">
                                    <label class="control-label">Aseguradora</label>
                                    <?php 
$ases = Insurance::all();
?>
                                    <select class="selectpicker form-control" data-size="10" data-live-search="true"  name="seguro">
                                      <option  value="" selected>Seleccione una Aseguradora</option>
                                     @foreach($ases as $ase)
                                      <option  value="{{$ase->id}}">{{$ase->name}}</option>
                                     @endforeach 
                                    </select>
                                </div>

		            			<div class="form-group">
		            				<hr>
		            				<button type="submit" class="btn btn-theme"><i class="fa fa-filter"></i> Filtrar</button>
		            			</div>

		            		{{ Form::close() }}
 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;
 }
Example #23
0
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
# Default value for the maximum nr of rows per block displayed, define this to the value you wish
# In normal cases this value is derived from the db table "care_config_global" using the "pagin_insurance_list_max_block_rows" element.
define('MAX_BLOCK_ROWS', 30);
$lang_tables[] = 'search.php';
define('LANG_FILE', 'finance.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
# Load the insurance object
require_once $root_path . 'include/care_api_classes/class_insurance.php';
$ins_obj = new Insurance();
$breakfile = 'insurance_co_manage.php' . URL_APPEND;
$thisfile = basename($_SERVER['PHP_SELF']);
# Initialize page�s control variables
if ($mode != 'paginate') {
    # Reset paginator variables
    $pgx = 0;
    $totalcount = 0;
    # Set the sort parameters
    if (empty($oitem)) {
        $oitem = 'name';
    }
    if (empty($odir)) {
        $odir = 'ASC';
    }
}
Example #24
0
                        <div class="group">
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('specialty', '', Specialty::findAllArray());
?>
                            </div>
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('hospital', '', Hospital::findAllArray());
?>
                            </div>
                        </div>
                        <div class="group">
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('insurance', '', Insurance::findAllArray());
?>
                            </div>
                            <div class="row">
                                <input type="text" name="doctor_clinic" id="doctor_clinic" placeholder="<?php 
echo Yii::t('translation', 'layout.site.by_Doctor_s_Name');
?>
" />
                            </div>
                        </div>
                        <ul class="check-list">
                            <li><input type="checkbox" id="appointment_today" name="appointment_today" value="1" /><label for="check-1"><?php 
echo Yii::t('translation', 'layout.site.Available_for_appointment_today');
?>
</label></li>
                            <li><input type="checkbox" id="male_doctor" name="male_doctor" value="1" /><label for="male_doctor"><?php 
Example #25
0
	private function getInsuranceList()
	{
		$info = Insurance::model()->findAll(array(
				'select'=>'id,name,price',
				));
		return $info;
	}
 /**
  * 添加保险预约
  */
 public function addReservationAction()
 {
     $data = $this->request->getJsonRawBody(true);
     //提交数据包含car_info_id说明该车辆信息已存在,则修改
     if (!empty($data['car_info_id'])) {
         $car_info_id = $data['car_info_id'];
         //同一个号码同一车辆只能预约一次(未报价前)
         if (Insurance::isReserved($data['phone'], $car_info_id)) {
             $this->view->setVars(array('success' => false, 'err_msg' => '车辆已预约'));
             return;
         }
         CarInfo::updateCarInfo($car_info_id, $data);
     } else {
         //车辆信息不存在,则添加
         $data['car_info_id'] = CarInfo::addCarInfo($data);
     }
     $success = Insurance::addInsuranceReservation($data);
     $this->view->setVars(array('success' => $success, 'err_msg' => '保险预约成功'));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Insurance::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #28
0
 /**
  * Method getRecordTarget()
  * @return array
  */
 private function getRecordTarget()
 {
     $patientData = $this->patientData;
     $Insurance = new Insurance();
     $insuranceData = $Insurance->getPatientPrimaryInsuranceByPid($this->pid);
     $recordTarget['patientRole']['id'] = ['@attributes' => ['root' => '2.16.840.1.113883.19.5', 'extension' => $patientData['pid']]];
     $recordTarget['patientRole']['addr'] = $this->addressBuilder('HP', $patientData['address'], $patientData['city'], $patientData['state'], $patientData['zipcode'], $patientData['country'], date('Ymd'));
     $recordTarget['patientRole']['telecom'] = $this->telecomBuilder($patientData['home_phone'], 'H');
     $recordTarget['patientRole']['patient']['name'] = ['@attributes' => ['use' => 'L']];
     $recordTarget['patientRole']['patient']['name']['given'][] = $patientData['fname'];
     if ($patientData['mname'] != '') {
         $recordTarget['patientRole']['patient']['name']['given'][] = $patientData['mname'];
     }
     $recordTarget['patientRole']['patient']['name']['family'] = $patientData['lname'];
     if ($patientData['title'] != '') {
         $recordTarget['patientRole']['patient']['name']['suffix'] = ['@attributes' => ['qualifier' => 'TITLE'], '@value' => isset($patientData['title']) ? $patientData['title'] : ''];
     }
     $recordTarget['patientRole']['patient']['administrativeGenderCode'] = ['@attributes' => ['code' => $patientData['sex'], 'codeSystemName' => 'AdministrativeGender', 'codeSystem' => '2.16.840.1.113883.5.1']];
     if ($patientData['sex'] == 'F') {
         $recordTarget['patientRole']['patient']['administrativeGenderCode']['@attributes']['displayName'] = 'Female';
     } elseif ($patientData['sex'] == 'M') {
         $recordTarget['patientRole']['patient']['administrativeGenderCode']['@attributes']['displayName'] = 'Male';
     }
     $recordTarget['patientRole']['patient']['birthTime'] = ['@attributes' => ['value' => preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) \\d{2}:\\d{2}:\\d{2}/', '$1$2$3', $patientData['DOB'])]];
     if (isset($patientData['marital_status']) && $patientData['marital_status'] != '') {
         $recordTarget['patientRole']['patient']['maritalStatusCode'] = ['@attributes' => ['code' => $patientData['marital_status'], 'codeSystemName' => 'MaritalStatusCode', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(12, $patientData['marital_status']), 'codeSystem' => '2.16.840.1.113883.5.2']];
     } else {
         $recordTarget['patientRole']['patient']['maritalStatusCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'MaritalStatusCode', 'codeSystem' => '2.16.840.1.113883.5.2']];
     }
     if (isset($patientData['race']) && $patientData['race'] != '') {
         $recordTarget['patientRole']['patient']['raceCode'] = ['@attributes' => ['code' => $patientData['race'], 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(14, $patientData['race']), 'codeSystem' => '2.16.840.1.113883.6.238']];
     } else {
         $recordTarget['patientRole']['patient']['raceCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'codeSystem' => '2.16.840.1.113883.6.238']];
     }
     if (isset($patientData['ethnicity']) && $patientData['ethnicity'] != '') {
         $recordTarget['patientRole']['patient']['ethnicGroupCode'] = ['@attributes' => ['code' => $patientData['ethnicity'] == 'H' ? '2135-2' : '2186-5', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'displayName' => $this->CombosData->getDisplayValueByListIdAndOptionValue(59, $patientData['ethnicity']), 'codeSystem' => '2.16.840.1.113883.6.238']];
     } else {
         $recordTarget['patientRole']['patient']['ethnicGroupCode'] = ['@attributes' => ['nullFlavor' => 'NA', 'codeSystemName' => 'Race &amp; Ethnicity - CDC', 'codeSystem' => '2.16.840.1.113883.6.238']];
     }
     $recordTarget['patientRole']['patient']['birthplace']['place']['addr'] = $this->addressBuilder(false, false, false, false, false, '');
     if (isset($patientData['language']) && $patientData['language'] != '') {
         $recordTarget['patientRole']['patient']['languageCommunication']['languageCode']['@attributes']['code'] = $patientData['language'];
     } else {
         $recordTarget['patientRole']['patient']['languageCommunication']['languageCode']['@attributes']['nullFlavor'] = 'NI';
     }
     $org = [];
     $org['id']['@attributes'] = ['root' => '2.16.840.1.113883.4.6', 'assigningAuthorityName' => 'CCD-Author'];
     $org['name']['prefix'] = $this->facility['name'];
     $org['telecom'] = $this->telecomBuilder($this->facility['phone'], 'WP');
     $org['addr'] = $this->addressBuilder('WP', $this->facility['address'] . ' ' . $this->facility['address_cont'], $this->facility['city'], $this->facility['state'], $this->facility['postal_code'], $this->facility['country_code']);
     $recordTarget['patientRole']['providerOrganization'] = $org;
     unset($Patient, $patientData, $Insurance, $insuranceData);
     return $recordTarget;
 }
Example #29
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
 }
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places,drawing"></script>
<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', ['id' => 'search-insurance', 'enableAjaxValidation' => false, 'enableClientValidation' => true, 'type' => 'vertical']);
?>

<div class="row">
    <section class="col-md-12">
		<?php 
echo $form->textFieldGroup($Autosearch, 'name');
?>
    </section>
</div>
<div class="row">
	<section class="col-md-7">
		<?php 
echo $form->dropDownListGroup($InsuranceSearchForm, 'category_id', ['widgetOptions' => ['data' => Insurance::getTypeInsurance()]]);
?>
	</section>
	<section class="col-md-5 geo-search">
		<?php 
$this->widget('application.components.mapwindow.MapWindowWidget', array('model' => $InsuranceSearchForm, 'form' => $form, 'name' => 'name', 'addressLat' => 'address_lat', 'addressLong' => 'address_long', 'addressInd' => 'ind', 'shapes' => 'shapes', 'radius' => 'radius', 'id' => 'from', 'mode' => 'marker'));
?>
	</section>
</div>
<div class="row">
	<section class="col-md-4">
		<?php 
echo $form->datePickerGroup($InsuranceSearchForm, 'date_to', ['widgetOptions' => ['options' => ['format' => 'yyyy-mm-dd', 'autoclose' => 'true'], 'events' => ['show' => 'js:function(e){
                                var date = new Date();
                                var year = date.getFullYear();
                                var month = date.getMonth() + 1;