';print_r($checked_id);exit; foreach($checked_id as $checked_id_array){ $depertment = check_null_value('department','sat_task','task_id',$checked_id_array); //exit; //echo "SELECT `staff_task_id`,`resource` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'"; $checked_values = mysql_fetch_array(mysql_query("SELECT `staff_task_id`,`resource` , `complete_date` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'")); //echo "hi";exit; //$get_user_initial = mysql_fetch_array(mysql_query("SELECT `user_initial` FROM `sat_users` WHERE `user_id`='".$_SESSION['sat_login_id']."'")); //if($checked_values['resource'] == $_SESSION['sat_login_id']){ $exist = mysql_num_rows(mysql_query("SELECT `staff_task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'")); if($exist>0){ $exsist_com_date = mysql_fetch_array(mysql_query("SELECT `complete_date` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'")); //echo "hiiiiiiii";exit; if($exsist_com_date['complete_date']=='0000-00-00'){ if (in_array($checked_id_array, $hold_task)){ $hold_stat=1; }else{ $hold_stat=0; } $sql3 = "UPDATE `sat_staff_task` SET `complete_date` = '".$today_date."' , comments = '".mysql_real_escape_string($_REQUEST['comments2_'.$checked_id_array])."' , `hold_status` ='".$hold_stat."'"; if($checked_values['complete_date']=='0000-00-00'){ $sql3 .=" , `user_id`='".$_SESSION['sat_login_id']."'"; } $sql3 .=" WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'"; //echo "UPDATE `sat_staff_task` SET `complete_date` = '".$today_date."' , comments = '".mysql_real_escape_string($_REQUEST['comments2_'.$checked_id_array])."' , `user_id`='".$_SESSION['sat_login_id']."' , `hold_status` ='".$hold_stat."' WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$checked_id_array."'"; $update_query = mysql_query($sql3); /*===============ar-11 email===============*/ if($_REQUEST['activity_id']=='9'){ //for "Change - Home ADDRESS" activity if($checked_id_array == '103'){ //for "Inform Staff about AR11 if Non US Citizen" activity //$ifNotUsCitizen = check_null_value('visa_status','sat_staff','staff_id',$_REQUEST['s_name']); //if($ifNotUsCitizen!='US Citizen'){ //check Staff visa status not equal "US Citizen" // generate ar11 mail // $acmgr_id = check_null_value('account_manager','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ac_email = check_null_value('email','sat_users','user_id',$acmgr_id); $mail_to = check_null_value('pemail','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ccEmail = 'info@absi-usa.com'; $m = new Mail(); //$m->clear(TRUE); $to=$mail_to; $form = 'itteam@absi-usa.com'; $subject='AR-11 - SAT'; $body = check_null_value('body','sat_email_template','id','1'); $templete_body = emailTempalte($subject , $body); $m->From($form); $m->Subject($subject); $m->Body($templete_body); $m->To($to); $m->To($ac_email); $m->Cc($ccEmail); $m->Send(); //end of ar11 mail // //} } } /*===============ar-11 email===============*/ /*===============ABSI Time Reporting, Supplemental Timesheet email===============*/ if($checked_id_array == '389' || $checked_id_array == '332' || $checked_id_array == '291'){ //for "Inform Staff about AR11 if Non US Citizen" activity // generate Time Reporting mail // $acmgr_id = check_null_value('account_manager','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ac_email = check_null_value('email','sat_users','user_id',$acmgr_id); $mail_to = check_null_value('pemail','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ccEmail = 'info@absi-usa.com'; $tr = new Mail(); //$tr->clear(TRUE); $to=$mail_to; $form = 'itteam@absi-usa.com'; $subject = check_null_value('subject','sat_email_template','id','2'); $body = check_null_value('body','sat_email_template','id','2'); $templete_body = emailTempalte($subject , $body); $attach = 'mail_attachment/ABSITimeSheet.xls'; $tr->From($form); $tr->Subject($subject); $tr->Body($templete_body); $tr->To($to); $tr->To($ac_email); $tr->Cc($ccEmail); $tr->Attach($attach); $tr->Send(); //end of Time Reporting mail // //send Supplemental Timesheet (STS) // $getTemplate = check_null_value('body','sat_email_template','id','5'); $getSubject = check_null_value('subject','sat_email_template','id','5'); $templete_body = emailTempalte($getSubject,$getTemplate); $stsattach = 'mail_attachment/sts.xlsx'; $sts = new Mail(); $sts->From($form); $sts->Subject($getSubject); $sts->Body($templete_body); $sts->To($to); $sts->To($ac_email); $sts->Cc($ccEmail); $sts->Attach($stsattach); $sts->Send(); //end Supplemental Timesheet (STS) // } /*===============ABSI Time Reporting, Supplemental Timesheet email===============*/ /*===============ABSI Project Ending email===============*/ if($checked_id_array == '415'){ //for "Send Email Reminder on Last day of Project and Make sure get the timesheet" activity // generate Time Reporting mail // $acmgr_id = check_null_value('account_manager','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ac_email = check_null_value('email','sat_users','user_id',$acmgr_id); $mail_to = check_null_value('pemail','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ccEmail = 'info@absi-usa.com'; $pe = new Mail(); //$pe->clear(TRUE); $to=$mail_to; $form = 'itteam@absi-usa.com'; $subject = check_null_value('subject','sat_email_template','id','3'); $body = check_null_value('body','sat_email_template','id','3'); $templete_body = emailTempalte($subject , $body); //$attach = 'mail_attachment/ABSITimeSheet.xls'; $pe->From($form); $pe->Subject($subject); $pe->Body($templete_body); $pe->To($to); $pe->To($ac_email); $pe->Cc($ccEmail); //$pe->Attach($attach); $pe->Send(); //end of Time Reporting mail // } /*===============ABSI Project Ending email===============*/ /*===============ABSI W2 Employee Payroll System Login - ADP & Payroll Calendar email===============*/ if($checked_id_array == '277' || $checked_id_array == '351'){ //for "Setup ADP & 401K - Send Email to Staff" activity // generate Time Reporting mail // $acmgr_id = check_null_value('account_manager','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ac_email = check_null_value('email','sat_users','user_id',$acmgr_id); $mail_to = check_null_value('pemail','sat_staff','staff_id',$_REQUEST['h_stuff_id']); $ccEmail = 'info@absi-usa.com'; $w2e = new Mail(); //$m->clear(TRUE); $to=$mail_to; $form = 'itteam@absi-usa.com'; $subject = check_null_value('subject','sat_email_template','id','4'); $body = check_null_value('body','sat_email_template','id','4'); $templete_body = emailTempalte($subject , $body); $attachPayroll = 'mail_attachment/W2_Payroll_Calender_Rel_705.xlsx'; $w2e->From($form); $w2e->Subject($subject); $w2e->Body($templete_body); $w2e->To($to); $w2e->To($ac_email); $w2e->Cc($ccEmail); $w2e->Attach($attachPayroll); $w2e->Send(); //end of Time Reporting mail // } /*===============ABSI W2 Employee Payroll System Login - ADP & Payroll Calendar email===============*/ } //header("location:activity.php?msg=2"); }else{ } //}else{ //header("location:activity.php?msg=2"); //} } foreach($unchecked_id as $unchecked_id_array){ $task_values = mysql_fetch_array($sql_query=mysql_query("SELECT `task_id` , `task_status` , `user_id`, `task` FROM `sat_task` WHERE task_id='".$unchecked_id_array."'")); $exist1 = mysql_num_rows(mysql_query("SELECT `staff_task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$unchecked_id_array."'")); if($exist1>0){ if (in_array($unchecked_id_array, $hold_task)){ echo $hold_stat=1; }else{ echo $hold_stat=0; } $update_query = mysql_query("UPDATE `sat_staff_task` SET `complete_date` = '0000-00-00' , comments = '".mysql_real_escape_string($_REQUEST['comments2_'.$unchecked_id_array])."' ,`user_id` = '".$_SESSION['sat_login_id']."', `hold_status` ='".$hold_stat."' WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$unchecked_id_array."'"); } if($exist1==0 && $unchecked_id_array!=0){ mysql_query("insert into `sat_staff_task` set staff_activity_id='".$_REQUEST['h_edit_id']."', task_id='". $unchecked_id_array."', user_id='".$_SESSION['sat_login_id']."', start_date='".$today_date."' , complete_date='0000-00-00' , staff_task_status='".$task_values['task_status']."' , resource='".$task_values['user_id']."' , comments = '".mysql_real_escape_string($_REQUEST['comments2_'.$unchecked_id_array])."'"); } } // echo sizeof($_REQUEST['task']); // // exit; // if(sizeof($_REQUEST['task'])>0){ // // foreach($_REQUEST['task'] as $request_task){ // // $data_date = change_dateformat($_REQUEST['change_date']); // mysql_query("UPDATE `sat_staff_task` SET `complete_date` = '".$today_date."' WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$request_task."'"); // // // } // } // // //if($_REQUEST['task']==''){ // // $exist = mysql_num_rows(mysql_query("SELECT `staff_task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$_REQUEST['h_id_task11']."'")); // //echo $exist;exit; // $update_query = "UPDATE `sat_staff_task` SET `complete_date` = '0000-00-00'"; // if($_REQUEST['comments2']!=''){ // $update_query .= " , `comments` = '$_REQUEST[comments2]'"; // } // $update_query .= " WHERE `staff_activity_id` = '".$_REQUEST['h_edit_id']."' AND `task_id` = '".$_REQUEST['h_id_task11']."'"; // // // // // // mysql_query($update_query); // // if($exist==0){ // mysql_query("insert into `sat_staff_task` set // staff_activity_id='".$_REQUEST['h_edit_id']."', // // task_id='".$_REQUEST['h_id_task11']."', // user_id='".$_SESSION['sat_login_id']."', // start_date='".$today_date."' , // complete_date='0000-00-00' , // staff_task_status=' ' , // comments = '".mysql_real_escape_string($_REQUEST["comments2"])."'"); // } // //header("location:activity.php?msg=2"); header("location:activity.php?msg=2"); } ?> Task added successfully'; } if($msg == 2){ $msg = 'Activity updated successfully'; } if($msg == 3){ $msg = "Date field can't be empty to complite a task"; } if($msg == 4){ $msg = "Task already exsists under this department, activity and user initial"; } $no_data=mysql_num_rows(mysql_query("select * from sat_task")); // create array for existing task id // //echo "SELECT `task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['edit_id']."' AND `complete_date` = '0000-00-00'"; //$g = mysql_query("SELECT `task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['edit_id']."' AND `complete_date` = '0000-00-00'"); $g = mysql_query("SELECT `task_id` FROM `sat_staff_task` WHERE `staff_activity_id` = '".$_REQUEST['edit_id']."'"); while($get_task_id1 = mysql_fetch_array($g)){ $x[] = $get_task_id1['task_id']; } // create array for existing task id // $query_res="select * from sat_task where main_activity_id='".$main_activity_id."' AND `task_status` = 'Active'"; if($_REQUEST['search_market']!='') { $query_res.=" and category_id='".$_REQUEST['search_market']."'"; } $query_res.=" order by main_activity_id,task"; $sel_product=mysql_query($query_res); $num_row = mysql_num_rows($sel_product); ?> blocknone;"> EditAdd Task Staff Name* : -- Select -- Client Name* : End Client Name* : Activity* : -- Select -- > Effective Date* : Work Location* : Comments* : </textarea> if($_REQUEST['action']=="edit") { ?> } else { ?> } ?> Edit Staff Activity Staff Name: Activity : Client Name: Effective Date : End Client Name: Work Location: Comments: </textarea> Department Task Id onchange="selectAllFiles(this.checked,);" style="margin-right:8px;" /> Task Activity Resource User Initial Comments Completion Date Hold Action E / D 1) { $pagination .= "Previous"; $pagination.=" "; } for($i = 1; $i <=$total_pages; $i++) { if(($page) == $i) { $pagination .= $i; $pagination.=' '; } else { $pagination .= "$i"; $pagination.=' '; } } if($page < $total_pages) { $pagination .= "Next"; $pagination.=" "; } //$query_res.=" limit $from,$max_results"; $query_res; $query_products=mysql_query($query_res); ////////////////////////////////End pagination//////////////////////////////////// $separator = ''; $separator1 = ""; $checked = ''; if(mysql_num_rows($query_products)>0) { $inc=1; while($array_products=mysql_fetch_array($query_products)) { if($inc%2==0) { ?> }else{ ?> //$productName=mysql_fetch_array(mysql_query("select * from sat_task_category where id ='".$array_products['category_id']."'")); $query_checked_hold = mysql_query("SELECT `hold_status` FROM `sat_staff_task` WHERE `task_id` = '".$array_products['task_id']."' AND `staff_activity_id` = '".$_REQUEST['edit_id']."'"); $hold_status = mysql_fetch_array($query_checked_hold); ?> disabled="disabled" checked style="margin-right:8px;" class="checkTask1" > disabled="disabled" checked style="margin-right:8px;" class="checkTask check_box" > selected="selected" selected="selected" > disabled="disabled" checked="checked" /> disabled="disabled" checked="checked" /> Edit Cancel Unchecked ".$unchecked; ?> Sorry, no result found. =$pagination;?>