public function setup()
 {
     $rules = array('first_name' => 'required|alpha_num|max:128', 'last_name' => 'required|alpha_num|max:128', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|min:7|confirmed', 'sitename' => 'required|max:50');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json($validator->messages());
     } else {
         $setting = new Setting();
         $setting->sitename = Input::get('sitename');
         $setting->save();
         $list = new Addressbook();
         $list->name = 'General';
         $list->save();
         try {
             $user = Sentry::register(array('email' => Input::get('email'), 'password' => Input::get('password'), 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name')), true);
             $feedback = array('success' => 'Great! Your system is ready to roll! You will be redirected to login form in 3 seconds.');
             return Response::json($feedback);
         } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
             echo 'Login field is required.';
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             echo 'Password field is required.';
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             echo 'User with this login already exists.';
         }
     }
 }
 public function getAddressbook()
 {
     if (!$this->addressbook) {
         $this->addressbook = Addressbook::find($this->id);
     }
     return $this->addressbook;
 }
Example #3
0
 /**
  * @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;
 }
Example #4
0
 function search($query)
 {
     $addressbooks = Addressbook::all(\OCP\USER::getUser(), 1);
     if (count($addressbooks) == 0 || !\OCP\App::isEnabled('contacts')) {
         return array();
     }
     $results = array();
     $l = new \OC_l10n('contacts');
     foreach ($addressbooks as $addressbook) {
         $vcards = VCard::all($addressbook['id']);
         foreach ($vcards as $vcard) {
             if (substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
                 //$link = \OCP\Util::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']);
                 $link = 'javascript:openContact(' . $vcard['id'] . ')';
                 $results[] = new \OC_Search_Result($vcard['fullname'], '', $link, (string) $l->t('Contact'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
 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.';
         }
     }
 }
Example #6
0
 /**
  * Get the addressbook for the user profiles. If it doesn't exist it will be
  * created.
  * 
  * @return Addressbook 
  */
 public function getUsersAddressbook()
 {
     $ab = Addressbook::model()->findSingleByAttribute('users', '1');
     //\GO::t('users','base'));
     if (!$ab) {
         $ab = new Addressbook();
         $ab->name = \GO::t('users');
         $ab->users = true;
         $ab->save();
         $ab->acl->addGroup(\GO::config()->group_internal);
     }
     return $ab;
 }
 public function lists()
 {
     $user = Sentry::getUser();
     $lists = Addressbook::with('subscribers')->orderBy('id', 'desc')->get();
     return View::make('dashboard.lists', array('user' => $user, 'lists' => $lists));
 }
Example #8
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 #9
0
<?php

include 'config.php';
include 'Addressbook.php';
include 'Exceptions.php';
include 'Account.php';
include 'Stat.php';
$Gateway = new APISMS($sms_key_private, $sms_key_public, 'http://atompark.com/api/sms/');
$Addressbook = new Addressbook($Gateway);
$Exceptions = new Exceptions($Gateway);
$Account = new Account($Gateway);
$Stat = new Stat($Gateway);
//Первым делом, зарегистрируем имя отправителя, если собираемся рассылать СМС в том числе в Украину
//Если вы собираетесь отправлять смс исключительно в Россию - регистрировать имя отправителя нет необходимости
$res = $Account->registerSender('testName', 'ua');
//Проверяем успешность операции
if (isset($res["result"]["error"])) {
    die("Ошибка: " . $res["result"]["code"]);
}
//Создаем адресную книгу
$res = $Addressbook->addAddressBook('Test book');
//Проверяем успешность операции
if (isset($res["result"]["error"])) {
    die("Ошибка: " . $res["result"]["code"]);
} else {
    //Получаем ИД книги
    $addrbook_id = $res["result"]["addressbook_id"];
}
//Добавляем несколько телефонов для рассылки
$res = $Addressbook->addPhoneToAddressBook($addrbook_id, '79010000001', 'Валерий;Маринец;');
if (isset($res["result"]["error"])) {
 /**
  * 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 = Addressbook::model()->findByPk((int) $id);
     //if($model===null)
     //	throw new CHttpException(404,'The requested page does not exist.');
     return $model;
 }
 public function export_list_csv($id)
 {
     $list = Addressbook::with(array('subscribers' => function ($query) {
         $query->orderBy('first_name', 'asc');
     }))->find($id);
     $file_name = date('Y_m_d_H_i') . '_' . $list->name . '_list' . '.csv';
     $file = fopen('exports/' . $file_name, 'w');
     $field_names = false;
     foreach ($list->subscribers as $row) {
         if (!$field_names) {
             $allkeys = array_keys($row->toArray());
             $trimmedkeys = array_slice($allkeys, 0, 7);
             fputcsv($file, $trimmedkeys);
             $field_names = true;
         }
         $allvalues = array_values($row->toArray());
         $trimmedvalues = array_slice($allvalues, 0, 7);
         fputcsv($file, $trimmedvalues);
     }
     fclose($file);
     $path = 'exports/' . $file_name;
     return Redirect::to($path);
     //Response::json(array('file' => $path));
 }
 public function actionWrite()
 {
     if (isset($_POST['Employee'])) {
         $messages = $this->ValidateData(array(array($_POST['Employee']['fullname'], 'emptyfullname', 'emptystring'), array($_POST['Employee']['orgstructureid'], 'emptyorgstructure', 'emptystring'), array($_POST['Employee']['positionid'], 'emptyposition', 'emptystring'), array($_POST['Employee']['employeetypeid'], 'emptyemployeetype', 'emptystring'), array($_POST['Employee']['sexid'], 'emptysex', 'emptystring'), array($_POST['Employee']['birthcityid'], 'emptybirthcity', 'emptystring'), array($_POST['Employee']['birthdate'], 'emptybirthdate', 'emptystring'), array($_POST['Employee']['maritalstatusid'], 'emptymaritalstatus', 'emptystring'), array($_POST['Employee']['joindate'], 'emptyjoindate', 'emptystring'), array($_POST['Employee']['employeestatusid'], 'emptyemployeestatus', 'emptystring'), array($_POST['Employee']['levelorgid'], 'emptylevelorg', 'emptystring')));
         if ($messages == '') {
             if ((int) $_POST['Employee']['employeeid'] > 0) {
                 $model = $this->loadModel($_POST['Employee']['employeeid']);
                 $ab = Addressbook::model()->findbypk($model->addressbookid);
                 $ab->fullname = $_POST['Employee']['fullname'];
                 $ab->save();
                 $model->fullname = $_POST['Employee']['fullname'];
                 $model->oldnik = $_POST['Employee']['oldnik'];
                 $model->orgstructureid = $_POST['Employee']['orgstructureid'];
                 $model->positionid = $_POST['Employee']['positionid'];
                 $model->levelorgid = $_POST['Employee']['levelorgid'];
                 $model->employeetypeid = $_POST['Employee']['employeetypeid'];
                 $model->sexid = $_POST['Employee']['sexid'];
                 $model->birthcityid = $_POST['Employee']['birthcityid'];
                 $model->birthdate = $_POST['Employee']['birthdate'];
                 $model->religionid = $_POST['Employee']['religionid'];
                 $model->maritalstatusid = $_POST['Employee']['maritalstatusid'];
                 $model->referenceby = $_POST['Employee']['referenceby'];
                 $model->joindate = $_POST['Employee']['joindate'];
                 $model->employeestatusid = $_POST['Employee']['employeestatusid'];
                 $model->istrial = $_POST['Employee']['istrial'];
                 $model->accountno = $_POST['Employee']['accountno'];
                 $model->taxno = $_POST['Employee']['taxno'];
             } else {
                 $model = new Employee();
                 $model->attributes = $_POST['Employee'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Employee']['fullname']);
                     $this->GetSMessage('insertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }
Example #13
0
 public function importContacts($form, $post)
 {
     $tmpFile = $form->getReceivedFiles();
     $model = new Addressbook();
     $importLogModel = new AddressbookImport();
     $addressbookRecipientModel = new AddressbookRecipient();
     $instance = Zend_Auth::getInstance();
     $identity = $instance->getIdentity();
     $config = Zend_Registry::get('config');
     $maxRow = $config['uploads']['maxpackage'];
     $new_path = $config['uploads']['destination'] . 'addressbook/';
     foreach ($tmpFile as $tmp) {
         if (is_file($tmp) === false) {
             throw new Logic_Exception("Temporary files does not exists!");
         } else {
             $oldInf = pathinfo($tmp);
             $new_name = uniqid();
             if (false === is_dir($new_path) && false === mkdir($new_path, 0777, true)) {
                 throw new Logic_Exception("Cannot create directory for addressbook import file!");
             }
             rename($oldInf['dirname'] . '/' . $oldInf['basename'], $new_path . $new_name);
             if (!file_exists($new_path . $new_name)) {
                 throw new Logic_Exception("Files does not exists!");
             }
             $importInfo = array('addressbook_name' => $post['addressbok_name'], 'private' => $post['is_private'] == 0 ? 'true' : 'false');
             $insertedID = $model->createImport($importInfo);
             $data = array();
             $header = $post['has_headers'] == 1 ? false : true;
             $phoneColumn = isset($post['phone_heders']) ? $post['phone_heders'] : 'phone_number';
             $emailColumn = isset($post['email_heders']) ? $post['email_heders'] : 'email_address';
             if ($fp = fopen($new_path . $new_name, 'r')) {
                 $first = false;
                 $i = 0;
                 while (!feof($fp)) {
                     $delimiter = $post['delimeter'] == 1 ? ',' : ';';
                     $row = fgetcsv($fp, filesize($new_path . $new_name), $delimiter);
                     if ($row !== FALSE) {
                         if (!$first && $header) {
                             $keys = $row;
                             $first = true;
                         } else {
                             if (!$first && !$header) {
                                 $keys = $row;
                                 $first = true;
                             }
                             $tmpArray = array_filter(array_combine($keys, $row));
                             if (!empty($tmpArray)) {
                                 if ($phoneColumn != "none") {
                                     $data[$i]['phone_number'] = $tmpArray[$phoneColumn];
                                 }
                                 if ($emailColumn != "none") {
                                     $data[$i]['email_address'] = $tmpArray[$emailColumn];
                                 }
                                 $data[$i]['ws_adressbook_id'] = $insertedID;
                             }
                             if ($i % $maxRow == 0) {
                                 $addressbookRecipientModel->MultiAdd($data);
                                 $data = array();
                                 $i = 0;
                             }
                             $i++;
                         }
                     }
                 }
                 if ($i < $maxRow) {
                     $addressbookRecipientModel->MultiAdd($data);
                 }
                 fclose($fp);
                 $importLogModel->insert(array('filename' => $new_name, 'original_filename' => $oldInf['basename'], 'created_by' => $identity->id));
             }
         }
     }
 }
 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 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 bulk_destroy()
 {
     $listIds = Input::get('lists');
     Addressbook::whereIn('id', $listIds)->delete();
     return Redirect::to('dashboard/lists')->withSuccess(count($listIds) . ' ' . str_plural('list', count($listIds)) . ' destroyed.');
 }
Example #17
0
 /**
  * Pobranie ksiązki adresowej dla Clienta
  * @return type
  */
 protected function _getAddressBook()
 {
     $model = new Addressbook();
     $select = $model->select()->where('created_by = ?', Zend_Auth::getInstance()->getIdentity()->id)->where('ghost IS FALSE');
     return $model->fetchAll($select);
 }