modify('+1 day'); // Include the last day $dates = []; $interval = new DateInterval('P1D'); // 1 day interval $date_period = new DatePeriod($start_date, $interval, $end_date); foreach ($date_period as $date) { $dates[] = $date->format('Y-m-d'); } $select = $mysqli->query("select * from staff where deleted_at is null and staff_id = '138'") ; if ( $select->num_rows > 0 ){ while ( $row = $select->fetch_assoc() ){ foreach ( $dates as $k => $v ){ $selectattendance = $mysqli->query("SELECT * FROM `staff_attendance_list` WHERE `staff_id` = '".$row['staff_id']."' and list_date LIKE '%".$v."%' and deleted_at is null;") ; if ( $selectattendance->num_rows == 0 ){ echo $row['staff_id'] . ' : ' . $v ; echo "\n\n" ; } } echo "\n\n" ; echo "\n\n" ; echo "\n\n" ; echo "\n\n" ; } } exit; $a = '' ; $b = json_decode($a, true) ; $c = $b['2']['data'] ; $select_staff = $mysqli->query("select * from staff where branch_id = '1'") ; if ( $select_staff->num_rows > 0 ){ while ($row_staff = $select_staff->fetch_assoc() ){ $check = false ; foreach ( $c as $k => $v ){ if ( $v['badgenumber'] == $row_staff['staff_idno'] ){ $check = true ; } } if ( !$check ){ // $mysqli->query("update staff set updated_at = '".date("Y-m-d H:i:s", time())."' where staff_id = '".$row_staff['staff_id']."'") ; echo "update staff set updated_at = '".date("Y-m-d H:i:s", time())."' where staff_id = '".$row_staff['staff_id']."' ;" ; echo "\n\n" ; } } } exit ; // $mysqli->query("UPDATE `staff_leave_month` SET // `given_date` = '2023-06-01' // WHERE `given_date` = '0000-00-00'"); exit ; $select = $mysqli->query( "SELECT SUM(given_day) as total, staff_id FROM staff_leave_month GROUP BY staff_id" ) ; while ( $row = $select->fetch_assoc() ){ $get_leave_year = $mysqli->query("SELECT leave_year_id, leave_record_days FROM staff_leave_year WHERE deleted_at IS NULL AND staff_id = '".$row['staff_id']."' AND leave_type = 'annual' AND leave_year = '2023' LIMIT 1") ; if ( $get_leave_year->num_rows > 0 ){ $row_leave_year = $get_leave_year->fetch_assoc() ; $staff = $mysqli->query( "SELECT leave_given_days FROM staff_leave_year WHERE leave_type = 'annual' AND leave_year = '2023' AND staff_id = '".$row['staff_id']."'" ) ; $row_staff = $staff->fetch_assoc() ; $extra_days = ( $row_staff['leave_given_days'] - $row['total'] ) ; if ( $extra_days > 0 ){ echo "INSERT INTO staff_leave_month ( leave_year_id, staff_id, given_month, given_day ) VALUES ( '".$row_leave_year['leave_year_id']."', '".$row['staff_id']."', '6', '".$extra_days."' )" ; print_r('
') ; print_r('
') ; // $mysqli->query( "INSERT INTO staff_leave_month // ( leave_year_id, staff_id, given_month, given_day ) VALUES // ( '".$row_leave_year['leave_year_id']."', '".$row['staff_id']."', '6', '".$extra_days."' )" ) ; // $mysqli->query( "UPDATE staff_leave_year SET // leave_days = leave_days + ".$extra_days." // WHERE leave_year_id = '".$row_leave_year['leave_year_id']."'" ) ; print_r('
') ; print_r($row) ; print_r('
') ; print_r($extra_days) ; print_r('
') ; print_r('
') ; print_r('
') ; print_r('
') ; } } } exit ; $select = $mysqli->query( "SELECT * FROM staff_leave_year WHERE leave_type = 'annual' AND leave_year = '2023'" ) ; // // Define the plaintext, IV, and encryption key // $plaintext = '{"CompanyID":"1","IsActive":"1"}'; // $key = '1234567890030188'; // $iv = 'Info-TechGateWay' ; // // Encrypt the plaintext using AES-256-CBC // $ciphertext = openssl_encrypt($plaintext, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $iv); // // Encode the ciphertext in base64 for output // $output = base64_encode($ciphertext); // echo $output; // exit ; exit ; $rms_call = rmsCall( 'pinless/getproductidlistbymobilenumber', $rms_content ) ; print_r($rms_call) ; exit ; $parameter = [ 'referenceId' => 'TESTBO000043', 'countryCode' => '60', 'mobileNumber' => '176168619' ] ; $post = 'POST' ; $path = 'https://api-qa.molreloads.com/terminal/v1/pinless/getproductidlistbymobilenumber' ; $content = json_encode($parameter) ; // $datetime = gmdate("Y-m-d\TH:i:s\Z") ; $datetime = '2023-05-07T12:36:32Z' ; $terminal = 'IPSSB01001' ; // $terminal = '000300001' ; $terminaltobase64 = base64_encode($terminal) ; $key = '3566977797971712' ; // $key = '0806105298910204' ; $data = $post . $path . $content . $datetime . $terminal ; $signature = hash_hmac("sha1", $data, $key) ; $signaturetobase64 = base64_encode($signature) ; echo 'Post: '.$post ; echo '
' ; echo 'Path: '.$path ; echo '
' ; echo 'Content: '.$content ; echo '
' ; echo 'Datetime: '.$datetime ; echo '
' ; echo 'Terminal: '.$terminal ; echo '
' ; echo 'Terminal Base64: '.$terminaltobase64 ; echo '
' ; echo 'Secret Key: '.$key ; echo '
' ; echo 'Signature Before: '.$data ; echo '
' ; echo 'Signature: '.$signature ; echo '
' ; echo 'Signature Base64: '.$signaturetobase64 ; echo '
' ; echo '
' ; echo '
' ; print_r(array( 'Authorization: mol-req-sign '.$terminaltobase64.':'.$signaturetobase64, 'Content-Type: application/json', 'x-mol-date-time: '.$datetime )) ; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $path, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $content, CURLOPT_HTTPHEADER => array( 'authorization: mol-req-sign '.$terminaltobase64.':'.$signaturetobase64, 'content-type: application/json', 'x-mol-date-time: '.$datetime ), )); $response = curl_exec($curl); curl_close($curl); echo $response; exit ; ?>
query("SELECT * FROM setting_point where point_from = 'task' AND deleted_at IS NULL") ; if ( $select_point->num_rows > 0 ){ while ( $row_point = $select_point->fetch_assoc() ){ $array_point[$row_point['point_type']][$row_point['difficulty']] = $row_point['point_value'] ; } } $select_task = $mysqli->query("SELECT * FROM task where status = 'approved' AND deleted_at IS NULL ORDER BY task_id DESC") ; if ( $select_task->num_rows > 0 ){ while ( $row_task = $select_task->fetch_assoc() ){ $point_earn = $array_point[$row_task['task_type']][$row_task['difficulty']] ; $extra = ( $point_earn + $row_task['extra'] ) ; $earned_assigned = ( $row_task['incentive'] + $extra ) ; $earned_executed = ( $row_task['incentive2'] + $extra ) ; echo $row_task['task_type'] . ' : ' . $row_task['difficulty'] . ' = ' . $extra ; echo "\n" ; echo $row_task['incentive'] . ' : ' . $row_task['incentive2'] ; echo "\n" ; echo $row_task['task_so'] . " : " . $row_task['assigned_by'] . ' : ( '.$earned_assigned.' : '.$earned_executed.' ) ' ; echo "\n" ; $select_movement = $mysqli->query("SELECT * FROM staff_point_movement WHERE from_table = 'task' AND from_id = '".$row_task['task_id']."' AND remark LIKE '%Earn incentive from task%'") ; if ( $select_movement->num_rows > 0 ){ while ( $row_movement = $select_movement->fetch_assoc() ){ echo $row_movement['remark'] . " : " . $row_movement['staff_id'] . " : " . $row_movement['amount'] ; echo "\n" ; } } echo "\n" ; echo "\n" ; echo "\n" ; echo "\n" ; echo "\n" ; } } exit ; $array = [ [ 'table' => 'announcement_translation', 'key' => 'announcement_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'app_menu_translation', 'key' => 'menu_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'app_page_translation', 'key' => 'page_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'app_screen_translation', 'key' => 'screen_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'app_service_translation', 'key' => 'service_id', 'related' => [ 'title' ] ], [ 'table' => 'app_support_translation', 'key' => 'support_id', 'related' => [ 'name' ] ], [ 'table' => 'association_category_translation', 'key' => 'category_id', 'related' => [ 'title' ] ], [ 'table' => 'association_translation', 'key' => 'association_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'form_category_translation', 'key' => 'category_id', 'related' => [ 'title' ] ], [ 'table' => 'form_translation', 'key' => 'form_id', 'related' => [ 'title' ] ], [ 'table' => 'handbook_category_translation', 'key' => 'category_id', 'related' => [ 'title' ] ], [ 'table' => 'handbook_translation', 'key' => 'handbook_id', 'related' => [ 'title' ] ], [ 'table' => 'nomination_translation', 'key' => 'nomination_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'profile_achievement_translation', 'key' => 'achievement_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'profile_point_translation', 'key' => 'point_id', 'related' => [ 'title', 'sub', 'content' ] ], [ 'table' => 'profile_star_translation', 'key' => 'star_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'profile_tier_translation', 'key' => 'tier_id', 'related' => [ 'title', 'sub', 'content' ] ], [ 'table' => 'redeem_translation', 'key' => 'redeem_id', 'related' => [ 'title', 'content' ] ], [ 'table' => 'setting_adjustment_translation', 'key' => 'adjustment_id', 'related' => [ 'title' ] ], [ 'table' => 'setting_department_translation', 'key' => 'department_id', 'related' => [ 'department_desc' ] ], [ 'table' => 'setting_difficulty_translation', 'key' => 'difficulty_id', 'related' => [ 'title' ] ], [ 'table' => 'setting_job_position_translation', 'key' => 'job_position_id', 'related' => [ 'job_position_desc' ] ], [ 'table' => 'setting_job_section_translation', 'key' => 'job_section_id', 'related' => [ 'job_section_desc' ] ], [ 'table' => 'setting_request_sub_translation', 'key' => 'sub_id', 'related' => [ 'title' ] ], [ 'table' => 'setting_request_translation', 'key' => 'main_id', 'related' => [ 'title' ] ], [ 'table' => 'training_translation', 'key' => 'training_id', 'related' => [ 'title', 'content' ] ] ] ; foreach ( $array as $k => $v ){ $table_from = str_replace( '_translation', '', $v['table'] ) ; $table_to = $v['table'] ; $select = $mysqli->query( "SELECT * FROM " . $table_from ) ; if ( $select->num_rows > 0 ){ while ( $row = $select->fetch_assoc() ){ $insert_key = '' ; $insert_value = '' ; foreach ( $v['related'] as $krelated => $vrelated ){ $insert_key .= ", " . $vrelated ; $insert_value .= ", '" . $row[$vrelated] . "'" ; } // echo "INSERT INTO " . $table_to . " // ( ".$v['key']." ".$insert_key." ) VALUES // ( '".$row[$v['key']]."' ".$insert_value." )" ; // echo '
' ; // echo '
' ; // echo '
' ; // echo '
' ; // echo '
' ; foreach ( $LANGS as $klang => $vlang ){ $mysqli->query( "INSERT INTO " . $table_to . " ( lang, ".$v['key']." ".$insert_key." ) VALUES ( '".$klang."', '".$row[$v['key']]."' ".$insert_value." )" ) ; } } } } // $staff_info['staff_name'] = 'Jimmy' ; // $staff_info['staff_email'] = 'Jimmy@ips.com.my' ; // $leave_type = 'Test' ; // // send email when apply leave // $content = ' // Hello Team,

// Please approve '.$staff_info['staff_name'].' leave.

//

// The approval for this application belongs to you, so do keep this e-mail safe.' ; // $mailer = new Mailer() ; // $mailer->from = EMAILNOREPLY ; // $mailer->to = $EMAILCC ; // $mailer->cc = [ $staff_info['staff_email'] ] ; // $mailer->subject = ucwords($leave_type).' leave request from '.$staff_info['staff_name'] ; // $mailer->body = $content ; // $mailer->send() ;