# Fetch the job keywords $result = dbSelect(JOB_TABLE, "WHERE job_id = " . $job_id); $row = mysql_fetch_assoc($result); $job_keyword = $row['job_keyword']; $job_keyword_string = explode(",", $job_keyword); $importance = $row['keyword_importance']; $importance_string = explode(",", $importance); $fullMark = 0; foreach ($job_keyword_string as $index => $keyword) { $job_keyword_arr[$keyword] = $importance_string[$index]; $fullMark += $importance_string[$index]; } # Extract the cv information $cv_description = $_SESSION['cv_description'][$CV_id]; $cv_email = findEmail($cv_description); $cv_phone = findPhoneNumber($cv_description); $cv_name = findName($cv_description); $result = matchingJobAndCV($cv_description, $job_keyword_arr); foreach ($result as $key => $value) { $matched_keyword = $key; $grade = $value; } $percentage = round($grade / $fullMark * 100, 2); # Update the cv information in database dbUpdate(CV_TABLE, "cv_keyword = '{$matched_keyword}', cv_name = '{$cv_name}', cv_phone = '{$cv_phone}',\n cv_email = '{$cv_email}', cv_grade = '{$percentage}'", "WHERE cv_id = '{$CV_id}'"); function findEmail($a) { $lastPos = 0; // while (($lastPos = strpos($a, "@", $lastPos))!== false) { $b4 = stristr($a, "@", true); $b4pos = strripos($b4, " ") + 1;
//$process = odbc_exec($connection_string,$sqlquery); while (odbc_fetch_row($process)) { $phoneFound = 1; $mbrPhone = preg_replace('(\\D+)', '', odbc_result($process, "memberPhone1")); $mbrPhone2 = preg_replace('(\\D+)', '', odbc_result($process, "memberPhone2")); $mbrEmail = preg_replace('(\\D+)', '', odbc_result($process, "memberEmail")); $msiPhone = preg_replace('(\\D+)', '', odbc_result($process, "field_13")); $mdoPhone = preg_replace('(\\D+)', '', odbc_result($process, "field_12")); $facPhone = preg_replace('(\\D+)', '', odbc_result($process, "facPhone")); $facFax = preg_replace('(\\D+)', '', odbc_result($process, "facFax")); $refPhysPhone = preg_replace('(\\D+)', '', odbc_result($process, "refPhysPhone")); $refPhysMSI = preg_replace('(\\D+)', '', odbc_result($process, "refPhysMSI")); $note_text = odbc_result($process, "note_text"); $symptoms = odbc_result($process, "symptoms"); $note_textPhone = findPhoneNumber($note_text); $apptInfoPhone = findPhoneNumber($symptoms); // If all phone #'s are empty, do not build query if (($mbrPhone == "" || $mbrPhone == NULL) && ($mbrPhone2 == "" || $mbrPhone2 == NULL) && ($msiPhone == "" || $msiPhone == NULL) && ($mdoPhone == "" || $mdoPhone == NULL) && ($facPhone == "" || $facPhone == NULL) && ($facFax == "" || $facFax == NULL) && ($refPhysPhone == "" || $refPhysPhone == NULL) && ($refPhysMSI == "" || $refPhysMSI == NULL) && ($apptInfoPhone == "" || $apptInfoPhone == NULL) && ($note_textPhone == "" || $note_textPhone == NULL) && ($mbrEmail == "" || $mbrEmail == NULL) || strpos($note_text, "DO NOT CALL")) { $phoneFound = 0; } $cdrQuery = "\tSELECT\t\tcount(*)\n\t\t\t\t\tFROM \t\ttbl_cdr_short AS TC \n\t\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\t\tWHERE \t\tTC.startTime\n\t\t\t\t\tBETWEEN \t'" . $cdrEffDate . "'\tAND '" . $cdrThruDate . "'\n\t\t\t\t\tAND\t\t\tanswerIndicator = 'YES'\n\t\t\t\t\tAND\t\t\tdirection = 'Originating'"; if ($phoneFound == 1) { $cdrQuery .= "\tAND \t("; if ($mbrPhone != "" || $mbrPhone != NULL) { $cdrQuery .= "\tcalledNumber like '%" . odbc_result($process, "memberPhone1") . "%'"; if ($mbrPhone2 != "" || $mbrPhone2 != NULL || $msiPhone != "" || $msiPhone != NULL || $mdoPhone != "" || $mdoPhone != NULL || $facPhone != "" || $facPhone != NULL || $facFax != "" || $facFax != NULL || $refPhysPhone != "" || $refPhysPhone != NULL || $refPhysMSI != "" || $refPhysMSI != NULL || $apptInfoPhone != "" || $apptInfoPhone != NULL || $note_textPhone != "" || $note_textPhone != NULL || $mbrEmail != "" || $mbrEmail != NULL) { $cdrQuery .= " OR "; } } if ($mbrPhone2 != "" || $mbrPhone2 != NULL) { $cdrQuery .= "\tcalledNumber like '%" . odbc_result($process, "memberPhone2") . "%'";
$objPHPExcel->setActiveSheetIndex(0); $objWorksheet = $objPHPExcel->getActiveSheet(); $objWorksheet->getDefaultStyle()->getFont()->setName('Calibri'); $objWorksheet->getDefaultStyle()->getFont()->setSize(11); $objWorksheet->setTitle('MDO Outbound'); $objWorksheet->setCellValue('A1', 'Referral ID')->setCellValue('B1', 'Agent Last Name')->setCellValue('C1', 'Agent First Name')->setCellValue('D1', 'Referral Creation')->setCellValue('E1', 'MDO Phone')->setCellValue('F1', 'Time & Appt Phone')->setCellValue('G1', 'Time & Appt Full Text')->setCellValue('H1', 'Ref Phys Last Name')->setCellValue('I1', 'Ref Phys First Name')->setCellValue('J1', 'Ref Phys Middle Name'); $currRow = 1; $objWorksheet->getStyle('A1:J1')->applyFromArray($header); $sqlquery = "Exec usp_USI_getMDOReferrals " . $employergroup_id . ",'" . $effDate . "','" . $thruDate . "'"; echo $sqlquery . "\n"; $process = odbc_exec($connection_string, $sqlquery) or die(odbc_errormsg() . $sqlquery); while (odbc_fetch_row($process)) { $phoneFound = 1; $referral_ud = odbc_result($process, "referral_ud"); $ref_phone = preg_replace('(\\D+)', '', odbc_result($process, "ref_phone")); $timeappt_arr = findPhoneNumber(odbc_result($process, "symptoms")); /* echo $referral_ud.": ".$ref_phone." | "; if(empty($timeappt_arr)){ echo "EMPTY"; } else { foreach($timeappt_arr as $key => $phone) echo $phone.", "; } echo "\n"; */ $query1 = "\tSELECT\t\tcount(*)\n\t\t\t\tFROM \t\ttbl_cdr_short AS TC \n\t\t\t\tJOIN\t\ttbl_call_rep as TCR \n\t\t\t\tON\t\t\tTCR.ext = TC.userNumber \n\t\t\t\tWHERE \t\tTC.startTime\n\t\t\t\tBETWEEN \t'" . $effDate . "' AND '" . $thruDate . "'\n\t\t\t\tAND\t\t\tanswerIndicator = 'YES'\n\t\t\t\tAND\t\t\tdirection = 'Originating'\t\n\t\t\t\t"; // Build array to hold all 2nd part of query
<?php //02182015gms0136 $text = "071560325\nRend. Fac: OLATHE MEDICAL CENTER KS 9137913532\nPrac. Office Fac: MIDWEST SURGICAL ASSOC KS 9137828577"; $number = findPhoneNumber($text); print_r($number); function findPhoneNumber($text) { $searchReplaceArray = array(' ' => '', '-' => '', '/' => '', '\\' => '', '-' => '', '(' => '', ')' => ''); $fullString = str_replace(array_keys($searchReplaceArray), array_values($searchReplaceArray), $text); preg_match_all('/[0-9]{10}/', $fullString, $matches); return $matches[0]; }
// Grab the uploaded file $file = $request->files->get('upload'); // Extract some information about the uploaded file $info = new SplFileInfo($file->getClientOriginalName()); // Create a quasi-random filename $filename = sprintf('%d.%s', time(), $info->getExtension()); // Copy the file $file->move(__DIR__ . '/../uploads', $filename); // Instantiate the Tessearct library $tesseract = new TesseractOCR(__DIR__ . '/../uploads/' . $filename); // Perform OCR on the uploaded image $text = $tesseract->recognize(); return $app['twig']->render('results.twig', ['text' => $text]); }); $app->post('/identify-telephone-number', function (Request $request) use($app) { // Grab the uploaded file $file = $request->files->get('upload'); // Extract some information about the uploaded file $info = new SplFileInfo($file->getClientOriginalName()); // Create a quasi-random filename $filename = sprintf('%d.%s', time(), $info->getExtension()); // Copy the file $file->move(__DIR__ . '/../uploads', $filename); // Instantiate the Tessearct library $tesseract = new TesseractOCR(__DIR__ . '/../uploads/' . $filename); // Perform OCR on the uploaded image $text = $tesseract->recognize(); $number = findPhoneNumber($text, 'GB'); return $app->json(['number' => $number]); }); $app->run();