public function getAddressbook() { if (!$this->addressbook) { $this->addressbook = Addressbook::find($this->id); } return $this->addressbook; }
/** * @brief Converts the shared item sources back into the item in the specified format * @param array Shared items * @param int Format * @return ? * * The items array is a 3-dimensional array with the item_source as the first key and the share id as the second key to an array with the share info. * The key/value pairs included in the share info depend on the function originally called: * If called by getItem(s)Shared: id, item_type, item, item_source, share_type, share_with, permissions, stime, file_source * If called by getItem(s)SharedWith: id, item_type, item, item_source, item_target, share_type, share_with, permissions, stime, file_source, file_target * This function allows the backend to control the output of shared items with custom formats. * It is only called through calls to the public getItem(s)Shared(With) functions. */ public function formatItems($items, $format, $parameters = null) { $addressbooks = array(); if ($format == self::FORMAT_ADDRESSBOOKS) { foreach ($items as $item) { $addressbook = Addressbook::find($item['item_source']); if ($addressbook) { $addressbook['displayname'] = $item['item_target']; $addressbook['permissions'] = $item['permissions']; $addressbooks[] = $addressbook; } } } return $addressbooks; }
public function update($id) { $addressbook = Addressbook::find($id); $inputs = []; foreach (Input::all() as $key => $input) { $inputs[$key] = Jamesy\Sanitiser::trimInput($input); } if ($inputs['name'] == $addressbook->name) { $validation = NULL; } else { $validation = Jamesy\MyValidations::validate($inputs, $this->rules); } if ($validation != NULL) { return Redirect::back()->withErrors($validation)->withInput(); } else { $addressbook->name = $inputs['name']; $addressbook->active = $inputs['active']; $addressbook->save(); if ($addressbook->active == 0) { $subscribers = Subscriber::with(['addressbooks' => function ($query) use($id) { $query->where('addressbook_id', $id); }])->get(); foreach ($subscribers as $subscriber) { $subscriber->active = 0; $subscriber->save(); } } return Redirect::to('dashboard/lists')->withSuccess($addressbook->active == 0 ? 'List updated. NOTE: All subscribers in the list are now inactive.' : 'List updated.'); } }
public function postPayorId($address_id) { $row = Addressbook::find($address_id); if ($row->insurance_plan_payor_id == "") { $arr = "Unknown"; } else { $arr = $row->insurance_plan_payor_id; } echo $arr; }
public function postTipOrders($item) { $eid = Session::get('eid'); if ($item == 'rx') { $data = Rx::find($eid); if ($data) { if ($data->rx_rx == '') { echo 'No entry for this item.'; } else { $text = nl2br($data->rx_rx) . "<br><br>Click on check mark to edit text."; echo $text; } } else { echo 'No entry for this item.'; } } if ($item == 'sup') { $data = Rx::find($eid); if ($data) { if ($data->rx_supplements == '') { echo 'No entry for this item.'; } else { $text = nl2br($data->rx_supplements) . "<br><br>Click on check mark to edit text."; echo $text; } } else { echo 'No entry for this item.'; } } if ($item == 'imm') { $data = Rx::find($eid); if ($data) { if ($data->rx_immunizations == '') { echo 'No entry for this item.'; } else { $text = nl2br($data->rx_immunizations) . "<br><br>Click on check mark to edit text."; echo $text; } } else { echo 'No entry for this item.'; } } if ($item == 'labs') { $query = DB::table('orders')->where('eid', '=', $eid)->get(); if ($query) { $description = ''; foreach ($query as $data) { if ($data->orders_labs == '') { $description .= ''; } else { $text = nl2br($data->orders_labs); $row1 = Addressbook::find($data->address_id); $description .= 'Orders sent to ' . $row1->displayname . ': ' . $text . '<br>'; } } echo $description; } else { echo 'No entry for this item.'; } } if ($item == 'rad') { $query = DB::table('orders')->where('eid', '=', $eid)->get(); if ($query) { $description = ''; foreach ($query as $data) { if ($data->orders_radiology == '') { $description .= ''; } else { $text = nl2br($data->orders_radiology); $row1 = Addressbook::find($data->address_id); $description .= 'Orders sent to ' . $row1->displayname . ': ' . $text . '<br>'; } } echo $description; } else { echo 'No entry for this item.'; } } if ($item == 'cp') { $query = DB::table('orders')->where('eid', '=', $eid)->get(); if ($query) { $description = ''; foreach ($query as $data) { if ($data->orders_cp == '') { $description .= ''; } else { $text = nl2br($data->orders_cp); $row1 = Addressbook::find($data->address_id); $description .= 'Orders sent to ' . $row1->displayname . ': ' . $text . '<br>'; } } echo $description; } else { echo 'No entry for this item.'; } } if ($item == 'ref') { $query = DB::table('orders')->where('eid', '=', $eid)->get(); if ($query) { $description = ''; foreach ($query as $data) { if ($data->orders_referrals == '') { $description .= ''; } else { $text = nl2br($data->orders_referrals); $row1 = Addressbook::find($data->address_id); $description .= 'Orders sent to ' . $row1->displayname . ': ' . $text . '<br>'; } } echo $description; } else { echo 'No entry for this item.'; } } }
public function import_csv($num) { $input = Input::file('csvfile'); $ext = pathinfo($input->getClientOriginalName(), PATHINFO_EXTENSION); $rules = array('csvfile' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { $error = array('files' => array(array('error' => $validator->messages()->first(), 'name' => 'none', 'size' => 'none', 'url' => 'none', 'thumbnail_url' => 'none', 'delete_url' => 'none', 'delete_type' => 'DELETE'))); return Response::json($error); } elseif ($ext != 'csv') { $error = array('files' => array(array('error' => 'Only CSV files are allowed', 'name' => 'none', 'size' => 'none', 'url' => 'none', 'thumbnail_url' => 'none', 'delete_url' => 'none', 'delete_type' => 'DELETE'))); return Response::json($error); } else { $destination = 'imports'; $filename = date('Y_m_d_H_i') . '_subscribers.' . $ext; $filepath = asset('imports/' . $filename); if ($input->move($destination, $filename)) { $csvpath = public_path() . '/imports/' . $filename; $processed = CsvManipulation::csvToArray($csvpath); $thecsv = $processed['uniqueSubscribers']; $rules = array('first_name' => 'required|alpha_num|max:128', 'last_name' => 'required|alpha_num|max:128', 'email' => 'required|email|max:255|unique:subscribers'); $length = count($thecsv); $failedValidation = 0; for ($i = 0; $i < $length; $i++) { $validator = Validator::make($thecsv[$i], $rules); if ($validator->fails()) { unset($thecsv[$i]); $failedValidation++; } } $newcsvarray = array_values($thecsv); $newlength = count($newcsvarray); $timestamp = date("Y-m-d H:i:s"); $defaults = ['active' => 1, 'created_at' => $timestamp, 'updated_at' => $timestamp]; $arrayforinsert = []; foreach ($newcsvarray as $key => $value) { $arrayforinsert[] = array_merge($value, $defaults); } if (count($arrayforinsert) > 0) { Subscriber::insert($arrayforinsert); $list = Addressbook::find(1); $subscribers = Subscriber::get(); foreach ($subscribers as $key => $subscriber) { $list->subscribers()->attach($subscriber->id); } $successful = Subscriber::where('created_at', '=', $timestamp)->count(); $successMsg = "Total no. of subscribers successfully imported: <b>" . $successful . "</b><br />" . "Total no. of rows in the CSV file: <b>" . $processed['allRows'] . "</b><br />" . "Total no. of rows with the required 3 fields: <b>" . $processed['rowsWithThreeFields'] . "</b><br />" . "Total no. of unique emails in the CSV file: <b>" . $processed['noOfUniqueEmails'] . "</b><br />" . "Total no. of failed validations: <b>" . $failedValidation . "</b>"; $success = array('files' => array(array('success' => $successMsg, 'name' => $filename, 'size' => 'none', 'url' => $filepath, 'thumbnail_url' => 'none', 'delete_url' => 'none', 'delete_type' => 'DELETE'))); return Response::json($success); } else { $error = array('files' => array(array('error' => 'None of the subscribers has been imported. Kindly try again.', 'name' => 'none', 'size' => 'none', 'url' => 'none', 'thumbnail_url' => 'none', 'delete_url' => 'none', 'delete_type' => 'DELETE'))); return Response::json($error); } } else { return Response::json(array('error' => "An error was encountered. Kindly refresh and try again.")); } } }
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!'; }
public function postFaxOrders() { $pid = Session::get('pid'); if (Session::get('job_id') == FALSE) { $job_id = ''; } else { $job_id = Session::get('job_id'); } $orders_id = Input::get('orders_id'); $html = $this->page_orders($orders_id)->render(); $filename = __DIR__ . "/../../public/temp/orders_" . time() . "_" . Session::get('user_id') . ".pdf"; $this->generate_pdf($html, $filename); while (!file_exists($filename)) { sleep(2); } $row1 = Orders::find($orders_id); if ($row1->orders_labs != '') { $file_original = "Laboratory Order"; } if ($row1->orders_radiology != '') { $file_original = "Imaging Order"; } if ($row1->orders_cp != '') { $file_original = "Cardiopulmonary Order"; } if ($row1->orders_referrals != '') { $file_original = "Referral Order"; } $row2 = Addressbook::find($row1->address_id); $result_message = $this->fax_document($pid, $file_original, 'yes', $filename, $file_original, $row2->fax, $row2->displayname, $job_id, 'yes'); Session::forget('job_id'); unlink($filename); echo $result_message; }
public function remove_subscribers_from_list($id) { $subs_array = Input::get('subsarray'); $list = Addressbook::find($id); $count = 0; foreach ($subs_array as $key => $value) { $list->subscribers()->detach($value); if ($list->active == 0) { $subscriber = Subscriber::with('lists')->find($value); $check = 1; foreach ($subscriber->lists as $alist) { if ($alist->active == 0) { $check = 0; } } if ($check == 1) { $subscriber->active = 1; $subscriber->save(); } } $count++; } return Response::json(array('success' => $count . ' subscribers successfully removed from ' . $list->name)); }