$row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = $aRow[$i]; } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; $task_type_id = $_REQUEST['task_type_id']; if ($incom_id == '') { Addincomming($phone, $call_type_id, $category_id, $category_parent_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $problem_date, $call_content, $file, $rand_file, $hidden_inc); $incomming_call_id = mysql_insert_id(); if ($task_type_id != 0) { Addtask($incomming_call_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $comment); } Addsite_user($incomming_call_id, $personal_pin, $friend_pin, $personal_id); } else { Saveincomming($call_type_id, $phone, $category_id, $category_parent_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $problem_date, $call_content, $file, $rand_file); Savetask($incom_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $comment); //Savesite_user($incom_id, $personal_pin, $name, $personal_phone, $mail, $personal_id); } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\r\n\t\t\t\t\t`rand_name`,\r\n\t\t\t\t\t`id`\r\n\t\t\t\t\tFROM \t`file`\r\n\t\t\t\t\tWHERE `incomming_call_id` = {$edit_id}\r\n\t\t\t\t\t"); $data1 = '';
break; case 'save_incomming': $incom_id = $_REQUEST['hidden_checker']; $task_type_id = $_REQUEST['task_type_id']; if ($incom_id == '') { Addincomming($call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment, $file, $rand_file, $hidden_inc); $incomming_call_id = mysql_insert_id(); if ($task_type_id != 0) { Addtask($incomming_call_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } } else { Saveincomming($call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment, $file, $rand_file, $hidden_inc); $check_task = mysql_fetch_assoc(mysql_query("SELECT id FROM task WHERE incomming_call_id = '{$incom_id}'")); if ($task_type_id != 0) { if ($check_task == '') { Addtask($incom_id, $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } else { Savetask($check_task[id], $persons_id, $task_type_id, $priority_id, $task_department_id, $call_date, $call_phone, $category_parent_id, $category_id, $sub_category, $call_problem_date, $call_status_id, $call_object_id, $call_source_id, $call_content, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } } } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\r\n\t\t\t\t\t`rand_name`,\r\n\t\t\t\t\t`id`\r\n\t\t\t\t\tFROM \t`file`\r\n\t\t\t\t\tWHERE `incomming_call_id` = {$edit_id}\r\n\t\t\t\t\t"); $data1 = ''; while ($increm_row = mysql_fetch_assoc($increm)) { $data1 .= '<tr style="border-bottom: 1px solid #85b1de;">
$row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = addslashes($aRow[$i]); if ($i == $count - 1) { $row[] = '<input type="checkbox" id="' . $aRow[$hidden] . '" name="check_' . $aRow[$hidden] . '" class="check" value="' . $aRow[$hidden] . '" />'; } } $data['aaData'][] = $row; } break; case 'save_outgoing': $user_id = $_SESSION['USERID']; if (empty($task_id)) { $task_id = mysql_insert_id(); Addtask($cur_date, $done_start_time, $done_end_time, $task_type_id, $template_id, $task_department_id, $persons_id, $task_comment, $priority_id); //Addsite_user($incomming_call_id, $personal_pin, $friend_pin, $personal_id); } else { Savetask($task_id, $cur_date, $done_start_time, $done_end_time, $task_type_id, $template_id, $task_department_id, $persons_id, $priority_id); //Savesite_user($incom_id, $personal_pin, $name, $personal_phone, $mail, $personal_id); } break; case 'get_responsible_person_add_page': $page = GetResoniblePersonPage(); $data = array('page' => $page); break; case 'save_task': // task_detail------------------------ $phone = mysql_real_escape_string($_REQUEST['p_phone']); $person_n = mysql_real_escape_string($_REQUEST['p_person_n']); $first_name = mysql_real_escape_string($_REQUEST['p_first_name']);
// SQL server connection information $sql_details = array('user' => 'root', 'pass' => 'Gl-1114', 'db' => 'ddb', 'host' => 'localhost'); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * If you just want to use the basic configuration for DataTables with PHP * server-side, there is no need to edit below this line. */ //mysql_close(); require '../../../includes/ssp.class.php'; $where_param = " where `status` = 0 and user_id = {$user} "; $data = SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $where_param); break; case 'save_outgoing': $user_id = $_SESSION['USERID']; if (empty($task_id)) { $task_id = mysql_insert_id(); Addtask($cur_date, $done_start_time, $done_end_time, $task_type_id, $template_id, $task_department_id, $persons_id, $status); //Addsite_user($incomming_call_id, $personal_pin, $friend_pin, $personal_id); } else { Savetask($task_id, $cur_date, $done_start_time, $done_end_time, $task_type_id, $template_id, $task_department_id, $persons_id); //Savesite_user($incom_id, $personal_pin, $name, $personal_phone, $mail, $personal_id); } break; case 'get_responsible_person_add_page': $page = GetResoniblePersonPage(); $data = array('page' => $page); break; case 'save_task': // task_detail------------------------ $phone = $_REQUEST['p_phone']; $person_n = $_REQUEST['p_person_n']; $first_name = $_REQUEST['p_first_name'];
} $rResult = mysql_query("SELECT\t`task`.id,\n \t\t\t\t`task`.id,\n \t\t\t\ttask.`date`,\n \t\t\t\ttask.`phone` AS `phone`,\n \t\t\t\tc_type.`name` AS `call_type`,\n \t\t\t\tcat.`name` AS `category`,\n \t\t\t\tsub_cat.`name` AS `sub_category`,\n \t\t\t\tobject.`name` AS object,\n \t\t\t\tpersons.`name`,\n\t original.`name`,\n\t priority.`name`,\n \t\t\t\t`status`.`call_status`\n FROM \t`task`\n LEFT JOIN \t`incomming_call` ON task.incomming_call_id=incomming_call.id\n LEFT JOIN \t`category` AS c_type ON task.call_type_id=c_type.id\n LEFT JOIN \t`category` AS cat ON task.category_id=cat.id\n LEFT JOIN \t`category` AS sub_cat ON task.subcategory_id=sub_cat.id\n LEFT JOIN \t`object` ON task.object_id=object.id\n LEFT JOIN \t`status` ON\ttask.`status`=`status`.`id`\n LEFT JOIN `users` ON task.responsible_user_id = users.id\n LEFT JOIN `persons` ON users.person_id = persons.id\n\t JOIN `users` AS uu ON task.user_id = uu.id\n JOIN `persons` AS original ON uu.person_id = original.id\n\t LEFT JOIN priority ON task.priority_id = priority.id\n WHERE \t\t`task`.`actived`=1 {$user_dep}\n\t \t\t\t "); $data = array("aaData" => array()); while ($aRow = mysql_fetch_array($rResult)) { $row = array(); $row1 = array(); for ($i = 0; $i < $count; $i++) { $row[] = $aRow[$i]; } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; if ($incom_id == '') { Addtask($persons_id, $c_date, $phone, $task_type_id, $priority_id, $task_department_id, $call_type_id, $category_parent_id, $category_id, $object_id, $problem_date, $call_status_id, $source, $comment, $rand_file, $file, $hidden_inc, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } else { Savetask($incom_id, $persons_id, $c_date, $phone, $task_type_id, $template_id, $task_department_id, $call_type_id, $category_parent_id, $category_id, $problem_date, $call_status_id, $object_id, $source, $comment, $problem_comment, $priority_id, $rand_file, $file, $abonent_phone, $abonent_pin, $abonent_name, $abonent_responsibl_person, $abonent_address, $abonent_number, $abonent_status, $abonent_coment); } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\n\t\t\t\t\t\t\t\t\t\t`rand_name`,\n\t\t\t\t\t\t\t\t\t\t`id`\n\t\t\t\t\t\t\t\tFROM \t`file`\n\t\t\t\t\t\t\t\tWHERE `task_id` = {$edit_id}\n\t\t\t\t\t\t\t "); $data1 = ''; while ($increm_row = mysql_fetch_assoc($increm)) { $data1 .= '<tr style="border-bottom: 1px solid #85b1de;"> <td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td> <td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td>
} else { $row[] = $aRow[$i]; } } $data['aaData'][] = $row; } break; case 'save_outgoing': $incom_id = $_REQUEST['id']; $ast_incomming_id = $_REQUEST['ast_incomming_id']; $sbstr = substr($incom_id, 0, 1); if ($sbstr == 'u') { $task_ast_id = str_replace("u", "", $incom_id); $check_user = mysql_fetch_assoc(mysql_query("SELECT task.responsible_user_id,\r\n \t persons.`name`\r\n FROM task\r\n JOIN users ON users.id = task.responsible_user_id\r\n JOIN persons ON persons.id = users.person_id \r\n WHERE task.ast_incomming_id = '{$task_ast_id}'\r\n \t\t LIMIT 1")); if ($check_user[responsible_user_id] == '' || $check_user[responsible_user_id] == null) { Addtask($incom_id, $client_name, $phone, $call_content, $comment, $problem_coment); } else { global $error; $error = "ამ უპასუხო ზარზე უკვე მუშაობს {$check_user['name']}"; } } else { $check_user = mysql_fetch_assoc(mysql_query("SELECT task.responsible_user_id,\r\n \t\t persons.`name`\r\n \t\t FROM task\r\n \t\t JOIN users ON users.id = task.responsible_user_id\r\n \t\t JOIN persons ON persons.id = users.person_id\r\n \t\t WHERE task.id = '{$incom_id}'")); if ($check_user[responsible_user_id] == '' || $check_user[responsible_user_id] == null) { Savetask($incom_id, $phone, $ast_incomming_id); } else { global $error; $error = "ამ უპასუხო ზარზე უკვე მუშაობს {$check_user['name']}"; } } break; case 'save_noansver':
} } else { $row[] = $aRow[$i]; } if ($i == $count - 1) { $row[] = '<input type="checkbox" id="' . $aRow[$hidden] . '" name="check_' . $aRow[$hidden] . '" class="check" value="' . $aRow[$hidden] . '" />'; } } $data['aaData'][] = $row; } break; case 'save_outgoing': $user_id = $_SESSION['USERID']; if ($task_id == 0) { $task_id = mysql_insert_id(); Addtask($persons_id, $planned_start_date, $fact_end_date, $call_duration, $priority_id, $template_id, $phone, $comment, $problem_comment, $file, $rand_file, $hidden_inc); if ($personal_pin != 0) { $incomming_call_id = mysql_insert_id(); //Addsite_user($incomming_call_id, $personal_pin, $friend_pin, $personal_id); } } else { Savetask($task_id, $persons_id, $planned_start_date, $fact_end_date, $call_duration, $priority_id, $template_id, $phone, $comment, $problem_comment, $file, $rand_file); //Savesite_user($incom_id, $personal_pin, $name, $personal_phone, $mail, $personal_id); } break; case 'get_responsible_person_add_page': $page = GetResoniblePersonPage(); $data = array('page' => $page); break; case 'change_responsible_person': $letters = json_decode('[' . $_REQUEST['lt'] . ']');
$row[] = $aRow[$i]; } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; $hidden_user = $_REQUEST['hidden_user']; Saveincomming($phone, $hidden_user, $call_status, $client_name, $call_content); $result = mysql_query(" SELECT task.id\n\t\t\t\t\t\t\t\tFROM task\n\t\t\t\t\t\t\t\tWHERE task.incomming_call_id = {$incom_id} AND task.actived=1"); $check = mysql_num_rows($result); if ($department_id != 0 && $check > 0) { Savetask($incom_id, $task_type_id, $priority, $department_id, $persons_id, $out_phone, $problem_comment); } else { if ($department_id != 0 && $check == 0) { Addtask($incom_id, $task_type_id, $priority, $department_id, $persons_id, $out_phone, $problem_comment); } } break; default: $error = 'Action is Null'; } $data['error'] = $error; echo json_encode($data); /* ****************************** * Request Functions * ****************************** */ function checkgroup($user) { $res = mysql_fetch_assoc(mysql_query("SELECT users.group_id\n FROM users\n WHERE users.id = {$user}"));
$row = array(); for ($i = 0; $i < $count; $i++) { /* General output */ $row[] = $aRow[$i]; if ($i == $count - 1) { $row[] = '<input type="checkbox" id="' . $aRow[$hidden] . '" name="check_' . $aRow[$hidden] . '" class="check" value="' . $aRow[$hidden] . '" />'; } } $data['aaData'][] = $row; } break; case 'save_action': if ($action_id == '') { Addaction($action_name, $start_date, $end_date, $action_content, $file, $rand_file, $edit_id); $task_id = mysql_insert_id(); Addtask($task_id, $task_type_id, $task_department_id, $priority_id, $comment); } else { saveaction($action_id, $action_name, $start_date, $end_date, $action_content); Savetask($action_id, $task_type_id, $task_department_id, $priority_id, $comment); } break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\r\n\t\t\t\t\t`rand_name`,\r\n\t\t\t\t\t`id`\r\n\t\t\t\t\tFROM \t`file`\r\n\t\t\t\t\tWHERE `action_id` = {$edit_id}\r\n\t\t\t\t\t"); $data1 = ''; while ($increm_row = mysql_fetch_assoc($increm)) { $data1 .= '<tr style="border-bottom: 1px solid #85b1de;"> <td style="width:260px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td> <td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td> <td ><button type="button" value="' . $increm_row[id] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none; background-image:url(\'media/images/x.png\');" id="delete"></button></td> </tr>';
} elseif ($aRow[$i] == 'მოგვარებულია') { $row[] = '<div style="background: #33dd33; WIDTH: 150%;">' . $aRow[$i] . '</div>'; } else { $row[] = $aRow[$i]; } } else { $row[] = $aRow[$i]; } } $data['aaData'][] = $row; } break; case 'save_incomming': $incom_id = $_REQUEST['id']; if ($incom_id == '') { Addtask($persons_id, $control_id, $phone, $planned_date, $fact_end_date, $call_duration, $task_type_id, $priority_id, $task_department_id, $call_type_id, $category_parent_id, $category_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $call_status_id, $source, $money, $comment, $rand_file, $file, $hidden_inc); $task_id = mysql_insert_id(); } else { Savetask($incom_id, $persons_id, $control_id, $planned_date, $fact_end_date, $call_duration, $call_status_id, $task_type_id, $priority_id, $task_department_id, $call_type_id, $category_id, $category_parent_id, $object_id, $pay_type_id, $bank_id, $card_type_id, $pay_aparat_id, $comment, $problem_comment, $source, $money, $rand_file, $file); } break; case 'get_calls': $data = array('calls' => getCalls()); break; case 'delete_file': mysql_query("DELETE FROM file WHERE id = {$delete_id}"); $increm = mysql_query("\tSELECT `name`,\r\n\t\t\t\t\t\t\t\t\t\t`rand_name`,\r\n\t\t\t\t\t\t\t\t\t\t`id`\r\n\t\t\t\t\t\t\t\tFROM \t`file`\r\n\t\t\t\t\t\t\t\tWHERE `task_id` = {$edit_id}\r\n\t\t\t\t\t\t\t "); $data1 = ''; while ($increm_row = mysql_fetch_assoc($increm)) { $data1 .= '<tr style="border-bottom: 1px solid #85b1de;"> <td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td>
} $gauqmebuli = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS gauqmebuli\r\n FROM task\r\n WHERE actived = 0 \r\n \t AND DATE(date) BETWEEN '{$startdate}' AND '{$enddate}' {$gauqmebuli_yvela}")); $garkvevis_processhi = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS garkvevis_processhi\r\n \t\t FROM task\r\n \t\t WHERE task.actived=1 AND task.status=1 \r\n\t AND ISNULL(task.ast_incomming_id) {$filter_tabs}")); $mogvarebuli = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS mogvarebuli\r\n \t FROM task\r\n \t WHERE actived = 1 AND ISNULL(task.ast_incomming_id) \r\n\t AND (task.status=2 OR task.status=3) {$filter_tabs}\r\n\t AND DATE(date) BETWEEN '{$startdate}' AND '{$enddate}'")); $yvela = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS yvela\r\n \t FROM task\r\n \t WHERE actived = 1 AND ISNULL(task.ast_incomming_id) {$filter_yvela}\r\n \t AND date BETWEEN '{$startdate}' AND '{$enddate}'")); $chemi_task = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS chemi_task\r\n \t FROM task\r\n \t WHERE actived = 1 AND ISNULL(task.ast_incomming_id)\r\n \t AND task.user_id = {$user}\r\n \t AND DATE(date) BETWEEN '{$startdate}' AND '{$enddate}'")); $data = array('gauqmebuli' => $gauqmebuli[gauqmebuli], 'mogvarebuli' => $mogvarebuli[mogvarebuli], 'yvela' => $yvela[yvela], 'garkvevis_processhi' => $garkvevis_processhi[garkvevis_processhi], 'chemi_task' => $chemi_task[chemi_task]); break; case 'save_incomming': $incom_id = $_REQUEST['id']; $task_status_id = $_REQUEST['task_status_id']; $task_type_id = $_REQUEST['task_type_id']; $persons_id = $_REQUEST['persons_id']; $comment1 = $_REQUEST['comment1']; if ($incom_id == '') { Addtask($client_name, $task_type_id, $priority_id, $department_id, $phone, $call_content, $comment, $problem_coment, $task_status_id); } else { $row = mysql_fetch_assoc(mysql_query("SELECT task.incomming_call_id\r\n from task\r\n WHERE task.id={$incom_id}")); if ($row[incomming_call_id] != 0) { Savetask($incom_id, $persons_id, $task_type_id, $priority_id, $department_id, $task_status_id, $comment, $comment1); } else { Savetask1($incom_id, $client_name, $task_type_id, $priority_id, $department_id, $persons_id, $phone, $call_content, $comment1, comment1, $problem_coment, $task_status_id); } } break; case 'filt_task_type': $user = $_SESSION['USERID']; $dep_detail1_id = $_REQUEST['dep_detail1_id']; $task_type = Gettask_type1($dep_detail1_id); $data = array('task_type' => $task_type); break;