1168 lines
41 KiB
PHP
1168 lines
41 KiB
PHP
<?php
|
|
|
|
include 'dbconfig.php';
|
|
require './../functions.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
|
|
if($_POST['formdata'] == 'getForm'){
|
|
getForm($conn,$_POST['id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'bankInfo'){
|
|
if(!isset($_POST['client_id'])){
|
|
$_POST['client_id'] = 0;
|
|
}
|
|
getBankInfo($conn,$_POST['client_id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'categoryInfo'){
|
|
getCategoryInfo($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'public_categoryInfo'){
|
|
getPublicCategoryInfo($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'sucategoryInfo'){
|
|
getSubCategoryInfo($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'allDbasic'){
|
|
getAllDbasicInfo($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'allPublic'){
|
|
getAllpublicByDdId($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'getDestination'){
|
|
getDestination($conn,$_POST['id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'getAccountDetail'){
|
|
getAccountDetail($conn,$_POST['id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'getAttachmentDetail'){
|
|
getAttachmentDetail($conn,$_POST['id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'deleteFormData'){
|
|
deleteFormData($conn,$_POST['id']);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'inquiryCategoryInfo'){
|
|
getInquiryList($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'inquiryCategoryInfoForDF'){
|
|
getInquiryListForDF($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'publicCategoryInfoForDF'){
|
|
getPublicListForDF($conn,$_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'STT_PI_LETTER_SET'){
|
|
get_stt_pi_letter_info($conn,$_POST);
|
|
}
|
|
|
|
|
|
|
|
if($_POST['formdata'] == 'deleteAllForm'){
|
|
//$member_id = $_POST['member_id'];
|
|
deleteAllForm($conn, $_POST);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'bankCategoryInfo'){
|
|
$dd_id = $_POST['dd_id'];
|
|
$category_id = $_POST['category_id'];
|
|
$client_id = $_POST['client_id'];
|
|
bankCategoryInfo($conn,$dd_id,$category_id,$client_id);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'latepaysBankCategoryInfo'){
|
|
$dd_id = $_POST['dd_id'];
|
|
$category_id = $_POST['category_id'];
|
|
$client_id = $_POST['client_id'];
|
|
LatePaysbankCategoryInfo($conn,$dd_id,$category_id,$client_id);
|
|
}
|
|
|
|
if($_POST['formdata'] == 'CHECK_HAS_AUTOMATION'){
|
|
checkHasAutomation($conn, $_POST['id']);
|
|
}
|
|
|
|
} else {
|
|
if($_GET['formdata'] == 'getFormData'){
|
|
getFormData($conn,$_GET);
|
|
}
|
|
}
|
|
|
|
function get_stt_pi_letter_info($conn, $request){
|
|
|
|
setCurrentSession();
|
|
$final_result['status'] = false;
|
|
$final_result['html'] = "";
|
|
if($request['client_id'] > 0){
|
|
$sql = "select * from client_letter_sets where client_id = ".$request['client_id'];
|
|
$query_result = $conn->query($sql);
|
|
$result = [];
|
|
$letter_set_list = [];
|
|
$current_date = date('Y-m-d');
|
|
while($row = $query_result->fetch_assoc()) {
|
|
$letter_set_list[$row['letter_set_no']] = "gray";
|
|
if($row['is_blue'] == 1){
|
|
$letter_set_list[$row['letter_set_no']] = "blue";
|
|
}else{
|
|
if(!empty($row['next_action_date']) && strtotime($row['next_action_date']) > 0){
|
|
$days = daysBetween($current_date,$row['next_action_date']);
|
|
if($days > NEXT_SELECTION_NEAREST_DAY){
|
|
$letter_set_list[$row['letter_set_no']] = "green";
|
|
}else{
|
|
if($days < 0){
|
|
$letter_set_list[$row['letter_set_no']] = "red";
|
|
}else{
|
|
if($days <= NEXT_SELECTION_NEAREST_DAY){
|
|
$letter_set_list[$row['letter_set_no']] = "yellow";
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
$user_type_name = getCurrentUserInfo();
|
|
|
|
$html = '<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="stt-pi-area div-box-shadow">
|
|
<ul>';
|
|
$li = "";
|
|
foreach(STT_PI_LETTER_SET as $key => $l){
|
|
|
|
if($user_type_name == "MEMBER"){
|
|
if(!isset($_SESSION['hasVelocity']) && $key == 13){
|
|
continue;
|
|
}
|
|
}else if($user_type_name == "EMPLOYEE"){
|
|
if((!isset($_SESSION['crm_has_velocity']) || !$_SESSION['crm_has_velocity']) && $key == 13){
|
|
continue;
|
|
}
|
|
}
|
|
|
|
$class_name = "";
|
|
if(isset($letter_set_list[$key])){
|
|
$class_name = $letter_set_list[$key];
|
|
}
|
|
$li .= '<li class="'.$class_name.'">'.$l.'</li>';
|
|
}
|
|
|
|
|
|
$html .= $li.'</ul></div></div></div>';
|
|
|
|
$final_result['status'] = true;
|
|
$final_result['html'] = $html;
|
|
}
|
|
|
|
echo json_encode($final_result);
|
|
die();
|
|
}
|
|
|
|
function checkHasAutomation($conn, $sertg_id){
|
|
$result['status'] = false;
|
|
$result['message'] = "";
|
|
|
|
if($sertg_id > 0){
|
|
$sql = "select count(id) AS total_rows from automation_schedules where sertg_id = $sertg_id AND velocity_type = 1";
|
|
$query_result = $conn->query($sql);
|
|
$totalRecords = 0;
|
|
while($row = $query_result->fetch_assoc()) {
|
|
$totalRecords = $row['total_rows'];
|
|
}
|
|
|
|
if($totalRecords > 0){
|
|
$result['status'] = true;
|
|
$result['message'] = AUTOMATION_WARRING;
|
|
}
|
|
}
|
|
|
|
echo json_encode($result);
|
|
die();
|
|
}
|
|
|
|
|
|
|
|
function getFormData($conn,$request)
|
|
{
|
|
//testFwrite(json_encode($request));
|
|
// echo "<pre>";print_r($request);exit;
|
|
## Read value
|
|
$draw = $request['draw'];
|
|
$tbl_row = $request['start'];
|
|
$tbl_rowperpage = $request['length']; // Rows display per page
|
|
$columnIndex = $request['order'][0]['column']; // Column index
|
|
$columnName = $request['columns'][$columnIndex]['data']; // Column name
|
|
$columnSortOrder = $request['order'][0]['dir']; // asc or desc
|
|
$searchValue = $request['search']['value']; // Search value
|
|
|
|
$searchQuery = " ";
|
|
if(!empty($searchValue)){
|
|
$searchQuery = " and (personal_info like '%".$searchValue."%' or
|
|
dob like '%".$searchValue."%' or
|
|
ssn like'%".$searchValue."%' ) ";
|
|
}
|
|
|
|
$member_id = $request['member_id'];
|
|
$employee_id = isset($request['employee_id']) ? $request['employee_id']:0;
|
|
$form_employee_id = isset($request['form_employee_id']) ? $request['form_employee_id']:0;
|
|
$form_afiiliate_id = isset($request['form_afiiliate_id']) ? $request['form_afiiliate_id']:0;
|
|
$isEmployee = isset($request['isEmployee']) ? $request['isEmployee']:0;
|
|
/*if(empty($member_id)){
|
|
$member_id = 0;
|
|
}*/
|
|
|
|
|
|
|
|
$data = array();
|
|
$sertgForm_count_qry = "SELECT count(*) as total FROM sertg WHERE member_id = ".$member_id;
|
|
$sertgForm = "SELECT * FROM sertg WHERE member_id = ".$member_id.$searchQuery." order by modified_on desc Limit ".$tbl_row.",".$tbl_rowperpage;
|
|
if($employee_id > 0){
|
|
$crm_sql = "select * from crmusers where id = ".$employee_id." Limit 0,1";
|
|
$crmuser = $conn->query($crm_sql);
|
|
$crmuser = $crmuser->fetch_assoc();
|
|
if($crmuser['is_show_all_clients'] == 2){
|
|
$sertgForm = "SELECT sertg.client_id AS client_id , sertg.id AS id, clients.*, sertg.* FROM sertg INNER JOIN clients
|
|
ON clients.id = sertg.client_id
|
|
WHERE member_id = ".$member_id." AND sertg.employee_id = ".$employee_id." order by sertg.modified_on desc Limit ".$tbl_row.",".$tbl_rowperpage;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if($form_employee_id != 0 || $form_employee_id == -1){
|
|
$condition = "sertg.employee_id = ".$form_employee_id;
|
|
if($form_employee_id == -1){
|
|
$condition = "sertg.employee_id > 0";
|
|
}
|
|
$sertgForm_count_qry = "SELECT count(*) as total FROM sertg INNER JOIN clients
|
|
ON clients.id = sertg.client_id
|
|
WHERE member_id = ".$member_id." AND ".$condition." order by sertg.modified_on desc ";
|
|
|
|
$sertgForm = "SELECT sertg.client_id AS client_id , sertg.id AS id, clients.*, sertg.* FROM sertg INNER JOIN clients
|
|
ON clients.id = sertg.client_id
|
|
WHERE member_id = ".$member_id." AND ".$condition." order by sertg.modified_on desc Limit ".$tbl_row.",".$tbl_rowperpage;
|
|
|
|
}else if($form_afiiliate_id != 0 || $form_afiiliate_id == -1){
|
|
$condition = "clients.crmuser_id = ".$form_afiiliate_id." AND sertg.employee_id = 0";
|
|
if($form_afiiliate_id == -1){
|
|
$condition = "clients.crmuser_id > 0 AND sertg.employee_id = 0";
|
|
if($employee_id > 0){
|
|
$condition = "clients.crmuser_id > 0 AND sertg.employee_id = ".$employee_id;
|
|
}
|
|
}
|
|
$sertgForm_count_qry = "SELECT count(*) as total FROM sertg INNER JOIN clients
|
|
ON clients.id = sertg.client_id
|
|
WHERE member_id = ".$member_id." AND ".$condition." order by sertg.modified_on desc ";
|
|
|
|
$sertgForm = "SELECT sertg.client_id AS client_id , sertg.id AS id, clients.*, sertg.* FROM sertg INNER JOIN clients
|
|
ON clients.id = sertg.client_id
|
|
WHERE member_id = ".$member_id." AND ".$condition." order by sertg.modified_on desc Limit ".$tbl_row.",".$tbl_rowperpage;
|
|
}
|
|
|
|
|
|
// $file = fopen(__DIR__."/../pranak.txt","w");
|
|
// fwrite($file,$sertgForm);
|
|
// fclose($file);
|
|
|
|
$sel = $conn->query($sertgForm_count_qry);
|
|
$result = $conn->query($sertgForm);
|
|
while($row1 = $sel->fetch_assoc()) {
|
|
$totalRecords = $row1['total'];
|
|
}
|
|
$allShortName = json_decode(LETTER_TYPES_SHORT_NAME);
|
|
|
|
$totalRecordwithFilter = $totalRecords;
|
|
if ($totalRecords > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$row['slected_letter'] = "";
|
|
|
|
if(isset($row['lettertypes']) && !empty($row['lettertypes'])){
|
|
$row['lettertypes'] = explode(',', $row['lettertypes']);
|
|
foreach($row['lettertypes'] as $type){
|
|
if(!empty($row['slected_letter'])){
|
|
$row['slected_letter'] .=", ".$allShortName->{$type};
|
|
}else{
|
|
$row['slected_letter'] =$allShortName->{$type};
|
|
}
|
|
}
|
|
}else {
|
|
$row['lettertypes'] = "";
|
|
}
|
|
|
|
if($row['next_section_date'] == "0000-00-00 00:00:00"){
|
|
$row['next_section_date'] = "";
|
|
}
|
|
if(!empty($row['next_section_date'])){
|
|
$row['next_section_date'] = date('Y-m-d', strtotime($row['next_section_date']));
|
|
}
|
|
|
|
if(!empty($row['modified_on'])){
|
|
$row['modified_on'] = date('Y-m-d', strtotime($row['modified_on']));
|
|
}
|
|
$row['row_checkbox'] = '<input type="checkbox" value="'.$row['id'].'" class="current-checkbox" name="velocity_ids[]">';
|
|
$row['report_source_type'] = REPORT_SOURCE_TYPES[$row['report_type']];
|
|
$row['report_source_type_id'] = $row['report_type'];
|
|
$row['action_btn'] =
|
|
'<i id="client-file-'.$row['id'].'" class="fa fa-spinner fa-spin" style="display:none;"></i>'
|
|
. '<a href="javascript:;" onclick="deleteFormData(this)" data-toggle="tooltip" title="Delete" data-id="' .$row['id']. '" id="formDelete_"'.$row['id'].'">'
|
|
. '<span style="color:#dd4b39;padding-left:10px;font-size:18px;">'
|
|
. '<i class="fa fa-trash" aria-hidden="true"></i>'
|
|
. '</span>'
|
|
. '</a>'.' '.''
|
|
. '<a href="javascript:;" onclick="getValueById(this)" data-toggle="tooltip" title="Load" data-report="'.$row['report_source_type_id'].'" data-id="'.$row['id'].'" id="formLoad_"'.$row['id'].'">'
|
|
. '<span style="color:#00a65a;padding-left:5px;font-size:18px;">'
|
|
. '<i class="fa fa-external-link-square" aria-hidden="true"></i>'
|
|
. '</span>'
|
|
. '</a>';
|
|
|
|
$data[]=$row;
|
|
}
|
|
}
|
|
$response = array(
|
|
"draw" => intval($draw),
|
|
"iTotalRecords" => $totalRecords,
|
|
"iTotalDisplayRecords" => $totalRecordwithFilter,
|
|
"aaData" => $data
|
|
);
|
|
|
|
echo json_encode($response);
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
function testFwrite($data){
|
|
$file = fopen(__DIR__."/clientfiles.txt","w");
|
|
fwrite($file, $data);
|
|
fclose($file);
|
|
}
|
|
|
|
|
|
function getbankInfoCoreFunction($conn,$client_id){
|
|
$data = array();
|
|
$sertgForm = "SELECT data_item_key_values.id AS dd_id,"
|
|
. " data_item_key_values.value1,data_item_key_values.value2,"
|
|
. "data_item_key_values.value3, data_item_key_values.value4,"
|
|
. "data_item_key_values.value5,"
|
|
. "data_item_key_values.value6,data_item_key_values.isJson FROM data_documents "
|
|
. "inner join data_item_key_values "
|
|
. "on data_documents.id = data_item_key_values.dd_id "
|
|
. "WHERE client_id = ".$client_id;
|
|
|
|
$result = $conn->query($sertgForm);
|
|
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$transUnionInfo = trim($row['value1']);
|
|
$experianInfo = trim($row['value5']);
|
|
$equifaxInfo = trim($row['value6']);
|
|
if($row['isJson'] == 1){
|
|
$transUnionInfo = json_decode(trim($row['value1']));
|
|
$experianInfo = json_decode(trim($row['value5']));
|
|
$equifaxInfo = json_decode(trim($row['value6']));
|
|
}
|
|
|
|
$data[$row['dd_id']]=['value1'=>$transUnionInfo,
|
|
'value2'=>trim($row['value2']),
|
|
'value3'=>trim($row['value3']),
|
|
'value4'=>trim($row['value4']),
|
|
'value5'=>$experianInfo,
|
|
'value6'=>$equifaxInfo,
|
|
'isJson'=>!empty($row['isJson']) ? $row['isJson']:0
|
|
];
|
|
}
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
|
|
function getBankInfo($conn,$client_id)
|
|
{
|
|
$data = getbankInfoCoreFunction($conn,$client_id);
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function getHtmlContentByClientId($conn, $client_id){
|
|
$html = "";
|
|
$sql = "SELECT * FROM `data_documents` WHERE `client_id` = ".$client_id;
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$data = $row;
|
|
}
|
|
}
|
|
|
|
if(!empty($data)){
|
|
$html = file_get_contents('../html_content/'.$data['cmsuser_id']."/".$data['client_id']."/".$data['id'].".html");
|
|
}
|
|
|
|
return $html;
|
|
}
|
|
|
|
function getForm($conn,$id)
|
|
{
|
|
|
|
$data = array();
|
|
//$sertgForm = "SELECT * FROM sertg WHERE id = ".$id;
|
|
$sertgForm = "SELECT sertg.*,clients.crmuser_id,clients.employee_id AS client_tbl_employee_id FROM sertg LEFT JOIN clients ON sertg.client_id = clients.id WHERE sertg.id = ".$id;
|
|
//echo $sertgForm;exit;
|
|
//$sertgForm = "SELECT sertg.*,clients.crmuser_id FROM sertg LEFT JOIN clients ON sertg.member_id = clients.cmsuser_id WHERE sertg.id = ".$id;
|
|
$result = $conn->query($sertgForm);
|
|
|
|
if ($result->num_rows > 0) {
|
|
while($row = $result->fetch_assoc()) {
|
|
$data = $row;
|
|
}
|
|
|
|
$sertg_automation_sql = "select * from automation_schedules where velocity_type = 1 AND sertg_id = ".$id;
|
|
$sertg_automation_result = $conn->query($sertg_automation_sql);
|
|
$automation_schedule['day_value'] = 0;
|
|
$automation_schedule['type'] = 1;
|
|
$data['set_automation'] = 0;
|
|
if ($sertg_automation_result->num_rows > 0) {
|
|
$automation_schedule = $sertg_automation_result->fetch_assoc();
|
|
$data['set_automation'] = 1;
|
|
$data['day_value'] = $automation_schedule['day_value'];
|
|
$data['automatio_type'] = $automation_schedule['type'];
|
|
}
|
|
|
|
$html = getHtmlContentByClientId($conn, $data['client_id']);
|
|
$data['html_content'] = "";
|
|
if(!empty($html)){
|
|
$data['html_content'] = $html;
|
|
}
|
|
|
|
}
|
|
// if($data['crmuser_id'] > 0){
|
|
// $sql = "SELECT * FROM "
|
|
// }
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function getDestination($conn,$id)
|
|
{
|
|
|
|
$sertgForm = "SELECT * FROM sertg_destination WHERE sertg_id = ".$id;
|
|
$result = $conn->query($sertgForm);
|
|
$destinationArray = array();
|
|
$destinationOtherArray = array();
|
|
if ($result->num_rows > 0) {
|
|
while ($destination = $result->fetch_assoc()) {
|
|
$destinationArray[$destination['destination_id']] = explode(",", $destination['addresses']);
|
|
$destinationOtherArray[$destination['destination_id']] = $destination['other_address'];
|
|
}
|
|
}
|
|
$destination1 = ['address' => $destinationArray,'other' => $destinationOtherArray];
|
|
|
|
echo json_encode($destination1);
|
|
die();
|
|
|
|
}
|
|
|
|
function getAccountDetail($conn,$id)
|
|
{
|
|
|
|
$accountArray = array();
|
|
if(!empty($id)){
|
|
$sertgAccount = "SELECT * From sertg_account WHERE sertg_id = ".$id;
|
|
|
|
$result = $conn->query($sertgAccount);
|
|
if ($result->num_rows > 0) {
|
|
$count =1;
|
|
$selected_banks = array();
|
|
$negative_items = array();
|
|
$inquires_items = array();
|
|
$public_items = array();
|
|
$public_items_category = 0;
|
|
$inquires_items_category = 0;
|
|
$item_category = 0;
|
|
$accountDestination = array();
|
|
$isSTT = 1;
|
|
while ($account = $result->fetch_assoc()) {
|
|
|
|
|
|
if($account['sertg_id'] != 61480){
|
|
$account['acc_image_desc'] = str_replace(" ", " ", $account['acc_image_desc']);
|
|
}
|
|
$account_number = explode(",", $account['acc_number']);
|
|
$aspect_number = explode(",", $account['acc_aspect']);
|
|
$account_derogatory = explode(",", $account['acc_derogatory']);
|
|
$item_ownership = $account['ownership_item_issue'];
|
|
$item_discontinaunce = $account['item_discontinuance'];
|
|
$disable_indicator = $account['acc_disable_indicator'];
|
|
$item_attack_num = $account['item_attack_num'];
|
|
$acc_rebuttal = $account['rebuttal_value'];
|
|
$df_dropdown_value = $account['df_dropdown_value'];
|
|
$df_textarea = $account['df_textarea_value'];
|
|
$item_category = $account['acc_item_category'];
|
|
$selected_banks = explode(',', $account['acc_selected_banks']);
|
|
$negative_items = explode(',', $account['acc_negative_items']);
|
|
$late_pays_items = explode(',', $account['latepays_banks']);
|
|
$public_items = explode(',', $account['acc_public_records']);
|
|
$inquires_items = explode(',', $account['acc_inquries']);
|
|
$inquires_items_category = $account['acc_inquries_categoy'];
|
|
$public_items_category = $account['acc_public_category'];
|
|
$client_id = isset($account['client_id']) ? $account['client_id']:0;
|
|
$isSTT = isset($account['isSTT']) ? $account['isSTT']:1;
|
|
$is_auto_generated_image = $account['is_auto_generated_image'];
|
|
$is_create_new_letter = $account['is_create_new_letter'];
|
|
$sertgDestination = "SELECT sertg_dest_id From sertg_destination_acc WHERE sertg_acc_id = ".$account['id'];
|
|
|
|
$dest = array();
|
|
$result1 = $conn->query($sertgDestination);
|
|
while ($destination = $result1->fetch_assoc()) {
|
|
$dest[] = $destination['sertg_dest_id'];
|
|
|
|
}
|
|
//$accountDestination[$count] = $dest;
|
|
$accountArray[$count] = ['acc_number' => $account_number, 'acc_aspect' => $aspect_number, 'acc_derogatory' => $account_derogatory,
|
|
'acc_other' => $account['acc_other'], 'acc_image' => $account['acc_image'], 'acc_image_desc' => $account['acc_image_desc'],
|
|
'acc_num_other' => $account['acc_num_other'], 'acc_derogatory_other' => $account['acc_derogatory_other'], 'destination' => $dest,
|
|
'item_ownership' => $item_ownership, 'item_discontinaunce' => $item_discontinaunce, 'disable_indicator' => $disable_indicator,
|
|
'item_attack_num' => $item_attack_num,'rebuttal'=>$acc_rebuttal,'df_dropdown_value'=>$df_dropdown_value,'df_textarea'=>$df_textarea,
|
|
'item_category'=>$item_category,'selected_banks'=>$selected_banks,'neative_items'=>$negative_items,'client_id'=>$client_id,
|
|
'inquires'=>$inquires_items,
|
|
'is_auto_generated_image' => $is_auto_generated_image,
|
|
'is_create_new_letter' => $is_create_new_letter,
|
|
'late_pays_items'=>$late_pays_items,
|
|
'public_items'=>$public_items,'inquiry_category'=>$inquires_items_category,'public_category'=>$public_items_category
|
|
];
|
|
$accountArray[$count]['isSTT'] = $isSTT;
|
|
|
|
$count++;
|
|
}
|
|
}
|
|
echo json_encode($accountArray);
|
|
die();
|
|
}
|
|
|
|
}
|
|
|
|
function getAttachmentDetail($conn,$id)
|
|
{
|
|
|
|
|
|
if(!empty($id)){
|
|
|
|
$sql ="SELECT * FROM sertg_attachment WHERE sertg_id = ".$id;
|
|
$result = $conn->query($sql);
|
|
if ($result->num_rows > 0) {
|
|
$count = 1;
|
|
$attachmentArray = array();
|
|
$attachmentDestination = array();
|
|
while ($attachment = $result->fetch_assoc()) {
|
|
|
|
$sertgDestination ="SELECT sertg_dest_id FROM sertg_destination_attachment WHERE sertg_attachment_id = ".$attachment['id'];
|
|
$result1 = $conn->query($sertgDestination);
|
|
$dest = array();
|
|
if ($result1->num_rows > 0) {
|
|
while ($destination = $result1->fetch_assoc()) {
|
|
$dest[] = $destination['sertg_dest_id'];
|
|
|
|
}
|
|
}
|
|
|
|
$attachmentArray[$count] = ['attachment' => $attachment['attachment'], 'destination' => $dest];
|
|
$count++;
|
|
}
|
|
}
|
|
echo json_encode($attachmentArray);
|
|
die();
|
|
}
|
|
|
|
}
|
|
|
|
function deleteFormData($conn,$id)
|
|
{
|
|
deleteAutomationBySertgId($conn, $id);
|
|
|
|
if(!empty($id)){
|
|
$sql="DELETE FROM sertg WHERE id =".$id;
|
|
if ($conn->query($sql)=== TRUE) {
|
|
$sql2="DELETE FROM sertg_destination WHERE sertg_id =".$id;
|
|
if ($conn->query($sql2)=== TRUE) {
|
|
$sql3="SELECT * FROM sertg_account WHERE sertg_id = ".$id;
|
|
$result = $conn->query($sql3);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$sql4 = "DELETE FROM sertg_account WHERE id =" . $row['id'];
|
|
if ($conn->query($sql4) === TRUE) {
|
|
if(!empty($row['acc_image'])){
|
|
@unlink('Staff/sertg/accounts/' . $row['acc_image']);
|
|
}
|
|
}
|
|
$sql5="DELETE FROM sertg_destination_acc WHERE sertg_acc_id = ".$row['id'];
|
|
if ($conn->query($sql5) === TRUE) {
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$sql6="SELECT * FROM sertg_attachment WHERE sertg_id = ".$id;
|
|
$result2 = $conn->query($sql6);
|
|
if ($result2->num_rows > 0) {
|
|
while ($row = $result2->fetch_assoc()) {
|
|
$sql7 = "DELETE FROM sertg_attachment WHERE id =" . $row['id'];
|
|
if ($conn->query($sql7) === TRUE) {
|
|
@unlink('Staff/sertg/attachment/' . $row['attachment']);
|
|
}
|
|
|
|
$sql8="DELETE FROM sertg_destination_attachment WHERE sertg_attachment_id = ".$row['id'];
|
|
if ($conn->query($sql8) === TRUE) {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
deleteAutomationBySertgId($conn, $id);
|
|
}
|
|
|
|
echo json_encode('Deleted successfully.');
|
|
//die();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function deleteAutomationBySertgId($conn, $sertg_id){
|
|
|
|
$result = false;
|
|
|
|
if($sertg_id > 0){
|
|
|
|
$generic_query = " from automation_schedules where velocity_type = 1 AND sertg_id =".$sertg_id;
|
|
$select_as_query = "select id".$generic_query;
|
|
$automation_schecdule_sql = "delete".$generic_query;
|
|
$automation_schecdule_export_sql = "delete from automation_schedule_exports where automation_schedule_id in ($select_as_query)";
|
|
|
|
if ($conn->query($automation_schecdule_export_sql)) {
|
|
if($conn->query($automation_schecdule_sql)){
|
|
$result = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
function deleteAllForm($conn, $request)
|
|
{
|
|
|
|
//echo "<pre>";print_r($request);exit;
|
|
|
|
//$member_id = $request['member_id'];
|
|
//deleting from sertg_account
|
|
// $sertg_sql = "SELECT * FROM sertg WHERE member_id=".$member_id;
|
|
// $result = $conn->query($sertg_sql);
|
|
// if ($result->num_rows > 0) {
|
|
//
|
|
// }
|
|
if (!empty($request['velocity_ids'])) {
|
|
foreach ($request['velocity_ids'] as $vId) {
|
|
if ($vId > 0) {
|
|
deleteFormData($conn, $vId);
|
|
}
|
|
}
|
|
}
|
|
echo json_encode('Deleted succesfully');
|
|
die();
|
|
|
|
}
|
|
|
|
function getCategoryInfo($conn, $data)
|
|
{
|
|
$requestData = $data;
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id <4 ){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = $status.APP_TRANSUNION;
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = $status.APP_EXPERIAN;
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = $status.APP_EQUIFAX;
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
if($dd_id > 0 && !empty($status)){
|
|
$sertg_sql = "SELECT id,data_key FROM data_basic_key_values WHERE dd_id=".$dd_id." AND ".$status." = 1";
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']] = $row['data_key'];
|
|
}
|
|
}
|
|
}
|
|
} else if($category_id == 4){
|
|
$data = getAllCategoryInfo($conn,$requestData);
|
|
}
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
|
|
function getAllCategoryInfo($conn, $data)
|
|
{
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
|
|
$data = array();
|
|
if($category_id == 4){
|
|
|
|
$sertg_sql = "SELECT * FROM data_basic_key_values WHERE dd_id=".$dd_id." AND (status1 = 1 OR status2 = 1 OR status3 = 1)";
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']] = $row['data_key'];
|
|
}
|
|
}
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
|
|
function getMaxValue($dataArray){
|
|
$returnValue = "";
|
|
if(!empty($dataArray)){
|
|
$max = strlen($dataArray[0]);
|
|
if($max > 0){
|
|
$returnValue = $dataArray[0];
|
|
}
|
|
foreach ($dataArray as $key => $value){
|
|
if($key > 0){
|
|
$currentLen = strlen($value);
|
|
if($currentLen > $max){
|
|
$max = $currentLen;
|
|
$returnValue = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return $returnValue;
|
|
}
|
|
|
|
|
|
function getSubCategoryInfo($conn, $data)
|
|
{
|
|
$dbkey_id = $data['dbkey_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id > 0 && $dbkey_id > 0){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = $status.APP_TRANSUNION;
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = $status.APP_EXPERIAN;
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = $status.APP_EQUIFAX;
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
$sertg_sql = "SELECT id,".$value." FROM data_basic_key_values WHERE id=".$dbkey_id;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']] = $row[$value];
|
|
}
|
|
}
|
|
|
|
echo json_encode($data);
|
|
} else {
|
|
echo json_encode(0);
|
|
}
|
|
|
|
die();
|
|
}
|
|
function getAllDbasicInfo($conn, $data)
|
|
{
|
|
$publicData = $data;
|
|
$dd_id = isset($data['dd_id']) ? $data['dd_id']:0;
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($dd_id > 0){
|
|
|
|
$sertg_sql = "SELECT * FROM data_basic_key_values WHERE dd_id=".$dd_id;
|
|
//echo json_encode($sertg_sql);exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']]['value1'] = $row['value1'];
|
|
$data[$row['id']]['value2'] = $row['value2'];
|
|
$data[$row['id']]['value3'] = $row['value3'];
|
|
$data[$row['id']]['status1'] = $row['status1'];
|
|
$data[$row['id']]['status2'] = $row['status2'];
|
|
$data[$row['id']]['status3'] = $row['status3'];
|
|
}
|
|
}
|
|
$response['data'] = $data;
|
|
$response['public'] = getAllpublicByDdId($conn,$publicData);
|
|
echo json_encode($response);
|
|
} else {
|
|
echo json_encode(0);
|
|
}
|
|
|
|
die();
|
|
}
|
|
function getAllpublicByDdId($conn, $data)
|
|
{
|
|
$dd_id = $data['dd_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($dd_id > 0){
|
|
|
|
$sertg_sql = "SELECT * FROM data_public_records WHERE dd_id=".$dd_id;
|
|
//print_r($sertg_sql);exit;
|
|
//echo json_encode($sertg_sql);exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']]['value1'] = $row['value1'];
|
|
$data[$row['id']]['value2'] = $row['value2'];
|
|
$data[$row['id']]['value3'] = $row['value3'];
|
|
$data[$row['id']]['status1'] = $row['status1'];
|
|
$data[$row['id']]['status2'] = $row['status2'];
|
|
$data[$row['id']]['status3'] = $row['status3'];
|
|
}
|
|
}
|
|
return $data;
|
|
}
|
|
// echo json_encode($data);
|
|
// } else {
|
|
// echo json_encode(0);
|
|
// }
|
|
//
|
|
// die();
|
|
}
|
|
|
|
|
|
function getInquiryList($conn, $data)
|
|
{
|
|
$requestData = $data;
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id < 4){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = $status.APP_TRANSUNION;
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = $status.APP_EXPERIAN;
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = $status.APP_EQUIFAX;
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
$sertg_sql = "SELECT id,data_key FROM data_inquiries WHERE dd_id=".$dd_id." AND type =1 AND item_category_id = ".$category_id;
|
|
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = explode('_',$row['data_key']);
|
|
$data['key_name'][$row['id']] = $key_date_name[0];
|
|
$data['key_date'][$row['id']] = $key_date_name[1];
|
|
}
|
|
}
|
|
//print_r($data);exit;
|
|
} else if($category_id == 4) {
|
|
$data = getAllInquiryList($conn,$requestData);
|
|
}
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function getInquiryListForDF($conn, $data)
|
|
{
|
|
|
|
$requestData = $data;
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id < 4){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = $status.APP_TRANSUNION;
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = $status.APP_EXPERIAN;
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = $status.APP_EQUIFAX;
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
$sertg_sql = "SELECT data_inquiries.id,data_inquiries.data_key,dia.address FROM data_inquiries inner join data_inquiries_address dia on dia.data_inquiry_id = data_inquiries.id WHERE data_inquiries.dd_id=".$dd_id." AND data_inquiries.type =1 AND data_inquiries.item_category_id = ".$category_id;
|
|
//echo $sertg_sql;exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = explode('_',$row['data_key']);
|
|
$data['key_name'][$row['id']] = $key_date_name[0];
|
|
$data['key_date'][$row['id']] = $key_date_name[1];
|
|
$data['address'][$row['id']] = $row['address'];
|
|
}
|
|
}
|
|
//print_r($data);exit;
|
|
} else if($category_id == 4) {
|
|
$data = getAllInquiryListForDF($conn,$requestData);
|
|
}
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function getPublicListForDF($conn, $data)
|
|
{
|
|
|
|
$requestData = $data;
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id > 0){
|
|
// if($category_id == APP_TRANSUNION){
|
|
// $status = $status.APP_TRANSUNION;
|
|
// $value = $value.APP_TRANSUNION;
|
|
// } else if ($category_id == APP_EXPERIAN){
|
|
// $status = $status.APP_EXPERIAN;
|
|
// $value = $value.APP_EXPERIAN;
|
|
// } else if($category_id == APP_EQUIFAX){
|
|
// $status = $status.APP_EQUIFAX;
|
|
// $value = $value.APP_EQUIFAX;
|
|
// }
|
|
|
|
$sertg_sql = "SELECT data_public_records.id,data_public_records.data_key,dia.creaditor_address,dia.creaditor_name FROM data_public_records inner join data_publicrecord_address dia on dia.data_public_record_id = data_public_records.id WHERE data_public_records.dd_id=".$dd_id;
|
|
// echo $sertg_sql;exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name =$row['data_key'];
|
|
$key_date_name = trim($key_date_name);
|
|
if(!empty($key_date_name) && strtolower($key_date_name) == "court-1"){
|
|
$data['key_name'][$row['id']] = $key_date_name;
|
|
$data['key_date'][$row['id']] = $row['creaditor_name'];
|
|
$data['address'][$row['id']] = $row['creaditor_address'];
|
|
}
|
|
}
|
|
}
|
|
//print_r($data);exit;
|
|
} else if($category_id == 4) {
|
|
// $data = getAllInquiryListForDF($conn,$requestData);
|
|
}
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function getAllInquiryList($conn, $data)
|
|
{
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$data = array();
|
|
if($category_id == 4){
|
|
|
|
$sertg_sql = "SELECT id,data_key FROM data_inquiries WHERE dd_id=".$dd_id." AND type =1";
|
|
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = explode('_',$row['data_key']);
|
|
$data['key_name'][$row['id']] = $key_date_name[0];
|
|
$data['key_date'][$row['id']] = $key_date_name[1];
|
|
}
|
|
}
|
|
}
|
|
//print_r($data);exit;
|
|
return $data;
|
|
}
|
|
|
|
function getAllInquiryListForDF($conn, $data)
|
|
{
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$data = array();
|
|
if($category_id == 4){
|
|
|
|
$sertg_sql = "SELECT data_inquiries.id,data_inquiries.data_key,dia.address FROM data_inquiries inner join data_inquiries_address dia on dia.data_inquiry_id = data_inquiries.id WHERE data_inquiries.dd_id=".$dd_id." AND data_inquiries.type =1";
|
|
// echo $sertg_sql;exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = explode('_',$row['data_key']);
|
|
$data['key_name'][$row['id']] = $key_date_name[0];
|
|
$data['key_date'][$row['id']] = $key_date_name[1];
|
|
$data['address'][$row['id']] = $row['address'];
|
|
}
|
|
}
|
|
}
|
|
//print_r($data);exit;
|
|
return $data;
|
|
}
|
|
|
|
function getPublicCategoryInfo($conn, $data)
|
|
{
|
|
$dd_id = $data['dd_id'];
|
|
$category_id = $data['category_id'];
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id <= 3){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = $status.APP_TRANSUNION;
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = $status.APP_EXPERIAN;
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = $status.APP_EQUIFAX;
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
$clause = " AND ".$status." = 1";
|
|
} else {
|
|
$clause = " AND (status1 = 1 OR status2 = 1 OR status3 = 1)";
|
|
}
|
|
$sertg_sql = "SELECT id,data_key FROM data_public_records WHERE dd_id=".$dd_id.$clause;
|
|
// print_r($sertg_sql);exit;
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$data[$row['id']] = $row['data_key'];
|
|
}
|
|
}
|
|
|
|
echo json_encode($data);
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
|
function bankCategoryInfo($conn, $dd_id, $category_id, $client_id){
|
|
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id < 4){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = "type";
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = "type2";
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = "type3";
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
$sertg_sql = "SELECT id,data_key FROM data_item_key_values WHERE dd_id=".$dd_id." AND ".$status." = 1";
|
|
//echo $sertg_sql;exit;
|
|
|
|
}else{
|
|
//$data = getbankInfoCoreFunction($conn, $client_id);
|
|
$sertg_sql = "SELECT id,data_key FROM data_item_key_values WHERE dd_id=".$dd_id." AND (type = 1 OR type2 = 1 OR type3=1)";
|
|
}
|
|
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = $row['data_key'];
|
|
$data[$row['id']] = $key_date_name;
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
function LatePaysbankCategoryInfo($conn, $dd_id, $category_id, $client_id){
|
|
|
|
$status = 'status';
|
|
$value = 'value';
|
|
$data = array();
|
|
if($category_id < 4){
|
|
if($category_id == APP_TRANSUNION){
|
|
$status = "type";
|
|
$value = $value.APP_TRANSUNION;
|
|
} else if ($category_id == APP_EXPERIAN){
|
|
$status = "type2";
|
|
$value = $value.APP_EXPERIAN;
|
|
} else if($category_id == APP_EQUIFAX){
|
|
$status = "type3";
|
|
$value = $value.APP_EQUIFAX;
|
|
}
|
|
|
|
$sertg_sql = "SELECT id,data_key FROM data_item_key_values WHERE dd_id=".$dd_id." AND ".$status." = 5";
|
|
// echo $sertg_sql;exit;
|
|
|
|
}else{
|
|
//$data = getbankInfoCoreFunction($conn, $client_id);
|
|
$sertg_sql = "SELECT id,data_key FROM data_item_key_values WHERE dd_id=".$dd_id." AND (type = 5 OR type2 = 5 OR type3 = 5)";
|
|
}
|
|
|
|
$result = $conn->query($sertg_sql);
|
|
if ($result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$key_date_name = $row['data_key'];
|
|
$data[$row['id']] = $key_date_name;
|
|
|
|
}
|
|
}
|
|
|
|
echo json_encode($data);
|
|
die();
|
|
}
|
|
|
|
|
|
function daysBetween($from_date, $to_date) {
|
|
|
|
$str_to_time_from = strtotime($from_date);
|
|
$str_to_time_to = strtotime($to_date);
|
|
|
|
$difference = 0;
|
|
|
|
if($str_to_time_from > $str_to_time_to){
|
|
$difference = date_diff(
|
|
date_create($to_date),
|
|
date_create($from_date)
|
|
)->format('%a');
|
|
$difference = (-1)*$difference;
|
|
}else if($str_to_time_from < $str_to_time_to){
|
|
$difference = date_diff(
|
|
date_create($to_date),
|
|
date_create($from_date)
|
|
)->format('%a');
|
|
}
|
|
|
|
return $difference;
|
|
} |